Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Context_Config Class Reference
Inheritance diagram for Context_Config:
Config MySource_Object

Public Member Functions

 __construct ()
 
 paintBackend (&$o)
 
 paintSummary (Backend_Outputter $o, Array $contexts, $write_access, $current_context=NULL)
 
 paintSelectedContext (Backend_Outputter $o, Array $contexts, $current_context)
 
 processSelectedContext (Backend_Outputter $o, Array $contexts, $current_context)
 
 paintMatchOrder (Backend_Outputter $o, Array $match_order, $write_access)
 
 processMatchOrder (Backend_Outputter $o, Array $match_order)
 
 processBackend (Backend_Outputter $o)
 
 load ()
 
 save ($vars, $backup_existing=FALSE)
 
- Public Member Functions inherited from Config
 __construct ()
 
 save ($vars, $backup_existing=FALSE, $send_message=TRUE)
 
 acquireLock ()
 
 canAcquireLock ()
 
 releaseLock ()
 
 updateLock ()
 
 getLockInfo ()
 
 writeAccess ()
 
 paintBackend (&$o)
 
 processBackend (&$o)
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

 $config_vars
 
 $prefix = 'config_context_'
 
 $new_vars = NULL
 
- Data Fields inherited from Config
 $config_vars = Array()
 
 $config_file = ''
 
 $name = ''
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Protected Member Functions

 _getReorderJS ()
 
 _getSummaryConditionList ($conditions)
 
 _getContextErrors ($context)
 
 _paintConditionsList (Backend_Outputter $o, $conditions)
 
 _paintCondition (Backend_Outputter $o, $conditions, $condition_id)
 
 _processCondition ($condition_id, $condition_type, &$condition_options)
 
 _getAcceptLanguageOptions ()
 
- Protected Member Functions inherited from Config
 _paintConfigVar ($var_name, $value, $var_export=TRUE)
 

Detailed Description

Definition at line 39 of file context_config.inc.

Constructor & Destructor Documentation

__construct ( )

Constructor

Returns
void

Definition at line 76 of file context_config.inc.

Member Function Documentation

_getAcceptLanguageOptions ( )
protected

Get Accept-Language options

Returns
array

Definition at line 1578 of file context_config.inc.

_getContextErrors (   $context)
protected

Returns a list of errors with this context

If the context is valid, no errors will be returned (the return will be empty array). If the return is not empty, assume the context is NOT valid.

Context errors will be keyed in two ways: 'context' Whole-of-context-level errors. (for instance, requiring "at least 3" with only two conditions)

'condition' Condition-level errors caused by a combination of conditions. For instance, conditions that negate each other.

integer key Condition-level errors affecting a single condition. Key is the condition ID.

The splitting of context errors by condition allows the paint functions to paint the errors next to/underneath the condition to which it applies.

Parameters
array$contextDetails of a context
Returns
array

Definition at line 601 of file context_config.inc.

_getReorderJS ( )
protected

Return fragment code required for reordering the conditions

This script creates a top-level "ContextConfig" object, containing the required code. To set up the reordering in the backend, use: $o->addOnLoad('ContextConfig.setup();'); Where $o is a Backend_Outputter object.

Returns
string

Definition at line 430 of file context_config.inc.

_getSummaryConditionList (   $conditions)
protected

Generates a human-readable summary from the condition list of a contexts

Returns an array of readable condition summaries. This can then be styled as desired in the summary table.

Parameters
array$conditionsThe list of conditions
Returns
array

Definition at line 525 of file context_config.inc.

_paintCondition ( Backend_Outputter  $o,
  $conditions,
  $condition_id 
)
protected

Paints a single condition's interface

Parameters
Backend_Outputter$oThe outputter class for this editing interface
array$conditionsThe list of the conditions, in no particular order
int$condition_idThe condition currently being painted
Returns
void

Definition at line 794 of file context_config.inc.

_paintConditionsList ( Backend_Outputter  $o,
  $conditions 
)
protected

Paints a table of conditions for an alternate context

Parameters
Backend_Outputter$oThe outputter class for this editing interface
array$conditionsThe list of the conditions, in no particular order
Returns
void

