Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Files | Namespaces | Classes | Functions | Variables
core_completion

Files

file  api.php
 Contains class containing completion API.
 
file  behat_completion.php
 Completion steps definitions.
 
file  bulkedit_form.php
 Bulk edit activity completion form.
 
file  completion_aggregation.php
 Course completion critieria aggregation.
 
file  completion_completion.php
 Course completion status for a particular user/course.
 
file  completion_criteria.php
 Course completion criteria.
 
file  completion_criteria_activity.php
 This file contains the activity completion criteria type class and any supporting functions it may require.
 
file  completion_criteria_completion.php
 Completion data for a specific user, course and critieria.
 
file  completion_criteria_course.php
 This file contains the course criteria type.
 
file  completion_criteria_date.php
 This file contains the date criteria type.
 
file  completion_criteria_duration.php
 Course completion critieria - completion after specific duration from course enrolment.
 
file  completion_criteria_grade.php
 Course completion critieria - completion on achieving course grade.
 
file  completion_criteria_role.php
 Course completion critieria - marked by role.
 
file  completion_criteria_self.php
 Course completion critieria - student self marked.
 
file  completion_criteria_unenrol.php
 Course completion critieria - completion on unenrolment.
 
file  completion_form.php
 Edit course completion settings - the form definition.
 
file  completionlib.php
 Contains classes, functions and constants used during the tracking of activity completion for users.
 
file  data_object.php
 Course completion critieria aggregation.
 
file  defaultedit_form.php
 Default activity completion form.
 
file  edit_base_form.php
 Base form for changing completion rules.
 
file  external.php
 Completion external API.
 
file  manager.php
 Bulk activity completion manager class.
 
file  progress.php
 Contains class used to return completion progress information.
 

Namespaces

namespace  core_completion
  
 
namespace  core_completion\privacy
  
 

Classes

class  behat_completion
 
class  completion_aggregation
 
class  completion_completion
 
class  completion_criteria
 
class  completion_criteria_activity
 
class  completion_criteria_completion
 
class  completion_criteria_course
 
class  completion_criteria_date
 
class  completion_criteria_duration
 
class  completion_criteria_grade
 
class  completion_criteria_role
 
class  completion_criteria_self
 
class  completion_criteria_unenrol
 
class  completion_info
 
class  core_completion\api
 Class containing completion API. More...
 
class  core_completion\manager
 
class  core_completion\privacy\provider
 Privacy class for requesting user data. More...
 
class  core_completion\progress
 Class used to return completion progress information. More...
 
class  core_completion_bulkedit_form
 Bulk edit activity completion form. More...
 
class  core_completion_defaultedit_form
 Default activity completion form. More...
 
class  core_completion_edit_base_form
 Base form for changing completion rules. More...
 
class  core_completion_external
 
class  course_completion_form
 Defines the course completion settings form. More...
 
class  data_object
 

Functions

 completion_can_view_data ($userid, $course=null)
 Utility function for checking if the logged in user can view another's completion data for a particular course. More...
 
 completion_cron_aggregate ($method, $data, &$state)
 Aggregate criteria status's as per configured aggregation method. More...
 

Variables

global $COMPLETION_CRITERIA_TYPES
 Criteria type constant to class name mapping. More...
 
const COMPLETION_AGGREGATION_ALL 1
 Course completion criteria aggregation method.
 
const COMPLETION_AGGREGATION_ANY 2
 Course completion criteria aggregation method.
 
const COMPLETION_AND true
 Completion details should be ANDed together and you should return true if none apply.
 
const COMPLETION_COMPLETE 1
 The user has completed this activity. More...
 
const COMPLETION_COMPLETE_FAIL 3
 The user has completed this activity but their grade is less than the pass mark This is a completion state value (course_modules_completion/completionstate)
 
const COMPLETION_COMPLETE_PASS 2
 The user has completed this activity with a grade above the pass mark. More...
 
const COMPLETION_CRITERIA_TYPE_ACTIVITY 4
 Activity completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_CRITERIA_TYPE_COURSE 8
 Course completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_CRITERIA_TYPE_DATE 2
 Date completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_CRITERIA_TYPE_DURATION 5
 Duration completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_CRITERIA_TYPE_GRADE 6
 Grade completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_CRITERIA_TYPE_ROLE 7
 Role completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_CRITERIA_TYPE_SELF 1
 Self completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_CRITERIA_TYPE_UNENROL 3
 Unenrol completion criteria type Criteria type constant, primarily for storing criteria type in the database.
 
const COMPLETION_DISABLED 0
 The completion system is not enabled in this site/course.
 
const COMPLETION_ENABLED 1
 Include the required completion libraries. More...
 
const COMPLETION_GRADECHANGE -2
 The user's grade has changed, so their new state might be COMPLETION_COMPLETE_PASS or COMPLETION_COMPLETE_FAIL. More...
 
const COMPLETION_INCOMPLETE 0
 The user has not completed this activity. More...
 
const COMPLETION_NOT_VIEWED 0
 User has not viewed this activity. More...
 
const COMPLETION_OR false
 Completion details should be ORed together and you should return false if none apply.
 
