/** * @inheritdoc */ public function init() { parent::init(); Html::addCssClass($this->options, ['widget' => 'info-box']); $iconOptions = ['class' => 'info-box-icon']; if ($this->type === self::COLORED_ICON) { Html::addCssClass($iconOptions, 'bg-' . $this->color); } else { Html::addCssClass($this->options, 'bg-' . $this->color); } echo Html::beginTag('div', $this->options); echo Html::tag('span', FA::icon($this->icon), $iconOptions); echo '<div class="info-box-content">'; if (!empty($this->contents)) { foreach ($this->contents as $content) { if (is_array($content)) { $type = ArrayHelper::getValue($content, 'type', 'text'); $text = ArrayHelper::getValue($content, 'text', ''); if (in_array($type, ['text', 'number'])) { echo Html::tag('span', $text, ['class' => 'info-box-' . $type]); } elseif ($type == 'progress') { $value = ArrayHelper::getValue($content, 'value', $text); echo '<div class="progress">'; echo Html::tag('div', '', ['class' => 'progress-bar', 'style' => ['width' => $value . '%']]); echo '</div>'; } else { echo Html::tag('span', $text, ['class' => $type]); } } else { echo $content; } } } }
/** * @inheritdoc */ public function init() { parent::init(); Html::addCssClass($this->options, ['widget' => 'box']); if ($this->solid) { Html::addCssClass($this->options, 'box-solid'); if ($this->variant === null) { Html::addCssClass($this->options, 'box-default'); } } if ($this->variant !== null) { Html::addCssClass($this->options, 'box-' . $this->variant); } echo Html::beginTag('div', $this->options); // header if ($this->header || !empty($this->boxTools)) { echo '<div class="box-header with-border">'; echo Html::tag('h3', $this->header, ['class' => 'box-title']); } // box-tools if (!empty($this->boxTools)) { echo Html::beginTag('div', ['class' => 'box-tools pull-right']); foreach ($this->boxTools as $toolbox) { if (is_array($toolbox)) { $tag = 'span'; if (($widget = ArrayHelper::getValue($toolbox, 'button')) !== null) { $tag = 'button'; $toolbox['options']['data-widget'] = $widget; Html::addCssClass($toolbox['options'], 'btn btn-box-tool'); } elseif (($label = ArrayHelper::getValue($toolbox, 'label')) !== null) { Html::addCssClass($toolbox['options'], 'label label-' . $label); } elseif (($badge = ArrayHelper::getValue($toolbox, 'badge')) !== null) { Html::addCssClass($toolbox['options'], 'badge bg-' . $badge); } $tag = ArrayHelper::getValue($toolbox, 'tag', $tag); $options = ArrayHelper::getValue($toolbox, 'options', []); $text = ArrayHelper::getValue($toolbox, 'text', ''); $icon = ArrayHelper::getValue($toolbox, 'icon'); if ($icon !== null) { $text .= ' ' . FA::icon($icon); } if (($tooltip = ArrayHelper::getValue($toolbox, 'tooltip')) !== null) { $options['data-toggle'] = 'tooltip'; $options['title'] = $tooltip; } echo Html::tag($tag, $text, $options); } else { echo $toolbox; } } echo '</div>'; } if ($this->header || !empty($this->boxTools)) { echo '</div>'; } // body echo '<div class="box-body">'; echo $this->body; }
/** * Initializes the widget. * If you override this method, make sure you call the parent implementation first. */ public function init() { if ($this->submenuOptions === null) { // copying of [[options]] kept for BC // @todo separate [[submenuOptions]] from [[options]] completely before 2.1 release $this->submenuOptions = $this->options; unset($this->submenuOptions['id']); } parent::init(); Html::addCssClass($this->options, ['widget' => 'dropdown-menu']); }
/** * Initializes the widget. */ public function init() { parent::init(); if ($this->route === null && Yii::$app->controller !== null) { $this->route = Yii::$app->controller->getRoute(); } if ($this->params === null) { $this->params = Yii::$app->request->getQueryParams(); } if ($this->treeviewCaret === null) { $this->treeviewCaret = FA::icon('angle-left')->pullRight(); } Html::addCssClass($this->options, ['widget' => 'sidebar-menu']); }
/** * Initializes the widget. */ public function init() { parent::init(); if ($this->route === null && Yii::$app->controller !== null) { $this->route = Yii::$app->controller->getRoute(); } if ($this->params === null) { $this->params = Yii::$app->request->getQueryParams(); } if ($this->dropDownCaret === null) { $this->dropDownCaret = Html::tag('span', '', ['class' => 'caret']); } Html::addCssClass($this->options, ['widget' => 'nav']); }