Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $filter = "")
 {
     $query = Urine::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_urine.altered = 1')->andWhere("creation_name = '{$username}'");
     }
     $query->andFilterWhere(['id' => $this->id, 'fk_person' => $this->fk_person, 'date_visit' => $this->date_visit, 'time_visit' => $this->time_visit, 'spot_urine_collected' => $this->spot_urine_collected, 'reason_not_collected' => $this->reason_not_collected, 'date_collect_urine' => $this->date_collect_urine, 'date_received_urine' => $this->date_received_urine, 'time_received_urine' => $this->time_received_urine, 'date_result_spot_urine' => $this->date_result_spot_urine, 'time_result_spot_urine' => $this->time_result_spot_urine, 'spot_na_urine' => $this->spot_na_urine, 'spot_k_urine' => $this->spot_k_urine, 'spot_cr_urine' => $this->spot_cr_urine, 'spot_alb_urine' => $this->spot_alb_urine, 'year' => $this->year, 'result_complete' => $this->result_complete, 'tech_date_r' => $this->tech_date_r, 'tech_time_r' => $this->tech_time_r, 'tech_date_p' => $this->tech_date_p, 'tech_time_p' => $this->tech_time_p]);
     $query->andFilterWhere(['like', 'clinician', $this->clinician])->andFilterWhere(['like', 'aliquots', $this->aliquots])->andFilterWhere(['like', 'sample_labelled', $this->sample_labelled])->andFilterWhere(['like', 'frozen', $this->frozen])->andFilterWhere(['like', 'tech_initials_r', $this->tech_initials_r])->andFilterWhere(['like', 'tech_initials_p', $this->tech_initials_p]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUrines()
 {
     return $this->hasMany(Urine::className(), ['fk_person' => 'pk_person']);
 }
Ejemplo n.º 3
0
 /**
  * Finds the Urine model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Urine the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Urine::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }