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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 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: 546 lines (23 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[]

get_available_completion_options(int $courseid)   X-Ref
Returns an array with the available completion options (url => name) for the current course and user.

param: int $courseid The course id.
return: array

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