libdir . '/completionlib.php'); $id = required_param('id', PARAM_INT); // Course Module ID $cm = get_coursemodule_from_id('exp360', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $exp360 = $DB->get_record('exp360', array('id' => $cm->instance), '*', MUST_EXIST); $content_id = $exp360->content_id; // Ensure completion is enabled for the course module. $completion = new completion_info($course); if ($completion->is_enabled($cm)) { // Mark the activity as completed for this user. $completion->update_state($cm, COMPLETION_COMPLETE, $userId); } ?>