Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Conditions_List Class Reference

Public Member Functions

 Conditions_List (&$host_asset, $conditions_attribute_name='')
 
 setHost (&$host_asset, $conditions_attribute_name)
 
 evaluate (&$asset_being_painted, $condition_names, &$logical_keywords, $boolean_values=Array(0, 1))
 
 _updateKeywordsInRestriction (&$logical_keywords, &$condition_parameters)
 
 getConditionsNames ()
 
 getRequiredKeywords ($condition_name)
 
 _getConditionRestriction ($condition_name)
 
_getConditionAsset ($condition_type, $edit_fns=FALSE)
 
 _getConditionParameter ($condition_name, $key='', $default=Array())
 
 _getAllConditions ()
 
_getHostAsset ()
 
_getCurrentUser ()
 
 isValid ()
 
 paintConditionsList (&$asset, &$o, $prefix, $write_access, $allowed_keywords)
 
 processConditionsList (&$asset, &$o, $prefix, $write_access, $allowed_keywords)
 
 _generateUniqueName ($desired_name, &$reserved_names)
 

Data Fields

 $host_asset = NULL
 
 $conditions_attribute_name = ''
 

Detailed Description

Definition at line 37 of file conditions_list.inc.

Member Function Documentation

_generateUniqueName (   $desired_name,
$reserved_names 
)

Returns a unique name based on a desired name and not part of an array of a existing names

Parameters
string$desired_namedesired new name
array&$reserved_namesarray of reserved name
Returns
string public

Definition at line 514 of file conditions_list.inc.

_getAllConditions ( )

Returns all the conditions parameters in one array

Returns
array private

Definition at line 285 of file conditions_list.inc.

& _getConditionAsset (   $condition_type,
  $edit_fns = FALSE 
)

Returns a reference to a child Condition Asset, or its edit functions

Parameters
string$condition_typea condition type code
boolean$edit_fnsif TRUE returns an instance of the edit_fns class
Returns
object private

Definition at line 233 of file conditions_list.inc.

_getConditionParameter (   $condition_name,
  $key = '',
  $default = Array() 
)

Returns parameters of a condition.

If a key is given, it will return the corresponding element in the parameters, otherwise the whole array is returned. If the desired value doesn't exists the default value is returned.

Parameters
string$condition_namecondition name
string$keyoptional element in the parameters
mixed$defaultdefault value to return if the result is empty
Returns
mixed array|string private

Definition at line 261 of file conditions_list.inc.

_getConditionRestriction (   $condition_name)

Returns the condition data array for a particular condition

Parameters
string$condition_namea condition name
Returns
array private

Definition at line 217 of file conditions_list.inc.

& _getCurrentUser ( )

Get a reference to the current user asset.

Returns
object private

Definition at line 316 of file conditions_list.inc.

& _getHostAsset ( )

Returns a reference to the host asset

Returns
object private

Definition at line 303 of file conditions_list.inc.

_updateKeywordsInRestriction ( $logical_keywords,
$condition_parameters 
)

Set the values of the conditional keywords in the condition parameters

The call_user_func_array() is messy but we need it to be able to statically call the same function in a variable type code (which is not as easy with static calls as it is creating objects of a variable type code). Could not use plain call_user_func() either because of the need to pass by reference

Parameters
array&$logical_keywordslogical keywords (keyword => value)
array&$condition_parameterscondition parameters
Returns
void private

Definition at line 155 of file conditions_list.inc.

Conditions_List ( $host_asset,
  $conditions_attribute_name = '' 
)

Constructor

See Also
setHost()

Definition at line 72 of file conditions_list.inc.

evaluate ( $asset_being_painted,
  $condition_names,
$logical_keywords,
  $boolean_values = Array(0, 1) 
)

Evaluates multiple conditions

Returns an array of (condition_name => condition_value)

Parameters
object$asset_being_paintedThe asset being painted, relevant when evaluating conditions
array$condition_namesConditions to evaluate
array&$logical_keywordsLogical keywords and their values (keyword => value)
array$boolean_valuesValues to assign to the returned array for TRUE or FALSE
Returns
array public

Definition at line 111 of file conditions_list.inc.

getConditionsNames ( )

Returns an array of condition names

Returns
array public

Definition at line 171 of file conditions_list.inc.

getRequiredKeywords (   $condition_name)

Returns the list of keywords required by a condition

The call_user_func() is messy but we need it to be able to statically call the same function in a variable type code (which is not as easy with static calls as it is creating objects of a variable type code).

Parameters
string$condition_namecondition name
Returns
array public

Definition at line 192 of file conditions_list.inc.

isValid ( )

Returns TRUE if this object has a proper host asset and a attribute name for the condition parameters

Returns
boolean public

Definition at line 332 of file conditions_list.inc.

paintConditionsList ( $asset,
$o,
  $prefix,
  $write_access,
  $allowed_keywords 
)

Paint the backend editing interface for the conditions list

Parameters
object&$assetthe asset we are painting for
object&$othe backend outputter class
string$prefixprefix for form elements
boolean$write_accessdo we have write access to this?
array$allowed_keywordsallowed keywords
Returns
boolean public

Definition at line 354 of file conditions_list.inc.

processConditionsList ( $asset,
$o,
  $prefix,
  $write_access,
  $allowed_keywords 
)

Process the backend editing interface for the conditions list

Parameters
object&$assetthe asset we are painting for
object&$othe backend outputter class
string$prefixprefix for form elements
boolean$write_accessdo we have write access to this?
array$allowed_keywordsallowed keywords
Returns
boolean public

Definition at line 453 of file conditions_list.inc.

setHost ( $host_asset,
  $conditions_attribute_name 
)

Initialises the condition list with a host

Parameters
object&$host_assetthe host asset for this condition list
string$conditions_attribute_nameattribute containing the conditions
Returns
boolean public

Definition at line 88 of file conditions_list.inc.


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