diff --git a/app/Action.php b/app/Action.php index 1ad7056..36fd258 100644 --- a/app/Action.php +++ b/app/Action.php @@ -39,9 +39,13 @@ abstract class Action * Redirect * * @param mixed $url + * @param bool $permanently */ - protected function redirect($url = null) + protected function redirect($url = null, $permanently = false) { + if ($permanently) { + header('HTTP/1.1 301 Moved Permanently'); + } header('Location: ' . (($url) ? $url : Env::getRequestUri())); exit(); } diff --git a/view/helpers/MsgViewHelper.php b/view/helpers/MsgViewHelper.php index 0a2b89f..1283367 100644 --- a/view/helpers/MsgViewHelper.php +++ b/view/helpers/MsgViewHelper.php @@ -18,6 +18,13 @@ class MsgViewHelper extends ViewHelper const WARNING = 'warning'; + private static $type_to_class = array( + self::SUCCESS => 'success', + self::ERROR => 'error', + self::INFO => 'info', + self::WARNING => 'warning', + ); + protected $css_prefix = ''; public function msg($msg = null, $type = null) @@ -67,8 +74,14 @@ class MsgViewHelper extends ViewHelper $msg = Session::get(__CLASS__, false); if ($msg) { Session::del(__CLASS__); - return '
' . $this->view->escape($msg['message']) . '
'; + $type_to_class = static::getTypeToClass(); + return '
' . $this->view->escape($msg['message']) . '
'; } return ''; } + + protected static function getTypeToClass() + { + return self::$type_to_class; + } } \ No newline at end of file