Fixed bug #12295: Cleaning config_default, exclude values from being listed in instal...
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_flashmessage.php
index 562d3df..06423a4 100644 (file)
@@ -41,22 +41,49 @@ class t3lib_FlashMessage {
        const WARNING = 1;
        const ERROR   = 2;
 
-       protected $title    = '';
-       protected $message  = '';
+       /**
+        * The message's title
+        *
+        * @var string
+        */
+       protected $title = '';
+
+       /**
+        * The message
+        *
+        * @var string
+        */
+       protected $message = '';
+
+       /**
+        * The message's severity
+        *
+        * @var integer
+        */
        protected $severity = self::OK;
 
        /**
+        * defines whether the message should be stored in the session (to survive redirects) or only for one request (default)
+        *
+        * @var bool
+        */
+       protected $storeInSession = FALSE;
+
+       /**
         * Constructor for a flash message
         *
         * @param       string  The message.
         * @param       string  Optional message title.
-        * @param       integer Optional severity, must be either of t3lib_FlashMessage::INFO, t3lib_FlashMessage::OK, t3lib_FlashMessage::WARNING or t3lib_FlashMessage::ERROR. Default is t3lib_FlashMessage::OK.
+        * @param       integer Optional severity, must be either of t3lib_FlashMessage::INFO, t3lib_FlashMessage::OK,
+        *                  t3lib_FlashMessage::WARNING or t3lib_FlashMessage::ERROR. Default is t3lib_FlashMessage::OK.
+        * @param       bool    Optional, defines whether the message should be stored in the session or only for one request (default)
         * @return      void
         */
-       public function __construct($message, $title = '', $severity = self::OK) {
+       public function __construct($message, $title = '', $severity = self::OK, $storeInSession = FALSE) {
                $this->setMessage($message);
                $this->setTitle($title);
                $this->setSeverity($severity);
+               $this->setStoreInSession($storeInSession);
        }
 
        /**
@@ -78,6 +105,27 @@ class t3lib_FlashMessage {
                $this->title = (string) $title;
        }
 
+
+       /**
+        * Gets the message's storeInSession flag.
+        *
+        * @return      bool    true if message should be stored in the session, otherwise false.
+        */
+       public function isSessionMessage() {
+               return $this->storeInSession;
+       }
+
+       /**
+        * Sets the message's storeInSession flag
+        *
+        * @param       bool    The persistence flag
+        * @return      void
+        */
+       public function setStoreInSession($storeInSession) {
+               $this->storeInSession = (bool) $storeInSession;
+       }
+
+
        /**
         * Gets the message.
         *