Exemplo n.º 1
0
 /**
  * Initializes the list view.
  * This method will initialize required property values and instantiate {@link columns} objects.
  */
 public function init()
 {
     if ($this->itemView === null) {
         throw new CException(Yii::t('zii', 'The property "itemView" cannot be empty.'));
     }
     parent::init();
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'list-view';
     }
     if ($this->baseScriptUrl === null) {
         $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets')) . '/listview';
     }
     if ($this->cssFile !== false) {
         if ($this->cssFile === null) {
             $this->cssFile = $this->baseScriptUrl . '/styles.css';
         }
         Yii::app()->getClientScript()->registerCssFile($this->cssFile);
     }
 }
Exemplo n.º 2
0
 /**
  * Initializes the grid view.
  * This method will initialize required property values and instantiate {@link columns} objects.
  */
 public function init()
 {
     parent::init();
     if (empty($this->updateSelector)) {
         throw new CException(Yii::t('zii', 'The property updateSelector should be defined.'));
     }
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'grid-view';
     }
     if ($this->baseScriptUrl === null) {
         $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets')) . '/gridview';
     }
     if ($this->cssFile !== false) {
         if ($this->cssFile === null) {
             $this->cssFile = $this->baseScriptUrl . '/styles.css';
         }
         Yii::app()->getClientScript()->registerCssFile($this->cssFile);
     }
     $this->initColumns();
 }
Exemplo n.º 3
0
 /**
  * Initializes the grid view.
  * This method will initialize required property values and instantiate {@link columns} objects.
  */
 public function init()
 {
     parent::init();
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'grid-view';
     }
     if ($this->baseScriptUrl === null) {
         $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets')) . '/gridview';
     }
     if ($this->cssFile !== false) {
         if ($this->cssFile === null) {
             $this->cssFile = $this->baseScriptUrl . '/styles.css';
         }
         Yii::app()->getClientScript()->registerCssFile($this->cssFile);
     }
     $this->initColumns();
 }
Exemplo n.º 4
0
 public function init()
 {
     parent::init();
     $this->initColumns();
 }
Exemplo n.º 5
0
 /**
  * Initializes the grid view.
  * This method will initialize required property values and instantiate {@link columns} objects.
  */
 public function init()
 {
     parent::init();
     $this->htmlOptions['id'] = $this->getId() . '-widget';
     if ($this->baseScriptUrl === null) {
         $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.JCarousel.assets'));
     }
     if ($this->cssFile !== false) {
         if ($this->cssFile === null) {
             $this->cssFile = $this->baseScriptUrl . '/skin.css';
         }
         Yii::app()->getClientScript()->registerCssFile($this->cssFile);
     }
     if (!isset($this->thumbUrl)) {
         throw new CHttpException(500, Yii::t('jcarousel', 'you must assign a value for thumbUrl'));
     } elseif (str_word_count($this->thumbUrl) === 1) {
         $this->thumbUrl = '$data->' . $this->thumbUrl;
     }
     if (!isset($this->imageUrl)) {
         throw new CHttpException(500, Yii::t('jcarousel', 'you must assign a value for imageUrl'));
     } elseif (str_word_count($this->imageUrl) === 1) {
         $this->imageUrl = '$data->' . $this->imageUrl;
     }
 }
Exemplo n.º 6
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $id = $this->getId();
     $this->htmlOptions['id'] = $id;
     echo CHtml::openTag('div', $this->htmlOptions);
     echo CHtml::closeTag('div');
     parent::run();
     // check if options parameter is a json string
     if (is_string($this->options)) {
         if (!($this->options = CJSON::decode($this->options))) {
             throw new CException('The options parameter is not valid JSON.');
         }
         // TODO translate exception message
     }
     // merge options with default values
     $defaultOptions = array('chart' => array('renderTo' => $id), 'exporting' => array('enabled' => true));
     $this->options = CMap::mergeArray($defaultOptions, $this->options);
     $jsOptions = CJavaScript::encode($this->options);
     //$this->registerScripts(__CLASS__ . '#' . $id, "var chart = new Highcharts.Chart($jsOptions);");
     $this->registerScripts(__CLASS__ . '#' . $id, "\$.chart = new Highcharts.Chart({$jsOptions});");
     $this->registerChartProcessScript($id);
     //self defined extra javascript
     $i = 0;
     $cs = Yii::app()->clientScript;
     foreach ($this->action as $ext) {
         $cs->registerScript("ext" . $i++, $ext, CClientScript::POS_BEGIN);
     }
 }