示例#1
0
 /**
  * Updates a particular model
  * @param integer $id the ID of the model to be updated
  * @redirected to'view' page.
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     if (isset($_POST['Fbm3'])) {
         $model->attributes = $_POST['Fbm3'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $responsables = Responsable::model()->findAll();
     $profesiones = Profesion::model()->findAll();
     $dps = Dependencia::model()->findAll();
     $generos = Sexo::model()->findAll();
     $this->render('update', array('model' => $model, 'responsables' => $responsables, 'profesiones' => $profesiones, 'dps' => $dps, 'generos' => $generos));
 }
示例#2
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $pdata = PersonaData::model()->findByPk($id);
     if (isset($_POST['PersonaData'])) {
         $pdata->attributes = $_POST['PersonaData'];
         $persona = PersonaData::model()->findByAttributes(array('cedula' => $pdata->cedula));
         if ($persona->id == $pdata->id) {
             if ($pdata->update()) {
                 $this->redirect(array('view', 'pid' => $pdata->id));
             }
         } else {
             $pdata->id = NULL;
             if ($pdata->validate()) {
             }
         }
     }
     $profesiones = Profesion::model()->findAll(array('select' => 'id, descripcion', 'order' => 'descripcion ASC'));
     $genero = Sexo::model()->findAll(array('select' => 'id, descripcion', 'order' => 'descripcion ASC'));
     $this->render('update', array('pdata' => $pdata, 'profesiones' => $profesiones, 'genero' => $genero));
 }