You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
885 B

<?php
/**
* @copyright NetMonsters <team@netmonsters.ru>
* @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 '<div class="' . $msg['type'] . '">' . $this->view->escape($msg['message']) . '</div>';
}
return '&nbsp;';
}
}