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]); } }
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]); } }
/** * 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.'); } }