示例#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;
 }
示例#2
0
 /**
  * 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']}"]);
 }