--- /Users/Daniele/Desktop/moodle19/lib/weblib.php 2009-02-17 00:05:37.000000000 +0100
+++ /Applications/MAMP/htdocs/moodle19/lib/weblib.php 2009-02-19 17:19:22.000000000 +0100
@@ -3788,6 +3788,37 @@
'type' => 'home');
}
+ if (!isset($CFG->hidecategorynavlink)) {
+ // use default = show
+ $CFG->hidecategorynavlink = 0;
+ }
+ if ($CFG->hidecategorynavlink == 0) {
+ // Hide from nobody
+ $showcategory = true;
+ }
+ if ($CFG->hidecategorynavlink == 1) {
+ // Hide from students
+ $showcategory = !has_capability('moodle/course:view', get_context_instance(CONTEXT_COURSE, $COURSE->id), '', false);
+ }
+ if ($CFG->hidecategorynavlink == 2) {
+ // Hide from all users
+ $showcategory = false;
+ }
+
+ if (isset($COURSE) && $showcategory) {
+ $catlinks = array();
+ if ($cattree = get_record("course_categories", "id", $COURSE->category)) {
+ $cattype = $cattree->visible ? "category" : "hiddencategory";
+ $catlinks[] = array('name' => $cattree->name, 'link' => "category.php?id=$COURSE->category", 'type' => $cattype);
+ while ($cattree->parent) {
+ $cattree = get_record("course_categories", "id", $cattree->parent);
+ $cattype = $cattree->visible ? "category" : "hiddencategory";
+ array_unshift($catlinks, array('name' => $cattree->name, 'link' => "category.php?id=$COURSE->category", 'type' => $cattype));
+ }
+ }
+ $navlinks = array_merge($navlinks, $catlinks);
+ }
+
// Course name, if appropriate.
if (isset($COURSE) && $COURSE->id != SITEID) {
$navlinks[] = array(
@@ -3866,7 +3897,11 @@
$navigation .= get_separator();
}
if ((!empty($navlink['link'])) && !$last) {
- $navigation .= "framename'\" href=\"{$navlink['link']}\">";
+ if ($navlink['type'] == 'hiddencategory') {
+ $navigation .= "framename'\" href=\"{$navlink['link']}\">";
+ } else {
+ $navigation .= "framename'\" href=\"{$navlink['link']}\">";
+ }
}
$navigation .= "{$navlink['name']}";
if ((!empty($navlink['link'])) && !$last) {