ultimix
messages_1_0_0 Class Reference

Public Member Functions

 __construct ()
 add_error_message ($Message)
 get_last_error_message ()
 add_success_message ($Message)
 get_last_success_message ()
 get_success_message_from_session ()
 clear_messages ()
 compile_success_message (&$Settings)
 compile_error_message (&$Settings)

Data Fields

 $ErrorMessages = array()
 $SuccessMessages = array()
 $CachedMultyFS = false
 $Security = false

Detailed Description

Class processes page's messages.

Author
Dodonov A.A.

Definition at line 26 of file messages.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 79 of file messages.php.

{
try
{
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

add_error_message (   $Message)

Function adds error message to render queue.

Parameters
$Message- Error message.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 110 of file messages.php.

{
try
{
if( array_search( $Message , $this->ErrorMessages ) === false )
{
$this->ErrorMessages [] = $Message;
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
add_success_message (   $Message)

Function adds notification message to render queue.

Parameters
$Message- Success message.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 180 of file messages.php.

{
try
{
if( array_search( $Message , $this->SuccessMessages ) === false )
{
$this->SuccessMessages [] = $Message;
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
clear_messages ( )

Function clears all messages.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 285 of file messages.php.

{
try
{
$this->SuccessMessages = array();
$this->ErrorMessages = array();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_error_message ( $Settings)

Function compiles macro 'error_messages'.

Parameters
$Settings- Compilation parameters.
Returns
Widget.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 368 of file messages.php.

{
try
{
$Code = '';
if( isset( $this->ErrorMessages[ 0 ] ) )
{
$StartingDiv = $this->CachedMultyFS->get_template( __FILE__ , 'error_start.tpl' );
$ClosingDiv = $this->CachedMultyFS->get_template( __FILE__ , 'error_end.tpl' );
$Messages = implode( '}'.$ClosingDiv.$StartingDiv.'{lang:' , $this->ErrorMessages );
$Code = $StartingDiv."{lang:$Messages}".$ClosingDiv;
$this->ErrorMessages = array();
}
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_success_message ( $Settings)

Function compiles macro 'success_messages'.

Parameters
$Settings- Compilation parameters.
Returns
Widget.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 320 of file messages.php.

{
try
{
$Code = '';
if( isset( $this->SuccessMessages[ 0 ] ) )
{
$StartingDiv = $this->CachedMultyFS->get_template( __FILE__ , 'success_start.tpl' );
$ClosingDiv = $this->CachedMultyFS->get_template( __FILE__ , 'success_end.tpl' );
$Messages = implode( '}'.$ClosingDiv.$StartingDiv.'{lang:' , $this->SuccessMessages );
$Code = $StartingDiv."{lang:$Messages}".$ClosingDiv;
$this->SuccessMessages = array();
}
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_last_error_message ( )

Function returns last error message.

Returns
Error message.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 143 of file messages.php.

{
try
{
if( isset( $this->ErrorMessages[ 0 ] ) )
{
return( $this->ErrorMessages[ count( $this->ErrorMessages ) - 1 ] );
}
else
{
return( 'message_was_not_found' );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_last_success_message ( )

Function returns last success message.

Returns
Success message.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 213 of file messages.php.

{
try
{
if( isset( $this->SuccessMessages[ 0 ] ) )
{
return( $this->SuccessMessages[ count( $this->SuccessMessages ) - 1 ] );
}
else
{
return( 'message_was_not_found' );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_success_message_from_session ( )

Function processes success messages.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 246 of file messages.php.

{
try
{
if( $this->Security->get_s( 'success_message' , 'set' ) )
{
$this->add_success_message( $this->Security->get_s( 'success_message' , 'command' ) );
$this->Security->unset_s( 'success_message' );
}
$PageName = $this->Security->get_gp( 'page_name' , 'command' );
if( $this->Security->get_s( "$PageName:success_message" , 'set' ) )
{
$FieldName = "$PageName:success_message";
$this->add_success_message( $this->Security->get_s( $FieldName , 'command' ) );
$this->Security->unset_s( "$PageName:success_message" );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$CachedMultyFS = false

Cached object.

Author
Dodonov A.A.

Definition at line 62 of file messages.php.

$ErrorMessages = array()

Array keeps all error messages.

Author
Dodonov A.A.

Definition at line 38 of file messages.php.

$Security = false

Definition at line 63 of file messages.php.

$SuccessMessages = array()

Array keeps all notification messages.

Author
Dodonov A.A.

Definition at line 50 of file messages.php.


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