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.

Provides support for the conversion of moodle1 backup to the moodle2 format

Copyright: 2011 David Mudrak <david@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 213 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

moodle1_workshopform_accumulative_handler:: (4 methods):
  process_legacy_element()
  get_new_scaleid()
  get_new_scale_definition()
  workshopform_accumulative_upgrade_element()


Class: moodle1_workshopform_accumulative_handler  - X-Ref

Conversion handler for the accumulative grading strategy data

process_legacy_element(array $data, array $raw)   X-Ref
Converts <ELEMENT> into <workshopform_accumulative_dimension>


get_new_scaleid($oldscaleid)   X-Ref
If needed, creates new standard (global) scale to replace the legacy workshop one and returns the mapping

If the given $oldscaleid represents a scale, returns array $oldscaleid => $newscaleid that
can be used as a parameter for {@link workshopform_accumulative_upgrade_element()}. Otherwise
this method returns empty array.

In workshop 1.x, scale field in workshop_elements had the following meaning:
0 | 2 point Yes/No scale
1 | 2 point Present/Absent scale
2 | 2 point Correct/Incorrect scale
3 | 3 point Good/Poor scale
4 | 4 point Excellent/Very Poor scale
5 | 5 point Excellent/Very Poor scale
6 | 7 point Excellent/Very Poor scale
7 | Score out of 10
8 | Score out of 20
9 | Score out of 100

param: int $oldscaleid the value of the 'scale' field in the moodle.xml backup file
return: array (int)oldscaleid => (int)newscaleid

get_new_scale_definition($oldscaleid)   X-Ref
Returns a definition of a legacy workshop scale

param: object $oldscaleid
return: array

workshopform_accumulative_upgrade_element(stdclass $old, array $newscaleids, $newworkshopid)   X-Ref
Transforms a given record from workshop_elements_old into an object to be saved into workshopform_accumulative

param: stdClass $old legacy record from workshop_elements_old
param: array $newscaleids mapping from old scale types into new standard ones
param: int $newworkshopid id of the new workshop instance that replaced the previous one
return: stdclass to be saved in workshopform_accumulative