Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

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

Contains the class for building the user's activity completion details.

Copyright: 2021 Jun Pataleta <jun@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 316 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: cm_completion_details  - X-Ref

Class for building the user's activity completion details.

__construct(completion_info $completioninfo, cm_info $cminfo, int $userid, bool $returndetails = true)   X-Ref
Constructor.

param: completion_info $completioninfo The completion info instance for this cm's course.
param: cm_info $cminfo The course module information.
param: int $userid The user ID.
param: bool $returndetails Whether to return completion details or not.

get_details()   X-Ref
Fetches the completion details for a user.

return: array An array of completion details for a user containing the completion requirement's description and status.

sort_completion_details(array $details)   X-Ref
Sort completion details in the order specified by the activity's custom completion implementation.

param: array $details The completion details to be sorted.
return: array

get_overall_completion()   X-Ref
Fetches the overall completion state of this course module.

return: int The overall completion state for this course module.

is_overall_complete()   X-Ref
Returns whether the overall completion state of this course module should be marked as complete or not.
This is based on the completion settings of the course module, so when the course module requires a passing grade,
it will only be marked as complete when the user has passed the course module. Otherwise, it will be marked as complete
even when the user has failed the course module.

return: bool True when the module can be marked as completed.

has_completion()   X-Ref
Whether this activity module has completion enabled.

return: bool

is_automatic()   X-Ref
Whether this activity module instance tracks completion automatically.

return: bool

is_manual()   X-Ref
Whether this activity module instance tracks completion manually.

return: bool

overridden_by()   X-Ref
Fetches the user ID that has overridden the completion state of this activity for the user.

return: int|null

is_tracked_user()   X-Ref
Checks whether completion is being tracked for this user.

return: bool

show_manual_completion()   X-Ref
Determine whether to show the manual completion or not.

return: bool

get_timemodified()   X-Ref
Completion state timemodified

return: int timestamp

get_instance(cm_info $cminfo, int $userid, bool $returndetails = true)   X-Ref
Generates an instance of this class.

param: cm_info $cminfo The course module info instance.
param: int $userid The user ID that we're fetching completion details for.
param: bool $returndetails  Whether to return completion details or not.
return: cm_completion_details