/** * Finds the Preparat model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Preparat the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Preparat::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Preparat::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['preparat_name' => SORT_ASC]]]); $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; } // grid filtering conditions $query->andFilterWhere(['preparat_id' => $this->preparat_id]); $query->andFilterWhere(['like', 'preparat_name', $this->preparat_name]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getIdPreparat() { return $this->hasOne(Preparat::className(), ['preparat_id' => 'id_preparat'])->from(['idPreparat' => Preparat::tableName()]); }
public static function VariablesValues($attribute, $value = NULL) { $values = ['patient_pol' => Patient::VariablesValues($attribute), 'fias_city' => [$value => Fias::GetCityByAOGUID($value)], 'fias_street' => [$value => Fias::GetStreetByAOGUID($value)], 'glaukuchet_detect' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_deregreason' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_stage' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_invalid' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_id_employee' => [$value => Employee::getEmployeeByID($value)], 'employee_id_person' => [$value => Authuser::getAuthuserByID($value)], 'employee_id_dolzh' => [$value => Dolzh::getDolzhByID($value)], 'employee_id_podraz' => [$value => Podraz::getPodrazByID($value)], 'employee_id_build' => [$value => Build::getBuildByID($value)], 'glprep_id_preparat' => [$value => Preparat::getPreparatByID($value)], 'glprep_rlocat' => Glprep::VariablesValues($attribute)]; return isset($values[$attribute]) ? $values[$attribute] : NULL; }