Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

SelectElement Class Reference

Inheritance diagram for SelectElement:

Inheritance graph
List of all members.

Detailed Description

A single XHTML control which can support a choice of options.

This is an implementation of a type of form control which both appears as a single element as well as supporting the selection of options. A combo box and drop down list are two such existing controls.

The functionality is implemented by extending a ControlElement to contain a ControlChoice. The ControlChoice interface is then implemented and calls are chained to the contained ControlChoice instance.

Definition at line 2692 of file controls.php.

Public Member Functions

 SelectElement ($choice=null)
 The SelectElement constructor.

 setAttribute ($name, $value)
 Set an attribute.

 toXHTML ()
 Serialise the object to an XHTML string.

 isSimpleControl ()
 Check whether this is a simple control.

 submitsMultipleValues ()
 Check whether this control submits multiple values.

 setId ($id)
 Set the unique ID.

 getValue ()
 Get the control's value.

 setControlName ($name)
 Set the control's name.

 triggerActions ()
 Trigger all actions associated with the control.

 eventHasOccurred ($event)
 Check whether an event has occurred.

 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.

 selectedCount ()
 Get the number of currently selected controls.

 getSelectedIds ()
 Get the currently selected Option IDs.

 getSelectedControls ()
 Get the currently selected Options.

 select ($id)
 Select an Option by ID.

 selected ($id)
 Check whether an option is selected.

 deselect ($id)
 Deselect an Option.

 triggerChildActions ()
 Trigger all actions of the contained controls.

getByValue ($value)
 Get a control that has a certain value.

get ($id)
 Get a control.

 add (&$control)
 Add a control.

 exists ($id)
 Check whether a control exists.

remove ($id)
 Remove and return a control.

 getAllIds ()
 Get all control IDs.

 getAllControls ()
 Get all controls.

 getDisplayableIds ()
 Get the IDs of controls which can be displayed.

 getDisplayableControls ()
 Get the controls which can be displayed.

 childDisplay ($id)
 Check whether a contained control can be displayed.

 childToString ($id)
 Get a string representation of a contained control.

 childUpdated ($id)
 Check whether a contained control has been updated.

 __wakeup ()
 Initialise control after unserialisation.

 __sleep ()
 Prepare object for serialisation.


Public Attributes

 $controlchoice
 The ControlChoice instance.


Constructor & Destructor Documentation

SelectElement::SelectElement choice = null  ) 
 

The SelectElement constructor.

Parameters:
$choice an array of choices with which to create Option controls

Definition at line 2701 of file controls.php.

References select().


Member Function Documentation

SelectElement::__sleep  ) 
 

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.

Returns:
an array of object property names to be serialised.

Reimplemented from ControlElement.

Definition at line 3004 of file controls.php.

SelectElement::__wakeup  ) 
 

Initialise control after unserialisation.

Checks for a POST variable corresponding to this control and processes it if found.

Returns:
void

Reimplemented from ControlElement.

Definition at line 2993 of file controls.php.

SelectElement::add &$  control  ) 
 

Add a control.

Parameters:
$control a reference to the control
Returns:
void

Definition at line 2903 of file controls.php.

& SelectElement::addChoice value,
label = null,
selected = false
 

Add an Option.

Parameters:
$value the value for the option
$label the label for the option
$selected true if the Option is to be selected, false otherwise
Returns:
a reference to the newly instantiated control

Definition at line 2809 of file controls.php.

References selected().

SelectElement::childDisplay id  ) 
 

Check whether a contained control can be displayed.

Parameters:
$id the ID of the control
Returns:
true if the control can be displayed, false otherwise

Definition at line 2966 of file controls.php.

SelectElement::childToString id  ) 
 

Get a string representation of a contained control.

Parameters:
$id the ID of the control
Returns:
the serialised control

Definition at line 2975 of file controls.php.

SelectElement::childUpdated id  ) 
 

Check whether a contained control has been updated.

Parameters:
$id the ID of the control
Returns:
the result of calling ControlElement::updated() on the child

Definition at line 2984 of file controls.php.

SelectElement::deselect id  ) 
 

Deselect an Option.

Parameters:
$id the ID of the option to deselect
Returns:
the result of calling Option::deselect()

Definition at line 2863 of file controls.php.

SelectElement::eventHasOccurred event  ) 
 

Check whether an event has occurred.

Returns:
true if the event has occurred, false otherwise

Reimplemented from ControlElement.

Definition at line 2772 of file controls.php.

References FC_EVENT_UPDATE.

SelectElement::exists id  ) 
 

Check whether a control exists.

Parameters:
$id the id of the control
Returns:
true if the control exists, false otherwise

Definition at line 2912 of file controls.php.

& SelectElement::get id  ) 
 

Get a control.

