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 defines interface of all grading strategy logic classes

Copyright: 2009 David Mudrak <david.mudrak@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 127 lines (5 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Interface: workshop_strategy  - X-Ref

Strategy interface defines all methods that strategy subplugins has to implement

get_edit_strategy_form($actionurl=null)   X-Ref
Factory method returning a form that is used to define the assessment form

param: string $actionurl URL of the action handler script, defaults to auto detect
return: stdclass The instance of the assessment form editor class

save_edit_strategy_form(stdclass $data)   X-Ref
Saves the assessment dimensions and other grading form elements

Assessment dimension (also know as assessment element) represents one aspect or criterion
to be evaluated. Each dimension consists of a set of form fields. Strategy-specific information
are saved in workshopform_{strategyname} tables.

param: stdClass $data Raw data as returned by the form editor
return: void

get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdclass $assessment=null, $editable=true, $options=array()   X-Ref
Factory method returning an instance of an assessment form

param: moodle_url $actionurl URL of form handler, defaults to auto detect the current url
param: string $mode          Mode to open the form in: preview|assessment
param: stdClass $assessment  If opening in the assessment mode, the current assessment record
param: bool $editable        Shall the form be opened as editable (true) or read-only (false)
param: array $options        More assessment form options, editableweight implemented only now

save_assessment(stdclass $assessment, stdclass $data)   X-Ref
Saves the filled assessment and returns the grade for submission as suggested by the reviewer

This method processes data submitted using the form returned by {@link get_assessment_form()}
The returned grade should be rounded to 5 decimals as with round($grade, 5).

param: stdClass $assessment Assessment being filled
param: stdClass $data       Raw data as returned by the assessment form
return: float|null          Raw percentual grade (0.00000 to 100.00000) for submission

form_ready()   X-Ref
Has the assessment form been defined and is ready to be used by the reviewers?

return: boolean

get_dimensions_info()   X-Ref
Returns a general information about the assessment dimensions

return: array [dimid] => stdclass (->id ->max ->min ->weight and optionally ->scale containing scale items)

get_assessments_recordset($restrict=null)   X-Ref
Returns recordset with detailed information of all assessments done using this strategy

The returned structure must be a recordset of objects containing at least properties:
submissionid, assessmentid, assessmentweight, reviewerid, gradinggrade, dimensionid and grade.
It is possible to pass user id(s) of reviewer(s). Then, the method returns just the reviewer's
assessments info.

param: array|int|null $restrict optional id or ids of the reviewer
return: moodle_recordset

scale_used($scaleid, $workshopid=null)   X-Ref
Is a given scale used by the instance of workshop?

If the grading strategy does not use scales, it should just return false. If the strategy
supports scales, it returns true if the given scale is used.
If workshopid is null, it checks for any workshop instance. If workshopid is provided,
it checks the given instance only.

param: int $scaleid id of the scale to check
param: int|null $workshopid id of workshop instance to check, checks all in case of null
return: bool

delete_instance($workshopid)   X-Ref
Delete all data related to a given workshop module instance

This is called from {@link workshop_delete_instance()}.

param: int $workshopid id of the workshop module instance being deleted
return: void