const COMPLETION_TRACKING_AUTOMATIC 2
 Automatic completion tracking (system ticks box) is enabled for this activity This is a completion tracking option per-activity (course_modules/completion)
 
const COMPLETION_TRACKING_MANUAL 1
 Manual completion tracking (user ticks box) is enabled for this activity This is a completion tracking option per-activity (course_modules/completion)
 
const COMPLETION_TRACKING_NONE 0
 Completion tracking is disabled for this activity This is a completion tracking option per-activity (course_modules/completion)
 
const COMPLETION_UNKNOWN -1
 The effect of this change to completion status is unknown. More...
 
const COMPLETION_VIEW_NOT_REQUIRED 0
 User does not need to view this activity Whether view is required to create an activity (course_modules/completionview)
 
const COMPLETION_VIEW_REQUIRED 1
 User must view this activity. More...
 
const COMPLETION_VIEWED 1
 User has viewed this activity. More...
 
const DATA_OBJECT_FETCH_BY_KEY 2
 Trigger for the new data_object api. More...
 

Detailed Description

Function Documentation

◆ completion_can_view_data()

completion_can_view_data (   $userid,
  $course = null 
)

Utility function for checking if the logged in user can view another's completion data for a particular course.

Parameters
int$useridCompletion data's owner
mixed$courseCourse object or Course ID (optional)
Return values
boolean

◆ completion_cron_aggregate()

completion_cron_aggregate (   $method,
  $data,
$state 
)

Aggregate criteria status's as per configured aggregation method.

Parameters
int$methodCOMPLETION_AGGREGATION_* constant.
bool$dataCriteria completion status.
bool | null$stateAggregation state.

Variable Documentation

◆ $COMPLETION_CRITERIA_TYPES

$COMPLETION_CRITERIA_TYPES
Initial value:
= array(
)
const COMPLETION_CRITERIA_TYPE_DURATION
Duration completion criteria type Criteria type constant, primarily for storing criteria type in the ...
Definition: completion_criteria.php:59
const COMPLETION_CRITERIA_TYPE_SELF
Self completion criteria type Criteria type constant, primarily for storing criteria type in the data...
Definition: completion_criteria.php:35
const COMPLETION_CRITERIA_TYPE_ROLE
Role completion criteria type Criteria type constant, primarily for storing criteria type in the data...
Definition: completion_criteria.php:71
const COMPLETION_CRITERIA_TYPE_UNENROL
Unenrol completion criteria type Criteria type constant, primarily for storing criteria type in the d...
Definition: completion_criteria.php:47
const COMPLETION_CRITERIA_TYPE_DATE
Date completion criteria type Criteria type constant, primarily for storing criteria type in the data...
Definition: completion_criteria.php:41
const COMPLETION_CRITERIA_TYPE_COURSE
Course completion criteria type Criteria type constant, primarily for storing criteria type in the da...
Definition: completion_criteria.php:77
const COMPLETION_CRITERIA_TYPE_GRADE
Grade completion criteria type Criteria type constant, primarily for storing criteria type in the dat...
Definition: completion_criteria.php:65
const COMPLETION_CRITERIA_TYPE_ACTIVITY
Activity completion criteria type Criteria type constant, primarily for storing criteria type in the ...
Definition: completion_criteria.php:53

Criteria type constant to class name mapping.

This global variable would be improved if it was implemented as a cache.

◆ COMPLETION_COMPLETE

const COMPLETION_COMPLETE 1

The user has completed this activity.

It is not specified whether they have passed or failed it. This is a completion state value (course_modules_completion/completionstate)

◆ COMPLETION_COMPLETE_PASS

const COMPLETION_COMPLETE_PASS 2

The user has completed this activity with a grade above the pass mark.

This is a completion state value (course_modules_completion/completionstate)

◆ COMPLETION_ENABLED

const COMPLETION_ENABLED 1

Include the required completion libraries.

The completion system is enabled in this site/course

◆ COMPLETION_GRADECHANGE

const COMPLETION_GRADECHANGE -2

The user's grade has changed, so their new state might be COMPLETION_COMPLETE_PASS or COMPLETION_COMPLETE_FAIL.

A completion effect changes (used only in update_state)

◆ COMPLETION_INCOMPLETE

const COMPLETION_INCOMPLETE 0

The user has not completed this activity.

This is a completion state value (course_modules_completion/completionstate)

◆ COMPLETION_NOT_VIEWED

const COMPLETION_NOT_VIEWED 0

User has not viewed this activity.

Completion viewed state (course_modules_completion/viewed)

◆ COMPLETION_UNKNOWN

const COMPLETION_UNKNOWN -1

The effect of this change to completion status is unknown.

A completion effect changes (used only in update_state)

◆ COMPLETION_VIEW_REQUIRED

const COMPLETION_VIEW_REQUIRED 1

User must view this activity.

Whether view is required to create an activity (course_modules/completionview)

◆ COMPLETION_VIEWED

const COMPLETION_VIEWED 1

User has viewed this activity.

Completion viewed state (course_modules_completion/viewed)

◆ DATA_OBJECT_FETCH_BY_KEY

const DATA_OBJECT_FETCH_BY_KEY 2

Trigger for the new data_object api.

See data_object::__constructor