<div class="user-form"> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'username']]); ?> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <div class="form-group"> <?php $rol = User::getRol($model->id); echo Html::label('Rol', 'rol', ['class' => 'control-label']); //Yii::trace(ArrayHelper::map(AuthAssignment::listaRoles(), 'name', 'description')); echo Html::dropDownList('rol', $rol->name, ArrayHelper::map(AuthAssignment::listaRoles(), 'name', 'description'), ['id' => 'rol', 'class' => 'form-control']); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'acceso_externo')->dropDownList(User::getSiNo()); ?> <?php if ($model->isNewRecord) { echo $form->field($model, 'foto')->fileInput(); } if (!$model->isNewRecord) { echo $form->field($model, 'foto')->hint($model->foto)->fileInput(); }
/** * @return \yii\db\ActiveQuery agregada a mano */ public function getAuthAssignment() { return $this->hasOne(\frontend\models\AuthAssignment::className(), ['user_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getAuthAssignments() { return $this->hasMany(AuthAssignment::className(), ['item_name' => 'name']); }