Definition at line 746 of file context_config.inc.

_processCondition (   $condition_id,
  $condition_type,
$condition_options 
)
protected

Process a single condition

Parameters
int$condition_idThe ID of the condition being processed - used mainly for POST vars
string$condition_typeThe type of condition we are processing
array&$condition_optionsOptions for this condition - can be processed in place
Returns
void

Definition at line 1346 of file context_config.inc.

load ( )

Load contexts from database

Returns
array

Definition at line 1416 of file context_config.inc.

paintBackend ( $o)

Paints the interface for our config options.

If you (as a sub-class) put your config vars so that when they are submitted appear in $_POST[get_class($this)] then you probably won't need to override processBackend()

Parameters
object&$oBackend_Outputter, reference to the backend outputter
Returns
void public
See Also
processBackend()

Definition at line 98 of file context_config.inc.

paintMatchOrder ( Backend_Outputter  $o,
Array  $match_order,
  $write_access 
)

Paints the edit interface for changing the context matching order

Parameters
Backend_Outputter$oThe backend outputter being used
array$match_orderThe current matching order list (ie. SQ_CONTEXT_MATCH_ORDER)
boolean$write_accessTRUE if write access available
Returns
void

Definition at line 1043 of file context_config.inc.

paintSelectedContext ( Backend_Outputter  $o,
Array  $contexts,
  $current_context 
)

Paints the edit interface for the currently selected context

Note: Write access is not sent to this function since it is only displayed when you are able to edit a context, ie. write access must be TRUE.

Parameters
Backend_Outputter$oThe backend outputter being used
array$contextsThe list of currently available contexts (ie. SQ_CONTEXT_DEFINITIONS)
int$current_contextThe context being edited
Returns
void

Definition at line 661 of file context_config.inc.

paintSummary ( Backend_Outputter  $o,
Array  $contexts,
  $write_access,
  $current_context = NULL 
)

Paints the summary of contexts, and interface to allow select one for editing

Parameters
Backend_Outputter$oThe backend outputter being used
array$contextsThe list of currently available contexts (ie. SQ_CONTEXT_DEFINITIONS)
boolean$write_accessTRUE if write access available
int$current_contextCurrently selected context. Used for highlighting the selection being edited.
Returns
void

Definition at line 167 of file context_config.inc.

processBackend ( Backend_Outputter  $o)

Process the entire screen

Parameters
Backend_Outputter$oThe backend
array$match_orderThe current matching order list (ie. SQ_CONTEXT_MATCH_ORDER)
Returns
void

Definition at line 1073 of file context_config.inc.

processMatchOrder ( Backend_Outputter  $o,
Array  $match_order 
)

Processes the edit interface for changing the context matching order

Parameters
Backend_Outputter$oThe backend outputter being used
array$match_orderThe current matching order list (ie. SQ_CONTEXT_MATCH_ORDER)
Returns
void

Definition at line 1058 of file context_config.inc.

processSelectedContext ( Backend_Outputter  $o,
Array  $contexts,
  $current_context 
)

Processes the edit interface for the currently selected context

Parameters
Backend_Outputter$oThe backend outputter being used
array$contextsThe list of currently available contexts (ie. SQ_CONTEXT_DEFINITIONS)
int$current_contextThe context being edited
Returns
void

Definition at line 1027 of file context_config.inc.

save (   $vars,
  $backup_existing = FALSE 
)

Rewrites the configuration with current variables

This needs to be completely overridden since this config will save to DB rather than to config file. Since we control processBackend() here, this is completely fine.

Returns TRUE on successful write to DB, FALSE otherwise.

Parameters
array$varsan array with the new set of variables Array(string => mixed)
boolean$backup_existingIgnored here as we don't have a config file
Returns
boolean public

Definition at line 1453 of file context_config.inc.

Field Documentation

$config_vars
Initial value:
= Array(
'SQ_CONTEXT_DEFINITIONS' => Array('editable' => 1, 'default' => 'a:0:{}'),
)

Definition at line 46 of file context_config.inc.


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