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


Public Member Functions | |
| MoodleQuickForm ($formName, $method, $action, $target='', $attributes=null) | |
| setAdvanced ($elementName, $advanced=true) | |
| setShowAdvanced ($showadvancedNow=null) | |
| getShowAdvanced () | |
| accept (&$renderer) | |
| closeHeaderBefore ($elementName) | |
| setType ($elementname, $paramtype) | |
| setTypes ($paramtypes) | |
| updateSubmission ($submission, $files) | |
| getReqHTML () | |
| getAdvancedHTML () | |
| setDefault ($elementName, $defaultValue) | |
| setHelpButtons ($buttons, $suppresscheck=false, $function='helpbutton') | |
| setHelpButton ($elementname, $buttonargs, $suppresscheck=false, $function='helpbutton') | |
| addHelpButton ($elementname, $identifier, $component= 'moodle', $linktext= '', $suppresscheck=false) | |
| setConstant ($elname, $value) | |
| exportValues ($elementList=null) | |
| addRule ($element, $message, $type, $format=null, $validation='server', $reset=false, $force=false) | |
| addGroupRule ($group, $arg1, $type='', $format=null, $howmany=0, $validation= 'server', $reset=false) | |
| getValidationScript () | |
| _setDefaultRuleMessages () | |
| getLockOptionObject () | |
| _getElNamesRecursive ($element) | |
| disabledIf ($elementName, $dependentOn, $condition= 'notchecked', $value='1') | |
| registerNoSubmitButton ($buttonname) | |
| isNoSubmitButton ($buttonname) | |
| _registerCancelButton ($addfieldsname) | |
| hardFreeze ($elementList=null) | |
| hardFreezeAllVisibleExcept ($elementList) | |
| isSubmitted () | |
Data Fields | |
| $_types = array() | |
| $_dependencies = array() | |
| $_noSubmitButtons = array() | |
| $_cancelButtons = array() | |
| $_advancedElements = array() | |
| $_showAdvanced = null | |
| $_formName = '' | |
| $_pageparams = '' | |
Definition at line 1215 of file formslib.php.
| _getElNamesRecursive | ( | $ | element | ) |
| _registerCancelButton | ( | $ | addfieldsname | ) |
| string | $buttonname |
Definition at line 2066 of file formslib.php.
Definition at line 1938 of file formslib.php.
| accept | ( | &$ | renderer | ) |
Accepts a renderer
| object | $renderer | HTML_QuickForm_Renderer An HTML_QuickForm_Renderer object public |
Reimplemented from HTML_QuickForm.
Definition at line 1379 of file formslib.php.
| addGroupRule | ( | $ | group, |
| $ | arg1, | ||
| $ | type = '', |
||
| $ | format = null, |
||
| $ | howmany = 0, |
||
| $ | validation = 'server', |
||
| $ | reset = false |
||
| ) |
Adds a validation rule for the given group of elements
Only groups with a name can be assigned a validation rule Use addGroupRule when you need to validate elements inside the group. Use addRule if you need to validate the group as a whole. In this case, the same rule will be applied to all elements in the group. Use addRule if you need to validate the group against a function.
| string | $group | Form group name |
| mixed | $arg1 | Array for multiple elements or error message string for one element |
| string | $type | (optional)Rule type use getRegisteredRules() to get types |
| string | $format | (optional)Required for extra rule data |
| int | $howmany | (optional)How many valid elements should be in the group |
| string | $validation | (optional)Where to perform validation: "server", "client" |
| bool | $reset | Client-side: whether to reset the element's value to its original state if validation failed. public |
Reimplemented from HTML_QuickForm.
Definition at line 1708 of file formslib.php.
| addHelpButton | ( | $ | elementname, |
| $ | identifier, | ||
| $ | component = 'moodle', |
||
| $ | linktext = '', |
||
| $ | suppresscheck = false |
||
| ) |
Add a help button to element, only one button per element is allowed.
This is new, simplified and preferable method of setting a help icon on form elements. It uses the new $OUTPUT->help_icon().
Typically, you will provide the same identifier and the component as you have used for the label of the element. The string identifier with the _help suffix added is then used as the help string.
There has to be two strings defined: 1/ get_string($identifier, $component) - the title of the help page 2/ get_string($identifier.'_help', $component) - the actual help page text
| string | $elementname | name of the element to add the item to |
| string | $identifier | help string identifier without _help suffix |
| string | $component | component name to look the help string in |
| string | $linktext | optional text to display next to the icon |
| boolean | $suppresscheck | set to true if the element may not exist |
Definition at line 1602 of file formslib.php.


