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]

(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.

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

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

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

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.

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

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.

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