Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.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: 419 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 mod/workshop/locallib.php

Defines 2 classes


Class: moodle1_mod_workshop_handler  - X-Ref

Workshop conversion handler

get_paths()   X-Ref
Declare the paths in moodle.xml we are able to convert

The method returns list of {@link convert_path} instances. For each path returned,
at least one of on_xxx_start(), process_xxx() and on_xxx_end() methods must be
defined. The method process_xxx() is not executed if the associated path element is
empty (i.e. it contains none elements or sub-paths only).

Note that the path /MOODLE_BACKUP/COURSE/MODULES/MOD/WORKSHOP does not
actually exist in the file. The last element with the module name was
appended by the moodle1_converter class.

return: array of {@link convert_path} instances

process_workshop($data, $raw)   X-Ref
This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/WORKSHOP
data available


on_workshop_elements_start()   X-Ref
This is executed when the parser reaches <ELEMENTS>

The dimensions definition follows. One of the grading strategy subplugins
will append dimensions data in {@link self::process_workshop_element()}

process_workshop_element($data, $raw)   X-Ref
Processes one <ELEMENT> tag from moodle.xml


process_workshop_element_rubric($data, $raw)   X-Ref
Processes one <RUBRIC> tag from moodle.xml


on_workshop_element_end()   X-Ref
This is executed when the parser reaches </ELEMENT>


on_workshop_elements_end()   X-Ref
This is executed when the parser reaches </ELEMENTS>


on_workshop_end()   X-Ref
This is executed when the parser reaches </MOD>


get_current_workshop()   X-Ref
Provides access to the current <workshop> data

return: array|null

get_inforef_manager()   X-Ref
Provides access to the instance's inforef manager

return: moodle1_inforef_manager

get_strategy_handler($strategy)   X-Ref
Factory method returning the handler of the given grading strategy subplugin

param: string $strategy the name of the grading strategy
return: moodle1_workshopform_handler the instance of the handler

Class: moodle1_workshopform_handler  - X-Ref

Base class for the grading strategy subplugin handler

__construct(moodle1_mod_handler $workshophandler, $subpluginname)   X-Ref

param: moodle1_mod_handler $workshophandler the handler of a module we are subplugin of
param: string $subpluginname the name of the subplugin

use_xml_writer(xml_writer $xmlwriter)   X-Ref
Provides a xml_writer instance to this workshopform handler

param: xml_writer $xmlwriter

on_elements_start()   X-Ref
Called when we reach <ELEMENTS>

Gives the handler a chance to prepare for a new workshop instance

process_legacy_element(array $data, array $raw)   X-Ref
Called everytime when legacy <ELEMENT> data are available

param: array $data legacy element data
param: array $raw raw element data
return: array converted

on_legacy_element_end()   X-Ref
Called when we reach </ELEMENT>


on_elements_end()   X-Ref
Called when we reach </ELEMENTS>


workshop_upgrade_transform_instance(stdClass $old)   X-Ref
Given a record containing data from 1.9 workshop table, returns object containing data as should be saved in 2.0 workshop table

param: stdClass $old record from 1.9 workshop table
return: stdClass