예제 #1
0
 /**
  * Kolonowanie profilów
  */
 public function cloneprofileAction()
 {
     $request = $this->getRequest();
     $logic = new Logic_User();
     $id = $request->getParam('id');
     $id = $this->_helper->IdConvert->hexToStr($id);
     $form = new Logic_User_Form_CloneProfile();
     if ($request->isPost()) {
         if ($form->isCancelled($this->getRequest()->getPost())) {
             $this->_helper->redirector('index', null, null, array());
             return;
         }
         if ($form->isValid($request->getPost())) {
             $values = $request->getPost();
             try {
                 $from = $this->_helper->IdConvert->hexToStr($values['from']);
                 $to = $this->_helper->IdConvert->hexToStr($values['to']);
                 $logic->cloneProfile($from, $to);
                 $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cachemanager')->getCache('rolecache');
                 $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
                 //                    $this->_helper->messenger->success('Klonowanie profilu czeka na akceptację.');
                 $this->_helper->messenger->success('Sklonowano profil');
                 $this->_helper->redirector('index');
                 return;
             } catch (Logic_User_Exception $e) {
                 $this->_helper->messenger('error', MSG_ERROR, $e);
             }
         }
     }
     $this->view->form = $form;
     //        $from = $request->getParam('from');
     //        $from = $this->_helper->IdConvert->hexToStr($from);
     //        $id = $request->getParam('to');
     //        $id = $this->_helper->IdConvert->hexToStr($id);
     //        $user = new Logic_User();
     //
     //        try {
     //            $user->cloneProfile($from, $id);
     //            $this->_helper->messenger('success', 'Pomyślnie sklonowano uprawnienia dla profilu.');
     //        } catch (Logic_Exception $e) {
     //            $this->_helper->messenger('error', MSG_ERROR, $e);
     //        }
     //
     //        $this->_helper->redirector('index');
 }