Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Bulk activity completion manager class

Copyright: 2017 Adrian Greeve
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 497 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: manager  - X-Ref

Bulk activity completion manager class

__construct($courseid)   X-Ref
manager constructor.

param: int $courseid the course id.

get_activities_and_headings()   X-Ref
Gets the data (context) to be used with the bulkactivitycompletion template.

return: stdClass data for use with the bulkactivitycompletion template.

get_activities($cmids, $withcompletiondetails = false)   X-Ref
Gets the data (context) to be used with the activityinstance template

param: array $cmids list of course module ids
param: bool $withcompletiondetails include completion details
return: array

get_completion_detail($mod)   X-Ref
Get completion information on the selected module or module type

param: cm_info|stdClass $mod either instance of cm_info (with 'customcompletionrules' in customdata) or
return: array

get_completion_active_rule_descriptions($moduledata)   X-Ref
Get the descriptions for all active conditional completion rules for the current module.

param: cm_info|stdClass $moduledata either instance of cm_info (with 'customcompletionrules' in customdata) or
return: array $activeruledescriptions an array of strings describing the active completion rules.

get_activities_and_resources()   X-Ref
Gets the course modules for the current course.

return: stdClass $data containing the modules

can_edit_bulk_completion($courseorid, $cm = null)   X-Ref
Checks if current user can edit activity completion

param: int|stdClass $courseorid
param: \cm_info|null $cm if specified capability for a given coursemodule will be check,

get_available_completion_tabs($courseorid)   X-Ref
Gets the available completion tabs for the current course and user.

param: stdClass|int $courseorid the course object or id.
return: tabobject[]

apply_completion($data, $updateinstances)   X-Ref
Applies completion from the bulk edit form to all selected modules

param: stdClass $data data received from the core_completion_bulkedit_form
param: bool $updateinstances if we need to update the instance tables of the module (i.e. 'assign', 'forum', etc.) -

apply_completion_cm(\cm_info $cm, $data, $updateinstance)   X-Ref
Applies new completion rules to one course module

param: \cm_info $cm
param: array $data
param: bool $updateinstance if we need to update the instance table of the module (i.e. 'assign', 'forum', etc.) -
return: bool if module was updated

apply_default_completion($data, $updatecustomrules)   X-Ref
Saves default completion from edit form to all selected module types

param: stdClass $data data received from the core_completion_bulkedit_form
param: bool $updatecustomrules if we need to update the custom rules of the module -

get_default_completion($course, $module, $flatten = true)   X-Ref
Returns default completion rules for given module type in the given course

param: stdClass $course
param: stdClass $module
param: bool $flatten if true all module custom completion rules become properties of the same object,
return: stdClass