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.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

Course copy class. Handles procesing data submitted by UI copy form and sets up the course copy process.

Author: Matt Porritt <mattp@catalyst-au.net>
Copyright: 2020 onward The Moodle Users Association <https://moodleassociation.org/>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 170 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

copy:: (1 method):
  __construct()

instead:: (4 methods):
  get_enrollment_roles()
  get_copy_data()
  create_copy()
  get_copies()


Class: copy  - X-Ref

Course copy class.

Handles procesing data submitted by UI copy form
and sets up the course copy process.

__construct(\stdClass $formdata)   X-Ref
Constructor for the class.

param: \stdClass $formdata Data from the validated course copy form.

Class: instead  - X-Ref

get_enrollment_roles(\stdClass $formdata)   X-Ref
Extract the enrolment roles to keep in the copied course
from the raw submitted form data.

param: \stdClass $formdata Data from the validated course copy form.
return: array $keptroles The roles to keep.

get_copy_data(\stdClass $formdata)   X-Ref
Take the validated form data and extract the required information for copy operations.

param: \stdClass $formdata Data from the validated course copy form.
return: \stdClass $copydata Data required for course copy operations.

create_copy()   X-Ref
Creates a course copy.
Sets up relevant controllers and adhoc task.

return: array $copyids THe backup and restore controller ids.

get_copies(int $userid, int $courseid=0)   X-Ref
Get the in progress course copy operations for a user.

param: int $userid User id to get the course copies for.
param: int $courseid The optional source course id to get copies for.
return: array $copies Details of the inprogress copies.