TYPO3 CMS  TYPO3_6-2
FlashMessage.php
Go to the documentation of this file.
1 <?php
3 
22 
28  protected $storeInSession = FALSE;
29 
33  protected $classes = array(
34  self::NOTICE => 'notice',
35  self::INFO => 'information',
36  self::OK => 'ok',
37  self::WARNING => 'warning',
38  self::ERROR => 'error'
39  );
40 
50  public function __construct($message, $title = '', $severity = self::OK, $storeInSession = FALSE) {
51  $this->setMessage($message);
52  $this->setTitle($title);
53  $this->setSeverity($severity);
55  }
56 
62  public function isSessionMessage() {
63  return $this->storeInSession;
64  }
65 
73  $this->storeInSession = (bool)$storeInSession;
74  }
75 
81  public function getClass() {
82  return 'message-' . $this->classes[$this->severity];
83  }
84 
90  public function render() {
91  $title = '';
92  if (!empty($this->title)) {
93  $title = '<div class="message-header">' . $this->title . '</div>';
94  }
95  $message = '<div class="typo3-message ' . $this->getClass() . '">' . $title . '<div class="message-body">' . $this->message . '</div>' . '</div>';
96  return $message;
97  }
98 
99 }
__construct($message, $title='', $severity=self::OK, $storeInSession=FALSE)