ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Slim_Session_Flash Class Reference
+ Inheritance diagram for Slim_Session_Flash:
+ Collaboration diagram for Slim_Session_Flash:

Public Member Functions

 __construct ( $sessionKey=null)
 Constructor. More...
 
 setSessionKey ( $key)
 Set the $_SESSION key used to access Flash messages. More...
 
 getSessionKey ()
 Get the $_SESSION key used to access Flash messages. More...
 
 now ( $key, $value)
 Set a Flash message for the current request. More...
 
 set ( $key, $value)
 Set a Flash message for the next request. More...
 
 getMessages ()
 Get Flash messages intended for the current request's View. More...
 
 load ()
 Load Flash messages from $_SESSION. More...
 
 keep ()
 Transfer Flash messages from the previous request so they are available to the next request. More...
 
 save ()
 Save Flash messages to $_SESSION. More...
 
 offsetExists ( $offset)
 
 offsetGet ( $offset)
 
 offsetSet ( $offset, $value)
 
 offsetUnset ( $offset)
 

Protected Attributes

 $sessionKey = 'flash'
 
 $messages
 

Detailed Description

Definition at line 57 of file Flash.php.

Constructor & Destructor Documentation

◆ __construct()

Slim_Session_Flash::__construct (   $sessionKey = null)

Constructor.

Establishes Flash session key and loads existing Flash messages from the $_SESSION.

Parameters
string$sessionKey
Returns
void

Definition at line 82 of file Flash.php.

References $sessionKey, load(), and setSessionKey().

82  {
83  if ( !is_null($sessionKey) ) {
84  $this->setSessionKey($sessionKey);
85  }
86  $this->load();
87  }
setSessionKey( $key)
Set the $_SESSION key used to access Flash messages.
Definition: Flash.php:95
load()
Load Flash messages from $_SESSION.
Definition: Flash.php:145
+ Here is the call graph for this function:

Member Function Documentation

◆ getMessages()

Slim_Session_Flash::getMessages ( )

Get Flash messages intended for the current request's View.

Returns
array[String]

Definition at line 137 of file Flash.php.

Referenced by offsetExists(), and offsetGet().

137  {
138  return array_merge($this->messages['prev'], $this->messages['now']);
139  }
+ Here is the caller graph for this function:

◆ getSessionKey()

Slim_Session_Flash::getSessionKey ( )

Get the $_SESSION key used to access Flash messages.

Returns
string

Definition at line 107 of file Flash.php.

References $sessionKey.

107  {
108  return $this->sessionKey;
109  }

◆ keep()

Slim_Session_Flash::keep ( )

Transfer Flash messages from the previous request so they are available to the next request.

Returns
Slim_Session_Flash

Definition at line 155 of file Flash.php.

References save().

155  {
156  foreach ( $this->messages['prev'] as $key => $val ) {
157  $this->messages['next'][$key] = $val;
158  }
159  return $this->save();
160  }
save()
Save Flash messages to $_SESSION.
Definition: Flash.php:166
+ Here is the call graph for this function:

◆ load()

Slim_Session_Flash::load ( )

Load Flash messages from $_SESSION.

Returns
Slim_Session_Flash

Definition at line 145 of file Flash.php.

References $_SESSION, $sessionKey, and array.

Referenced by __construct().

145  {
146  $this->messages['prev'] = isset($_SESSION[$this->sessionKey]) ? $_SESSION[$this->sessionKey] : array();
147  return $this;
148  }
$_SESSION["AccountId"]
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ now()

Slim_Session_Flash::now (   $key,
  $value 
)

Set a Flash message for the current request.

Parameters
string$key
string$value
Returns
Slim_Session_Flash

Definition at line 117 of file Flash.php.

References save(), and string.

Referenced by offsetSet().

117  {
118  $this->messages['now'][(string)$key] = $value;
119  return $this->save();
120  }
Add rich text string
The name of the decorator.
save()
Save Flash messages to $_SESSION.
Definition: Flash.php:166
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetExists()

Slim_Session_Flash::offsetExists (   $offset)

Definition at line 173 of file Flash.php.

References $messages, and getMessages().

173  {
174  $messages = $this->getMessages();
175  return isset($messages[$offset]);
176  }
getMessages()
Get Flash messages intended for the current request's View.
Definition: Flash.php:137
+ Here is the call graph for this function:

◆ offsetGet()

Slim_Session_Flash::offsetGet (   $offset)

Definition at line 178 of file Flash.php.

References $messages, and getMessages().

178  {
179  $messages = $this->getMessages();
180  return isset($messages[$offset]) ? $messages[$offset] : null;
181  }
getMessages()
Get Flash messages intended for the current request's View.
Definition: Flash.php:137
+ Here is the call graph for this function:

◆ offsetSet()

Slim_Session_Flash::offsetSet (   $offset,
  $value 
)

Definition at line 183 of file Flash.php.

References now().

183  {
184  $this->now($offset, $value);
185  }
now( $key, $value)
Set a Flash message for the current request.
Definition: Flash.php:117
+ Here is the call graph for this function:

◆ offsetUnset()

Slim_Session_Flash::offsetUnset (   $offset)

Definition at line 187 of file Flash.php.

187  {
188  unset($this->messages['prev'][$offset]);
189  unset($this->messages['now'][$offset]);
190  }

◆ save()

Slim_Session_Flash::save ( )

Save Flash messages to $_SESSION.

Returns
Slim_Session_Flash

Definition at line 166 of file Flash.php.

References $_SESSION, and $sessionKey.

Referenced by keep(), now(), and set().

166  {
167  $_SESSION[$this->sessionKey] = $this->messages['next'];
168  return $this;
169  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ set()

Slim_Session_Flash::set (   $key,
  $value 
)

Set a Flash message for the next request.

Parameters
string$key
string$value
Returns
Slim_Session_Flash

Definition at line 128 of file Flash.php.

References save(), and string.

128  {
129  $this->messages['next'][(string)$key] = $value;
130  return $this->save();
131  }
Add rich text string
The name of the decorator.
save()
Save Flash messages to $_SESSION.
Definition: Flash.php:166
+ Here is the call graph for this function:

◆ setSessionKey()

Slim_Session_Flash::setSessionKey (   $key)

Set the $_SESSION key used to access Flash messages.

Parameters
string$key
Exceptions
RuntimeExceptionIf session key is null
Returns
Slim_Session_Flash

Definition at line 95 of file Flash.php.

References string.

Referenced by __construct().

95  {
96  if ( is_null($key) ) {
97  throw new RuntimeException('Session key cannot be null');
98  }
99  $this->sessionKey = (string)$key;
100  return $this;
101  }
Add rich text string
The name of the decorator.
+ Here is the caller graph for this function:

Field Documentation

◆ $messages

Slim_Session_Flash::$messages
protected
Initial value:
'prev' => array(),
'next' => array(),
'now' => array()
)

Definition at line 67 of file Flash.php.

Referenced by offsetExists(), and offsetGet().

◆ $sessionKey

Slim_Session_Flash::$sessionKey = 'flash'
protected

Definition at line 62 of file Flash.php.

Referenced by __construct(), getSessionKey(), load(), and save().


The documentation for this class was generated from the following file: