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

Public Member Functions

 MoodleQuickForm_selectgroups ($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false)
 setSelected ($values)
 getSelected ()
 setName ($name)
 getName ()
 getPrivateName ()
 setValue ($value)
 getValue ()
 setSize ($size)
 getSize ()
 setMultiple ($multiple)
 getMultiple ()
 loadArrayOptGroups ($arr, $values=null)
 addOptGroup ($text, $value, $attributes=null)
 loadArrayOptions ($optgroup, $arr, $values=null)
 addOption ($optgroup, $text, $value, $attributes=null)
 toHtml ()
 getFrozenHtml ()
 exportValue (&$submitValues, $assoc=false)
 onQuickFormEvent ($event, $arg, &$caller)
 setHiddenLabel ($hiddenLabel)
 setHelpButton ($helpbuttonargs, $function='helpbutton')
 getHelpButton ()
 getElementTemplateType ()

Data Fields

 $showchoose = false
 $_optGroups = array()
 $_values = null
 $_helpbutton = ''
 $_hiddenLabel = false

Detailed Description

Class to dynamically create an HTML SELECT with all options grouped in optgroups

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

Definition at line 31 of file selectgroups.php.


Member Function Documentation

addOptGroup ( 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 310 of file selectgroups.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addOption ( optgroup,
text,
value,
attributes = null 
)

Adds a new OPTION to an optgroup

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 359 of file selectgroups.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Definition at line 488 of file selectgroups.php.

Here is the call graph for this function:

Slightly different container template when frozen. Don't want to use a label tag with a for attribute in that case for the element label but instead use a div. Templates are defined in renderer constructor.

Returns:
string

Definition at line 578 of file selectgroups.php.

Returns the value of field without HTML tags

Since:
1.0 public
Returns:
string

Reimplemented from HTML_QuickForm_element.

Definition at line 445 of file selectgroups.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get html for help button

public

Returns:
string html for help button

Definition at line 567 of file selectgroups.php.

Returns the select mutiple attribute

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

Definition at line 270 of file selectgroups.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 154 of file selectgroups.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 169 of file selectgroups.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 123 of file selectgroups.php.

getSize ( )

Returns the select field size

Since:
1.0 public
Returns:
int

Definition at line 235 of file selectgroups.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 204 of file selectgroups.php.

Here is the caller graph for this function:

loadArrayOptGroups ( 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 285 of file selectgroups.php.

Here is the call graph for this function:

Here is the caller graph for this function:

loadArrayOptions ( optgroup,
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 333 of file selectgroups.php.

Here is the call graph for this function:

Here is the caller graph for this function:

MoodleQuickForm_selectgroups ( elementName = null,
elementLabel = null,
optgrps = null,
attributes = null,
showchoose = false 
)

Class constructor

Parameters:
stringSelect name attribute
mixedLabel(s) for the select
mixedData to be used to populate options
mixedAn array whose keys are labels for optgroups and whose values are arrays similar to those passed to the select element with keys that are values for options and values are strings for display.
mixedEither a typical HTML attribute string or an associative array
booladd standard moodle "Choose..." option as first item
Since:
1.0 public
Returns:
void

Definition at line 78 of file selectgroups.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.

Definition at line 528 of file selectgroups.php.

Here is the call graph for this function:

setHelpButton ( helpbuttonargs,
function = 'helpbutton' 
)

set html for help button

public

Parameters:
array$helparray of arguments to make a help button
string$functionfunction name to call to get html

Definition at line 558 of file selectgroups.php.

Here is the call graph for this function:

setHiddenLabel ( hiddenLabel)

Definition at line 548 of file selectgroups.php.

setMultiple ( multiple)

Sets the select mutiple attribute

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

Definition at line 251 of file selectgroups.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 139 of file selectgroups.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 101 of file selectgroups.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 220 of file selectgroups.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 189 of file selectgroups.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.

Definition at line 386 of file selectgroups.php.

Here is the call graph for this function:


Field Documentation

$_helpbutton = ''

Definition at line 61 of file selectgroups.php.

$_hiddenLabel = false

Definition at line 62 of file selectgroups.php.

$_optGroups = array()

Definition at line 45 of file selectgroups.php.

$_values = null

Definition at line 54 of file selectgroups.php.

$showchoose = false

add choose option

Definition at line 36 of file selectgroups.php.


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