/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Estudiantes::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(['codEstudiante' => $this->codEstudiante, 'fechaIngreso' => $this->fechaIngreso, 'fechaNac' => $this->fechaNac]); $query->andFilterWhere(['like', 'carnetEst', $this->carnetEst])->andFilterWhere(['like', 'teleDomicilio', $this->teleDomicilio])->andFilterWhere(['like', 'direccionDomicilio', $this->direccionDomicilio])->andFilterWhere(['like', 'cedula', $this->cedula])->andFilterWhere(['like', 'lugarNac', $this->lugarNac])->andFilterWhere(['like', 'nomapes', $this->nomapes]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getCodEstudiante0() { return $this->hasOne(Estudiantes::className(), ['codEstudiante' => 'codEstudiante']); }
use kartik\select2\Select2; /* @var $this yii\web\View */ /* @var $model backend\models\Estudios */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="estudios-form"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'codEstudiante')->widget(Select2::classname(), ['data' => ArrayHelper::map(Estudiantes::find()->all(), 'codEstudiante', 'nomapes'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'titulo')->textInput(['maxlength' => 50]); ?> <?php echo $form->field($model, 'lugar')->textInput(['maxlength' => 30]); ?> <?php echo $form->field($model, 'file')->fileInput(); ?> <?php
/** * Finds the Estudiantes model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Estudiantes the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Estudiantes::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }