예제 #1
0
 /**
  * Edycja ról i grup dla profilu
  */
 public function profileAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id');
     $id = $this->_helper->IdConvert->hexToStr($id);
     $id_user = $request->getParam('id_user');
     $id_user = $this->_helper->IdConvert->hexToStr($id_user);
     $logic = new Logic_User();
     $form = new Logic_User_Form_Profile();
     if ($request->isPost()) {
         if ($form->isCancelled($this->getRequest()->getPost())) {
             $this->_helper->redirector('index', 'user');
             return;
         }
         if ($form->isValid($request->getPost())) {
             try {
                 $logic->updateProfile($form, $id, $id_user);
                 $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cachemanager')->getCache('rolecache');
                 $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
                 //                    $this->_helper->messenger->success('Zmiana profilu czeka na akceptację.');
                 $this->_helper->messenger->success('Zmieniono profil');
                 $this->_helper->redirector('index');
                 return;
             } catch (Logic_User_Exception $e) {
                 $this->_helper->messenger('error', MSG_ERROR, $e);
             }
         }
     } else {
         $defaults = $logic->getAuthorizationsForProfile($id);
         $form->setDefaults($defaults);
     }
     $this->view->form = $form;
 }