diff --git a/view/helpers/ViewHelperMsg.php b/view/helpers/ViewHelperMsg.php new file mode 100644 index 0000000..d6317f0 --- /dev/null +++ b/view/helpers/ViewHelperMsg.php @@ -0,0 +1,41 @@ + + * @link http://netmonsters.ru + * @package Majestic + * @subpackage View + * @since 2010-03-09 + * @version SVN: $Id$ + * @filesource $URL$ + */ + +class ViewHelperMsg extends ViewHelper +{ + + protected $get; + + public function msg() + { + return $this; + } + + public function success($msg) + { + Session::set(__CLASS__, array('message' => $msg, 'type' => 'success')); + } + + public function error($msg) + { + Session::set(__CLASS__, array('message' => $msg, 'type' => 'error')); + } + + public function __toString() + { + $msg = Session::get(__CLASS__, false); + if ($msg) { + Session::del(__CLASS__); + return '