Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Form element for handling rubric editor. More...
Public Member Functions | |
__construct ($elementName=null, $elementLabel=null, $attributes=null) | |
Constructor for rubric editor. More... | |
add_regrade_confirmation ($changelevel) | |
Specifies that confirmation about re-grading needs to be added to this rubric editor. More... | |
exportValue (&$submitValues, $assoc=false) | |
Prepares the data for saving. More... | |
getElementTemplateType () | |
The renderer will take care itself about different display in normal and frozen states. More... | |
getHelpButton () | |
get html for help button More... | |
MoodleQuickForm_rubriceditor ($elementName=null, $elementLabel=null, $attributes=null) | |
Old syntax of class constructor. More... | |
non_js_button_pressed ($value) | |
Checks if a submit button was pressed which is supposed to be processed on client side by JS but user seem to have disabled JS in the browser. More... | |
toHtml () | |
Returns html string to display this element. More... | |
validate ($value) | |
Validates that rubric has at least one criterion, at least two levels within one criterion, each level has a valid score, all levels have filled definitions and all criteria have filled descriptions. More... | |
Public Attributes | |
string | $_helpbutton = '' |
help message | |
Protected Member Functions | |
get_next_id ($ids) | |
Scans array $ids to find the biggest element ! NEWID*, increments it by 1 and returns. More... | |
prepare_data ($value=null, $withvalidation=false) | |
Prepares the data passed in $_POST: More... | |
Protected Attributes | |
bool | $nonjsbuttonpressed = false |
If non-submit (JS) button was pressed: null - unknown, true/false - button was/wasn't pressed. | |
bool | $regradeconfirmation = false |
Message to display in front of the editor (that there exist grades on this rubric being edited) | |
string bool | $validationerrors = null |
stores the result of the last validation: null - undefined, false - no errors, string - error(s) text | |
bool | $wasvalidated = false |
if element has already been validated | |
Form element for handling rubric editor.
The rubric editor is defined as a separate form element. This allows us to render criteria, levels and buttons using the rubric's own renderer. Also, the required Javascript library is included, which processes, on the client, buttons needed for reordering, adding and deleting criteria.
If Javascript is disabled when one of those special buttons is pressed, the form element is not validated and, instead of submitting the form, we process button presses.
MoodleQuickForm_rubriceditor::__construct | ( | $elementName = null , |
|
$elementLabel = null , |
|||
$attributes = null |
|||
) |
Constructor for rubric editor.
string | $elementName | |
string | $elementLabel | |
array | $attributes |
MoodleQuickForm_rubriceditor::add_regrade_confirmation | ( | $changelevel | ) |
Specifies that confirmation about re-grading needs to be added to this rubric editor.
$changelevel is saved in $this->regradeconfirmation and retrieved in toHtml()
int | $changelevel |
MoodleQuickForm_rubriceditor::exportValue | ( | & | $submitValues, |
$assoc = false |
|||
) |
Prepares the data for saving.
array | $submitValues | |
boolean | $assoc |
array |
|
protected |
Scans array $ids to find the biggest element ! NEWID*, increments it by 1 and returns.
array | $ids |
string |
MoodleQuickForm_rubriceditor::getElementTemplateType | ( | ) |
The renderer will take care itself about different display in normal and frozen states.
string |
MoodleQuickForm_rubriceditor::getHelpButton | ( | ) |
get html for help button
string | html for help button |
MoodleQuickForm_rubriceditor::MoodleQuickForm_rubriceditor | ( | $elementName = null , |
|
$elementLabel = null , |
|||
$attributes = null |
|||
) |
MoodleQuickForm_rubriceditor::non_js_button_pressed | ( | $value | ) |
Checks if a submit button was pressed which is supposed to be processed on client side by JS but user seem to have disabled JS in the browser.
(buttons 'add criteria', 'add level', 'move up', 'move down', etc.) In this case the form containing this element is prevented from being submitted
array | $value |
boolean | true if non-submit button was pressed and not processed by JS |
|
protected |
Prepares the data passed in $_POST:
array | $value | |
boolean | $withvalidation | whether to enable data validation |
array |
MoodleQuickForm_rubriceditor::toHtml | ( | ) |
Returns html string to display this element.
string |
MoodleQuickForm_rubriceditor::validate | ( | $value | ) |
Validates that rubric has at least one criterion, at least two levels within one criterion, each level has a valid score, all levels have filled definitions and all criteria have filled descriptions.
array | $value |
string|false | error text or false if no errors found |