/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Sensor::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, 'catchmentid' => $this->catchmentid, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'height' => $this->height, 'width' => $this->width, 'angle' => $this->angle]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'sensortype', $this->sensortype])->andFilterWhere(['like', 'units', $this->units])->andFilterWhere(['like', 'property', $this->property])->andFilterWhere(['like', 'admin_email', $this->admin_email]); return $dataProvider; }
public function actionTracing($sensorid = null) { if (isset($sensorid)) { $sensor = Sensor::find()->where(['id' => $sensorid])->one(); return $this->render('sensor_tracing', array('sensor' => $sensor)); } else { return $this->render('sensor_tracing', array('sensor' => null)); } }
<?php echo Html::activeDropDownList($model, 'catchmentid', ArrayHelper::map(Catchment::find()->all(), 'id', 'name')); ?> </div> <div class="col-sm-12"> <hr> </div> <div class="col-sm-4"> <?php echo \Yii::t('app', 'SENSORS'); ?> </div> <div class="col-sm-4"> <?php echo Html::activeDropDownList($model, 'sensorid', ArrayHelper::map(Sensor::find()->all(), 'id', 'name')); ?> </div> <div class="col-sm-4"> <button type="button" class="btn"><?php echo \Yii::t('app', 'Choose on map'); ?> </button> </div> <div class="col-sm-12"> <hr> </div> <div class="col-sm-4"> <?php