public function actionLogin() { $this->layout = 'login'; if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); $message = []; if ($model->load(LsYii::getRequest()->post())) { if ($model->login()) { $this->redirect(\source\helpers\Url::to(['index'])); } else { foreach ($model->getErrors() as $errors) { foreach ($errors as $error) { $message[] = $error; } } } } return $this->render('login', ['model' => $model, 'message' => !empty($message) ? $message[0] : '']); }
<?php echo $form->field($model, 'password')->passwordInput(); ?> <?php echo $form->field($model, 'repassword')->passwordInput(); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'status')->radioList(Constants::getStatusItems()); ?> <?php echo $form->field($model, 'role')->dropDownList(Role::getAdminItems(null, false)); ?> <?php $submitText = $model->isNewRecord ? "新建" : "修改"; $closeLink = Url::to(['/user/adminuser/index']); Html::SubmitButtons($submitText, $closeLink); ?> <?php ActiveForm::end(); ?> </div>
$html = ''; if ($menus) { $html .= '<ul class="nav bs-sidenav" style="height:567px">'; foreach ($menus as $menu) { $html .= '<li class="active"><a href="javascript:void(0)"> ' . $menu->name . ' </a></li>'; //查询四级子菜单 $childMenus = Menu::getMenuArray($menu->id, 4); if ($childMenus) { $html .= '<ul class="nav">'; foreach ($childMenus as $childMenu) { if (LsYii::getApp()->controller->sideMenu == $childMenu->id) { $class = 'class="active"'; } else { $class = ''; } $html .= '<li ' . $class . '><a href="' . Url::to([$childMenu->url]) . '">' . $childMenu->name . '</a></li>'; } $html .= '</ul>'; } } $html .= '</ul>'; } echo $html; ?> </div> </div> <div class="content col-md-10" role="main" id="contents" style="height: 553px;"> <div class="container" style="height:100%;"> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?>
/** * 得到后台侧边的菜单栏 */ public static function getSideMenu() { $html = ''; $topMenu = LsYii::getApp()->controller->topMenu; if (!isset($topMenu) || empty($topMenu)) { return $topMenu; } //查询三级菜单 $menus = self::getMenuArray($topMenu, 3); if ($menus) { $html .= '<div class="sidebar">'; $html .= '<div id="subnav" class="subnav">'; foreach ($menus as $menu) { $html .= '<h3><i class="icon"></i>' . $menu->name . '</h3>'; //查询四级子菜单 $childMenus = self::getMenuArray($menu->id, 4); if ($childMenus) { $html .= '<ul class="side-sub-menu subnav-off">'; foreach ($childMenus as $childMenu) { if (LsYii::getApp()->controller->sideMenu == $childMenu->id) { $class = 'class="active"'; } else { $class = ''; } $html .= '<li ' . $class . '><a class="item" href="' . Url::to([$childMenu->url]) . '">' . $childMenu->name . '</a></li>'; } $html .= '</ul>'; } } $html .= '</div>'; $html .= '</div>'; } return $html; }
<div class="dict-category-form"> <?php $form = ActiveForm::begin(['id' => 'dictcategory-form', 'options' => ['class' => 'form-horizontal']]); ?> <?php echo $form->field($model, 'id')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php $submitText = $model->isNewRecord ? "新建" : "修改"; $closeLink = Url::to(['/dict/dictcategory/index']); Html::SubmitButtons($submitText, $closeLink); ?> <?php ActiveForm::end(); ?> </div>
<ul class="dropdown-menu"> <li> <?php echo Html::a('<span class="glyphicon glyphicon-user"></span> ' . LsYii::gT("个人资料"), Url::to(['site/profile']), []); ?> </li> <li> <?php echo Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . LsYii::gT("修改密码"), Url::to(['site/modifyPwd']), []); ?> </li> </ul> </li> <li> <?php echo Html::a(LsYii::gT('退出登录'), Url::to(['/site/logout']), ['data-method' => 'post']); ?> </li> </ul> </div> </div> <div class="container bs-docs-container"> <div class="row"> <div class="content col-md-10" role="main" id="contents" style="height: 553px;padding: 0px 10px;"> <div class="container" style="height:100%;"> <?php $this->params['breadcrumbs'] = source\core\back\BackView::createBreadcrumbs(); ?> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?>
<div class="role-form"> <?php $form = ActiveForm::begin(['id' => 'role-form', 'options' => ['class' => 'form-horizontal']]); ?> <?php echo $form->field($model, 'id')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php $submitText = $model->isNewRecord ? "新建" : "修改"; $closeLink = Url::to(['/rbac/role/index', 'category' => LsYii::getGetValue('category')]); Html::SubmitButtons($submitText, $closeLink); ?> <?php ActiveForm::end(); ?> </div>
echo $form->field($model, 'form')->radioList(Permission::getFormItems()); ?> <?php echo $form->field($model, 'default_value')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'rule')->dropDownList(Rule::getRules(), ['prompt' => '请选择']); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'sort_num')->textInput(); ?> <?php $submitText = $model->isNewRecord ? "新建" : "修改"; $closeLink = Url::to(['/rbac/permission/index', 'category' => LsYii::getGetValue('category')]); Html::SubmitButtons($submitText, $closeLink); ?> <?php ActiveForm::end(); ?> </div>
/** * 输出日志消息 * @param type $message 要输出的日志消息 * @param type $callback 是否要返回检测用户输入 */ private static function _appendLog($message, $callback = false) { if ($callback) { $message .= '<br/> <a href="' . Url::to(['site/db']) . '" class="red">' . LsYii::gT('返回检测') . '</a>'; } $message = json_encode($message); echo '<script type="text/javascript"> var message=' . $message . ';$("#progress").append(message + "<br/>");</script>'; ob_flush(); flush(); }
/** * 得到格式化的数组 * @param type $model * @param type $pid * @param type $expanded * @param type $hasChildren * @param type $htmlOptions * @return array */ public static function getTreeDataInternal($models, $pid, $expanded = false, $hasChildren = false, $htmlOptions = array()) { $data = array(); if (!$models) { return $data; } foreach ($models as $model) { if ($model->pid == $pid) { $template = Html::beginTag('div', array('class' => 'tree-hover')); if (isset($htmlOptions['updateUrl'])) { $updateUrl = Url::to([$htmlOptions['updateUrl'], 'id' => $model->id]); $template .= Html::a($model->name, $updateUrl); $template .= '<span class="pull-right">'; $template .= Html::a('<span class="glyphicon glyphicon-edit"></span>', $updateUrl, ['title' => LsYii::gT('编辑')]); } else { $template .= $model->name; $template .= '<span class="pull-right">'; } if (isset($htmlOptions['addChildrenUrl'])) { $addChilderUrl = Url::to([$htmlOptions['addChildrenUrl'], 'id' => $model->id]); $template .= Html::a('<span class="glyphicon glyphicon-plus"></span>', $addChilderUrl, array('title' => LsYii::gT('添加子类'))); } if (isset($htmlOptions['deleteUrl'])) { $deleteUrl = Url::to([$htmlOptions['deleteUrl'], 'id' => $model->id]); $template .= Html::a('<span class="glyphicon glyphicon-remove"></span>', $deleteUrl, array('title' => LsYii::gT('删除'), 'data-method' => 'POST')); } $template .= Html::endTag('div'); $arr['text'] = $template; $arr['expanded'] = $expanded; $arr['id'] = $model->id; $arr['children'] = self::getTreeDataInternal($models, $model->id, $expanded, $hasChildren, $htmlOptions); $data[] = $arr; } } return $data; }
<?php use source\helpers\Html; use yii\grid\GridView; use source\LsYii; use common\widgets\TreeView; use source\modules\menu\models\Menu; /* @var $this yii\web\View */ /* @var $searchModel source\models\search\MenuSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = '菜单管理'; $this->registerJs("\$(function(){\n \$('.nav-tabs .active').mouseover(function(){\n \$(this).find('.attribute-remove').show();\n }).mouseout(function(){\n \$(this).find('.attribute-remove').hide();\n });\n \$('.nav-tabs .active .attribute-remove').click(function(){\n window.open('" . \source\helpers\Url::to(['/menu/site/delete', 'id' => $model->id]) . "' , '_self');\n return false;\n });\n})", \source\core\back\BackView::POS_END); echo source\libs\Message::getMessage(); ?> <div class="page-header"> <h3> <strong><?php echo Html::encode($this->title); ?> </strong> <div class="pull-right"> <?php echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . LsYii::gT('添加新菜单'), ['/menu/site/create'], ['class' => 'btn btn-primary']); ?> </div> </h3> </div> <div class="menu-index"> <?php echo yii\bootstrap\Tabs::widget(['items' => Menu::getItems($model->id, '/menu/site/index')]); echo TreeView::widget(['data' => Menu::getTreeData($model->root, $model->id, true, false, ['updateUrl' => '/menu/site/update', 'addChildrenUrl' => '/menu/site/create', 'deleteUrl' => '/menu/site/delete'])]);
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'url')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'if_show')->radioList(Constants::getMenuStatus()); ?> <?php echo $form->field($model, 'memo')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'sort')->textInput(); ?> <?php $submitText = $model->isNewRecord ? "新建" : "修改"; $closeLink = Url::to(['/menu/site/index']); Html::SubmitButtons($submitText, $closeLink); ?> <?php ActiveForm::end(); ?> </div>
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'url')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'if_show')->radioList(Constants::getCategoryStatus()); ?> <?php echo $form->field($model, 'memo')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'sort')->textInput(); ?> <?php $submitText = $model->isNewRecord ? "新建" : "修改"; $closeLink = Url::to(['/category/default/index']); Html::SubmitButtons($submitText, $closeLink); ?> <?php ActiveForm::end(); ?> </div>
echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'value'); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'status')->radioList(Constants::getDictStatus()); ?> <?php echo $form->field($model, 'sort')->textInput(); ?> <?php $submitText = $model->isNewRecord ? "新建" : "修改"; $closeLink = Url::to(['/dict/dict/index', 'category_id' => $category_id]); Html::SubmitButtons($submitText, $closeLink); ?> <?php ActiveForm::end(); ?> </div>