Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bf413f6
)
navigation MDL-24214 Hidden categories are now dealt with correctly by the navigation
author
Sam Hemelryk
<sam@moodle.com>
Wed, 15 Sep 2010 06:02:02 +0000
(06:02 +0000)
committer
Sam Hemelryk
<sam@moodle.com>
Wed, 15 Sep 2010 06:02:02 +0000
(06:02 +0000)
lib/navigationlib.php
patch
|
blob
|
blame
|
history
diff --git
a/lib/navigationlib.php
b/lib/navigationlib.php
index
17b09cf
..
4468110
100644
(file)
--- a/
lib/navigationlib.php
+++ b/
lib/navigationlib.php
@@
-1265,14
+1265,21
@@
class global_navigation extends navigation_node {
* @param navigation_node $parent
*/
protected function add_category($cat, navigation_node $parent) {
* @param navigation_node $parent
*/
protected function add_category($cat, navigation_node $parent) {
- $category = $parent->get($cat['category']->id, navigation_node::TYPE_CATEGORY);
- if (!$category) {
+ $category
node
= $parent->get($cat['category']->id, navigation_node::TYPE_CATEGORY);
+ if (!$category
node
) {
$category = $cat['category'];
$url = new moodle_url('/course/category.php', array('id'=>$category->id));
$category = $cat['category'];
$url = new moodle_url('/course/category.php', array('id'=>$category->id));
- $category = $parent->add($category->name, null, self::TYPE_CATEGORY, $category->name, $category->id);
+ $categorynode = $parent->add($category->name, null, self::TYPE_CATEGORY, $category->name, $category->id);
+ if (empty($category->visible)) {
+ if (has_capability('moodle/category:viewhiddencategories', get_system_context())) {
+ $categorynode->hidden = true;
+ } else {
+ $categorynode->display = false;
+ }
+ }
}
foreach ($cat['children'] as $child) {
}
foreach ($cat['children'] as $child) {
- $this->add_category($child, $category);
+ $this->add_category($child, $category
node
);
}
}
}
}