コード例 #1
0
 /**
  * @secured
  */
 public function handleDeleteMessage($id)
 {
     $message = $this->messagesFacade->readMessage($id, $this->messagesHandler->getMessagesType());
     if ($message !== null) {
         if (!$this->authorizator->isAllowed($this->user, $message, 'remove')) {
             $this->flashMessage('Nemáte dostatečná oprávnění ke smazání zprávy.', 'warning');
             $this->redirect('this');
         }
         try {
             $this->messagesHandler->removeMessage($id);
             $this->flashMessage('Zpráva byla úspěšně odstraněna.', 'success');
         } catch (DBALException $e) {
             $this->flashMessage('Zprávu se nepodařilo odstranit.', 'error');
         }
     }
     if ($this->presenter->isAjax()) {
         $this->redrawControl();
     } else {
         $this->redirect('this');
     }
 }
コード例 #2
0
 public function actionMessage($id, $type)
 {
     $user = $this->user->getIdentity();
     try {
         $this->message = $this->messagesFacade->readMessage($id, $type, $user);
     } catch (MessageTypeException $e) {
         $this->redirect('MailBox:receivedUnread');
     }
     if ($this->message === null or !$this->authorizator->isAllowed($user, $this->message, 'view')) {
         $this->flashMessage('Zpráva nebyla nalezena.', 'warning');
         $this->redirect('MailBox:receivedUnread');
     }
 }