set('sessionmsgs',static::$_data); return $this; } /** * Add a system message to be rendered * * @param array System Message attributes * @deprecated */ public static function add($msg,$prepend=FALSE) { if ($msgs = Session::instance()->get_once('sessionmsgs')) static::$_data = $msgs; parent::add($msg); static::$_c = count(static::$_data); // Save our messages in our session, so that we get them for redirects Session::instance()->set('sessionmsgs',static::$_data); } /** * Render this system message * * @see HTMLRender::render() */ protected function render() { $record = static::$_data[$this->_x]; $output = ''; $output .= sprintf('
',empty($record['type']) ? '' : 'alert-'.$record['type']); $output .= ''; switch ($record['type']) { case 'error': $output .= ''; break; case 'success': $output .= ''; break; case 'warning': $output .= ''; break; case 'info': default: $output .= ''; } $output .= sprintf(' %s: %s',$record['title'],$record['body']); $output .= '
'; return $output; } /** * Render all of these items */ public function render_all() { // Reload our message from the session if ($msgs = Session::instance()->get_once('sessionmsgs')) static::$_data = $msgs; return parent::render_all(); } public function dump() { } } ?>