mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-21687 Completion 'on view' not working on resource types after resource was rewritten
This commit is contained in:
parent
6d6b454aca
commit
c15a60e6be
@ -45,6 +45,10 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
add_to_log($course->id, 'folder', 'view', 'view.php?id='.$cm->id, $folder->id, $cm->id);
|
||||
|
||||
// Update 'viewed' state if required by completion system
|
||||
$completion = new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
$PAGE->set_url('/mod/folder/view.php', array('id' => $cm->id));
|
||||
|
||||
$PAGE->set_title($course->shortname.': '.$folder->name);
|
||||
|
@ -45,6 +45,10 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
add_to_log($course->id, 'imscp', 'view', 'view.php?id='.$cm->id, $imscp->id, $cm->id);
|
||||
|
||||
// Update 'viewed' state if required by completion system
|
||||
$completion = new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
$PAGE->set_url('/mod/imscp/view.php', array('id' => $cm->id));
|
||||
$PAGE->requires->js('/mod/imscp/dummyapi.js', true);
|
||||
|
||||
|
@ -52,6 +52,10 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
add_to_log($course->id, 'page', 'view', 'view.php?id='.$cm->id, $page->id, $cm->id);
|
||||
|
||||
// Update 'viewed' state if required by completion system
|
||||
$completion = new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
$PAGE->set_url('/mod/page/view.php', array('id' => $cm->id));
|
||||
|
||||
$options = empty($page->displayoptions) ? array() : unserialize($page->displayoptions);
|
||||
|
@ -304,6 +304,18 @@ function resource_get_coursemodule_info($coursemodule) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $coursemodule->id);
|
||||
$path = '/'.$context->id.'/resource_content/'.$resource->revision.$resource->mainfile;
|
||||
$fullurl = addslashes_js(file_encode_url($CFG->wwwroot.'/pluginfile.php', $path, true));
|
||||
|
||||
// When completion information is enabled for download files, make
|
||||
// the JavaScript version go to the view page with redirect set,
|
||||
// instead of directly to the file, otherwise we can't make it tick
|
||||
// the box for them
|
||||
if (!$course = $DB->get_record('course', array('id'=>$coursemodule->course), 'id, enablecompletion')) {
|
||||
return NULL;
|
||||
}
|
||||
$completion = new completion_info($course);
|
||||
if ($completion->is_enabled($coursemodule) == COMPLETION_TRACKING_AUTOMATIC) {
|
||||
$fullurl = "$CFG->wwwroot/mod/resource/view.php?id=$coursemodule->id&redirect=1";
|
||||
}
|
||||
$info->extra = "onclick=\"window.open('$fullurl'); return false;\"";
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,10 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
add_to_log($course->id, 'resource', 'view', 'view.php?id='.$cm->id, $resource->id, $cm->id);
|
||||
|
||||
// Update 'viewed' state if required by completion system
|
||||
$completion = new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
$PAGE->set_url('/mod/resource/view.php', array('id' => $cm->id));
|
||||
|
||||
if ($resource->tobemigrated) {
|
||||
|
@ -46,6 +46,10 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
add_to_log($course->id, 'url', 'view', 'view.php?id='.$cm->id, $url->id, $cm->id);
|
||||
|
||||
// Update 'viewed' state if required by completion system
|
||||
$completion = new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
$PAGE->set_url('/mod/url/view.php', array('id' => $cm->id));
|
||||
|
||||
if ($redirect) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user