Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_completion\cm_completion_details Class Reference

Class for building the user's activity completion details. More...

Public Member Functions

 __construct (completion_info $completioninfo, cm_info $cminfo, int $userid, bool $returndetails=true)
 Constructor.
 
 get_details ()
 Fetches the completion details for a user.
 
 get_overall_completion ()
 Fetches the overall completion state of this course module.
 
 get_timemodified ()
 Completion state timemodified.
 
 has_completion ()
 Whether this activity module has completion enabled.
 
 is_automatic ()
 Whether this activity module instance tracks completion automatically.
 
 is_manual ()
 Whether this activity module instance tracks completion manually.
 
 is_overall_complete ()
 Returns whether the overall completion state of this course module should be marked as complete or not.
 
 is_tracked_user ()
 Checks whether completion is being tracked for this user.
 
 overridden_by ()
 Fetches the user ID that has overridden the completion state of this activity for the user.
 
 show_manual_completion ()
 Determine whether to show the manual completion or not.
 

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

activity_custom_completion $cmcompletion = null
 Activity custom completion object.
 
cm_info $cminfo = null
 The course module information.
 
object $completiondata = null
 The completion data.
 
completion_info $completioninfo = null
 The completion info instance for this cm's course.
 
bool $returndetails = true
 Whether to return automatic completion details.
 
int $userid = 0
 The user ID.
 

Detailed Description

Class for building the user's activity completion details.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_completion\cm_completion_details::__construct ( completion_info $completioninfo,
cm_info $cminfo,
int $userid,
bool $returndetails = true )

Constructor.

Parameters
completion_info$completioninfoThe completion info instance for this cm's course.
cm_info$cminfoThe course module information.
int$useridThe user ID.
bool$returndetailsWhether to return completion details or not.

Member Function Documentation

◆ get_details()

core_completion\cm_completion_details::get_details ( )

Fetches the completion details for a user.

Return values
arrayAn array of completion details for a user containing the completion requirement's description and status.
Exceptions
coding_exception

◆ get_instance()

static core_completion\cm_completion_details::get_instance ( cm_info $cminfo,
int $userid,
bool $returndetails = true )
static

Generates an instance of this class.

Parameters
cm_info$cminfoThe course module info instance.
int$useridThe user ID that we're fetching completion details for.
bool$returndetailsWhether to return completion details or not.
Return values
cm_completion_details

◆ get_overall_completion()

core_completion\cm_completion_details::get_overall_completion ( )

Fetches the overall completion state of this course module.

Return values
intThe overall completion state for this course module.

◆ get_timemodified()

core_completion\cm_completion_details::get_timemodified ( )

Completion state timemodified.

Return values
inttimestamp

◆ has_completion()

core_completion\cm_completion_details::has_completion ( )

Whether this activity module has completion enabled.

Return values
bool

◆ is_automatic()

core_completion\cm_completion_details::is_automatic ( )

Whether this activity module instance tracks completion automatically.

Return values
bool

◆ is_manual()

core_completion\cm_completion_details::is_manual ( )

Whether this activity module instance tracks completion manually.

Return values
bool

◆ is_overall_complete()

core_completion\cm_completion_details::is_overall_complete ( )

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 values
boolTrue when the module can be marked as completed.

◆ is_tracked_user()

core_completion\cm_completion_details::is_tracked_user ( )

Checks whether completion is being tracked for this user.

Return values
bool

◆ overridden_by()

core_completion\cm_completion_details::overridden_by ( )

Fetches the user ID that has overridden the completion state of this activity for the user.

Return values
int|null

◆ show_manual_completion()

core_completion\cm_completion_details::show_manual_completion ( )

Determine whether to show the manual completion or not.

Return values
bool

◆ sort_completion_details()

core_completion\cm_completion_details::sort_completion_details ( array $details)
protected

Sort completion details in the order specified by the activity's custom completion implementation.

Parameters
array$detailsThe completion details to be sorted.
Return values
array
Exceptions
coding_exception

The documentation for this class was generated from the following file: