Example #1
0
 public function profileresourceAction()
 {
     $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_ProfileResource($id);
     if ($request->isPost()) {
         if ($form->isCancelled($this->getRequest()->getPost())) {
             $this->_helper->redirector('showprofiles', null, null, array('id' => $this->_helper->IdConvert->strToHex($id_user)));
             return;
         }
         if ($form->isValid($request->getPost())) {
             try {
                 $logic->updateGroupResource($form, $id);
                 $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cachemanager')->getCache('rolecache');
                 $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
                 //                    $this->_helper->messenger->success('Zmiana roli czeka na akceptację.');
                 $this->_helper->messenger->success('Zmieniono rolę');
                 $this->_helper->redirector('showprofiles', null, null, array('id' => $this->_helper->IdConvert->strToHex($id_user)));
                 return;
             } catch (Logic_User_Exception $e) {
                 $this->_helper->messenger('error', MSG_ERROR, $e);
             }
         }
     } else {
         $defaults = $logic->getResourcesForProfile($id);
         $form->setDefaults($defaults);
     }
     $this->view->form = $form;
 }