MDL-27491 Add 'complete on view' support to wiki, survey
authorsam marshall <s.marshall@open.ac.uk>
Wed, 3 Aug 2011 10:20:21 +0000 (11:20 +0100)
committersam marshall <s.marshall@open.ac.uk>
Wed, 10 Aug 2011 09:56:14 +0000 (10:56 +0100)
mod/survey/view.php
mod/wiki/lib.php
mod/wiki/view.php

index 2c44687..34e2f68 100644 (file)
         print_error('invalidtmptid', 'survey');
     }
 
+// Update 'viewed' state if required by completion system
+require_once($CFG->libdir . '/completionlib.php');
+$completion = new completion_info($course);
+$completion->set_module_viewed($cm);
+
     $showscales = ($template->name != 'ciqname');
 
     $strsurvey = get_string("modulename", "survey");
index 7f9a3d6..1428819 100644 (file)
@@ -246,8 +246,6 @@ function wiki_supports($feature) {
         return true;
     case FEATURE_COMPLETION_TRACKS_VIEWS:
         return true;
-    case FEATURE_COMPLETION_HAS_RULES:
-        return true;
     case FEATURE_GRADE_HAS_GRADE:
         return false;
     case FEATURE_GRADE_OUTCOMES:
index 6b6a40b..ae1c4d5 100644 (file)
@@ -258,6 +258,11 @@ require_capability('mod/wiki:viewpage', $context);
 
 add_to_log($course->id, 'wiki', 'view', 'view.php?id=' . $cm->id, $wiki->id);
 
+// Update 'viewed' state if required by completion system
+require_once($CFG->libdir . '/completionlib.php');
+$completion = new completion_info($course);
+$completion->set_module_viewed($cm);
+
 if (($edit != - 1) and $PAGE->user_allowed_editing()) {
     $USER->editing = $edit;
 }