HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbImageGallery.php
Go to the documentation of this file.
1 <?php
16 class TbImageGallery extends CWidget
17 {
21  public $previewImagesView = 'booster.views.gallery.preview';
22 
26  public $fullScreen = true;
27 
32  public $eventListener = true;
33 
38  public $htmlOptions = array();
39 
40  public static $defaultHtmlOptions = array(
41  'data-toggle' => 'modal-gallery',
42  'data-target' => '#modal-gallery',
43  'data-filter' => '*',
44  );
45 
46  public function init()
47  {
48  $booster = Booster::getBooster();
49  $booster->registerAssetCss('bootstrap-image-gallery' . (!YII_DEBUG ? '.min' : '') . '.css');
50  $booster->registerAssetJs('fileupload/load-image.min.js');
51  $booster->registerAssetJs('bootstrap-image-gallery' . (!YII_DEBUG ? '.min' : '') . '.js');
52  if ($this->fullScreen) {
53  Yii::app()->clientScript->registerScript(
54  $this->id,
55  'jQuery("#' . $this->id . '").addClass("modal-fullscreen");',
56  CClientScript::POS_READY
57  );
58  }
59  if (!$this->eventListener) {
60  Yii::app()->clientScript->registerScript($this->id, '$(document.body).off(".modal-gallery.data-api");');
61  }
62  if (!isset($this->htmlOptions['id'])) {
63  $this->htmlOptions['id'] = $this->id;
64  }
65  echo CHtml::openTag('div', CMap::mergeArray(self::$defaultHtmlOptions, $this->htmlOptions));
66  }
67 
68  public function run()
69  {
70  $this->render($this->previewImagesView);
71  echo CHtml::closeTag('div');
72  }
73 }