Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

This file contains the marking guide editor element

Copyright: 2012 Dan Marsden <dan@danmarsden.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 374 lines (15 kb)
Included or required: 1 time
Referenced: 1 time
Includes or requires: 0 files

Defines 2 classes

moodlequickform_guideeditor:: (2 methods):
  __construct()
  moodlequickform_guideeditor()

name:: (9 methods):
  getHelpButton()
  getElementTemplateType()
  add_regrade_confirmation()
  toHtml()
  prepare_data()
  get_next_id()
  non_js_button_pressed()
  validate()
  exportValue()


Class: moodlequickform_guideeditor  - X-Ref

The editor for the marking guide advanced grading plugin.

__construct($elementname=null, $elementlabel=null, $attributes=null)   X-Ref
Constructor

param: string $elementname
param: string $elementlabel
param: array $attributes

moodlequickform_guideeditor($elementname=null, $elementlabel=null, $attributes=null)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

getHelpButton()   X-Ref
get html for help button

return: string html for help button

getElementTemplateType()   X-Ref
The renderer will take care itself about different display in normal and frozen states

return: string

add_regrade_confirmation($changelevel)   X-Ref
Specifies that confirmation about re-grading needs to be added to this rubric editor.
$changelevel is saved in $this->regradeconfirmation and retrieved in toHtml()

param: int $changelevel

toHtml()   X-Ref
Returns html string to display this element

return: string

prepare_data($value = null, $withvalidation = false)   X-Ref
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

param: array $value
param: boolean $withvalidation whether to enable data validation
return: array

get_next_id($ids)   X-Ref
Scans array $ids to find the biggest element ! NEWID*, increments it by 1 and returns

param: array $ids
return: string

non_js_button_pressed($value)   X-Ref
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

param: array $value
return: boolean true if non-submit button was pressed and not processed by JS

validate($value)   X-Ref
Validates that guide has at least one criterion, filled definitions and all criteria
have filled descriptions

param: array $value
return: string|false error text or false if no errors found

exportValue(&$submitvalues, $assoc = false)   X-Ref
Prepares the data for saving

param: array $submitvalues
param: boolean $assoc
return: array