|
Moodle
2.2.1
http://www.collinsharper.com
|


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 | |
Class to dynamically create an HTML SELECT
Definition at line 33 of file select.php.
| addOption | ( | $ | text, |
| $ | value, | ||
| $ | attributes = null |
||
| ) |
Adds a new OPTION to the SELECT
| string | $text | Display text for the OPTION |
| string | $value | Value for the OPTION |
| mixed | $attributes | Either a typical HTML attribute string or an associative array |
Definition at line 293 of file select.php.


| apiVersion | ( | ) |
Returns the current API version
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.

| getFrozenHtml | ( | ) |
Returns the value of field without HTML tags
Reimplemented from HTML_QuickForm_element.
Definition at line 509 of file select.php.


| getMultiple | ( | ) |
Returns the select mutiple attribute
Definition at line 274 of file select.php.


| getName | ( | ) |
Returns the element name
Reimplemented from HTML_QuickForm_element.
Definition at line 158 of file select.php.


| getPrivateName | ( | ) |
Returns the element name (possibly with brackets appended)
Definition at line 173 of file select.php.


| getSelected | ( | ) |
Returns an array of the selected values
Definition at line 127 of file select.php.
| getSize | ( | ) |
Returns the select field size
Definition at line 239 of file select.php.

| getValue | ( | ) |
Returns an array of the selected values
Reimplemented from HTML_QuickForm_element.
Definition at line 208 of file select.php.

| HTML_QuickForm_select | ( | $ | elementName = null, |
| $ | elementLabel = null, |
||
| $ | options = null, |
||
| $ | attributes = null |
||
| ) |
Class constructor
| string | Select name attribute |
| mixed | Label(s) for the select |
| mixed | Data to be used to populate options |
| mixed | Either a typical HTML attribute string or an associative array |
Definition at line 69 of file select.php.


| 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.
| mixed | $options | Options 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 |
| PEAR_Error |
Definition at line 440 of file select.php.


| loadArray | ( | $ | arr, |
| $ | values = null |
||
| ) |
Loads the options from an associative array
| array | $arr | Associative array of options |
| mixed | $values | (optional) Array or comma delimited string of selected values |
| PEAR_Error |
Definition at line 326 of file select.php.


| 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
| object | $result | DB_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 |
| PEAR_Error |
Definition at line 358 of file select.php.


| loadQuery | ( | &$ | conn, |
| $ | sql, | ||
| $ | textCol = null, |
||
| $ | valueCol = null, |
||
| $ | values = null |
||
| ) |
Queries a database and loads the options from the results
| mixed | $conn | Either an existing DB connection or a valid dsn |
| string | $sql | SQL 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 |
| PEAR_Error |
Definition at line 393 of file select.php.


| onQuickFormEvent | ( | $ | event, |
| $ | arg, | ||
| &$ | caller | ||
| ) |
Called by HTML_QuickForm whenever form event is made on this element
| string | $event | Name of event |
| mixed | $arg | event arguments |
| object | $caller | calling object |
Reimplemented from HTML_QuickForm_element.
Reimplemented in MoodleQuickForm_modgrade, MoodleQuickForm_selectyesno, and MoodleQuickForm_modvisible.
Definition at line 581 of file select.php.

| setMultiple | ( | $ | multiple | ) |
Sets the select mutiple attribute
| bool | $multiple | Whether the select supports multi-selections |
Definition at line 255 of file select.php.

| setName | ( | $ | name | ) |
Sets the input field name
| string | $name | Input field name attribute |
Reimplemented from HTML_QuickForm_element.
Definition at line 143 of file select.php.


| setSelected | ( | $ | values | ) |
Sets the default values of the select box
| mixed | $values | Array or comma delimited string of selected values |
Definition at line 105 of file select.php.


| setSize | ( | $ | size | ) |
Sets the select field size, only applies to 'multiple' selects
| int | $size | Size of select field |
Definition at line 224 of file select.php.

| setValue | ( | $ | value | ) |
Sets the value of the form element
| mixed | $values | Array or comma delimited string of selected values |
Reimplemented from HTML_QuickForm_element.
Definition at line 193 of file select.php.


| toHtml | ( | ) |
Returns the SELECT in HTML
Reimplemented from HTML_Common.
Reimplemented in HTML_QuickForm_hiddenselect, MoodleQuickForm_searchableselector, MoodleQuickForm_selectwithlink, and MoodleQuickForm_select.
Definition at line 465 of file select.php.

| $_options = array() |
Definition at line 44 of file select.php.
| $_values = null |
Definition at line 53 of file select.php.