<?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'username')->textInput(['maxlength' => 255, 'readonly' => $model->isNewRecord ? null : 'readonly']); ?> <?php echo $form->field($model, 'password')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'status')->radioList(Constants::getStatusItems()); ?> <?php echo $form->field($model, 'role')->dropDownList(ArrayHelper::map(Role::buildOptions(), 'id', 'name', 'category')); ?> <?php echo $form->defaultButtons(); ?> <?php ActiveForm::end();
<?php use yii\helpers\Html; use source\LuLu; use source\libs\Common; use source\helpers\ArrayHelper; use source\core\widgets\ActiveForm; use source\modules\tools\models\Setting; /* @var $this source\core\front\FrontView */ /* @var $generator yii\gii\generators\module\Generator */ ?> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'post_taxonomy')->dropDownList(ArrayHelper::map($categories, 'id', 'name')); ?> <?php echo $form->defaultButtons(); ActiveForm::end();
public static function getCategorysArray($pid) { $model = self::find()->andWhere(['pid' => $pid])->all(); return ArrayHelper::map($model, 'id', 'name'); }
$this->title='页面模块设置'; $this->addBreadcrumbs([ '基本设置' ]); $categories = Common::getTakonomyCategories(); ?> <?php $form = ActiveForm::begin(); ?> <div class="mod"> <div class="mod-head"> <h3> <span class="pull-left"><?= $this->title ?></span> </h3> </div> <div class="tab-content mod-content"> <?= $form->field($model, 'page_takonomy')->dropDownList(ArrayHelper::map($categories, 'id', 'name')) ?> </div> <div class="tab-content mod-content mod-one-btn"> <div class="center-block"> <button type="submit" class="btn btn-primary" >保存设置</button> </div> </div> </div> <?php ActiveForm::end(); ?>
<?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'username')->textInput(['maxlength' => 255, 'readonly' => $model->isNewRecord ? null : 'readonly']); ?> <?php echo $form->field($model, 'password')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'role')->dropDownList(ArrayHelper::map($this->rbacService->getAllRoles(), 'id', 'name', 'category')); ?> <?php echo $form->field($model, 'status')->radioList(Constants::getStatusItems()); ?> <?php echo $form->defaultButtons(); ?> <?php ActiveForm::end();
public static function getCategories($type) { $items = self::findAll(['type' => $type]); return ArrayHelper::map($items, 'id', 'name'); }
public static function getRoleItems($role) { $model = self::find()->andWhere(['category' => $role])->all(); return empty($model) ? [] : ArrayHelper::map($model, 'id', 'name'); }