--- /Users/daniele/Desktop/funzionando1.1.2/latest/moodle19/lib/weblib.php 2009-02-17 00:05:37.000000000 +0100 +++ /Applications/MAMP/htdocs/moodle19/lib/weblib.php 2009-02-19 14:38:06.000000000 +0100 @@ -3788,6 +3798,35 @@ 'type' => 'home'); } + if (!isset($CFG->hidecategorynavlink)) { + // use default = show + $CFG->hidecategorynavlink = 0; + } + if ($CFG->hidecategorynavlink == 0) { + // Non nascondere a nessuno + $showcategory = true; + } + if ($CFG->hidecategorynavlink == 1) { + // Nascondi agli studenti + $showcategory = !has_capability('moodle/course:view', get_context_instance(CONTEXT_COURSE, $COURSE->id), '', false); + } + if ($CFG->hidecategorynavlink == 2) { + // Nascondi a tutti gli utenti + $showcategory = false; + } + + if (isset($COURSE) && $showcategory) { + $catlinks = array(); + if ($cattree = get_record("course_categories", "id", $COURSE->category)) { + $catlinks[] = array('name' => $cattree->name, 'link' => "category.php?id=$COURSE->category", 'type' => 'category'); + while ($cattree->parent) { + $cattree = get_record("course_categories", "id", $cattree->parent); + array_unshift($catlinks, array('name' => $cattree->name, 'link' => "category.php?id=$COURSE->category", 'type' => 'category')); + } + } + $navlinks = array_merge($navlinks, $catlinks); + } + // Course name, if appropriate. if (isset($COURSE) && $COURSE->id != SITEID) { $navlinks[] = array(