/** * 生成保存与关闭的按钮 * @param type $submitText * @param type $closeLink */ public static function SubmitButtons($submitText, $closeLink = null) { echo Html::beginTag('div', ['class' => 'form-group center']); echo Html::submitButton(LsYii::gT($submitText), ['class' => 'btn btn-primary', 'name' => 'save']); if ($closeLink !== null) { echo Html::a(LsYii::gT("Return"), $closeLink, ['name' => 'close', 'class' => 'btn btn-default', 'style' => 'margin-left:10px;']); } echo Html::endTag('div'); }
/** * 页面输入错误消息 * @return string */ public static function getErrorMessage() { $flash = LsYii::getFlash('error'); if (!empty($flash)) { $message = Html::beginTag('div', ['class' => 'alert alert-danger alert-dismissible fade in', 'role' => 'alert']); $message .= $flash; $message .= Html::endTag('div'); LsYii::getView()->registerJs("\$(function(){\n setTimeout(function(){\n \$('div.alert-danger').remove();\n } , 3000);\n })", BackView::POS_END); } else { $message = ''; } return $message; }
/** * Initializes the default button rendering callbacks. */ protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model, $key) { $options = array_merge(['title' => Yii::t('yii', 'View'), 'aria-label' => Yii::t('yii', 'View'), 'data-pjax' => '0'], $this->buttonOptions); return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, $options); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model, $key) { $options = array_merge(['title' => Yii::t('yii', 'Update'), 'aria-label' => Yii::t('yii', 'Update'), 'data-pjax' => '0'], $this->buttonOptions); return Html::a('<span class="glyphicon glyphicon-edit"></span>', $url, $options); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model, $key) { $options = array_merge(['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0'], $this->buttonOptions); return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options); }; } }
<?php use source\LsYii; use source\helpers\Html; /* @var $this yii\web\View */ /* @var $model source\models\Menu */ $this->title = '更新菜单'; ?> <div class="page-header"> <h3> <strong><?php echo Html::encode($this->title); ?> </strong> <small><?php echo Html::encode($model->name); ?> </small> </h3> </div> <div class="menu-update"> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
use yii\grid\GridView; use source\LsYii; use source\modules\dict\models\DictCategory; /* @var $this yii\web\View */ /* @var $searchModel source\models\search\DictCategorySearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = '字典分类'; 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('添加字典分类'), ['/dict/dictcategory/create'], ['class' => 'btn btn-primary']); ?> </div> </h3> </div> <div class="dict-category-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => '{items} {summary} {pager}', 'tableOptions' => ['class' => 'table table-hover'], 'columns' => ['id', 'name', 'description', ['class' => 'source\\core\\grid\\ActionColumn', 'template' => '{view} {update} {delete}', 'buttons' => ['view' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', source\helpers\Url::to(['/dict/dict/index', 'category_id' => $model->id]), []); }]]]]); ?> </div>
<?php use source\helpers\Html; use yii\grid\GridView; use source\LsYii; use source\modules\dict\models\Dict; use source\modules\dict\models\DictCategory; /* @var $this yii\web\View */ /* @var $model source\models\Dict */ $this->title = '修改字典'; echo source\libs\Message::getMessage(); ?> <div class="page-header"> <h3> <strong><?php echo Html::encode($this->title); ?> </strong> <small><?php echo Html::encode(DictCategory::getDictCategoryName($category_id) . '-' . $model->name); ?> </small> </h3> </div> <div class="dict-update"> <?php echo $this->render('_form', ['model' => $model, 'category_id' => $category_id]); ?> </div>
<?php use source\LsYii; use source\helpers\Html; use source\models\User; /* @var $this yii\web\View */ /* @var $model source\models\User */ $this->title = '新建注册会员'; echo source\libs\Message::getMessage(); ?> <div class="page-header"> <h3> <strong><?php echo Html::encode($this->title); ?> </strong> </h3> </div> <div class="user-create"> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
use source\models\User; use source\libs\Constants; use source\modules\rbac\models\Role; /* @var $this yii\web\View */ /* @var $searchModel source\models\search\UserSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = '注册会员'; 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('添加' . $this->title), ['/user/member/create'], ['class' => 'btn btn-primary']); ?> </div> </h3> </div> <div class="user-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'username', 'value' => 'username'], ['attribute' => 'email', 'value' => 'email'], ['attribute' => 'status', 'filter' => Constants::getStatusItems(), 'content' => function ($model, $key, $index, $gridView) { return Constants::getStatusItems($model->status); }], ['attribute' => 'role', 'value' => 'role', 'filter' => Role::getMemberItems()], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
?> <div class="header"> <div class="step_area"> <h2>关于</h2> </div> </div> <div class="mainbody"> <div class="agreement_area"> <div class="agreement"> <p> 感谢您选择LsYii CMS。希望我们的努力能为您提供一个高效快速和强大的建站解决方案。 </p> <p>LsYii CMS官方网站为 <?php echo Html::a(LsYii::getHostInfo(), LsYii::getHostInfo(), array('target' => '_blank', 'class' => 'action')); ?> </p> <p> LsYii CMS是一款基于强大的开源框架Yii Framework 2,采用高性能的PHP5+MySql开发的多功能开源的网站内容管理系统。 具有操作简单、稳定、安全、高效、跨平台等特点。采用MVC设计模式,模板定制方便灵活,内置小挂工具,方便制作各类功能和效果. </p> <p>LsYii CMS可用于企业建站、个人博客、资讯门户、图片站等各类型站点。</p> <div class="hr_8"></div> <p>在开始前,我们需要您数据库的一些信息。请准备好如下信息。</p> <ol> <li>数据库主机</li> <li>数据库名</li>
?> </strong> <small><?php echo Html::encode(DictCategory::getDictCategoryName($category_id)); ?> </small> <div class="pull-right"> <?php echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . LsYii::gT('添加字典'), ['/dict/dict/create', 'category_id' => $category_id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('<span class="glyphicon glyphicon-share-alt"></span> ' . LsYii::gT('Return'), ['/dict/dictcategory/index'], ['class' => 'btn btn-primary']); ?> </div> </h3> </div> <div class="dict-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => '{items} {summary} {pager}', 'tableOptions' => ['class' => 'table table-hover'], 'columns' => [['attribute' => 'name'], ['attribute' => 'value'], ['attribute' => 'status', 'filter' => \source\libs\Constants::getDictStatus(), 'content' => function ($model, $key, $index, $gridView) { return \source\libs\Constants::getDictStatus($model->status); }], ['attribute' => 'sort', 'filter' => Html::activeInput('text', $searchModel, 'sort', ['class' => 'form-control'])], ['class' => 'source\\core\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttons' => ['view' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['/dict/dict/view', 'id' => $model->id, 'category_id' => LsYii::getGetValue('category_id')], []); }, 'update' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-edit"></span>', ['/dict/dict/update', 'id' => $model->id, 'category_id' => LsYii::getGetValue('category_id')], []); }, 'delete' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['/dict/dict/delete', 'id' => $model->id, 'category_id' => LsYii::getGetValue('category_id')], ['data-method' => 'post', 'data-confirm' => LsYii::gT('Are you sure you want to delete this item?')]); }]]]]); ?> </div>
#main-content { margin-left: 0px; } .container { width: 100%; } .due-time { color: red; } </style> <div class="site-error"> <h1><?php echo Html::encode($this->title); ?> </h1> <div class="alert alert-danger"> <?php echo nl2br(Html::encode($message)); ?> </div> <p> 页面将在<span class="due-time">3</span>秒后自动跳转,如未跳转<?php echo Html::a(\source\LsYii::gT('这里'), LsYii::getRequest()->getReferrer(), ["node-type" => "run-link"]); ?> </p> </div> <?php $this->registerJs("\$(function() {\n var dt = setInterval(function() {\n var due = \$('.due-time').html();\n if(parseInt(due) <= 1) {\n clearInterval(dt);\n var url = \$('a[node-type=run-link]').attr('href');\n window.location.href = url;\n }\n \$('.due-time').html(parseInt(due) - 1);\n } , 1000);\n })", yii\web\View::POS_END);
</strong> <div class="pull-right"> <?php echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . LsYii::gT('添加' . $this->title), ['/user/adminuser/create'], ['class' => 'btn btn-primary']); ?> </div> </h3> </div> <div class="user-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'username', 'value' => 'username'], ['attribute' => 'email', 'value' => 'email'], ['attribute' => 'status', 'filter' => Constants::getStatusItems(), 'content' => function ($model, $key, $index, $gridView) { return Constants::getStatusItems($model->status); }], ['attribute' => 'role', 'filter' => Role::getAdminItems(), 'content' => function ($model, $key, $index, $gridView) { return Role::getAdminItems($model->role); }], ['class' => 'source\\core\\grid\\ActionColumn', 'buttons' => ['update' => function ($url, $model) { if ($model->role != 'administrator') { return Html::a('<span class="glyphicon glyphicon-edit"></span>', $url, []); } else { return ''; } }, 'delete' => function ($url, $model) { if ($model->role != 'administrator') { return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, []); } else { return ''; } }]]]]); ?> </div>
/** * 得到格式化的数组 * @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 source\modules\dict\models\Dict; use source\modules\dict\models\DictCategory; /* @var $this yii\web\View */ /* @var $model source\models\Dict */ $this->title = '添加字典'; echo source\libs\Message::getMessage(); ?> <div class="page-header"> <h3> <strong><?php echo Html::encode($this->title); ?> </strong> <small><?php echo Html::encode(DictCategory::getDictCategoryName($category_id)); ?> </small> </h3> </div> <div class="dict-create"> <?php echo $this->render('_form', ['model' => $model, 'category_id' => $category_id]); ?> </div>
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'])]); ?> </div>
$attribute = 'verifyCode'; $name = $model->getAttributeLabel($attribute); $input = Html::activeTextInput($model, $attribute, ['enter' => 'totab', 'placeholder' => $name, 'autocomplete' => 'off']); echo Html::label("<span></span>" . $input, Html::getInputId($model, $attribute), ['class' => 'clear']); echo Html::beginTag('div'); echo yii\captcha\Captcha::widget(['name' => 'captchaimage', 'imageOptions' => ['id' => 'captchaImg', 'title' => '换一个', 'alt' => '换一个', 'style' => 'cursor:pointer;'], 'template' => '{image}']); echo Html::endTag('div'); ?> </li> <li class="error-message" <?php echo empty($message) ? '' : 'style="display: block;"'; ?> > <?php echo $message; ?> </li> <li class="admin-submit"> <?php echo Html::submitInput(LsYii::gT('Login'), ['class' => 'btn btn-default']); ?> </li> </ul> <?php ActiveForm::end(); ?> </div> </div> </div>
if ($data["hasAdmin"] === true && $data["canActiveAdmin"] === true) { return Html::a("启用后台", ['/modularity/default/active', 'id' => $data['id'], 'isAdmin' => 1], []); } else { if ($data["hasAdmin"] === true && $data["canActiveAdmin"] === false) { return Html::a("关闭后台", ['/modularity/default/deactive', 'id' => $data['id'], 'isAdmin' => 1], []); } else { return ''; } } } else { return ''; } }, 'home' => function ($url, $data) { if (!$data["instance"]->is_system && $data["canInstall"] === false) { if ($data["hasHome"] === true && $data["canActiveHome"] === true) { return Html::a("启用前台", ['/modularity/default/active', 'id' => $data['id']], []); } else { if ($data["hasHome"] === true && $data["canActiveHome"] === false) { return Html::a("关闭前台", ['/modularity/default/deactive', 'id' => $data['id']], []); } else { return ''; } } } else { return ''; } }]]]]); ?> </div>
use source\libs\Message; /* @var $this yii\web\View */ /* @var $model backend\models\config\BasicConfig */ /* @var $form ActiveForm */ $this->title = LsYii::gT('Register And Visit'); echo Message::getMessage(); ?> <div class="page-header"> <h3> <strong><?php echo Html::encode($this->title); ?> </strong> </h3> </div> <div class="config-basic"> <?php $form = ActiveForm::begin(['id' => 'access-config-form', 'options' => ['class' => 'form-horizontal']]); ?> <?php echo $form->field($model, 'allow_register')->checkbox([], false); ?> <?php Html::SubmitButtons("Save"); ?> <?php ActiveForm::end(); ?> </div>
<link rel="shortcut icon" href="favicon.ico" /> <?php $this->head(); ?> <style type="text/css" id="custom-background-css"> body.custom-background { background-color: #f0f0f0; } </style> </head> <body class="home blog custom-background chrome"> <!-- <div class="site-top"> <div class="clearfix container"> <div class="site-branding"> <h1 class="site-title"> <?php echo Html::a("LsYii CMS", LsYii::getHostInfo(), array('target' => '_blank', 'rel' => 'home', 'title' => "LsYii CMS")); ?> </h1> </div> </div> .site-top </div>--> <nav id="w0" class="navbar-inverse navbar-fixed-top navbar" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w0-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
<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="col-md-2"> <div class="bs-sidebar hidden-print affix-top"> <?php $topMenu = LsYii::getApp()->controller->topMenu; $menus = Menu::getMenuArray($topMenu, 3); $html = ''; if ($menus) {
public function run() { $this->registerStatics(); echo Html::beginTag('ul', $this->treeOptions); echo self::saveDataAsHtml($this->data); echo Html::endTag('ul'); }
<?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>
use source\LsYii; use common\widgets\TreeView; use source\modules\category\models\Category; /* @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(['/category/default/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('添加新分类'), ['/category/default/create'], ['class' => 'btn btn-primary']); ?> </div> </h3> </div> <div class="menu-index"> <?php echo yii\bootstrap\Tabs::widget(['items' => Category::getItems($model->id, '/category/default/index')]); echo TreeView::widget(['data' => Category::getTreeData($model->root, $model->id, true, false, ['updateUrl' => '/category/default/update', 'addChildrenUrl' => '/category/default/create', 'deleteUrl' => '/category/default/delete'])]); ?> </div>