/** * 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]); ?>
/** * @return \yii\db\ActiveQuery */ public function getEntidads() { return $this->hasMany(Entidad::className(), ['tipoEntidad_tipo' => 'tipo']); }
/** * Finds the Entidad model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Entidad the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Entidad::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getEntidad() { return $this->hasOne(Entidad::className(), ['id' => 'entidad_id']); }