From 6246de9526defb12fecb1a3c505f038467564bd6 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 13 Apr 2009 08:24:20 +0000 Subject: [PATCH] filters: MDL-7336 settings page for setting the local enabled/disabled state - managed to missed this bit when transferring my changes from git. --- admin/roles/tabs.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index c86fe4edfc..86194b87e1 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -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) { -- 2.39.5