Ejemplo n.º 1
0
 /**
  * EditAction for Roles
  *
  * @return void
  */
 public function editAction()
 {
     $this->view->title = "Edit roles";
     $form = new User_Form_Role();
     $form->submit->setLabel('Save');
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $model = new User_Model_Roles();
             $id = $this->getRequest()->getPost('id');
             $data = $form->getValues();
             if ($data["name"] == "implementor") {
                 echo "pantalla de error de no se puede crear implementor";
                 die;
             }
             $model->update($form->getValues(), 'id = ' . (int) $id);
             return $this->_helper->redirector('index');
         } else {
             $form->populate($this->getRequest()->getPost());
         }
     } else {
         $id = $this->_getParam('id', 0);
         if ($id > 0) {
             $model = new User_Model_Roles();
             $form->populate($model->fetchEntry($id));
         }
     }
 }