/** * 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']); }; } }
public function init() { parent::init(); $session = \Yii::$app->getSession(); $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; $alerts = ''; foreach ($flashes as $type => $message) { if (isset($this->alertTypes[$type])) { /* initialize css class for each alert box */ $this->options['class'] = $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type; $body = Icons::p($this->alertIcons[$type], ['class' => 'icon']) . $message; $alerts .= Alert::widget(['body' => $body, 'closeButton' => $this->closeButton, 'options' => $this->options]); $session->removeFlash($type); } } if ($alerts) { echo strtr($this->template, ['{alerts}' => $alerts]); } }
public function getAdminMenu() { return [['label' => \Yii::t('admin/elfinder', 'File manager'), 'icon' => Icons::o('folder-o'), 'items' => [['route' => ['/filemanager/file-manager/index'], 'label' => \Yii::t('admin/elfinder', 'All files'), 'icon' => Icons::o('file-o')]]]]; }
/** * 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>
public function getAdminMenu() { return [['label' => \Yii::t('admin/export', 'Data export'), 'icon' => Icons::o('gear'), 'items' => [['label' => \Yii::t('admin/export', 'Files'), 'icon' => Icons::o('info'), 'route' => ['/admin-export/export-requests/index']]]]]; }
<?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();
public function getAdminMenu() { return [['label' => \Yii::t('admin/mailer', 'Sending emails'), 'icon' => Icons::o('envelope'), 'items' => [['label' => \Yii::t('admin/mailer', 'Send mails'), 'icon' => Icons::o('envelope-o'), 'route' => ['/mailing/mails/index']]]]]; }
<?php use yii\helpers\ArrayHelper; use yii\helpers\Html; use yz\admin\assets\AdminAsset; use yz\icons\Icons; /** * @var \yii\web\View $this * @var string $content */ AdminAsset::register($this); Icons::register($this); $this->beginPage(); ?> <!DOCTYPE html> <html> <head> <title><?php echo Yii::t('admin/t', 'Administration panel'); ?> </title> <meta charset="<?php echo Yii::$app->charset; ?> "/> <meta name="viewport" content="width=1008"> <?php echo Html::csrfMetaTags(); ?> <?php $this->head();
\yz\admin\assets\LoginAsset::register($this); $this->params['body-extra-class'] = 'login-page'; ?> <div class="container"> <div class="b-login"> <h1><?php echo Yii::t('admin/t', 'Administration panel'); ?> </h1> <?php $form = ActiveForm::begin(['id' => 'login-form', 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-3', 'wrapper' => 'col-sm-7']]]); ?> <?php echo $form->field($loginForm, 'login')->textInput(['autofocus' => '']); ?> <?php echo $form->field($loginForm, 'password')->passwordInput(); ?> <?php echo Html::submitButton(Icons::p('unlock-alt') . Yii::t('admin/t', 'Sign in'), ['class' => 'btn btn-success']); ?> <?php ActiveForm::end(); ?> </div> </div>
public function renderSettings() { if ($this->showSettings == false) { return ''; } return Html::a(Icons::p('gears') . Yii::t('admin/gridview', 'Grid Settings'), ['#'], ['class' => 'pull-right btn btn-default btn-xs btn-grid-settings js-btn-admin-grid-settings', 'data' => ['gridUniqueId' => $this->getGridId(), 'currentPageSize' => $this->dataProvider->getPagination()->pageSize, 'pageSizes' => $this->allowedPageSizes]]); }
/** * @return \yii\bootstrap\Button */ public function getImportButton() { if ($this->_importButton === null) { $url = $this->importUrl; if ($this->checkAccess($url) == false) { return null; } if ($this->checkAccess($url) == false) { return null; } $this->_importButton = Button::widget(['tagName' => 'a', 'label' => Icons::p('upload') . \Yii::t('admin/t', 'Импорт'), 'encodeLabel' => false, 'options' => ['href' => Url::to($url), 'class' => 'btn btn-default', 'id' => 'action-button-import']]); } return $this->_importButton; }
public function getAdminMenu() { return ArrayHelper::merge($this->menuItems, [['label' => \Yii::t('admin/menu', 'Administrators'), 'icon' => Icons::o('user'), 'items' => [['label' => \Yii::t('admin/menu', 'List'), 'icon' => Icons::o('list'), 'route' => ['/admin/users/index']], ['label' => \Yii::t('admin/menu', 'Roles'), 'icon' => Icons::o('list'), 'route' => ['/admin/roles/index']]]]], $this->showSystemInfoMenu ? [['label' => \Yii::t('admin/menu', 'System'), 'icon' => Icons::o('gear'), 'items' => [['label' => \Yii::t('admin/menu', 'Information'), 'icon' => Icons::o('info'), 'route' => ['/admin/general/info']]]]] : []); }