/** * Renders the data cell content. * @param mixed $model the data model * @param mixed $key the key associated with the data model * @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]]. * @return string the rendering result */ protected function renderDataCellContent($model, $key, $index) { if ($this->grid->runInConsoleMode) { return parent::renderDataCellContent($model, $key, $index); } $attribute = $this->attribute; $value = $model->{$attribute}; $url = [$this->action, 'id' => $model->id, 'attribute' => $attribute]; if ($value === null || $value == true) { $icon = 'toggle-on'; $title = Yii::t('yii', 'Off'); } else { $icon = 'toggle-off'; $title = Yii::t('yii', 'On'); } return Html::a(Icons::i($icon . ' fa-lg'), $url, ['title' => $title, 'class' => 'grid-view-toggle-cell-link', 'data-method' => 'post', 'data-pjax' => '0']); }
protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model) { return Html::a(Icons::i('eye fa-lg'), $url, ['title' => Yii::t('admin/t', 'View'), 'class' => 'btn btn-info btn-sm', 'data-pjax' => '0']); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model) { return Html::a(Icons::i('pencil-square-o fa-lg'), $url, ['title' => Yii::t('admin/t', 'Edit'), 'class' => 'btn btn-success btn-sm', 'data-pjax' => '0']); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model) { return Html::a(Icons::i('trash-o fa-lg'), $url, ['title' => Yii::t('admin/t', 'Delete'), 'data-confirm' => Yii::t('admin/t', 'Are you sure to delete this item?'), 'data-method' => 'post', 'class' => 'btn btn-danger btn-sm', 'data-pjax' => '0']); }; } }
/** * Renders icon * @return string */ public function render() { return $this->prepend . Icons::i($this->name, $this->options, $this->iconsSet, $this->tag) . $this->append; }
?> </ul> </li> </ul> </li> <?php } ?> <?php SystemEvents::end(); ?> <li class="dropdown user user-menu"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> <?php echo Icons::i('user fa-fw'); ?> <span><?php echo Html::encode(Yii::$app->user->identity->name); ?> <i class="caret"></i></span> </a> <ul class="dropdown-menu"> <li class="user-header bg-light-blue"> <p> <?php echo Yii::$app->user->identity->name; ?> <small><?php echo Yii::$app->user->identity->email; ?>
?> </span> </div> </a> <?php if (isset($group['items']) && is_array($group['items']) && count($group['items']) > 0) { ?> <ul class="treeview-menu"> <?php foreach ($group['items'] as $item) { ?> <li class="item <?php echo $item['active'] ? 'active' : ''; ?> "> <?php echo Html::a((isset($item['icon']) ? $item['icon']->ac('fa-fw') : Icons::i('angle-double-right fa-fw')) . ' ' . $item['label'], $item['route']); ?> </li> <?php } ?> </ul> <?php } ?> </li> <?php } ?> </ul>
<?php use yii\helpers\Html; use yz\admin\widgets\Box; use yz\admin\widgets\GridView; use yz\admin\widgets\ActionButtons; /** * @var yii\web\View $this * @var yii\data\ActiveDataProvider $dataProvider * @var array $columns */ $this->title = Yii::t('admin/export', 'Files'); $this->params['breadcrumbs'][] = $this->title; $this->params['header'] = $this->title; $box = Box::begin(['cssClass' => 'export-request-index box-primary']); ?> <div class="text-right"> <?php echo ActionButtons::widget(['order' => [['delete']], 'gridId' => 'export-request-grid', 'modelClass' => 'yz\\admin\\export\\common\\models\\ExportRequest']); ?> </div> <?php echo GridView::widget(['id' => 'export-request-grid', 'dataProvider' => $dataProvider, 'columns' => array_merge([['class' => 'yii\\grid\\CheckboxColumn']], $columns, [['class' => 'yz\\admin\\widgets\\ActionColumn', 'template' => '{download} {delete}', 'buttons' => ['download' => function ($url, $model, $key) { return Html::a(\yz\icons\Icons::i('download'), ['download', 'id' => $key], ['class' => 'btn btn-primary', 'title' => Yii::t('admin/export', 'Download')]); }]]])]); Box::end();