예제 #1
0
 /**
  * Creates a notice and ensures the type/message combo is unique
  *
  * @param	string	 $type
  * @param	string	 $msg_key
  * @param	array	 $values
  * @param	boolean	 $persistent
  */
 public function __construct($type, $msg_key, array $values = NULL, $persistent = FALSE)
 {
     parent::__construct($type, $msg_key, $values, $persistent);
     foreach (Notices::get_all($this->type) as $notice) {
         if ($this->similar_to($notice)) {
             throw new Exception('The new notice is not unique.');
         }
     }
 }
예제 #2
0
 /**
  * Display a set of notices (Defaults to all non-rendered notices)
  *
  * @param	mixed	 $type        Notice type
  * @param	boolean	 $rendered    Whether or not a Notice has been rendered
  * @param	boolean	 $persistent  Whether or not a Notice is persistent
  * @return	string
  */
 public static function display($type = NULL, $rendered = FALSE, $persistent = NULL)
 {
     $html = '';
     foreach (Notices::get_all($type, $rendered, $persistent) as $notice) {
         $html .= $notice->render();
     }
     Notices::save();
     return $html;
 }