public function init() { parent::init(); $this->contentOptions = ['class' => 'align-center']; $this->content = function ($model, $key, $index, $gridView) { return Constants::getStatusItems($model->status); }; }
/** * 检测用户是否已经完成了安装程序[在登录安装模块时] * @return 返回是否已经完成了安装,如果完成了安装则返回true,否则则返回false */ public static function checkIsInstalled() { $installfile = Constants::getCommonUrl(Constants::InstallFile_Url); $db = LsYii::getApp()->components['db']; if (file_exists($installfile) && isset($db['class']) && !empty($db['class'])) { return true; } else { return false; } }
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>
public function getStatusText() { return Constants::getStatusItemsForContent($this->status); }
echo $form->field($model, 'headline', ['template' => $template2, 'options' => ['class' => 'da-form-col-4']])->dropDownList(Constants::getHeadlineItems()); ?> <?php echo $form->field($model, 'sticky', ['template' => $template2, 'options' => ['class' => 'da-form-col-4 omega']])->dropDownList(Constants::getStickyItems()); ?> </div> <div class="da-form-row"> <?php echo $form->field($model, 'status', ['template' => $template2, 'options' => ['class' => 'da-form-col-4 alpha']])->dropDownList(Constants::getStatusItemsForContent(), [], false); ?> <?php echo $form->field($model, 'visibility', ['template' => $template2, 'options' => ['class' => 'da-form-col-4']])->dropDownList(Constants::getVisibilityItems(), [], false); ?> <?php echo $form->field($model, 'allow_comment', ['template' => $template2, 'options' => ['class' => 'da-form-col-4 omega']])->dropDownList(Constants::getYesNoItems(), [], false); ?> </div> <!-- <div class="da-form-row"> <?php echo $form->field($model, 'view_count', ['template' => $template2, 'options' => ['class' => 'da-form-col-3 alpha']])->textInput(); ?> <?php echo $form->field($model, 'comment_count', ['template' => $template2, 'options' => ['class' => 'da-form-col-3']])->textInput(); ?> <?php echo $form->field($model, 'agree_count', ['template' => $template2, 'options' => ['class' => 'da-form-col-3']])->textInput();
<?php use yii\helpers\Html; use source\core\grid\GridView; use source\LuLu; use source\models\Content; use source\libs\Constants; /* @var $this yii\web\View */ /* @var $searchModel app\models\search\ContentSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $type = 'post'; $this->title = '单面管理'; $this->params['breadcrumbs'][] = $this->title; $this->toolbars([Html::a('新建', ['create'], ['class' => 'btn btn-xs btn-primary mod-site-save']), Html::a('设置', ['setting/index'], ['class' => 'btn btn-xs btn-primary mod-site-save'])]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'layout' => "{items}\n{pager}", 'columns' => [['class' => 'source\\core\\grid\\IdColumn'], ['attribute' => 'title', 'headerOptions' => ['width' => 'auto']], ['class' => 'source\\core\\grid\\DateTimeColumn', 'attribute' => 'updated_at'], 'userText', 'comment_count', 'view_count', ['attribute' => 'status', 'width' => '25px', 'content' => function ($model, $key, $index, $gridView) { return Constants::getStatusItemsForContent($model->status); }], ['class' => 'source\\core\\grid\\ActionColumn']]]); ?>
?> <div class="page-header"> <h3> <strong><?php echo Html::encode($this->title); ?> </strong> </h3> </div> <div class="config-basic"> <?php $form = ActiveForm::begin(['id' => 'theme-config-form', 'options' => ['class' => 'form-horizontal']]); ?> <?php echo $form->field($model, 'datetime_timezone')->dropDownList(DatetimeConfig::getTimezoneItems()); ?> <?php echo $form->field($model, 'datetime_date_format'); ?> <?php echo $form->field($model, 'datetime_time_format')->radioList(Constants::getDateTimeTimeFormat()); ?> <?php Html::SubmitButtons("Save"); ?> <?php ActiveForm::end(); ?> </div>
$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]); ?> <?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); ?>
public function beforeValidate() { if (!$this->userValidate) { return parent::beforeValidate(); } if (parent::beforeValidate()) { if ($this->hasAttribute('sort_num')) { if ($this->sort_num === null || $this->sort_num === '') { $this->sort_num = Constants::getSortNum(); } } if ($this->hasAttribute('created_at')) { if (empty($this->created_at)) { $this->created_at = time(); } } if ($this->hasAttribute('updated_at')) { $this->updated_at = time(); } if ($this->hasAttribute('created_by')) { if (empty($this->created_by)) { $this->created_by = LuLu::getIdentity()->username; } } if ($this->hasAttribute('updated_by')) { if (empty($this->updated_by)) { $this->updated_by = LuLu::getIdentity()->username; } } return true; } return false; }
?> <?php echo $form->field($model, 'site_description'); ?> <?php echo $form->field($model, 'site_domain'); ?> <?php echo $form->field($model, 'site_email'); ?> <?php echo $form->field($model, 'site_language')->dropDownList(source\libs\Language::aLangs()); ?> <?php echo $form->field($model, 'sys_icp'); ?> <?php echo $form->field($model, 'site_about'); ?> <?php echo $form->field($model, 'site_status')->radioList(Constants::getWebSiteStatus()); ?> <?php Html::SubmitButtons("Save"); ?> <?php ActiveForm::end(); ?> </div>
?> </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>
private function installing() { LsYii::getApp()->controller = $this; if ($this->checkParam() === false) { return; } if ($this->checkDb() === FALSE) { return; } if (($dbConfig = $this->writeConfig()) === false) { return; } if (($db = $this->setDb($dbConfig)) === false) { return false; } $transcation = $db->beginTransaction(); try { self::_appendLog(LsYii::gT("开始创建数据库表。。。")); if ($this->executeSql($db, 'install') !== true) { $transcation->rollBack(); self::_appendLog(LsYii::gT("数据库创建失败"), true); return; } self::_appendLog(LsYii::gT("数据库创建成功")); self::_appendLog(LsYii::gT('生成管理员。。。')); $this->insertAdmin($db); self::_appendLog(LsYii::gT('管理员生成成功')); $transcation->commit(); $file = Constants::getCommonUrl(Constants::InstallFile_Url); @touch($file); self::_appendLog(LsYii::gT('安装完成')); echo '<script>window.location="' . Url::to(['complete']) . '"</script>'; } catch (\Exception $ex) { $transcation->rollBack(); $message = self::getDbError($ex->getMessage(), ['dbHost' => $dbHost, 'dbName' => $dbName]); self::_appendLog(LsYii::gT('安装失败')); self::_appendLog($e->getMessage(), true); } }
echo $form->field($model, 'headline', ['options' => ['class' => 'da-form-col-4-12'], 'size' => 'large'])->dropDownList(Constants::getHeadlineItems()); ?> <?php echo $form->field($model, 'sticky', ['options' => ['class' => 'da-form-col-4-12 omega'], 'size' => 'large'])->dropDownList(Constants::getStickyItems()); ?> </div> <div class="da-form-row da-form-block"> <?php echo $form->field($model, 'status', ['options' => ['class' => 'da-form-col-4-12 alpha'], 'size' => 'large'])->dropDownList(Constants::getStatusItemsForContent(), [], false); ?> <?php echo $form->field($model, 'visibility', ['options' => ['class' => 'da-form-col-4-12'], 'size' => 'large'])->dropDownList(Constants::getVisibilityItems(), [], false); ?> <?php echo $form->field($model, 'allow_comment', ['options' => ['class' => 'da-form-col-4-12 omega'], 'size' => 'large'])->dropDownList(Constants::getYesNoItems(), [], false); ?> </div> <?php echo $form->defaultButtons(); ?> </div> </div> <div class="da-panel collapsible collapsed"> <div class="da-panel-header"> <div class="da-panel-title"> <img src="<?php echo Resource::getAdminUrl(); ?>
public function getTargetText() { return Constants::getTargetItems($this->target); }
$this->title = LsYii::gT('QQ第三方登录设置'); 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' => 'baidu-config-form', 'options' => ['class' => 'form-horizontal']]); ?> <?php echo $form->field($model, 'baidu_appid'); ?> <?php echo $form->field($model, 'baidu_appkey'); ?> <?php echo $form->field($model, 'baidu_enable')->radioList(Constants::getThirdLoginStatus()); ?> <?php Html::SubmitButtons("Save"); ?> <?php ActiveForm::end(); ?> </div>
<?php echo $form->field($model, 'url')->textInput(['maxlength' => 512]); ?> <?php echo $form->field($model, 'target')->radioList(Constants::getTargetItems()); ?> <?php echo $form->field($model, 'thumb')->fileInput(['class' => 'da-custom-file']); ?> <?php echo $form->field($model, 'description')->textarea(['maxlength' => 512]); ?> <?php echo $form->field($model, 'sort_num')->textInput(); ?> <?php echo $form->field($model, 'status')->radioList(Constants::getStatusItems()); ?> <?php echo $form->defaultButtons(); ActiveForm::end();
public function beforeValidate() { if (parent::beforeValidate()) { if ($this->hasAttribute('sort_num')) { if ($this->sort_num === null || $this->sort_num === '') { $this->sort_num = Constants::getSortNum(); } } if ($this->hasAttribute('created_at')) { if ($this->created_at == null || $this->created_at == '') { $this->created_at = time(); } } if ($this->hasAttribute('updated_at')) { $this->updated_at = time(); } return true; } return false; }