Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
     }
 }