public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { $model_encuesta = \app\models\Factencuesta::findOne($id); $model_encuesta->id_sal_com = $model->id_sal_com; $model_encuesta->save(); return $this->redirect(['factencuesta/view', 'id' => $model_encuesta->id_enc]); //return $this->redirect(['view', 'id' => $model->id_sal_com]); } else { return $this->render('update', ['model' => $model]); } }
/** * Creates a new Desnutricion model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($id) { $model = new Desnutricion(); if ($model->load(Yii::$app->request->post()) && $model->save()) { //return $this->redirect(['view', 'id' => $model->id_des]); //Modificar con el ID del indicador en la encuesta $model_encuesta = \app\models\Factencuesta::findOne($id); $model_encuesta->id_des = $model->id_des; $model_encuesta->save(); return $this->redirect(['factencuesta/view', 'id' => $id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Factencuesta::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_enc' => $this->id_enc, 'id_tecn' => $this->id_tecn, 'id_comu' => $this->id_comu, 'id_nin' => $this->id_nin, 'id_ali' => $this->id_ali, 'id_nut' => $this->id_nut, 'id_sal' => $this->id_sal, 'id_ate' => $this->id_ate, 'id_des' => $this->id_des, 'id_cui' => $this->id_cui, 'id_viv' => $this->id_viv, 'id_sal_com' => $this->id_sal_com, 'num_tom' => $this->num_tom, 'fec_enc' => $this->fec_enc, 'fec_ini_tom' => $this->fec_ini_tom, 'fec_fin_tom' => $this->fec_fin_tom]); $query->andFilterWhere(['like', 'dir_cas', $this->dir_cas]); return $dataProvider; }
public function actionUpdate($id) { $model = new Cuidadores(); $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { $model_encuesta = \app\models\Factencuesta::findOne($id); $model_encuesta->id_cui = $model->id_cui; $model_encuesta->save(); return $this->redirect(['vivienda/update', 'id' => $model_encuesta->id_viv]); //return $this->redirect(['view', 'id' => $model->id_cui]); } else { return $this->render('update', ['model' => $model]); } }
public function actionUpdate($id) { $model = new Alimentacion(); $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { $model_encuesta = \app\models\Factencuesta::findOne($id); $model_encuesta->id_ali = $model->id_ali; $model_encuesta->save(); return $this->redirect(['salud/update', 'id' => $model_encuesta->id_sal]); //return $this->redirect(['view', 'id' => $model->id_ali]); } else { return $this->render('update', ['model' => $model]); } }
/** * @return \yii\db\ActiveQuery */ public function getFactencuestas() { return $this->hasMany(Factencuesta::className(), ['id_cui' => 'id_cui']); }
/** * Finds the Factencuesta model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Factencuesta the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Factencuesta::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }