Blame view

frontend/widgets/views/slider.php 2.3 KB
4253cbec   root   first commit
1
2
  <?php

  /* @var $slider Slider*/

50e38c82   Administrator   big commti
3
  use common\components\artboximage\ArtboxImageHelper;

4253cbec   root   first commit
4
5
  use common\models\Slider;

  use yii\helpers\Html;

50e38c82   Administrator   big commti
6
  use yii\web\View;

d51a2c71   Administrator   big commti
7
8
  use frontend\assets\FlipclockAsset;

  FlipclockAsset::register($this);

70bfbe0a   Administrator   big commti
9
  

4253cbec   root   first commit
10
  ?>

50e38c82   Administrator   big commti
11
12
13
  

  

  <div id="<?=$title?>" class="owl-carousel owl-theme">

389fc0d1   Administrator   big commti
14
      <?php if($slider instanceof Slider){ foreach($slider->sliderImage as $image):

50e38c82   Administrator   big commti
15
  

612a4ea1   Administrator   big commti
16
17
18
19
20
  

      ?>

      <div class="item">

  <?php

          if(!empty($image->end_at) && strtotime($image->end_at) > strtotime(date("Y-m-d"))){

2e96ba93   Administrator   big commti
21
          ?>

612a4ea1   Administrator   big commti
22
          <div class="clock_style clock_<?= $image->primaryKey ?>"></div>

6c66c02e   Administrator   big commti
23
          <?php $js = "var clock;

bc9441b0   Administrator   big commti
24
                      clock = new FlipClock($('.clock_". $image->primaryKey ."'), {

6c66c02e   Administrator   big commti
25
26
27
28
29
30
31
32
33
34
35
36
37
38
                          clockFace: 'DailyCounter',

                          language: 'ru',

                          classes: {

                              active: 'flip-clock-active',

                              before: 'flip-clock-before',

                              divider: 'flip-clock-divider',

                              dot: 'flip-clock-dot',

                              label: 'flip-clock-label',

                              flip: 'flip',

                              play: 'play',

                              wrapper: 'flip-clock-wrapper'

                          },

                      });

  

0242920b   Administrator   big commti
39
                      clock.setTime(".(strtotime($image->end_at) - strtotime(date('Y-m-d H:i:s'))).");

6c66c02e   Administrator   big commti
40
41
                      clock.setCountdown(true);

                      clock.start();";

17fd0b92   Administrator   big commti
42
          $this->registerJs($js,View::POS_LOAD) ?>

2e96ba93   Administrator   big commti
43
44
  

  

612a4ea1   Administrator   big commti
45
46
          <?php

          }?>

6f0b95f2   Administrator   big commti
47
          <?= Html::a(Html::img(ArtboxImageHelper::getImageSrc($image->imageUrl,'slider')), $image->url)?>

4253cbec   root   first commit
48
      </div>

50e38c82   Administrator   big commti
49
50
51
  

  

  

389fc0d1   Administrator   big commti
52
53
  <?php endforeach; }

      ?>

4253cbec   root   first commit
54
  </div>

4253cbec   root   first commit
55
56
57
  <?php

  $dur = $slider->duration ?  $slider->duration : 5000;

  $speed = $slider->speed ?  $slider->speed : 500;

50e38c82   Administrator   big commti
58
59
  $js="	$(\"#$title\").owlCarousel({

        navigation : true, // Show next and prev buttons

2cbb3bdc   Виталий   test commit
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
        slideSpeed : 500,

        autoplayTimeout:$dur,

        paginationSpeed : $speed,

        singleItem:true,

        autoPlay:true

  

       });

       var owl = $(\"#$title\");

       $('#next_slide').click(function() {

          owl.trigger('owl.next');

      })

      $('#prev_slide').click(function() {

          owl.trigger('owl.prev');

      })

       ";

4253cbec   root   first commit
75
  

79769aa4   Administrator   big commti
76
  $this->registerJs($js,View::POS_READY);

4253cbec   root   first commit
77
78
  

  ?>