====== Course completion ====== There are several states of completion of the course - Completion is turned off - Completion is turned on - Without any criteria - With one or more criteria(s) - Course is completed ==== 1. Completion is turned off ==== Settings->Course administration->Edit settings Completion tracking -> 'Disabled, not shown in activity settings' Database(DB): table 'mdl_course' field 'enablecompletion' is 0 -------------- ==== 2. Completion is turned on ==== Settings->Course administration->Edit settings Completion tracking -> 'Enabled, control via.....' DB: table 'mdl_course' field 'enablecompletion' is 1 --------------- ==== 3. Without any criteria ==== DB: table 'mdl_course_completion_criteria' does not contain any records with 'course' = [concrete course id] --------------- ==== 4. With one or more criteria(s) ==== DB: table 'mdl_course_completion_criteria' contains record(s) with 'course' = [concrete course id] --------------- ==== 5. Course is completed ==== DB: table 'mdl_course_completions' field 'timecompleted' != NULL via php code: $params = array( 'userid' => $user_id, 'course' => $course_id ); $ccompletion = new completion_completion($params); $ccompletion->is_complete();