public function render()
 {
     $template = $this->getTemplate();
     $template->setFile(__DIR__ . '/template.latte');
     $this->recipients = $this->messagesFacade->findMessageRecipients($this->message->getMessage());
     $template->messageEntity = $this->message;
     $template->render();
 }
 public function onListingSharing(Listing $newListing, User $sender, IResultObject $resultObject)
 {
     try {
         $message = $this->listingNotification->getNotificationMessage($newListing, $sender);
         $message->markAsSystemMessage();
         $this->messagesFacade->sendMessage($message, [$newListing->getUser()->getId()]);
     } catch (DBALException $e) {
         $resultObject->addError('Nepodařilo se odeslat zprávu o
              dopručení sdílené výčetky.', 'error');
     }
 }
 public function render()
 {
     $template = $this->getTemplate();
     $template->setFile(__DIR__ . '/template.latte');
     $this->loadUsers();
     $canBeSent = $this->messagesFacade->canMessageBeSentTo($this->responseRecipient, $this->restrictedUsers, $this->users);
     if (isset($this->responseRecipient) and $canBeSent) {
         $this['newMessageForm-recipients']->setDefaultValue($this->responseRecipient);
     }
     $template->render();
 }
 /**
  * @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');
     }
 }
 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');
     }
 }
示例#6
0
 public function sendNotifications(Form $form, $values)
 {
     $messages = [];
     foreach ($this->newListings as $listing) {
         $message = $this->sharedListingNotification->getNotificationMessage($listing, $this->user->getIdentity()->username, $this->users[$listing->getOwnerID()]);
         $messages[$listing->getOwnerID()] = $message;
     }
     try {
         $this->messagesFacade->sendMessages($messages);
     } catch (\DibiException $e) {
         $this->presenter->flashMessage('Nepodařilo se odeslat upozornění příjemcům.', 'warning');
         $this->redirect('this');
     }
     $this->redirect('this');
 }
示例#7
0
 public function processNewMessageForm(Form $form)
 {
     $values = $form->getValues();
     $texy = new \Texy();
     $texy->setOutputMode(\Texy::HTML4_TRANSITIONAL);
     $texy->encoding = 'utf-8';
     $texy->allowedTags = \Texy::ALL;
     $text = $texy->process($values->message);
     // 0 == system account
     $author = $values['isSystemMessage'] == true ? 0 : $this->user->id;
     try {
         $this->messagesFacade->sendMessage($values->subject, $text, $author, $values->receivers);
     } catch (MessageLengthException $ml) {
         $form->addError('Zprávu nelze uložit, protože je příliš dlouhá.');
         return;
     } catch (\DibiException $e) {
         $this->flashMessage('Zpráva nemohla být odeslána. Zkuste akci opakovat později.', 'errror');
         $this->redirect('this');
     }
     $this->flashMessage('Zpráva byla úspěšně odeslána', 'success');
     $this->redirect('MailBox:sent');
 }
 public function renderOverview($month, $year)
 {
     $numberOfMessages = $this->messageFacade->fetchReceivedMessages((new ReceivedMessagesQuery())->byRecipient($this->user->getIdentity())->onlyActive()->findUnreadMessages())->getTotalCount();
     $this->template->numberOfMessages = $numberOfMessages;
 }
示例#9
0
 public function renderOverview($month, $year)
 {
     $this->numberOfMessages = $this->messageFacade->getNumberOfReceivedMessages(Entities\Message::UNREAD);
     $this->template->numberOfMessages = $this->numberOfMessages;
 }