public function render(NotificationEvent $event)
 {
     if (isset($this->viewModel)) {
         if ($this->viewModel instanceof JsonModel) {
             // here add information for JSON
         } elseif ($this->viewModel instanceof ViewModel) {
             $headScript = $this->viewHelperManager->get('headScript');
             $notifications = $event->getNotifications();
             if (is_array($notifications) && !empty($notifications)) {
                 foreach ($notifications as $notification) {
                     $headScript->appendScript('/* ' . $notification->getNotification() . ' */');
                 }
             }
         }
     }
 }
示例#2
0
 public function renderHTML(MvcEvent $event)
 {
     if (!$this->hasRunned) {
         $nEvent = new NotificationEvent();
         $nEvent->setNotifications($this->notifications);
         $this->trigger(NotificationEvent::EVENT_NOTIFICATION_HTML, $nEvent);
         $this->notifications = array();
         $this->hasRunned = true;
     }
     return $this;
 }
示例#3
0
 public function createOutput(NotificationEvent $event)
 {
     $notifications = $event->getNotifications();
     if (is_array($notifications) && !empty($notifications)) {
         foreach ($notifications as $notification) {
             $this->renderMessage($notification->getNotification(), $this->priority2namespace[$notification->getPriority()]);
         }
     }
     return $this;
 }