| addRule | ( | $ | element, |
| $ | message, | ||
| $ | type, | ||
| $ | format = null, |
||
| $ | validation = 'server', |
||
| $ | reset = false, |
||
| $ | force = false |
||
| ) |
Adds a validation rule for the given field
If the element is in fact a group, it will be considered as a whole. To validate grouped elements as separated entities, use addGroupRule instead of addRule.
| string | $element | Form element name |
| string | $message | Message to display for invalid data |
| string | $type | Rule type, use getRegisteredRules() to get types |
| string | $format | (optional)Required for extra rule data |
| string | $validation | (optional)Where to perform validation: "server", "client" |
| boolean | $reset | Client-side validation: reset the form element to its original value if there is an error? |
| boolean | $force | Force the rule to be applied, even if the target form element does not exist public |
Reimplemented from HTML_QuickForm.
Definition at line 1682 of file formslib.php.
| closeHeaderBefore | ( | $ | elementName | ) |
| string | $elementName |
Definition at line 1424 of file formslib.php.
| disabledIf | ( | $ | elementName, |
| $ | dependentOn, | ||
| $ | condition = 'notchecked', |
||
| $ | value = '1' |
||
| ) |
Adds a dependency for $elementName which will be disabled if $condition is met. If $condition = 'notchecked' (default) then the condition is that the $dependentOn element is not checked. If $condition = 'checked' then the condition is that the $dependentOn element is checked. If $condition is something else (like "eq" for equals) then it is checked to see if the value of the $dependentOn element is $condition (such as equal) to $value.
| string | $elementName | the name of the element which will be disabled |
| string | $dependentOn | the name of the element whose state will be checked for condition |
| string | $condition | the condition to check |
| mixed | $value | used in conjunction with condition. |
Definition at line 2038 of file formslib.php.

| exportValues | ( | $ | elementList = null | ) |
| string | $elementList |
Reimplemented from HTML_QuickForm.
Definition at line 1629 of file formslib.php.

| getAdvancedHTML | ( | ) |
Definition at line 1509 of file formslib.php.
Definition at line 1953 of file formslib.php.
| getReqHTML | ( | ) |
Definition at line 1502 of file formslib.php.
| getShowAdvanced | ( | ) |
Definition at line 1367 of file formslib.php.
Returns the client side validation script
The code here was copied from HTML_QuickForm_DHTMLRulesTableless who copied it from HTML_QuickForm and slightly modified to run rules per-element Needed to override this because of an error with client side validation of grouped elements.
public
Reimplemented from HTML_QuickForm_DHTMLRulesTableless.
Definition at line 1740 of file formslib.php.

| hardFreeze | ( | $ | elementList = null | ) |
Displays elements without HTML input tags. This method is different to freeze() in that it makes sure no hidden elements are included in the form. Note: If you want to make sure the submitted value is ignored, please use setDefaults().
This function also removes all previously defined rules.
| mixed | $elementList | array or string of element(s) to be frozen public |
Definition at line 2080 of file formslib.php.

| hardFreezeAllVisibleExcept | ( | $ | elementList | ) |
Hard freeze all elements in a form except those whose names are in $elementList or hidden elements in a form.
This function also removes all previously defined rules of elements it freezes.
throws HTML_QuickForm_Error
| array | $elementList | array or string of element(s) not to be frozen public |
Definition at line 2124 of file formslib.php.
| isNoSubmitButton | ( | $ | buttonname | ) |
| isSubmitted | ( | ) |
Tells whether the form was already submitted
This is useful since the _submitFiles and _submitValues arrays may be completely empty after the trackSubmit value is removed.
public
Reimplemented from HTML_QuickForm.
Definition at line 2157 of file formslib.php.
| MoodleQuickForm | ( | $ | formName, |
| $ | method, | ||
| $ | action, | ||
| $ | target = '', |
||
| $ | attributes = null |
||
| ) |
Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless
object int $formcounter
| string | $formName | Form's name. |
| string | $method | (optional)Form's method defaults to 'POST' |
| mixed | $action | (optional)Form's action - string or moodle_url |
| string | $target | (optional)Form's target defaults to none |
| mixed | $attributes | (optional)Extra attributes for <form> tag public |
Definition at line 1274 of file formslib.php.

