protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model, $key, $index, $gridView) { return Html::a('<img src="' . Resource::getAdminUrl() . '/images/icons/color/magnifier.png">', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => '0']); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model, $key, $index, $gridView) { return Html::a('<img src="' . Resource::getAdminUrl() . '/images/icons/color/pencil.png">', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model, $key, $index, $gridView) { return Html::a('<img src="' . Resource::getAdminUrl() . '/images/icons/color/cross.png">', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']); }; } }
public static function getAdminMenu() { $html = ''; $adminUrl = Resource::getAdminUrl(); $action = LuLu::getApp()->requestedAction; $urlArray = explode('/', $action->uniqueId); $roots = self::getChildren('admin', 0, 1); foreach ($roots as $menu) { $url = $menu['url'] === '#' ? '#' : Url::to([$menu['url']]); $title = '<span class="da-nav-icon"><img src="' . $adminUrl . '/images/icons/black/32/' . $menu['thumb'] . '" alt="' . $menu['name'] . '" /></span>' . $menu['name']; $html .= '<li id="menu-item-' . $menu['id'] . '"><a href="' . $url . '">' . $title . '</a>'; $children = self::getChildren('admin', $menu['id'], 1); if (count($children) > 0) { $opened = false; $childHtml = ''; foreach ($children as $child) { $menuUrlArray = explode('/', trim($child['url'], '/')); if (in_array($urlArray[0], $menuUrlArray)) { $opened = true; } $childUrl = $child['url'] === '#' ? '#' : Url::to([$child['url']]); $childHtml .= '<li id="menu-item-' . $child['id'] . '"><a href="' . $childUrl . '">' . $child['name'] . '</a></li>'; } $html .= $opened ? '<ul>' : '<ul class="closed">'; $html .= $childHtml; $html .= '</ul>'; } $html .= '</li>'; } return $html; }
use source\LuLu; use source\modules\rbac\models\Role; use source\libs\Resource; /* @var $this yii\web\View */ /* @var $searchModel app\modules\rbac\models\search\RoleSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $categoryId = LuLu::getGetValue('category'); $this->title = '角色管理'; $this->params['breadcrumbs'][] = $this->title; $columns = [['attribute' => 'id', 'width' => '120px;'], ['attribute' => 'name', 'width' => '120px;'], ['attribute' => 'description', 'width' => 'auto'], ['class' => 'source\\core\\grid\\ActionColumn', 'template' => '{permission}{update} {delete}', 'buttons' => ['permission' => function ($url, $model) { return Html::a('<img src="' . Resource::getAdminUrl() . '/images/icons/color/key.png">', Url::to(['relation', 'role' => $model['id']]), ['title' => '设置权限']); }, 'delete' => function ($url, $model) { if ($model->is_system) { return ''; } return Html::a('<img src="' . Resource::getAdminUrl() . '/images/icons/color/cross.png">', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']); }]]]; ?> <?php $this->toolbars([Html::a('新建', ['create', 'category' => $categoryId], ['class' => 'btn btn-xs btn-primary mod-site-save'])]); ?> <style> .ui-tabs .ui-tabs-panel{padding:0px;} </style> <div class="da-ex-tabs"> <ul> <li><a href="#tabs-<?php echo Role::Category_Member; ?>
</div> <!-- Main Content Wrapper --> <div id="da-content-wrap" class="clearfix"> <!-- Content Area --> <div id="da-content-area"> <?php if (LuLu::getViewParam('defaultLayout') === null) { ?> <div class="grid_4"> <div class="da-panel"> <div class="da-panel-header"> <span class="da-panel-title"> <img src="<?php echo Resource::getAdminUrl(); ?> /images/icons/black/16/pencil.png" alt=""> <?php echo $this->title; ?> </span> </div> <?php if (($toolbars = LuLu::getViewParam('toolbars')) !== null) { ?> <div class="da-panel-toolbar top"> <ul> <?php
<?php use yii\helpers\Html; use yii\helpers\Url; use source\LuLu; use source\libs\Constants; use source\core\grid\GridView; use source\modules\fragment\models\Fragment; use source\libs\Resource; /* @var $this source\core\back\BackView */ /* @var $searchModel source\modules\fragment\models\search\FragmentSearch */ /* @var $dataProvider source\core\data\ActiveDataProvider */ $type = LuLu::getGetValue('type'); $this->title = Fragment::getTypeItems($type); $this->params['breadcrumbs'][] = $this->title; $this->toolbars([Html::a('新建', ['create', 'type' => $type], ['class' => 'btn btn-xs btn-primary mod-site-save'])]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'source\\core\\grid\\IdColumn'], 'code', ['attribute' => 'name', 'width' => '250px', 'value' => function ($model, $key, $index, $column) { $indexUrl = Url::to(['fragment' . $model->type . '-data/index', 'fid' => $model->id, 'type' => $model->type]); return Html::a($model->name, $indexUrl); }], ['attribute' => 'description', 'width' => 'auto'], ['class' => 'source\\core\\grid\\ActionColumn', 'width' => '60px', 'template' => '{data-create}{update} {delete}', 'buttons' => ['data-create' => function ($url, $model, $key, $index, $gridView) { $addUrl = Url::to(['fragment' . $model->type . '-data/create', 'fid' => $model->id, 'type' => $model->type]); return Html::a('<img src="' . Resource::getAdminUrl() . '/images/icons/color/text_signature.png">', $addUrl, ['title' => '添加内容']); }]]]]); ?>
/** * 向视图中注册默认的js资源 * @param type $jsFile */ public static function registerJsFile($jsFile) { $jsUrl = Resource::getAdminUrl($jsFile); LsYii::getView()->registerJsFile($jsUrl, ['depends' => 'yii\\web\\YiiAsset']); }
<?php use source\LsYii; use source\helpers\Html; use source\core\widgets\ActiveForm; use source\libs\Constants; use source\libs\Resource; use source\modules\menu\models\Menu; use source\helpers\Url; use backend\assets\AppAsset; /* @var $this yii\web\View */ /* @var $model common\models\Menu */ /* @var $form yii\widgets\ActiveForm */ $this->registerJsFile(Resource::getAdminUrl('/default/js/bootstrap-smartsearch.js'), ['depends' => 'yii\\web\\YiiAsset']); ?> <div class="menu-form"> <?php $form = ActiveForm::begin(['id' => 'menu-form', 'options' => ['class' => 'form-horizontal']]); ?> <?php $disabeld = $model->isNewRecord ? false : true; ?> <?php echo $form->field($model, 'pid')->textInput(['class' => 'form-control', 'autocomplete' => 'off', 'data-provide' => "smartsearch", 'data-items' => "all", 'data-source' => Menu::getToJson(), 'data-value' => $model->pid, 'disabled' => $disabeld]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?>
<div class="mod-header-user"> <ul class="pull-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle mod-bell" data-toggle="dropdown"> <i class="icon icon-bell"></i> </a> <ul class="dropdown-menu mod-chat"> <p>没有通知</p> </ul> </li> <li class="dropdown username"> <a href="" class="dropdown-toggle" data-toggle="dropdown"> <img src="<?php echo Resource::getAdminUrl('/images/avatar-mid-img.png')?>" class="img-circle" width="30"> admin888 <span class="caret"></span> </a> <ul class="dropdown-menu pull-right mod-user"> <li> <a href="<?php echo LuLu::getAlias('@web');?>" target="_blank"><i class="icon icon-home"></i>首页</a> </li> <li> <?php echo Html::a('<i class="icon icon-ul"></i>概述',['/site/welcome'],['target'=>'mainFrame'])?> </li> <li> <?php echo Html::a('<i class="icon icon-logout"></i>退出',['/site/logout'],['target'=>'mainFrame'])?> </li>
<div class="mod-header-user"> <ul class="pull-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle mod-bell" data-toggle="dropdown"> <i class="icon icon-bell"></i> </a> <ul class="dropdown-menu mod-chat"> <p>没有通知</p> </ul> </li> <li class="dropdown username"> <a href="" class="dropdown-toggle" data-toggle="dropdown"> <img src="<?php echo Resource::getAdminUrl('/images/avatar-mid-img.png'); ?> " class="img-circle" width="30"> admin888 <span class="caret"></span> </a> <ul class="dropdown-menu pull-right mod-user"> <li> <a href="<?php echo LuLu::getAlias('@web'); ?> " target="_blank"><i class="icon icon-home"></i>首页</a> </li> <li> <a href="<?php