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 311 and 401] [Versions 401 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: 288 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

cm_completion_details:: (11 methods):
  __construct()
  get_details()
  sort_completion_details()
  get_overall_completion()
  has_completion()
  is_automatic()
  overridden_by()
  is_tracked_user()
  show_manual_completion()
  get_timemodified()
  get_instance()


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.

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

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