Parameters:
$id the id of the control
Returns:
a reference to the control

Definition at line 2894 of file controls.php.

SelectElement::getAllControls  ) 
 

Get all controls.

Returns:
an array of references to the controls

Definition at line 2939 of file controls.php.

SelectElement::getAllIds  ) 
 

Get all control IDs.

Returns:
a list of control IDs

Definition at line 2930 of file controls.php.

& SelectElement::getByValue value  ) 
 

Get a control that has a certain value.

If a control has the specified value, it is returned. Only the first such matching control is returned.

Parameters:
$value the value to be checked
Returns:
a reference to the control, or null if no control has a matching value

Definition at line 2885 of file controls.php.

SelectElement::getControlClass  ) 
 

Get the class from which Options are instantiated.

Returns:
the class name

Definition at line 2799 of file controls.php.

SelectElement::getDisplayableControls  ) 
 

Get the controls which can be displayed.

Returns:
an array of references to controls

Definition at line 2957 of file controls.php.

SelectElement::getDisplayableIds  ) 
 

Get the IDs of controls which can be displayed.

Returns:
an array of IDs

Definition at line 2948 of file controls.php.

SelectElement::getSelectedControls  ) 
 

Get the currently selected Options.

Returns:
an array of references to controls

Definition at line 2836 of file controls.php.

SelectElement::getSelectedIds  ) 
 

Get the currently selected Option IDs.

Returns:
an array of control IDs

Definition at line 2827 of file controls.php.

SelectElement::getValue  ) 
 

Get the control's value.

An interface for retrieving a control's value. This should be overridden in a subclass to return a value.

Returns:
void

Reimplemented from ControlElement.

Definition at line 2754 of file controls.php.

SelectElement::isSimpleControl  ) 
 

Check whether this is a simple control.

A simple control is a control that does not contain other controls.

Returns:
true if it is a simple control, false otherwise

Reimplemented from ControlElement.

Definition at line 2738 of file controls.php.

& SelectElement::remove id  ) 
 

Remove and return a control.

Parameters:
$id the id of the control to remove
Returns:
a reference to the control or false if it does not exist

Definition at line 2921 of file controls.php.

SelectElement::select id  ) 
 

Select an Option by ID.

Parameters:
$id the ID of the option to select
Returns:
the result of calling Option::select() on the option

Definition at line 2845 of file controls.php.

Referenced by SelectElement().

SelectElement::selected id  ) 
 

Check whether an option is selected.

Parameters:
$id the ID of the option to check
Returns:
true if the option is selected, false otherwise

Definition at line 2854 of file controls.php.

Referenced by addChoice().

SelectElement::selectedCount  ) 
 

Get the number of currently selected controls.

Returns:
an integer

Definition at line 2818 of file controls.php.

SelectElement::setAttribute name,
value
 

Set an attribute.

Parameters:
$name the name of the attribute
$value the value of the attribute
Returns:
void

Reimplemented from XHTMLElement.

Definition at line 2711 of file controls.php.

SelectElement::setControlClass control_class  ) 
 

Set the class from which Options are instantiated.

Parameters:
$control_class the class name
Returns:
void

Definition at line 2789 of file controls.php.

SelectElement::setControlName name  ) 
 

Set the control's name.

Warning:
If the name is not valid, an error is raised.
Returns:
void

Reimplemented from ControlElement.

Definition at line 2759 of file controls.php.

SelectElement::setId id  ) 
 

Set the unique ID.

Parameters:
$id the ID string

Reimplemented from ControlElement.

Definition at line 2748 of file controls.php.

SelectElement::submitsMultipleValues  ) 
 

Check whether this control submits multiple values.

A control that submits multiple values is a control such as a checkbox or multiple select.

Returns:
true if the control is capable of submitting multiple values, false otherwise

Reimplemented from ControlElement.

Reimplemented in MultipleSelect.

Definition at line 2743 of file controls.php.

SelectElement::toXHTML  ) 
 

Serialise the object to an XHTML string.

Returns:
the XHTML string

Reimplemented from XHTMLElement.

Definition at line 2721 of file controls.php.

SelectElement::triggerActions  ) 
 

Trigger all actions associated with the control.

ControlElement::triggerAction() is called for each of the control's actions.

Returns:
void

Reimplemented from ControlElement.

Definition at line 2766 of file controls.php.

SelectElement::triggerChildActions  ) 
 

Trigger all actions of the contained controls.

Returns:
void

Definition at line 2876 of file controls.php.


Member Data Documentation

SelectElement::$controlchoice
 

The ControlChoice instance.

Definition at line 2695 of file controls.php.


The documentation for this class was generated from the following file:
Generated on Mon Feb 14 11:39:53 2005 for FormControls by doxygen 1.3.5