From: skodak Date: Sun, 24 Sep 2006 20:23:40 +0000 (+0000) Subject: it is now possible to hide parts of admin tree - not used yet, but it will be soon... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a8a66c96ab2affac3bc1d64243fe60d010423278;p=moodle.git it is now possible to hide parts of admin tree - not used yet, but it will be soon used for those hidden unsupported scripts in admin/ directory --- diff --git a/blocks/admin_tree/block_admin_tree.php b/blocks/admin_tree/block_admin_tree.php index aa0dee958a..323d045672 100644 --- a/blocks/admin_tree/block_admin_tree.php +++ b/blocks/admin_tree/block_admin_tree.php @@ -57,16 +57,16 @@ class block_admin_tree extends block_base { function build_tree (&$content) { global $CFG; if (is_a($content, 'admin_settingpage')) { - if ($content->check_access()) { + if ($content->check_access() and !$content->is_hidden()) { $this->create_item($content->visiblename,$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=' . $content->name,$CFG->wwwroot .'/blocks/admin_tree/item.gif'); } } else if (is_a($content, 'admin_externalpage')) { - if ($content->check_access()) { + if ($content->check_access() and !$content->is_hidden()) { $this->create_item($content->visiblename, $content->url, $CFG->wwwroot . '/blocks/admin_tree/item.gif'); } } else if (is_a($content, 'admin_category')) { - if ($content->check_access()) { - + if ($content->check_access() and !$content->is_hidden()) { + // check if the category we're currently printing is a parent category for the current page; if it is, we // make a note (in the javascript) that it has to be expanded after the page has loaded if ($this->pathtosection[count($this->pathtosection) - 1] == $content->name) { @@ -75,11 +75,11 @@ class block_admin_tree extends block_base { } $this->open_folder($content->visiblename); - + unset($entries); - + $entries = array_keys($content->children); - + foreach ($entries as $entry) { $this->build_tree($content->children[$entry]); } @@ -92,7 +92,7 @@ class block_admin_tree extends block_base { function get_content() { global $CFG, $ADMIN; - + require_once($CFG->libdir.'/adminlib.php'); $adminroot = admin_get_root(); @@ -107,17 +107,17 @@ class block_admin_tree extends block_base { // we need to do this instead of $this->build_tree($adminroot) because the top-level folder // is redundant (and ideally ignored). (the top-level folder is "administration".) - + unset($entries); - + $entries = array_keys($adminroot->children); - - asort($entries); - + + asort($entries); + foreach ($entries as $entry) { $this->build_tree($adminroot->children[$entry]); } - + if ($this->tempcontent !== '') { $this->content = new stdClass; $this->content->text = '' . "\n"; $this->content->text .= '
' . "\n"; - + $this->content->text .= $this->tempcontent; - + $this->content->text .= '
' . "\n"; $this->content->text .= '