| registerNoSubmitButton | ( | $ | buttonname | ) |
Definition at line 2051 of file formslib.php.
| setAdvanced | ( | $ | elementName, |
| $ | advanced = true |
||
| ) |
Use this method to indicate an element in a form is an advanced field. If items in a form are marked as advanced then 'Hide/Show Advanced' buttons will automatically be displayed in the form so the user can decide whether to display advanced form controls.
If you set a header element to advanced then all elements it contains will also be set as advanced.
| string | $elementName | group or element name (not the element name of something inside a group). |
| boolean | $advanced | default true sets the element to advanced. False removes advanced mark. |
Definition at line 1316 of file formslib.php.

| setConstant | ( | $ | elname, |
| $ | value | ||
| ) |
Set constant value not overridden by _POST or _GET note: this does not work for complex names with [] :-(
| string | $elname | name of element |
| mixed | $value |
Definition at line 1620 of file formslib.php.

| setDefault | ( | $ | elementName, |
| $ | defaultValue | ||
| ) |
Initializes a default form value. Used to specify the default for a new entry where no data is loaded in using moodleform::set_data()
note: $slashed param removed
| string | $elementname | element name |
| mixed | $values | values for that element name public |
Definition at line 1524 of file formslib.php.

| setHelpButton | ( | $ | elementname, |
| $ | buttonargs, | ||
| $ | suppresscheck = false, |
||
| $ | function = 'helpbutton' |
||
| ) |
Add a single button.
| string | $elementname | name of the element to add the item to |
| array | $button | arguments to pass to function $function |
| boolean | $suppresscheck | whether to throw an error if the element doesn't exist. |
| string | $function | - function to generate html from the arguments in $button |
| string | $function |
Definition at line 1554 of file formslib.php.

| setHelpButtons | ( | $ | buttons, |
| $ | suppresscheck = false, |
||
| $ | function = 'helpbutton' |
||
| ) |
Add an array of buttons to the form
| array | $buttons | An associative array representing help button to attach to to the form. keys of array correspond to names of elements in form. |
| bool | $suppresscheck | |
| string | $function | public |
Definition at line 1536 of file formslib.php.

| setShowAdvanced | ( | $ | showadvancedNow = null | ) |
Set whether to show advanced elements in the form on first displaying form. Default is not to display advanced elements in the form until 'Show Advanced' is pressed.
You can get the last state of the form and possibly save it for this user by using value 'mform_showadvanced_last' in submitted data.
| boolean | $showadvancedNow |
Definition at line 1339 of file formslib.php.

| setType | ( | $ | elementname, |
| $ | paramtype | ||
| ) |
Should be used for all elements of a form except for select, radio and checkboxes which clean their own data.
| string | $elementname | |
| integer | $paramtype | use the constants PARAM_*. * PARAM_CLEAN is deprecated and you should try to use a more specific type. * PARAM_TEXT should be used for cleaning data that is expected to be plain text. It will strip all html tags. But will still let tags for multilang support through. * PARAM_RAW means no cleaning whatsoever, it is used mostly for data from the html editor. Data from the editor is later cleaned before display using format_text() function. PARAM_RAW can also be used for data that is validated by some other way or printed by p() or s(). * PARAM_INT should be used for integers. * PARAM_ACTION is an alias of PARAM_ALPHA and is used for hidden fields specifying form actions. |
Definition at line 1447 of file formslib.php.
| setTypes | ( | $ | paramtypes | ) |
See description of setType above. This can be used to set several types at once.
| array | $paramtypes |
Definition at line 1456 of file formslib.php.
| updateSubmission | ( | $ | submission, |
| $ | files | ||
| ) |
| array | $submission | |
| array | $files |
Definition at line 1464 of file formslib.php.

| $_advancedElements = array() |
Definition at line 1237 of file formslib.php.
| $_cancelButtons = array() |
Definition at line 1230 of file formslib.php.
| $_dependencies = array() |
Definition at line 1218 of file formslib.php.
| $_formName = '' |
Definition at line 1253 of file formslib.php.
| $_noSubmitButtons = array() |
Definition at line 1224 of file formslib.php.
| $_pageparams = '' |
Definition at line 1260 of file formslib.php.
| $_showAdvanced = null |
Definition at line 1244 of file formslib.php.
| $_types = array() |
Definition at line 1217 of file formslib.php.