/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Docentes::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(['idDocente' => $this->idDocente, 'idEspecialidad' => $this->idEspecialidad]); $query->andFilterWhere(['like', 'carnetDocente', $this->carnetDocente])->andFilterWhere(['like', 'nombres', $this->nombres])->andFilterWhere(['like', 'cedula', $this->cedula])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'celular', $this->celular])->andFilterWhere(['like', 'correo', $this->correo]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getDocentes() { return $this->hasMany(Docentes::className(), ['idEspecialidad' => 'idEspecialidad']); }
/** * @return \yii\db\ActiveQuery */ public function getIdDocente0() { return $this->hasOne(Docentes::className(), ['idDocente' => 'idDocente']); }
/** * Finds the Docentes model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Docentes the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Docentes::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use backend\models\Docentes; use backend\models\Asignatura; use backend\models\Plan; /* @var $this yii\web\View */ /* @var $model backend\models\Grupo */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="grupo-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'idDocente')->widget(Select2::classname(), ['data' => ArrayHelper::map(Docentes::find()->all(), 'idDocente', 'nombres'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'idAsignatura')->widget(Select2::classname(), ['data' => ArrayHelper::map(Asignatura::find()->all(), 'idAsignatura', 'nombrea'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => 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]]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Guardar' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?>