MDL-36906 - mod_data: Latitude and Logitude error fix.
authorAdrian Greeve <adrian@moodle.com>
Thu, 29 Nov 2012 06:43:25 +0000 (14:43 +0800)
committerAdrian Greeve <adrian@moodle.com>
Thu, 29 Nov 2012 06:50:16 +0000 (14:50 +0800)
Thanks to Marcus Boon for providing a patch for this issue.

mod/data/field/latlong/kml.php was missing a context variable.
This was causing an error when trying to download a kml file for
google earth. This variable has now been included.

mod/data/field/latlong/kml.php

index 4a5cf40..2a68d4c 100644 (file)
@@ -75,8 +75,10 @@ if ($rid) {
 
 require_course_login($course, true, $cm);
 
 
 require_course_login($course, true, $cm);
 
+$context = context_module::instance($cm->id);
+
 /// If it's hidden then it's don't show anything.  :)
 /// If it's hidden then it's don't show anything.  :)
-if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities',get_context_instance(CONTEXT_MODULE, $cm->id))) {
+if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
     $PAGE->set_title($data->name);
     echo $OUTPUT->header();
     notice(get_string("activityiscurrentlyhidden"));
     $PAGE->set_title($data->name);
     echo $OUTPUT->header();
     notice(get_string("activityiscurrentlyhidden"));