public function init() { parent::init(); $boxClassNames = ['box']; $boxClassNames[] = 'box-' . $this->style; if ($this->solid) { $boxClassNames[] = 'box-solid'; } $opt = Html::beginTag('div', ['class' => implode(' ', $boxClassNames)]); // header $opt .= Html::beginTag('div', ['class' => 'box-header with-border']); $opt .= Html::tag('h3', $this->title, ['class' => 'box-title']); if (count($this->tools) > 0) { $predefinedBtns = ['collapse' => Html::button(Html::icon('minus'), ['class' => 'btn btn-box-tool', 'title' => '折叠', 'data' => ['widget' => 'collapse', 'toggle' => 'tooltip']]), 'remove' => Html::button(Html::icon('times'), ['class' => 'btn btn-box-tool', 'title' => '移除', 'data' => ['widget' => 'remove', 'toggle' => 'tooltip']])]; for ($i = 0; $i < count($this->tools); $i++) { $alias = $this->tools[$i]; if (isset($predefinedBtns[$alias])) { $this->tools[$i] = $predefinedBtns[$alias]; } } $opt .= Html::beginTag('div', ['class' => 'box-tools pull-right']); $opt .= implode('', $this->tools); $opt .= Html::endTag('div'); } $opt .= Html::endTag('div'); // body $opt .= Html::beginTag('div', ['class' => 'box-body']); echo $opt; }
public function init() { parent::init(); if (count($this->roles) == 0 || Yii::$app->user->identity->in($this->roles)) { $opt = Html::beginTag('div', ['class' => 'col-md-3 col-sm-6 col-xs-12']); $opt .= Html::beginTag('div', ['class' => 'info-box']); // icon $opt .= Html::tag('span', Html::icon($this->icon), ['class' => 'info-box-icon bg-' . $this->style]); // content $opt .= Html::beginTag('div', ['class' => 'info-box-content']); $opt .= Html::tag('span', $this->text, ['class' => 'info-box-text']); $opt .= Html::tag('span', $this->number, ['class' => 'info-box-number']); $opt .= Html::tag('div', $this->operation, ['class' => 'info-box-operation text-right']); $opt .= Html::endTag('div'); // info-box-content echo $opt; } }
/** * Migrate glyphicon to fant awesome * * Initializes the default button rendering callbacks. */ protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model, $key) { $options = array_merge(['title' => Yii::t('yii', 'View'), 'aria-label' => Yii::t('yii', 'View'), 'data-pjax' => '0'], $this->buttonOptions); return Html::a(Html::icon('eye'), $url, $options); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model, $key) { $options = array_merge(['title' => Yii::t('yii', 'Update'), 'aria-label' => Yii::t('yii', 'Update'), 'data-pjax' => '0'], $this->buttonOptions); return Html::a(Html::icon('pencil'), $url, $options); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model, $key) { $options = array_merge(['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0'], $this->buttonOptions); return Html::a(Html::icon('trash'), $url, $options); }; } }
/** * Fix the problem that the toggle button * is missing in AdminLTE. * * @return string the rendering toggle button. */ protected function renderToggleButton() { $bar = Html::icon('bars'); $screenReader = "<span class=\"sr-only\">{$this->screenReaderToggleText}</span>"; return Html::button("{$screenReader}\n{$bar}", ['class' => 'navbar-toggle', 'data-toggle' => 'collapse', 'data-target' => "#{$this->containerOptions['id']}"]); }