Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 311 and 400]

(no description)

File Size: 199 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: activity_custom_completion  - X-Ref

Base class for defining an activity module's custom completion rules.

Class for defining an activity module's custom completion rules and fetching the completion statuses
of the custom completion rules for a given module instance and a user.

__construct(cm_info $cm, int $userid, ?array $completionstate = null)   X-Ref
activity_custom_completion constructor.

param: cm_info $cm
param: int $userid
param: array|null $completionstate The current state of the core completion criteria

validate_rule(string $rule)   X-Ref
Validates that the custom rule is defined by this plugin and is enabled for this activity instance.

param: string $rule The custom completion rule.

is_defined(string $rule)   X-Ref
Whether this module defines this custom rule.

return: bool
param: string $rule The custom completion rule.

is_available(string $rule)   X-Ref
Checks whether the custom completion rule is being used by the activity module instance.

return: bool
param: string $rule The custom completion rule.

get_available_custom_rules()   X-Ref
Fetches the list of custom completion rules that are being used by this activity module instance.

return: array

get_overall_completion_state()   X-Ref
Fetches the overall completion status of this activity instance for a user based on its available custom completion rules.

return: int The completion state (e.g. COMPLETION_COMPLETE, COMPLETION_INCOMPLETE).

get_custom_rule_description(string $rule)   X-Ref
Fetches the description for a given custom completion rule.

return: string
param: string $rule The custom completion rule.

manual_completion_always_shown()   X-Ref
Show the manual completion or not regardless of the course's showcompletionconditions setting.
Returns false by default for plugins that don't need to override the course's showcompletionconditions setting.
Activity plugins that need to always show manual completion need to override this function.

return: bool

get_cm_completion_class(string $modname)   X-Ref
Fetches the module's custom completion class implementation if it's available.

return: string|null
param: string $modname The activity module name. Usually from cm_info::modname.