Example #1
0
 public function lockAction()
 {
     $logic = new Logic_User();
     $form = new Logic_User_Form_Lock();
     $request = $this->getRequest();
     $this->view->form = $form;
     $id = $this->_helper->IdConvert->hexToStr($request->getParam('id'));
     if ($request->isPost()) {
         $post = $request->getPost();
         if ($form->isCancelled($post)) {
             $this->_helper->redirector('index');
         } else {
             if ($form->isValid($post)) {
                 try {
                     $logic->setLocked($post);
                     $this->_helper->messenger->success('Zablokowano konto użytkownika');
                     $this->_helper->redirector('index', 'user', null, array());
                     return;
                 } catch (Logic_User_Exception $e) {
                     $this->_helper->redirector('index', 'user', null, array());
                     $this->_helper->messenger->error($e->getMessage());
                 }
             } else {
                 $this->_helper->messenger->error('Incorrect data');
             }
         }
     } else {
         $form->setId($id);
         $form->startForm();
         $datesRow = $logic->getTimelockDates($id);
         if ($datesRow !== false) {
             $form->setDefaults($datesRow->toArray());
         }
     }
 }