Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
workshop_rubric_strategy Class Reference

Rubric grading strategy logic. More...

Inheritance diagram for workshop_rubric_strategy:
workshop_strategy

Public Member Functions

 __construct (workshop $workshop)
 Constructor.
 
 form_ready ()
 Has the assessment form been defined and is ready to be used by the reviewers?
 
 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.
 
 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.
 
 save_assessment (stdclass $assessment, stdclass $data)
 Saves the filled assessment.
 
 save_edit_strategy_form (stdclass $data)
 Save the assessment dimensions into database.
 

Static Public Member Functions

static delete_instance ($workshopid)
 Delete all data related to a given workshop module instance.
 
static scale_used ($scaleid, $workshopid=null)
 Is a given scale used by the instance of workshop?
 

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.
 
 delete_dimensions (array $ids)
 Deletes dimensions and removes embedded media from its descriptions.
 
 get_current_assessment_data (stdclass $assessment)
 Returns the list of current grades filled by the reviewer indexed by dimensionid.
 
 load_config ()
 Get the configuration for the current rubric strategy.
 
 load_fields ()
 Loads the fields of the assessment form currently used in this workshop.
 
 prepare_database_fields (stdclass $raw)
 Prepares data returned by workshop_edit_rubric_strategy_form so they can be saved into database.
 
 prepare_form_fields (array $fields)
 Maps the dimension data from DB to the form fields.
 
 update_peer_grade (stdclass $assessment)
 Aggregates the assessment form data and sets the grade for the submission given by the peer.
 

Protected Attributes

object $config
 rubric configuration
 
array $definitionopts
 options for level definition fields
 
array $descriptionopts
 options for dimension description fields
 
array $dimensions = null
 definition of the assessment form fields
 
workshop $workshop
 the parent workshop instance
 

Detailed Description

Rubric grading strategy logic.

Constructor & Destructor Documentation

◆ __construct()

workshop_rubric_strategy::__construct ( workshop $workshop)

Constructor.

Parameters
workshop$workshopThe workshop instance record
Return values
void

Member Function Documentation

◆ calculate_peer_grade()

workshop_rubric_strategy::calculate_peer_grade ( array $grades)
protected

Calculates the aggregated grade given by the reviewer.

Parameters
array$gradesGrade records as returned by get_current_assessment_data @uses $this->dimensions
Return values
float|nullRaw grade (from 0.00000 to 100.00000) for submission as suggested by the peer

◆ delete_dimensions()

workshop_rubric_strategy::delete_dimensions ( array $ids)
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

Parameters
array$masterids
Return values
void

◆ delete_instance()

static workshop_rubric_strategy::delete_instance ( $workshopid)
static

Delete all data related to a given workshop module instance.

See also
workshop_delete_instance()
Parameters
int$workshopidid of the workshop module instance being deleted
Return values
void

Implements workshop_strategy.

◆ form_ready()

workshop_rubric_strategy::form_ready ( )

Has the assessment form been defined and is ready to be used by the reviewers?

Return values
boolean

Implements workshop_strategy.

◆ get_assessment_form()

workshop_rubric_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.

Parameters
moodle_url$actionurlURL of form handler, defaults to auto detect the current url
string$modeMode to open the form in: preview/assessment/readonly
stdClass$assessmentThe current assessment
bool$editable
array$options

Implements workshop_strategy.

◆ get_assessments_recordset()

workshop_rubric_strategy::get_assessments_recordset ( $restrict = null)
See also
parent\get_assessments_recordset()

Implements workshop_strategy.

◆ get_current_assessment_data()

workshop_rubric_strategy::get_current_assessment_data ( stdclass $assessment)
protected

Returns the list of current grades filled by the reviewer indexed by dimensionid.

Parameters
stdClass$assessmentAssessment record
Return values
array[int dimensionid] => stdclass workshop_grades record

◆ get_dimensions_info()

workshop_rubric_strategy::get_dimensions_info ( )
See also
parent\get_dimensions_info()

Implements workshop_strategy.

◆ get_edit_strategy_form()

workshop_rubric_strategy::get_edit_strategy_form ( $actionurl = null)

Factory method returning an instance of an assessment form editor class.

Parameters
$actionurlURL of form handler, defaults to auto detect the current url

Implements workshop_strategy.

◆ load_config()

workshop_rubric_strategy::load_config ( )
protected

Get the configuration for the current rubric strategy.

Return values
object

◆ load_fields()

workshop_rubric_strategy::load_fields ( )
protected

Loads the fields of the assessment form currently used in this workshop.

Return values
arraydefinition of assessment dimensions

◆ prepare_database_fields()

workshop_rubric_strategy::prepare_database_fields ( stdclass $raw)
protected

Prepares data returned by workshop_edit_rubric_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.

Parameters
stdClass$rawRaw data returned by mform
Return values
arrayArray of objects to be inserted/updated in DB

◆ prepare_form_fields()

workshop_rubric_strategy::prepare_form_fields ( array $fields)
protected

Maps the dimension data from DB to the form fields.

Parameters
array$fieldsArray of dimensions definition as returned by load_fields()
Return values
stdclassof fields data to be used by the mform set_data

◆ save_assessment()

workshop_rubric_strategy::save_assessment ( stdclass $assessment,
stdclass $data )

Saves the filled assessment.

This method processes data submitted using the form returned by get_assessment_form()

Parameters
stdClass$assessmentAssessment being filled
stdClass$dataRaw data as returned by the assessment form
Return values
float|nullRaw grade (0.00000 to 100.00000) for submission as suggested by the peer

Implements workshop_strategy.

◆ save_edit_strategy_form()

workshop_rubric_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

Parameters
stdClass$dataRaw data returned by the dimension editor form
Return values
void

Implements workshop_strategy.

◆ scale_used()

static workshop_rubric_strategy::scale_used ( $scaleid,
$workshopid = null )
static

Is a given scale used by the instance of workshop?

This grading strategy does not use scales.

Parameters
int$scaleidid of the scale to check
int | null$workshopidid of workshop instance to check, checks all in case of null
Return values
bool

Implements workshop_strategy.

◆ update_peer_grade()

workshop_rubric_strategy::update_peer_grade ( stdclass $assessment)
protected

Aggregates the assessment form data and sets the grade for the submission given by the peer.

Parameters
stdClass$assessmentAssessment record
Return values
float|nullRaw grade (from 0.00000 to 100.00000) for submission as suggested by the peer

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