Elgg  Version 2.3
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Elgg\SystemMessagesService Class Reference

Public Member Functions

 __construct (\ElggSession $session)
 Constructor. More...
 
 dumpRegister ($register_name= '')
 Empty and return the given register or all registers. More...
 
 count ($register_name="")
 Counts the number of messages, either globally or in a particular register. More...
 
 addSuccessMessage ($message)
 Display a system message on next page load. More...
 
 addErrorMessage ($error)
 Display an error on next page load. More...
 
 loadRegisters ()
 Load the registers from the session. More...
 
 saveRegisters (RegisterSet $set)
 Save the registers to the session. More...
 

Public Attributes

const SUCCESS = 'success'
 
const ERROR = 'error'
 
const SESSION_KEY = 'msg'
 

Protected Attributes

 $session
 

Detailed Description

Definition at line 17 of file SystemMessagesService.php.

Constructor & Destructor Documentation

Elgg\SystemMessagesService::__construct ( \ElggSession  $session)

Constructor.

Parameters
\ElggSession$sessionThe Elgg session

Definition at line 33 of file SystemMessagesService.php.

Member Function Documentation

Elgg\SystemMessagesService::addErrorMessage (   $error)

Display an error on next page load.

See also
system_messages()
Parameters
string|string[]$error Error or errors to add
Returns
void

Definition at line 114 of file SystemMessagesService.php.

Elgg\SystemMessagesService::addSuccessMessage (   $message)

Display a system message on next page load.

See also
system_messages()
Parameters
string|string[]$message Message or messages to add
Returns
void

Definition at line 97 of file SystemMessagesService.php.

Elgg\SystemMessagesService::count (   $register_name = "")

Counts the number of messages, either globally or in a particular register.

Parameters
string$register_nameOptionally, the register
Returns
integer The number of messages

Definition at line 75 of file SystemMessagesService.php.

Elgg\SystemMessagesService::dumpRegister (   $register_name = '')

Empty and return the given register or all registers.

In each case, the return value is a filtered version of the full registers array.

Parameters
string$register_nameThe register. Empty string for all.
Returns
array The array of registers dumped

Definition at line 45 of file SystemMessagesService.php.

Elgg\SystemMessagesService::loadRegisters ( )

Load the registers from the session.

Returns
RegisterSet

Definition at line 127 of file SystemMessagesService.php.

Elgg\SystemMessagesService::saveRegisters ( RegisterSet  $set)

Save the registers to the session.

The method of displaying these messages differs depending upon plugins and viewtypes. The core default viewtype retrieves messages in views/default/page/shells/default.php and displays messages as javascript popups.

Messages are stored as strings in the Elgg session as ['msg'][$register] array.

Parameters
RegisterSet$setThe set of registers
Returns
void

Definition at line 149 of file SystemMessagesService.php.

Member Data Documentation

Elgg\SystemMessagesService::$session
protected

Definition at line 26 of file SystemMessagesService.php.

const Elgg\SystemMessagesService::ERROR = 'error'

Definition at line 20 of file SystemMessagesService.php.

const Elgg\SystemMessagesService::SESSION_KEY = 'msg'

Definition at line 21 of file SystemMessagesService.php.

const Elgg\SystemMessagesService::SUCCESS = 'success'

Definition at line 19 of file SystemMessagesService.php.


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