/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Entidad::find(); // add conditions that should always apply here $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->joinWith('comunasComuna'); // grid filtering conditions $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'tipoEntidad_tipo', $this->tipoEntidad_tipo])->andFilterWhere(['like', 'rol', $this->rol])->andFilterWhere(['like', 'correo', $this->correo])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'comunas.comuna_nombre', $this->comunas_comuna_id])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'contacto', $this->contacto]); return $dataProvider; }
?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'rut')->textInput(['maxlength' => true]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'fechaNacimiento')->widget(DatePicker::className(), ['inline' => false, 'language' => 'es', 'options' => ['placeholder' => 'AÑO - MES - DIA'], 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'startView' => 2]]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'entidad_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Entidad::find()->all(), 'id', 'nombre'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'Selecciona alguna entidad a la que pertenezcas'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'liceoCurso')->textInput(['maxlength' => true]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'correo')->textInput(['maxlength' => true]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'direccion')->textInput(['maxlength' => true]); ?>
/** * Lists all Entidad models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Entidad::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }