ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
Slim_Session_Flash Class Reference
+ Inheritance diagram for Slim_Session_Flash:
+ Collaboration diagram for Slim_Session_Flash:

Public Member Functions

 __construct ($sessionKey=null)
 Constructor.
 setSessionKey ($key)
 Set the $_SESSION key used to access Flash messages.
 getSessionKey ()
 Get the $_SESSION key used to access Flash messages.
 now ($key, $value)
 Set a Flash message for the current request.
 set ($key, $value)
 Set a Flash message for the next request.
 getMessages ()
 Get Flash messages intended for the current request's View.
 load ()
 Load Flash messages from $_SESSION.
 keep ()
 Transfer Flash messages from the previous request so they are available to the next request.
 save ()
 Save Flash messages to $_SESSION.
 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

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().

{
if ( !is_null($sessionKey) ) {
}
$this->load();
}

+ Here is the call graph for this function:

Member Function Documentation

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().

{
return array_merge($this->messages['prev'], $this->messages['now']);
}

+ Here is the caller graph for this function:

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.

{
}
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().

{
foreach ( $this->messages['prev'] as $key => $val ) {
$this->messages['next'][$key] = $val;
}
return $this->save();
}

+ Here is the call graph for this function:

Slim_Session_Flash::load ( )

Load Flash messages from $_SESSION.

Returns
Slim_Session_Flash

Definition at line 145 of file Flash.php.

References $_SESSION, and $sessionKey.

Referenced by __construct().

{
$this->messages['prev'] = isset($_SESSION[$this->sessionKey]) ? $_SESSION[$this->sessionKey] : array();
return $this;
}

+ Here is the caller graph for this function:

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().

Referenced by offsetSet().

{
$this->messages['now'][(string)$key] = $value;
return $this->save();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Slim_Session_Flash::offsetExists (   $offset)

Definition at line 173 of file Flash.php.

References $messages, and getMessages().

{
$messages = $this->getMessages();
return isset($messages[$offset]);
}

+ Here is the call graph for this function:

Slim_Session_Flash::offsetGet (   $offset)

Definition at line 178 of file Flash.php.

References $messages, and getMessages().

{
$messages = $this->getMessages();
return isset($messages[$offset]) ? $messages[$offset] : null;
}

+ Here is the call graph for this function:

Slim_Session_Flash::offsetSet (   $offset,
  $value 
)

Definition at line 183 of file Flash.php.

References now().

{
$this->now($offset, $value);
}

+ Here is the call graph for this function:

Slim_Session_Flash::offsetUnset (   $offset)

Definition at line 187 of file Flash.php.

{
unset($this->messages['prev'][$offset]);
unset($this->messages['now'][$offset]);
}
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().

{
$_SESSION[$this->sessionKey] = $this->messages['next'];
return $this;
}

+ Here is the caller graph for this function:

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().

{
$this->messages['next'][(string)$key] = $value;
return $this->save();
}

+ Here is the call graph for this function:

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.

Referenced by __construct().

{
if ( is_null($key) ) {
throw new RuntimeException('Session key cannot be null');
}
$this->sessionKey = (string)$key;
return $this;
}

+ Here is the caller graph for this function:

Field Documentation

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

Definition at line 67 of file Flash.php.

Referenced by offsetExists(), and offsetGet().

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: