예제 #1
0
 /**
  * Get messages
  *
  * @param boolean $includeCurrentMessages
  * @return array
  */
 public function __invoke($includeCurrentMessages = false)
 {
     $messages = [FlashMessenger::NAMESPACE_ERROR => [], FlashMessenger::NAMESPACE_SUCCESS => [], FlashMessenger::NAMESPACE_INFO => [], FlashMessenger::NAMESPACE_DEFAULT => []];
     foreach ($messages as $ns => &$m) {
         $m = $this->flashMessenger->getMessagesFromNamespace($ns);
         if ($includeCurrentMessages) {
             $m = array_merge($m, $this->flashMessenger->getCurrentMessagesFromNamespace($ns));
         }
     }
     return $messages;
 }
예제 #2
0
 public function __invoke($includeCurrentMessages = false)
 {
     $messages = array(FlashMessenger::NAMESPACE_ERROR => [], FlashMessenger::NAMESPACE_SUCCESS => [], FlashMessenger::NAMESPACE_INFO => [], FlashMessenger::NAMESPACE_WARNING => [], FlashMessenger::NAMESPACE_DEFAULT => []);
     foreach ($messages as $namespace => &$message) {
         $message = $this->flashMessenger->getMessagesFromNamespace($namespace);
         if ($includeCurrentMessages) {
             $message = array_merge($message, $this->flashMessenger->getCurrentMessagesFromNamespace($namespace));
             $this->flashMessenger->clearCurrentMessagesFromNamespace($namespace);
         }
     }
     return $messages;
 }
예제 #3
0
 public function __invoke($includeCurrentMessages = false)
 {
     $messages = array_combine(array_keys($this->_nsMap), array(array(), array(), array(), array()));
     foreach ($messages as $className => &$m) {
         $ns = $this->_mapNameSpace($className);
         $m = $this->flashMessenger->getMessagesFromNamespace($ns);
         if ($includeCurrentMessages) {
             $m = array_merge($m, $this->flashMessenger->getCurrentMessagesFromNamespace($ns));
             $this->flashMessenger->clearCurrentMessagesFromNamespace($ns);
         }
     }
     return $messages;
 }
예제 #4
0
 public function __invoke($includeCurrentMessages = false)
 {
     $messages = array(FlashMessenger::NAMESPACE_ERROR => array(), FlashMessenger::NAMESPACE_SUCCESS => array(), FlashMessenger::NAMESPACE_INFO => array(), FlashMessenger::NAMESPACE_DEFAULT => array());
     foreach ($messages as $ns => &$m) {
         $m = $this->flashMessenger->getMessagesFromNamespace($ns);
         if ($includeCurrentMessages) {
             $m = array_merge($m, $this->flashMessenger->getCurrentMessagesFromNamespace($ns));
             $this->flashMessenger->clearCurrentMessagesFromNamespace($ns);
         }
     }
     // Fix Twitter Bootstrap 3
     $messages['danger'] =& $messages[FlashMessenger::NAMESPACE_ERROR];
     $messages['warning'] =& $messages[FlashMessenger::NAMESPACE_DEFAULT];
     return $messages;
 }
 /**
  * Render a namespace
  * @param string $namespace
  * @param bool $includeCurrentMessages
  * @param bool $forceClearMessages
  * @param array $attr
  * @return string 
  */
 public function renderNamespace($namespace, $includeCurrentMessages = false, $forceClearMessages = true, $attr = array())
 {
     // init : messages
     $messagesHTML = "";
     $messages = $this->flashMessenger->getMessagesFromNamespace($namespace);
     if ($includeCurrentMessages) {
         $messages = array_merge($messages, $this->flashMessenger->getCurrentMessagesFromNamespace($namespace));
     }
     $messages = array_unique($messages);
     foreach ($messages as $message) {
         $messagesHTML .= $this->renderMessage($message, $namespace, $attr);
     }
     // clear messages
     if ($forceClearMessages) {
         $this->flashMessenger->clearMessagesFromNamespace($namespace);
         if ($includeCurrentMessages) {
             $this->flashMessenger->clearCurrentMessagesFromNamespace($namespace);
         }
     }
     return $messagesHTML;
 }