Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
gradingform_rubric_instance Class Reference

Class to manage one rubric grading instance. More...

Inheritance diagram for gradingform_rubric_instance:
gradingform_instance

Public Member Functions

 cancel ()
 Deletes this (INCOMPLETE) instance from database.
 
 clear_attempt ($data)
 Removes the attempt from the gradingform_guide_fillings table.
 
 copy ($raterid, $itemid)
 Duplicates the instance before editing (optionally substitutes raterid and/or itemid with the specified values)
 
 default_validation_error_message ()
 Returns the error message displayed if validation failed.
 
 get_controller ()
 Returns the controller.
 
 get_current_instance ()
 Returns the current (active or needupdate) instance for the same raterid and itemid as this instance.
 
 get_data ($key)
 Returns the specified element from object $this->data.
 
 get_grade ()
 Calculates the grade to be pushed to the gradebook.
 
 get_id ()
 Returns instance id.
 
 get_rubric_filling ($force=false)
 Retrieves from DB and returns the data how this rubric was filled.
 
 get_status ()
 Returns instance status.
 
 is_empty_form ($elementvalue)
 Determines whether the submitted form was empty.
 
 render_grading_element ($page, $gradingformelement)
 Returns html for form element of type 'grading'.
 
 submit_and_get_grade ($elementvalue, $itemid)
 Called when teacher submits the grading form: updates the instance in DB, marks it as ACTIVE and returns the grade to be pushed to the gradebook.
 
 update ($data)
 Updates the instance with the data received from grading form.
 
 validate_grading_element ($elementvalue)
 Validates that rubric is fully completed and contains valid grade on each criterion.
 

Static Public Member Functions

static create_new ($definitionid, $raterid, $itemid)
 Creates a new empty instance in DB and mark its status as INCOMPLETE.
 

Public Attributes

const INSTANCE_STATUS_ACTIVE = 1
 Valid istance status.
 
const INSTANCE_STATUS_ARCHIVE = 3
 Grader re-graded the student and this is the status for previous grade stored as history.
 
const INSTANCE_STATUS_INCOMPLETE = 0
 The grader started grading but did clicked neither submit nor cancel.
 
const INSTANCE_STATUS_NEEDUPDATE = 2
 The grade needs to be updated by grader (usually because of changes is grading method)
 

Protected Member Functions

 make_active ()
 Marks the instance as ACTIVE and current active instance (if exists) as ARCHIVE.
 

Protected Attributes

gradingform_controller $controller
 link to the corresponding controller
 
stdClass $data
 record from table grading_instances
 
array $rubric
 stores the rubric, has two keys: 'criteria' and 'options'
 

Detailed Description

Class to manage one rubric grading instance.

Stores information and performs actions like update, copy, validate, submit, etc.

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

Member Function Documentation

◆ cancel()

gradingform_rubric_instance::cancel ( )

Deletes this (INCOMPLETE) instance from database.

Reimplemented from gradingform_instance.

◆ clear_attempt()

gradingform_rubric_instance::clear_attempt ( $data)

Removes the attempt from the gradingform_guide_fillings table.

Parameters
array$datathe attempt data

Reimplemented from gradingform_instance.

◆ copy()

gradingform_rubric_instance::copy ( $raterid,
$itemid )

Duplicates the instance before editing (optionally substitutes raterid and/or itemid with the specified values)

Parameters
int$rateridvalue for raterid in the duplicate
int$itemidvalue for itemid in the duplicate
Return values
intid of the new instance

Reimplemented from gradingform_instance.

◆ create_new()

static gradingform_instance::create_new ( $definitionid,
$raterid,
$itemid )
staticinherited

Creates a new empty instance in DB and mark its status as INCOMPLETE.

Parameters
int$definitionid
int$raterid
int$itemid
Return values
intid of the created instance

◆ default_validation_error_message()

gradingform_instance::default_validation_error_message ( )
inherited

Returns the error message displayed if validation failed.

If plugin wants to display custom message, the empty string should be returned here and the custom message should be output in render_grading_element()

Please note that in assignments grading in 2.2 the grading form is not validated properly and this message is not being displayed.

See also
validate_grading_element()
Return values
string

◆ get_controller()

gradingform_instance::get_controller ( )
inherited

Returns the controller.

Return values
gradingform_controller

◆ get_current_instance()

gradingform_instance::get_current_instance ( )
inherited

Returns the current (active or needupdate) instance for the same raterid and itemid as this instance.

This function is useful to find the status of the currently modified instance

Return values
gradingform_instance

◆ get_data()

gradingform_instance::get_data ( $key)
inherited

Returns the specified element from object $this->data.

Parameters
string$key
Return values
mixed

◆ get_grade()

gradingform_rubric_instance::get_grade ( )

Calculates the grade to be pushed to the gradebook.

Return values
float|intthe valid grade from $this->get_controller()->get_grade_range()

Reimplemented from gradingform_instance.

◆ get_id()

gradingform_instance::get_id ( )
inherited

Returns instance id.

Return values
int

◆ get_rubric_filling()

gradingform_rubric_instance::get_rubric_filling ( $force = false)

Retrieves from DB and returns the data how this rubric was filled.

Parameters
boolean$forcewhether to force DB query even if the data is cached
Return values
array

◆ get_status()

gradingform_instance::get_status ( )
inherited

Returns instance status.

Return values
int

◆ is_empty_form()

gradingform_rubric_instance::is_empty_form ( $elementvalue)

Determines whether the submitted form was empty.

Parameters
array$elementvaluevalue of element submitted from the form
Return values
booleantrue if the form is empty

Reimplemented from gradingform_instance.

◆ render_grading_element()

gradingform_rubric_instance::render_grading_element ( $page,
$gradingformelement )

Returns html for form element of type 'grading'.

Parameters
moodle_page$page
MoodleQuickForm_grading$gradingformelement
Return values
string

Reimplemented from gradingform_instance.

◆ submit_and_get_grade()

gradingform_instance::submit_and_get_grade ( $elementvalue,
$itemid )
inherited

Called when teacher submits the grading form: updates the instance in DB, marks it as ACTIVE and returns the grade to be pushed to the gradebook.

$itemid must be specified here (it was not required when the instance was created, because it might not existed in draft)

Parameters
array$elementvalue
int$itemid
Return values
intthe grade on 0-100 scale

◆ update()

gradingform_rubric_instance::update ( $data)

Updates the instance with the data received from grading form.

This function may be called via AJAX when grading is not yet completed, so it does not change the status of the instance.

Parameters
array$data

Reimplemented from gradingform_instance.

◆ validate_grading_element()

gradingform_rubric_instance::validate_grading_element ( $elementvalue)

Validates that rubric is fully completed and contains valid grade on each criterion.

Parameters
array$elementvaluevalue of element as came in form submit
Return values
booleantrue if the form data is validated and contains no errors

Reimplemented from gradingform_instance.


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