This class extends a ControlContainer an also implements the interface of a ControlElement. As such it provides the basis for all 'complex' controls where an user choice is possible (e.g. <select/>) by allowing Option controls to be contained within it.
Definition at line 1946 of file controls.php.
Public Member Functions | |
ControlChoice ($control_class, $choice) | |
The ControlChoice constructor. | |
isSimpleControl () | |
Check whether this is a simple control. | |
submitsMultipleValues () | |
Check whether this control submits multiple values. | |
display () | |
Check whether this control should be displayed. | |
setDisplay ($display) | |
Decide whether this control should be displayed. | |
checkControlName ($name) | |
Check a control name. | |
setControlName ($name) | |
Set the control's name. | |
getControlName () | |
Get the control's name. | |
updated () | |
Check whether the control has been updated. | |
getId () | |
Get the unique ID. | |
setId ($id) | |
Set the unique ID. | |
getValue () | |
Get the control's value. | |
setValue ($value) | |
Set the control's value. | |
addAction ($event, $name, $callback) | |
Add an action. | |
setActionTriggered ($name, $state) | |
Decide whether an action should be flagged as having been triggered. | |
actionTriggered ($name) | |
Check whether an action has been triggered. | |
& | getAction ($name) |
Get an action callback. | |
getEvent ($name) | |
Get the event(s) associated with a specific action. | |
getActionNames ($event=0) | |
Get the action names, optionally associated with a particular event. | |
getActions ($event=0) | |
Get the control actions, optionally associated with a particular event. | |
actionExists ($name) | |
Check whether an action exists. | |
triggerAction ($name) | |
Trigger an action. | |
removeAction ($name) | |
Remove an action. | |
triggerActions () | |
Trigger all actions associated with the control. | |
addEvent ($event) | |
Adds an event to the control. | |
eventHasOccurred ($event) | |
Check whether an event has occurred. | |
setEventHasOccurred ($event, $state) | |
Decide whether an event has occurred. | |
supportedEvents () | |
Get the events supported by the control. | |
isValidEvent ($event) | |
Check whether the control supports an event. | |
resetEvents () | |
Reset the status of the control's events. | |
add (&$control) | |
Add a control. | |
setControlClass ($control_class) | |
Set the class from which Options are instantiated. | |
getControlClass () | |
Get the class from which Options are instantiated. | |
& | addChoice ($value, $label=null, $selected=false) |
Add an Option. | |
getSelectedIds () | |
Get the currently selected Option IDs. | |
getSelectedControls () | |
Get the currently selected Options. | |
selectedCount () | |
Get the number of currently selected controls. | |
select ($id) | |
Select an Option by ID. | |
selected ($id) | |
Check whether an option is selected. | |
deselect ($id) | |
Deselect an Option. | |
toString () | |
| |
__wakeup () | |
Initialise object after unserialisation. | |
__sleep () | |
Prepare object for serialisation. | |
Public Attributes | |
$control_name | |
The name of the control. | |
$id | |
the unique ID of the control | |
$control_class | |
The class name of option elements. | |
$actions | |
A list of actions. | |
$selected | |
A list of selected control element IDs. | |
$display | |
Whether this control should be displayed. | |
$events | |
A list of supported events. |
|
The ControlChoice constructor.
Definition at line 1968 of file controls.php. References $control_class, $control_name, $id, FC_EVENT_UPDATE, and gen_control_name(). |
|
Prepare object for serialisation. This method is automatically called just before the object is serialised to carry out clean-up operations. See the PHP documentation at http://www.php.net/manual/en/language.oop.magic-functions.php for more information.
Reimplemented from ControlContainer. Definition at line 2551 of file controls.php. |
|
Initialise object after unserialisation. This method is automatically called just after the object is unserialised and ensures it is properly initialised. See the PHP documentation at http://www.php.net/manual/en/language.oop.magic-functions.php for more information.
Definition at line 2542 of file controls.php. |
|
Check whether an action exists.
Definition at line 2239 of file controls.php. |
|
Check whether an action has been triggered.
Definition at line 2172 of file controls.php. |
|
Add a control.
Reimplemented from ControlContainer. Definition at line 2394 of file controls.php. |
|
Add an action. Associate a callback routine with an event and a unique action name.
Definition at line 2142 of file controls.php. |
|
Add an Option.
Definition at line 2431 of file controls.php. References $control_class, and $selected. |
|
Adds an event to the control. If the event is not supported by the control, an error is raised.
Definition at line 2296 of file controls.php. |
|
Check a control name. Triggers an error if the control name is not valid.
Definition at line 2062 of file controls.php. References is_valid_control_name(). |
|
Deselect an Option.
Definition at line 2509 of file controls.php. |
|
Check whether this control should be displayed.
Definition at line 2041 of file controls.php. |
|
Check whether an event has occurred.
Definition at line 2308 of file controls.php. References FC_EVENT_UPDATE. |
|
Get an action callback.
Definition at line 2184 of file controls.php. |
|
Get the action names, optionally associated with a particular event. All action names registered with the control are returned unless a bitwise combination of FC_EVENT_* constants is passed as an argument in which case only those actions which support that event are returned.
Definition at line 2202 of file controls.php. |
|
Get the control actions, optionally associated with a particular event. All actions registered with the control are returned unless a bitwise combination of FC_EVENT_* constants is passed as an argument in which case only those actions which support that event are returned.
Definition at line 2223 of file controls.php. References $actions. |
|
Get the class from which Options are instantiated.
Definition at line 2419 of file controls.php. |
|
Get the control's name.
Definition at line 2088 of file controls.php. |
|
Get the event(s) associated with a specific action. If the action is associated with multiple events, the returned value can be checked with the bitwise operator to see what events it supports.
Definition at line 2193 of file controls.php. |
|
Get the unique ID.
Definition at line 2106 of file controls.php. |
|
Get the currently selected Options.
Definition at line 2463 of file controls.php. References $id. |
|
Get the currently selected Option IDs.
Definition at line 2448 of file controls.php. References $id. |
|
Get the control's value. An interface for retrieving a control's value. This should be overridden in a subclass to return a value.
Reimplemented in SingleChoice, and MultipleChoice. Definition at line 2124 of file controls.php. |
|
Check whether this is a simple control. A simple control is a control that does not contain other controls.
Definition at line 2023 of file controls.php. |
|
Check whether the control supports an event.
Definition at line 2364 of file controls.php. |
|
Remove an action. Removes an action from the control.
Definition at line 2271 of file controls.php. |
|
Reset the status of the control's events. All events are set as not having occurred, and all actions are set as not having been triggered.
Definition at line 2373 of file controls.php. References $events. |
|
Select an Option by ID.
Reimplemented in SingleChoice. Definition at line 2487 of file controls.php. |
|
Check whether an option is selected.
Definition at line 2498 of file controls.php. |
|
Get the number of currently selected controls.
Definition at line 2477 of file controls.php. |
|
Decide whether an action should be flagged as having been triggered.
Definition at line 2160 of file controls.php. |
|
Set the class from which Options are instantiated.
Definition at line 2409 of file controls.php. References $control_class. |
|
Set the control's name.
Definition at line 2072 of file controls.php. References $id. |
|
Decide whether this control should be displayed.
Definition at line 2050 of file controls.php. References $display. |
|
Decide whether an event has occurred.
Definition at line 2329 of file controls.php. |
|
Set the unique ID.
Definition at line 2115 of file controls.php. References $id. |
|
Set the control's value. This sets the control's value and flags the control has having been updated.
Definition at line 2132 of file controls.php. |
|
Check whether this control submits multiple values. A control that submits multiple values is a control such as a checkbox or multiple select.
Reimplemented in MultipleChoice. Definition at line 2032 of file controls.php. |
|
Get the events supported by the control.
Definition at line 2347 of file controls.php. References $events. |
|
Definition at line 2521 of file controls.php. |
|
Trigger an action. The callback routine associated with a particular action is executed if the event associated with the action has occurred.
Definition at line 2248 of file controls.php. |
|
Trigger all actions associated with the control. ControlElement::triggerAction() is called for each of the control's actions.
Definition at line 2280 of file controls.php. |
|
Check whether the control has been updated. Checks whether the FC_EVENT_UPDATE event has occurred.
Definition at line 2097 of file controls.php. References FC_EVENT_UPDATE. |
|
A list of actions.
Definition at line 1955 of file controls.php. Referenced by getActions(). |
|
The class name of option elements.
Definition at line 1953 of file controls.php. Referenced by addChoice(), ControlChoice(), and setControlClass(). |
|
The name of the control.
Definition at line 1949 of file controls.php. Referenced by ControlChoice(). |
|
Whether this control should be displayed.
Definition at line 1959 of file controls.php. Referenced by setDisplay(). |
|
A list of supported events.
Definition at line 1961 of file controls.php. Referenced by resetEvents(), and supportedEvents(). |
|
the unique ID of the control
Definition at line 1951 of file controls.php. Referenced by ControlChoice(), getSelectedControls(), getSelectedIds(), setControlName(), and setId(). |
|
A list of selected control element IDs.
Definition at line 1957 of file controls.php. Referenced by addChoice(). |