Merge branch 'MDL-61102-master' of https://github.com/sammarshallou/moodle
[moodle.git] / search / index.php
index 1d24151..638aff7 100644 (file)
@@ -66,10 +66,14 @@ if ($contextid) {
         $searchwithin = [];
         $searchwithin[''] = get_string('everywhere', 'search');
         $searchwithin['course'] = $coursecontext->get_context_name();
-        if ($context->contextlevel !== CONTEXT_COURSE) {
+        if ($context->contextlevel != CONTEXT_COURSE) {
             $searchwithin['context'] = $context->get_context_name();
+            if ($context->contextlevel == CONTEXT_MODULE) {
+                $customdata['withincmid'] = $context->instanceid;
+            }
         }
         $customdata['searchwithin'] = $searchwithin;
+        $customdata['withincourseid'] = $coursecontext->instanceid;
     }
 
     // Get available ordering options from search engine.