/** * 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; }
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']); ?>