/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Facultad::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['idFacultad' => $this->idFacultad]); $query->andFilterWhere(['like', 'nombref', $this->nombref]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getIdFacultad0() { return $this->hasOne(Facultad::className(), ['idFacultad' => 'idFacultad']); }
/** * Finds the Facultad model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Facultad the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Facultad::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/* @var $this yii\web\View */ /* @var $model backend\models\Plan */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="plan-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'nombrep')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'idFacultad')->dropDownList(ArrayHelper::map(Facultad::find()->all(), 'idFacultad', 'nombref'), ['prompt' => 'Selecciona facultad']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<div class="carrera-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'nombreca')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'idPlan')->widget(Select2::classname(), ['data' => ArrayHelper::map(plan::find()->all(), 'idPlan', 'nombrep'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'idFacultad')->widget(Select2::classname(), ['data' => ArrayHelper::map(Facultad::find()->all(), 'idFacultad', 'nombref'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Guardar' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>