Base block infrastructure common to all blocks. More...
Public Member Functions | |
main () | |
Body of the block. More... | |
id () | |
Get block id without namespaces. | |
fullId () | |
Get full block id (including all parent namespaces). | |
blockName () | |
Get block type. | |
status () | |
Get block state. | |
statusMessage () | |
Get status message - usually contains an error message why block failed. | |
getCascadeController () | |
Get CascadeController which owns this block. | |
getTimestamps () | |
Get profiler data. More... | |
visibleBlockNames () | |
List all visible block names already in cascade (for debugging only) More... | |
Public Attributes | |
const | force_exec = false |
Default value of 'force_exec' flag. More... | |
Static Public Attributes | |
static | $STATUS_NAMES |
Map block state constants to strings. More... | |
Protected Attributes | |
$inputs | |
List of inputs and their default values. More... | |
$connections | |
List of default input connections (all inputs mentioned here must be present in $inputs array too) More... | |
$outputs | |
List of outputs (no default values) More... | |
$context | |
Global context. More... | |
Block states | |
const | QUEUED = 0x00 |
The block is waiting for execution. | |
const | RUNNING = 0x01 |
The block or its dependencies are being evaluated. | |
const | ZOMBIE = 0x02 |
The block is finished, exist only to maintain its outputs. | |
const | DISABLED = 0x04 |
The block is disabled, its 'enable' input is false. | |
const | FAILED = 0x08 |
The block has failed, because its inputs cannot be connected, or its dependencies cannot be solved, or it threw an exception. More... | |
Part of Cascade Controller | |
These methods should not be used by anything except the CascadeController. Consider them private. | |
cc_init ($parent, $id, $full_id, $cascade_controller, $block_name, $context, $initial_status=self::QUEUED, $initial_status_message=null) | |
cc_connect (array $in_connections, array $in_values) | |
cc_registerBlock ($block) | |
cc_resolveBlockName ($block_name) | |
cc_execute () | |
cc_getOutput ($name) | |
cc_connections () | |
cc_outputs () | |
cc_outputCache () | |
cc_forwardedOutputs () | |
cc_outputExists ($name, $accept_wildcard=true) | |
cc_getNamespace () | |
cc_executionTime () | |
cc_dumpNamespace ($level=1) | |
cc_describeBlock () | |
Inputs and outputs | |
getOutput ($name) | |
Calculate output value on demand. More... | |
in ($name) | |
Get value from input. | |
inAll () | |
Get values from all inputs. | |
inputNames () | |
Get all input names, excluding common inputs (enable and * ) | |
collectNumericInputs () | |
Collect values from numeric inputs - works well with vsprintf() More... | |
out ($name, $value) | |
Set value to output. | |
outAll ($values) | |
Set all output values. More... | |
outForward ($name, $source_block, $source_name=null) | |
Forward output from another block. More... | |
Template helpers | |
templateAdd ($id_suffix, $template, $data=array()) | |
Add output object to template subsystem. | |
templateAddToSlot ($id_suffix, $slot, $weight, $template, $data=array()) | |
Add output object to template subsystem (with slot and weight) | |
templateSetPageTitle ($title, $format=null) | |
Set page title. | |
templateSetType ($type) | |
Set output type. | |
templateOptionSet ($slot, $option, $value) | |
Set slot option. | |
templateOptionAppend ($slot, $option, $value) | |
Append value to slot option (which is list) | |
Cascade manipulation helpers | |
cascadeAdd ($id, $block, $force_exec=null, $in_connections=array(), $in_values=array(), $context=null) | |
Add block to cascade. | |
cascadeAddFromArray ($array_of_blocks, $context=null) | |
Add array of blocks to cascade (calls cascadeAdd() for each item). More... | |
cascadeGetErrors () | |
Get errors from cascade controller (errors can occur when cascade_add or cascade_add_from_ini is called) | |
Authentication & Authorization helpers | |
auth () | |
Get auth object from cascade controller. | |
authIsBlockAllowed ($block_name, &$details=null) | |
Check if block is allowed before cascade controller loads it. | |
Base block infrastructure common to all blocks.
|
abstract |
Body of the block.
The method called when block is evaluated.
|
final |
Get profiler data.
Returns array of timestams, when block has been created, started and finished.
|
final |
List all visible block names already in cascade (for debugging only)
|
final |
|
finalprotected |
Collect values from numeric inputs - works well with vsprintf()
|
finalprotected |
Set all output values.
Keys are output names. Outputs missing in $values are unset.
|
finalprotected |
Forward output from another block.
Output value of $source_block:$source_name output is copied to local output $name.
|
finalprotected |
Add array of blocks to cascade (calls cascadeAdd() for each item).
Items in $array_of_blocks look like this:
array( 'block' => 'block/type', 'force_exec' => true/false/null, 'in_con' => array( ... like Block::$connections ... ), 'in_val' => array( ... like Block::$inputs ... ), ),
Unknown keys are ignored.
public function getOutput | ( | $name | ) |
Calculate output value on demand.
If some output is not always used and is hard to compute, do not set output value in main(). Implement this method instead.
const FAILED = 0x08 |
The block has failed, because its inputs cannot be connected, or its dependencies cannot be solved, or it threw an exception.
const force_exec = false |
Default value of 'force_exec' flag.
It is used only when adding this block into cascade (not when calling CascadeController::addBlock() from this class). This is used when force_exec arg. is null (or not set at all).
|
static |
Map block state constants to strings.
|
protected |
List of inputs and their default values.
|
protected |
List of default input connections (all inputs mentioned here must be present in $inputs array too)
|
protected |
List of outputs (no default values)
|
protected |
Global context.
A not-so-ugly way to make global things nice.