コード例 #1
0
 /**
  * Executes the widget.
  */
 public function init()
 {
     parent::init();
     $this->initOptions();
     ob_start();
     ob_implicit_flush(false);
 }
コード例 #2
0
ファイル: Modal.php プロジェクト: luobenyu/yii2-metronic
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $this->initOptions();
     echo $this->renderToggleButton() . "\n";
     echo Html::beginTag('div', $this->options) . "\n";
     echo $this->renderHeader() . "\n";
     echo $this->renderBodyBegin() . "\n";
 }
コード例 #3
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     if (!$this->hasModel() && $this->name === null) {
         throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
     }
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
     parent::init();
 }
コード例 #4
0
ファイル: Accordion.php プロジェクト: luobenyu/yii2-metronic
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, 'panel-group accordion');
 }
コード例 #5
0
ファイル: Portlet.php プロジェクト: luobenyu/yii2-metronic
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, 'portlet ' . $this->color . ' ' . $this->type);
     echo Html::beginTag('div', $this->options);
     Html::addCssClass($this->headerOptions, 'portlet-title');
     echo Html::beginTag('div', $this->headerOptions);
     $icon = $this->icon ? Html::tag('i', '', ['class' => 'fa ' . $this->icon]) : '';
     echo Html::tag('div', $icon . ' ' . $this->title, ['class' => 'caption']);
     if (!empty($this->tools)) {
         $tools = [];
         foreach ($this->tools as $tool) {
             $class = '';
             switch ($tool) {
                 case self::TOOL_CLOSE:
                     $class = 'remove';
                     break;
                 case self::TOOL_MINIMIZE:
                     $class = 'collapse';
                     break;
                 case self::TOOL_RELOAD:
                     $class = 'reload';
                     break;
             }
             $tools[] = Html::tag('a', '', ['class' => $class, 'href' => '']);
         }
         echo Html::tag('div', implode("\n", $tools), ['class' => 'tools']);
     }
     if (!empty($this->actions)) {
         echo Html::tag('div', implode("\n", $this->actions), ['class' => 'actions']);
     }
     echo Html::endTag('div');
     Html::addCssClass($this->bodyOptions, 'portlet-body');
     echo Html::beginTag('div', $this->bodyOptions);
     if (!empty($this->scroller)) {
         if (!isset($this->scroller['height'])) {
             throw new InvalidConfigException("The 'height' option of the scroller is required.");
         }
         $options = ArrayHelper::getValue($this->scroller, 'options', []);
         echo Html::beginTag('div', ArrayHelper::merge(['class' => 'scroller', 'data-always-visible' => '1', 'data-rail-visible' => '0'], $options, ['style' => 'height:' . $this->scroller['height'] . 'px;']));
     }
 }