public function actionSensorpopup($locationid = null) { $locations = Catchment::find()->all(); if (isset($locationid)) { $location = Catchment::find()->where(['id' => $locationid])->one(); } else { $location = $locations[0]; } return $this->renderPartial('sensorpopup', array('locations' => $locations, 'location' => $location)); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Catchment::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'name_es', $this->name_es])->andFilterWhere(['like', 'name_ne', $this->name_ne])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'description_es', $this->description_es])->andFilterWhere(['like', 'description_ne', $this->description_ne]); return $dataProvider; }
public function actionSensors($locationid) { $location = Catchment::find()->where(['id' => $locationid])->One(); return $this->renderPartial('sensors', array('location' => $location)); }
<hr> </div> <div class="col-lg-4"> <?php echo \Yii::t('app', 'LOCATION'); ?> </div> <div class="col-lg-8"> <?php /*= $form->field($model, 'catchmentid', ['template' => '{input}{error}{hint}'])->dropDownList(\yii\helpers\ArrayHelper::map(app\models\Catchment::find()->all(), 'id', 'name'), ['prompt' => Yii::t('app', 'Select')] ); */ ?> <?php echo Html::activeDropDownList($model, 'catchmentid', ArrayHelper::map(Catchment::find()->all(), 'id', 'name')); ?> </div> <div class="col-lg-12"> <hr> </div> <div class="col-lg-4"> <?php echo \Yii::t('app', 'TYPE OF SENSOR'); ?> </div> <div class="col-lg-8">