echo Html::hiddenInput('id', $model->id); echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['descripcion' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Ingrese Descripción...']], 'observaciones' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Ingrese Observaciones...']]]]); echo Html::hiddenInput('action', null, array('id' => 'action')); echo Html::hiddenInput('user_id', Yii::$app->user->id, array('id' => 'user_id')); ?> <?php echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['fechaEntrada' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\datecontrol\DateControl::className(), 'hint' => 'Ingrese Fecha de Alta (dd/mm/aaaa)'], 'fechaBaja' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\datecontrol\DateControl::className(), 'hint' => 'Ingrese Fecha de Baja (dd/mm/aaaa)']]]); ?> <div> <?php $dataPersona = \yii\helpers\ArrayHelper::map(\app\models\Persona::find()->asArray()->all(), 'id', 'nombre'); $dataTipoPersona = \yii\helpers\ArrayHelper::map(\app\models\TipoPersona::find()->asArray()->all(), 'id', 'nombre'); // $form->field($model, 'nombre', [ // 'hintType' => ActiveField::HINT_SPECIAL, // 'hintSettings' => [ // 'showIcon' => false, // 'title' => '<i class="glyphicon glyphicon-info-sign"></i> Nota' // ] // ])->textInput()->hint('Ingrese el nombre/designación con que se describirá el objeto.'); echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['persona_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\select2\\Select2', 'label' => 'Persona Donante', 'options' => ['options' => ['placeholder' => 'Seleccione Persona...'], 'data' => $dataPersona, 'pluginOptions' => ['allowClear' => true]]], 'tipoPersona_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\select2\\Select2', 'options' => ['options' => ['placeholder' => 'Seleccione Tipo de Persona...'], 'data' => $dataTipoPersona, 'pluginOptions' => ['allowClear' => true]]]]]); ?> <?php $dataPersonaDonante = \yii\helpers\ArrayHelper::map(\app\models\Persona::find()->asArray()->all(), 'id', 'nombre'); echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['persona_id_depositante' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\select2\\Select2', 'label' => 'Persona Depositante', 'options' => ['options' => ['placeholder' => 'Seleccione Persona Depositante...'], 'data' => $dataPersona, 'pluginOptions' => ['allowClear' => true]]]]]); ?>
/** * Finds the TipoPersona model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return TipoPersona the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TipoPersona::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getIdTipo() { return $this->hasOne(TipoPersona::className(), ['id' => 'id_tipo']); }
/** * @return \yii\db\ActiveQuery */ public function getTipoPersona() { return $this->hasOne(TipoPersona::className(), ['id' => 'tipoPersona_id']); }