/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CategoryWhere::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(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'text', $this->text]); return $dataProvider; }
<tr> <td>Picnic</td> <td>Camping</td> <td>Boat racing</td> <td>Parachute</td> </tr> </tbody> </table> </div> <?php echo $form->field($model, 'id_training')->radioList(ArrayHelper::map(CategoryTraining::find()->all(), 'id', 'name'), ['prompt' => 'Select Training...'])->hint('Indicate which level of training is required to have, to be able to come to do this activity'); ?> <?php echo $form->field($model, 'id_where')->radioList(ArrayHelper::map(CategoryWhere::find()->all(), 'id', 'name'), ['prompt' => 'Select Where...']); ?> <div class="col-sm-12" id="tbl_display"> <table class="table table-bordered table-condensed table-striped"> <thead> <tr> <th>Mountain Activities</th> <th>Forest Activities</th> <th>Beach & Sea Activities</th> <th>Fresh Water Activities</th> <th>Aero Activities</th> <th>Desert Activities</th> </tr> </thead> <tbody>
/** * Finds the CategoryWhere model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CategoryWhere the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CategoryWhere::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getIdWhere() { return $this->hasOne(CategoryWhere::className(), ['id' => 'id_where']); }