PHP Class MetaAction, newscoop

Datei anzeigen Open project: sourcefabric/newscoop Class Usage Examples

Protected Properties

Property Type Description
$m_defined boolean True if an action was set up; this member is set to false by the base class. The specialized class must set it to true.
$m_error PEAR_Error Stores the error data
$m_name string Stores the action type name
$m_properties array Action properties

Public Methods

Method Description
CreateAction ( array $p_input ) : MetaAction Factory method; creates an object specialized from MetaAction based on the given input.
DefaultAction ( )
DeleteActionsFromCache ( )
ReadAvailableActions ( ) : array Searches for classes that process actions. Returns an array of action names.
TranslateProperty ( string $p_property ) : string Converts the property name to the standard way of naming properties.
ValidateInput ( array $p_input, string $p_fieldName, integer $p_minSize = null, mixed &$p_error, string $p_errorMessage, mixed $p_errorCode ) : boolean Returns true and sets the error to null if the input field was defined and it's size respected the minimum size constraint. Returns false and initializes the error to a pear error object with the given error message and code if the input field was not defined or did not respect the minimum size constraint. The minimum size constraint may be null.
__construct ( $p_name = 'default' ) Base initializations
__get ( string $p_property ) : mixed Returns the value of the given property; throws InvalidPropertyHandlerException if the property didn't exist.
__set ( string $p_property, mixed $p_value ) Throws InvalidFunctionException; action properties can not be modified.
__unset ( string $p_property ) Throws InvalidFunctionException; action properties can not be modified.
defined ( ) : boolean Returns true if an action was set up.
takeAction ( CampContext &$p_context ) : boolean Performs the action; returns true on success, false on error.

Protected Methods

Method Description
getError ( ) : mixed Returns the error code of the action. Returns 0 on success, PEAR_Error object on error.
trigger_invalid_property_error ( string $p_property, mixed $p_smarty = null ) Registers an error message in the CampTemplate singleton object.

Private Methods

Method Description
FetchActionsFromCache ( )
StoreActionsInCache ( )

Method Details

CreateAction() public static method

Factory method; creates an object specialized from MetaAction based on the given input.
public static CreateAction ( array $p_input ) : MetaAction
$p_input array
return MetaAction

DefaultAction() public static method

public static DefaultAction ( )

DeleteActionsFromCache() public static method

public static DeleteActionsFromCache ( )

ReadAvailableActions() public static method

Searches for classes that process actions. Returns an array of action names.
public static ReadAvailableActions ( ) : array
return array

TranslateProperty() public static method

Converts the property name to the standard way of naming properties.
public static TranslateProperty ( string $p_property ) : string
$p_property string
return string

ValidateInput() public static method

Returns true and sets the error to null if the input field was defined and it's size respected the minimum size constraint. Returns false and initializes the error to a pear error object with the given error message and code if the input field was not defined or did not respect the minimum size constraint. The minimum size constraint may be null.
public static ValidateInput ( array $p_input, string $p_fieldName, integer $p_minSize = null, mixed &$p_error, string $p_errorMessage, mixed $p_errorCode ) : boolean
$p_input array
$p_fieldName string
$p_minSize integer
$p_error mixed
$p_errorMessage string
$p_errorCode mixed
return boolean

__construct() public method

Base initializations
public __construct ( $p_name = 'default' )

__get() public method

Returns the value of the given property; throws InvalidPropertyHandlerException if the property didn't exist.
public __get ( string $p_property ) : mixed
$p_property string
return mixed

__set() final public method

Throws InvalidFunctionException; action properties can not be modified.
final public __set ( string $p_property, mixed $p_value )
$p_property string
$p_value mixed

__unset() final public method

Throws InvalidFunctionException; action properties can not be modified.
final public __unset ( string $p_property )
$p_property string

defined() final public method

Returns true if an action was set up.
final public defined ( ) : boolean
return boolean

getError() protected method

Returns the error code of the action. Returns 0 on success, PEAR_Error object on error.
protected getError ( ) : mixed
return mixed

takeAction() public method

Performs the action; returns true on success, false on error.
public takeAction ( CampContext &$p_context ) : boolean
$p_context CampContext - the current context object
return boolean

trigger_invalid_property_error() protected method

Registers an error message in the CampTemplate singleton object.
protected trigger_invalid_property_error ( string $p_property, mixed $p_smarty = null )
$p_property string
$p_smarty mixed

Property Details

$m_defined protected_oe property

True if an action was set up; this member is set to false by the base class. The specialized class must set it to true.
protected bool $m_defined
return boolean

$m_error protected_oe property

Stores the error data
protected PEAR_Error $m_error
return PEAR_Error

$m_name protected_oe property

Stores the action type name
protected string $m_name
return string

$m_properties protected_oe property

Action properties
protected array $m_properties
return array