Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Accumulative grading strategy logic. More...
Public Member Functions | |
__construct (workshop $workshop) | |
Constructor. More... | |
form_ready () | |
Has the assessment form been defined and is ready to be used by the reviewers? More... | |
get_assessment_form (moodle_url $actionurl=null, $mode='preview', stdclass $assessment=null, $editable=true, $options=array()) | |
Factory method returning an instance of an assessment form. More... | |
get_assessments_recordset ($restrict=null) | |
get_dimensions_info () | |
get_edit_strategy_form ($actionurl=null) | |
Factory method returning an instance of an assessment form editor class. More... | |
save_assessment (stdclass $assessment, stdclass $data) | |
Saves the filled assessment. More... | |
save_edit_strategy_form (stdclass $data) | |
Save the assessment dimensions into database. More... | |
Static Public Member Functions | |
static | delete_instance ($workshopid) |
Delete all data related to a given workshop module instance. More... | |
static | scale_used ($scaleid, $workshopid=null) |
Is a given scale used by the instance of workshop? More... | |
Public Attributes | |
const | ADDDIMS = 2 |
@const number of dimensions to add | |
const | MINDIMS = 3 |
@const default number of dimensions to show | |
Protected Member Functions | |
calculate_peer_grade (array $grades) | |
Calculates the aggregated grade given by the reviewer. More... | |
delete_dimensions (array $ids) | |
Deletes dimensions and removes embedded media from its descriptions. More... | |
get_current_assessment_data (stdclass $assessment) | |
Returns the list of current grades filled by the reviewer indexed by dimensionid. More... | |
load_fields () | |
Loads the fields of the assessment form currently used in this workshop. More... | |
prepare_database_fields (stdclass $raw) | |
Prepares data returned by workshop_edit_accumulative_strategy_form so they can be saved into database. More... | |
prepare_form_fields (array $raw) | |
Maps the dimension data from DB to the form fields. More... | |
scale_to_grade ($scaleid, $item) | |
Convert scale grade to numerical grades. More... | |
update_peer_grade (stdclass $assessment) | |
Aggregates the assessment form data and sets the grade for the submission given by the peer. More... | |
Protected Attributes | |
array | $descriptionopts |
options for dimension description fields | |
array | $dimensions = null |
definition of the assessment form fields | |
workshop | $workshop |
the parent workshop instance | |
Accumulative grading strategy logic.
workshop_accumulative_strategy::__construct | ( | workshop | $workshop | ) |
Constructor.
workshop | $workshop | The workshop instance record |
void |
|
protected |
Calculates the aggregated grade given by the reviewer.
array | $grades | Grade records as returned by get_current_assessment_data @uses $this->dimensions |
float|null | Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer |
|
protected |
Deletes dimensions and removes embedded media from its descriptions.
todo we may check that there are no assessments done using these dimensions and probably remove them
array | $masterids |
void |
|
static |
Delete all data related to a given workshop module instance.
int | $workshopid | id of the workshop module instance being deleted |
void |
Implements workshop_strategy.
workshop_accumulative_strategy::form_ready | ( | ) |
Has the assessment form been defined and is ready to be used by the reviewers?
boolean |
Implements workshop_strategy.
workshop_accumulative_strategy::get_assessment_form | ( | moodle_url | $actionurl = null , |
$mode = 'preview' , |
|||
stdclass | $assessment = null , |
||
$editable = true , |
|||
$options = array() |
|||
) |
Factory method returning an instance of an assessment form.
moodle_url | $actionurl | URL of form handler, defaults to auto detect the current url |
string | $mode | Mode to open the form in: preview/assessment |
stdClass | $assessment | The current assessment |
bool | $editable | |
array | $options |
Implements workshop_strategy.
workshop_accumulative_strategy::get_assessments_recordset | ( | $restrict = null | ) |
Implements workshop_strategy.
|
protected |
Returns the list of current grades filled by the reviewer indexed by dimensionid.
stdClass | $assessment | Assessment record |
array | [int dimensionid] => stdclass workshop_grades record |
workshop_accumulative_strategy::get_dimensions_info | ( | ) |
Implements workshop_strategy.
workshop_accumulative_strategy::get_edit_strategy_form | ( | $actionurl = null | ) |
Factory method returning an instance of an assessment form editor class.
$actionurl | URL of form handler, defaults to auto detect the current url |
Implements workshop_strategy.
|
protected |
Loads the fields of the assessment form currently used in this workshop.
array | definition of assessment dimensions |
|
protected |
Prepares data returned by workshop_edit_accumulative_strategy_form so they can be saved into database.
It automatically adds some columns into every record. The sorting is done by the order of the returned array and starts with 1. Called internally from save_edit_strategy_form() only. Could be private but keeping protected for unit testing purposes.
stdClass | $raw | Raw data returned by mform |
array | Array of objects to be inserted/updated in DB |
|
protected |
Maps the dimension data from DB to the form fields.
array | $raw | Array of raw dimension records as returned by load_fields() |
array | Array of fields data to be used by the mform set_data |
workshop_accumulative_strategy::save_assessment | ( | stdclass | $assessment, |
stdclass | $data | ||
) |
Saves the filled assessment.
This method processes data submitted using the form returned by get_assessment_form()
stdClass | $assessment | Assessment being filled |
stdClass | $data | Raw data as returned by the assessment form |
float|null | Raw grade (0.00000 to 100.00000) for submission as suggested by the peer |
Implements workshop_strategy.
workshop_accumulative_strategy::save_edit_strategy_form | ( | stdclass | $data | ) |
Save the assessment dimensions into database.
Saves data into the main strategy form table. If the record->id is null or zero, new record is created. If the record->id is not empty, the existing record is updated. Records with empty 'description' field are removed from database. The passed data object are the raw data returned by the get_data().
@uses $DB
stdClass | $data | Raw data returned by the dimension editor form |
void |
Implements workshop_strategy.
|
protected |
Convert scale grade to numerical grades.
In accumulative grading strategy, scales are considered as grades from 0 to M-1, where M is the number of scale items.
coding_exception |
string | $scaleid | Scale identifier |
int | $item | Selected scale item number, numbered 1, 2, 3, ... M |
float |
|
static |
Is a given scale used by the instance of workshop?
int | $scaleid | id of the scale to check |
int | null | $workshopid | id of workshop instance to check, checks all in case of null |
bool |
Implements workshop_strategy.
|
protected |
Aggregates the assessment form data and sets the grade for the submission given by the peer.
stdClass | $assessment | Assessment record |
float|null | Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer |