/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Nos::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, 'luontipvm' => $this->luontipvm, 'naytteenottopvm' => $this->naytteenottopvm, 'tuote_id' => $this->tuote_id, 'bakteeri_id' => $this->bakteeri_id, 'henkilo_id' => $this->henkilo_id]); $query->andFilterWhere(['like', 'Raja-arvo1_m', $this->Raja_arvo1_m])->andFilterWhere(['like', 'Raja-arvo2_M', $this->Raja_arvo2_M]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getNos() { return $this->hasOne(Nos::className(), ['id' => 'nos_id']); }
/** * @return \yii\db\ActiveQuery */ public function getNos() { return $this->hasMany(Nos::className(), ['tuote_id' => 'id']); }
public function actionSend($id) { $model = new Send(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { $nos1 = Nos::findOne($id); $nos1->nayte_lahetetty = 'Kyllä'; $nos1->update(); $model->henkilo_id = Yii::$app->user->getId(); $model->save(); //return $this->redirect(['view', 'id' => $model->nos_id]); } else { //$snimi =Yii::$app->user->identity->sukunimi; //$enimi = Yii::$app->user->identity->etunimi; //$model->henkilo_id = $enimi . ' ' . $snimi; $model->nos_id = $id; $model->lahetyspvm = date('Y-m-d'); return $this->renderAjax('sendView', ['model' => $model]); } }
/** * @return \yii\db\ActiveQuery */ public function getBakteeri() { return $this->hasOne(Nos::className(), ['bakteeri_id' => 'bakteeri_id']); }