Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
moodlequickform_guideeditor Class Reference

The editor for the marking guide advanced grading plugin. More...

Inheritance diagram for moodlequickform_guideeditor:

Public Member Functions

 __construct ($elementname=null, $elementlabel=null, $attributes=null)
 Constructor. 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_guideeditor ($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 guide has at least one criterion, 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

null bool $nonjsbuttonpressed = false
 If non-submit (JS) button was pressed: null - unknown, true/false - button was/wasn't pressed.
 
string false $regradeconfirmation = false
 Message to display in front of the editor (that there exist grades on this guide being edited)
 
null false string $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
 

Detailed Description

The editor for the marking guide advanced grading plugin.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

moodlequickform_guideeditor::__construct (   $elementname = null,
  $elementlabel = null,
  $attributes = null 
)

Constructor.

Parameters
string$elementname
string$elementlabel
array$attributes

Member Function Documentation

◆ add_regrade_confirmation()

moodlequickform_guideeditor::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()

See also
gradingform_rubric_controller::update_or_check_rubric()
Parameters
int$changelevel

◆ exportValue()

moodlequickform_guideeditor::exportValue ( $submitvalues,
  $assoc = false 
)

Prepares the data for saving.

See also
prepare_data()
Parameters
array$submitvalues
boolean$assoc
Return values
array

◆ get_next_id()

moodlequickform_guideeditor::get_next_id (   $ids)
protected

Scans array $ids to find the biggest element ! NEWID*, increments it by 1 and returns.

Parameters
array$ids
Return values
string

◆ getElementTemplateType()

moodlequickform_guideeditor::getElementTemplateType ( )

The renderer will take care itself about different display in normal and frozen states.

Return values
string

◆ getHelpButton()

moodlequickform_guideeditor::getHelpButton ( )

get html for help button

Return values
stringhtml for help button

◆ moodlequickform_guideeditor()

moodlequickform_guideeditor::moodlequickform_guideeditor (   $elementname = null,
  $elementlabel = null,
  $attributes = null 
)

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

◆ non_js_button_pressed()

moodlequickform_guideeditor::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', 'add comment') In this case the form containing this element is prevented from being submitted

Parameters
array$value
Return values
booleantrue if non-submit button was pressed and not processed by JS

◆ prepare_data()

moodlequickform_guideeditor::prepare_data (   $value = null,
  $withvalidation = false 
)
protected

Prepares the data passed in $_POST:

  • processes the pressed buttons 'addlevel', 'addcriterion', 'moveup', 'movedown', 'delete' (when JavaScript is disabled) sets $this->nonjsbuttonpressed to true/false if such button was pressed
  • if options not passed (i.e. we create a new guide) fills the options array with the default values
  • if options are passed completes the options array with unchecked checkboxes
  • if $withvalidation is set, adds 'error_xxx' attributes to elements that contain errors and creates an error string and stores it in $this->validationerrors
Parameters
array$value
boolean$withvalidationwhether to enable data validation
Return values
array

◆ toHtml()

moodlequickform_guideeditor::toHtml ( )

Returns html string to display this element.

Return values
string

◆ validate()

moodlequickform_guideeditor::validate (   $value)

Validates that guide has at least one criterion, filled definitions and all criteria have filled descriptions.

Parameters
array$value
Return values
string|falseerror text or false if no errors found

The documentation for this class was generated from the following file: