YiiWheels
  • Package
  • Class
  • Tree

Packages

  • None
  • yiiwheels
    • behaviors
    • widgets
    • widgets
      • ace
      • box
      • datepicker
      • daterangepicker
      • datetimepicker
      • detail
      • fileupload
      • fileuploader
      • gallery
      • google
      • grid
        • behaviors
        • operations
      • highcharts
      • maskInput
      • maskmoney
      • modal
      • multiselect
      • rangeslider
      • redactor
      • select2
      • sparklines
      • switch
      • timeago
      • timepicker
      • toggle
      • typeahead

Classes

  • WhCarousel
  • WhGallery
  • WhVideoCarousel
 1 <?php
 2 /**
 3  * WhVideoCarousel widget class
 4  *
 5  * Renders a video carousel of blueimp Gallery
 6  * @see http://blueimp.github.io/Gallery/
 7  *
 8  * @author Antonio Ramirez <amigo.cobos@gmail.com>
 9  * @copyright Copyright &copy; 2amigos.us 2013-
10  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
11  * @package YiiWheels.widgets.gallery
12  * @uses YiiStrap.helpers.TbArray
13  * @uses YiiStrap.helpers.TbHtml
14  */
15 Yii::import('yiiwheels.widgets.gallery.WhCarousel');
16 
17 class WhVideoCarousel extends WhCarousel
18 {
19     /**
20      * Widget's initialization
21      */
22     public function init()
23     {
24         parent::init();
25         $this->pluginOptions['carousel'] = true;
26         $this->pluginOptions['container'] = '#' . $this->htmlOptions['id'] . '-videocarousel';
27     }
28 
29     /**
30      * Renders widget
31      * @return null|void
32      */
33     public function run()
34     {
35         if (empty($this->items)) {
36             return null;
37         }
38         $this->renderTemplate();
39         $this->registerClientScript();
40     }
41 
42     /**
43      * Renders the gallery template
44      */
45     public function renderTemplate()
46     {
47         $options = array(
48             'id' => $this->htmlOptions['id'] . '-videocarousel',
49             'class' => 'blueimp-gallery blueimp-gallery-carousel'
50         );
51         if($this->displayControls) {
52             TbHtml::addCssClass('blueimp-gallery-controls', $options);
53         }
54         echo CHtml::openTag('div', $options);
55         echo '<div class="slides"></div>
56         <h3 class="title"></h3>
57         <a class="prev">‹</a>
58         <a class="next">›</a>
59         <a class="play-pause"></a>
60         <ol class="indicator"></ol>';
61         echo CHtml::closeTag('div');
62     }
63 
64     /**
65      * Registers the script
66      */
67     public function registerClientScript() {
68         $this->registerGalleryScriptFiles();
69 
70         $items = CJavaScript::encode($this->items);
71         $options = CJavaScript::encode($this->pluginOptions);
72         $js = ";blueimp.Gallery({$items}, {$options});";
73 
74         Yii::app()->clientScript->registerScript(__CLASS__.'#'.$this->getId(), $js);
75     }
76 }
YiiWheels API documentation generated by ApiGen 2.8.0