/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Areas::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(['area_id' => $this->area_id]); $query->andFilterWhere(['like', 'region', $this->region])->andFilterWhere(['like', 'city', $this->city]); return $dataProvider; }
/** * Finds the Areas model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Areas the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Areas::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getRegionOfHsGraduatingFrom() { return $this->hasOne(Areas::className(), ['area_id' => 'region_of_hs_graduating_from']); }
?> <?php echo $form->field($model, 'height')->textInput(); ?> <?php echo $form->field($model, 'weight')->textInput(); ?> <?php echo $form->field($model, 'religion')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'region_of_hs_graduating_from')->dropDownList(ArrayHelper::map(Areas::find()->all(), 'area_id', 'region'), ['prompt' => 'Select HS region']); ?> <?php echo $form->field($model, 'type_of_hs_graduating_from')->dropDownList(['PUBLIC' => 'PUBLIC', 'MASA' => 'MASA'], ['prompt' => '']); ?> <?php echo $form->field($model, 'hs_graduating_from')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'section')->textInput(); ?>