]> git.mjollnir.org Git - moodle.git/commitdiff
filters: MDL-7336 settings page for setting the local enabled/disabled state
authortjhunt <tjhunt>
Mon, 13 Apr 2009 08:24:20 +0000 (08:24 +0000)
committertjhunt <tjhunt>
Mon, 13 Apr 2009 08:24:20 +0000 (08:24 +0000)
 - managed to missed this bit when transferring my changes from git.

admin/roles/tabs.php

index c86fe4edfc547c1ecd5628fc90967ccb5a703d8e..86194b87e1efa8fee02b14853c27b320c4609f81 100755 (executable)
@@ -35,6 +35,15 @@ if (!defined('MOODLE_INTERNAL')) {
     die('Direct access to this script is forbidden.'); // It must be included from a Moodle page
 }
 
+if (!isset($availablefilters)) {
+    $availablefilters  = array();
+    if (in_array($context->contextlevel, array(CONTEXT_COURSECAT, CONTEXT_COURSE, CONTEXT_MODULE)) &&
+            !($context->contextlevel == CONTEXT_COURSE && $context->instanceid == SITEID) &&
+            has_capability('moodle/filter:manage', $context)) {
+        $availablefilters = filter_get_available_in_context($context);
+    }
+}
+
 $navlinks = array();
 if ($currenttab != 'update') {
     switch ($context->contextlevel) {
@@ -202,6 +211,11 @@ if ($context->contextlevel != CONTEXT_SYSTEM) {    // Print tabs for anything ex
                 get_string('checkpermissions', 'role'));
     }
 
+    if (!empty($availablefilters)) {
+        $toprow[] = new tabobject('filters',
+                $CFG->wwwroot.'/filter/manage.php?contextid=' . $context->id,
+                get_string('filters', 'admin'));
+    }
 }
 
 /// Here other core tabs should go (always calling tabs.php files)
@@ -211,7 +225,7 @@ if ($context->contextlevel != CONTEXT_SYSTEM) {    // Print tabs for anything ex
 
 /// Finally, we support adding some 'on-the-fly' tabs here
 /// All the logic to decide what to show must be self-cointained in the tabs file
-    if (isset($CFG->extratabs) && !empty($CFG->extratabs)) {
+    if (!empty($CFG->extratabs)) {
         if ($extratabs = explode(',', $CFG->extratabs)) {
             asort($extratabs);
             foreach($extratabs as $extratab) {