Moodle  2.2.1
http://www.collinsharper.com
HTML_QuickForm_select Class Reference
Inheritance diagram for HTML_QuickForm_select:
Collaboration diagram for HTML_QuickForm_select:

Public Member Functions

 HTML_QuickForm_select ($elementName=null, $elementLabel=null, $options=null, $attributes=null)
 apiVersion ()
 setSelected ($values)
 getSelected ()
 setName ($name)
 getName ()
 getPrivateName ()
 setValue ($value)
 getValue ()
 setSize ($size)
 getSize ()
 setMultiple ($multiple)
 getMultiple ()
 addOption ($text, $value, $attributes=null)
 loadArray ($arr, $values=null)
 loadDbResult (&$result, $textCol=null, $valueCol=null, $values=null)
 loadQuery (&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
 load (&$options, $param1=null, $param2=null, $param3=null, $param4=null)
 toHtml ()
 getFrozenHtml ()
 exportValue (&$submitValues, $assoc=false)
 onQuickFormEvent ($event, $arg, &$caller)

Data Fields

 $_options = array()
 $_values = null

Detailed Description

Class to dynamically create an HTML SELECT

Author:
Adam Daniel <adaniel1@eesus.jnj.com>
Bertrand Mansion <bmansion@mamasam.com>
Version:
1.0
Since:
PHP4.04pl1 public

Definition at line 33 of file select.php.


Member Function Documentation

addOption ( text,
value,
attributes = null 
)

Adds a new OPTION to the SELECT

Parameters:
string$textDisplay text for the OPTION
string$valueValue for the OPTION
mixed$attributesEither a typical HTML attribute string or an associative array
Since:
1.0 public
Returns:
void

Definition at line 293 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the current API version

Since:
1.0 public
Returns:
double

Reimplemented from HTML_QuickForm_element.

Definition at line 89 of file select.php.

exportValue ( &$  submitValues,
assoc = false 
)

We check the options and return only the values that _could_ have been selected. We also return a scalar value if select is not "multiple"

Reimplemented from HTML_QuickForm_element.

Reimplemented in MoodleQuickForm_selectwithlink, and MoodleQuickForm_select.

Definition at line 550 of file select.php.

Here is the call graph for this function:

Returns the value of field without HTML tags

Since:
1.0 public
Returns:
string

Reimplemented from HTML_QuickForm_element.

Definition at line 509 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the select mutiple attribute

Since:
1.2 public
Returns:
bool true if multiple select, false otherwise

Definition at line 274 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getName ( )

Returns the element name

Since:
1.0 public
Returns:
string

Reimplemented from HTML_QuickForm_element.

Definition at line 158 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the element name (possibly with brackets appended)

Since:
1.0 public
Returns:
string

Definition at line 173 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns an array of the selected values

Since:
1.0 public
Returns:
array of selected values

Definition at line 127 of file select.php.

getSize ( )

Returns the select field size

Since:
1.0 public
Returns:
int

Definition at line 239 of file select.php.

Here is the call graph for this function:

getValue ( )

Returns an array of the selected values

Since:
1.0 public
Returns:
array of selected values

Reimplemented from HTML_QuickForm_element.

Definition at line 208 of file select.php.

Here is the caller graph for this function:

HTML_QuickForm_select ( elementName = null,
elementLabel = null,
options = null,
attributes = null 
)

Class constructor

Parameters:
stringSelect name attribute
mixedLabel(s) for the select
mixedData to be used to populate options
mixedEither a typical HTML attribute string or an associative array
Since:
1.0 public
Returns:
void

Definition at line 69 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load ( &$  options,
param1 = null,
param2 = null,
param3 = null,
param4 = null 
)

Loads options from different types of data sources

This method is a simulated overloaded method. The arguments, other than the first are optional and only mean something depending on the type of the first argument. If the first argument is an array then all arguments are passed in order to loadArray. If the first argument is a db_result then all arguments are passed in order to loadDbResult. If the first argument is a string or a DB connection then all arguments are passed in order to loadQuery.

Parameters:
mixed$optionsOptions source currently supports assoc array or DB_result
mixed$param1(optional) See function detail
mixed$param2(optional) See function detail
mixed$param3(optional) See function detail
mixed$param4(optional) See function detail
Since:
1.1 public
Returns:
PEAR_Error on error or true
Exceptions:
PEAR_Error

Definition at line 440 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

loadArray ( arr,
values = null 
)

Loads the options from an associative array

Parameters:
array$arrAssociative array of options
mixed$values(optional) Array or comma delimited string of selected values
Since:
1.0 public
Returns:
PEAR_Error on error or true
Exceptions:
PEAR_Error

Definition at line 326 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

loadDbResult ( &$  result,
textCol = null,
valueCol = null,
values = null 
)

Loads the options from DB_result object

If no column names are specified the first two columns of the result are used as the text and value columns respectively

Parameters:
object$resultDB_result object
string$textCol(optional) Name of column to display as the OPTION text
string$valueCol(optional) Name of column to use as the OPTION value
mixed$values(optional) Array or comma delimited string of selected values
Since:
1.0 public
Returns:
PEAR_Error on error or true
Exceptions:
PEAR_Error

Definition at line 358 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

loadQuery ( &$  conn,
sql,
textCol = null,
valueCol = null,
values = null 
)

Queries a database and loads the options from the results

Parameters:
mixed$connEither an existing DB connection or a valid dsn
string$sqlSQL query string
string$textCol(optional) Name of column to display as the OPTION text
string$valueCol(optional) Name of column to use as the OPTION value
mixed$values(optional) Array or comma delimited string of selected values
Since:
1.1 public
Returns:
void
Exceptions:
PEAR_Error

Definition at line 393 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

onQuickFormEvent ( event,
arg,
&$  caller 
)

Called by HTML_QuickForm whenever form event is made on this element

Parameters:
string$eventName of event
mixed$argevent arguments
object$callercalling object
Since:
1.0 public
Returns:
void

Reimplemented from HTML_QuickForm_element.

Reimplemented in MoodleQuickForm_modgrade, MoodleQuickForm_selectyesno, and MoodleQuickForm_modvisible.

Definition at line 581 of file select.php.

Here is the call graph for this function:

setMultiple ( multiple)

Sets the select mutiple attribute

Parameters:
bool$multipleWhether the select supports multi-selections
Since:
1.2 public
Returns:
void

Definition at line 255 of file select.php.

Here is the call graph for this function:

setName ( name)

Sets the input field name

Parameters:
string$nameInput field name attribute
Since:
1.0 public
Returns:
void

Reimplemented from HTML_QuickForm_element.

Definition at line 143 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

setSelected ( values)

Sets the default values of the select box

Parameters:
mixed$valuesArray or comma delimited string of selected values
Since:
1.0 public
Returns:
void

Definition at line 105 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

setSize ( size)

Sets the select field size, only applies to 'multiple' selects

Parameters:
int$sizeSize of select field
Since:
1.0 public
Returns:
void

Definition at line 224 of file select.php.

Here is the call graph for this function:

setValue ( value)

Sets the value of the form element

Parameters:
mixed$valuesArray or comma delimited string of selected values
Since:
1.0 public
Returns:
void

Reimplemented from HTML_QuickForm_element.

Definition at line 193 of file select.php.

Here is the call graph for this function:

Here is the caller graph for this function:

toHtml ( )

Returns the SELECT in HTML

Since:
1.0 public
Returns:
string

Reimplemented from HTML_Common.

Reimplemented in HTML_QuickForm_hiddenselect, MoodleQuickForm_searchableselector, MoodleQuickForm_selectwithlink, and MoodleQuickForm_select.

Definition at line 465 of file select.php.

Here is the call graph for this function:


Field Documentation

$_options = array()

Definition at line 44 of file select.php.

$_values = null

Definition at line 53 of file select.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations