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

Option Class Reference

Inheritance diagram for Option:

Inheritance graph
List of all members.

Detailed Description

An option element.

An option is not used as a control on its own. Instead it is used by a control that offers choices (e.g. checkbox). The FC_EVENT_SELECT and FC_EVENT_DESELECT events are supported to enable the option to be selected and deselected.

Options also have labels to describe themselves.

Definition at line 1177 of file controls.php.

Public Member Functions

 Option ($value, $label=null, $control_name=null)
 The Option constructor.

 getValue ()
 Get the control's value.

 setValue ($value)
 Set the control's value.

 getControlName ()
 Get the control's name.

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

 getLabel ()
 Get the option's label.

 setLabel ($label)
 Set the option's label.

 selected ()
 Check whether the the option has been selected.

 select ()
 Flag the option as being selected.

 deselect ()
 Flag the option as not being selected.

 __sleep ()
 Prepare object for serialisation.


Public Attributes

 $control_name
 The option's name.


Constructor & Destructor Documentation

Option::Option value,
label = null,
control_name = null
 

The Option constructor.

Parameters:
$value the value of the option
$label the label of the option
$control_name the unique name for the control (also as appears in the HTTPD POST string)

Definition at line 1188 of file controls.php.

References FC_EVENT_DESELECT, and FC_EVENT_SELECT.


Member Function Documentation

Option::__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 1289 of file controls.php.

Option::deselect  ) 
 

Flag the option as not being selected.

Returns:
void

Definition at line 1278 of file controls.php.

References FC_EVENT_DESELECT, and FC_EVENT_SELECT.

Option::getControlName  ) 
 

Get the control's name.

Returns:
the control's name as a string

Reimplemented from ControlElement.

Definition at line 1216 of file controls.php.

Option::getLabel  ) 
 

Get the option's label.

Returns:
the label or null if one has not been set

Definition at line 1235 of file controls.php.

Option::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 1202 of file controls.php.

Option::select  ) 
 

Flag the option as being selected.

Returns:
void

Definition at line 1267 of file controls.php.

References FC_EVENT_DESELECT, and FC_EVENT_SELECT.

Option::selected  ) 
 

Check whether the the option has been selected.

Returns:
true if the option is selected, false otherwise

Definition at line 1258 of file controls.php.

Option::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 1221 of file controls.php.

Option::setLabel label  ) 
 

Set the option's label.

Parameters:
$label the label string
Returns:
true if the label was successfully set, false otherwise

Definition at line 1245 of file controls.php.

Option::setValue value  ) 
 

Set the control's value.

This sets the control's value and flags the control has having been updated.

Returns:
void

Reimplemented from ControlElement.

Definition at line 1207 of file controls.php.


Member Data Documentation

Option::$control_name
 

The option's name.

Definition at line 1180 of file controls.php.


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