/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params, $filter = "") { $query = Bp24h::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; } if ($filter == 1) { $username = Yii::$app->user->identity->username; $query->andWhere('tbl_bp_24h.altered = 1')->andWhere("creation_name = '{$username}'"); } $query->andFilterWhere(['idbp24' => $this->idbp24, 'fk_person' => $this->fk_person, 'date_abpm_started' => $this->date_abpm_started, 'time_abpm_start' => $this->time_abpm_start, 'time_abpm_end' => $this->time_abpm_end, 'leaflet_given' => $this->leaflet_given, 'diary_given' => $this->diary_given, 'time_bed' => $this->time_bed, 'time_woke' => $this->time_woke, 'succ_readings' => $this->succ_readings, 'diary_collected' => $this->diary_collected, 'wasuploaded' => $this->wasuploaded]); $query->andFilterWhere(['like', 'serial_no_abpm', $this->serial_no_abpm]); return $dataProvider; }
/** * Finds the Bp24h model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Bp24h the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Bp24h::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getBp24hs() { return $this->hasOne(Bp24h::className(), ['fk_person' => 'pk_person']); }
/** * @return \yii\db\ActiveQuery */ public function getFkId24h() { return $this->hasOne(Bp24h::className(), ['idbp24' => 'fk_id24h']); }