From 2c8e21ac35bbee9f2d560ffc864c0fb6163b21cf Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Wed, 19 Jun 2013 11:04:11 +1000 Subject: [PATCH] MDL-38631 link categories in My courses only when needed --- blocks/navigation/renderer.php | 4 +++- lib/ajax/getnavbranch.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/blocks/navigation/renderer.php b/blocks/navigation/renderer.php index 92e28310c39..8387e082644 100644 --- a/blocks/navigation/renderer.php +++ b/blocks/navigation/renderer.php @@ -105,7 +105,9 @@ class block_navigation_renderer extends plugin_renderer_base { if ($item->hidden) { $attributes['class'] = 'dimmed_text'; } - if (is_string($item->action) || empty($item->action) || ($item->type === navigation_node::TYPE_CATEGORY && empty($options['linkcategories']))) { + if (is_string($item->action) || empty($item->action) || + (($item->type === navigation_node::TYPE_CATEGORY || $item->type === navigation_node::TYPE_MY_CATEGORY) && + empty($options['linkcategories']))) { $attributes['tabindex'] = '0'; //add tab support to span but still maintain character stream sequence. $content = html_writer::tag('span', $content, $attributes); } else if ($item->action instanceof action_link) { diff --git a/lib/ajax/getnavbranch.php b/lib/ajax/getnavbranch.php index e42d63a74a1..957d0a9bc70 100644 --- a/lib/ajax/getnavbranch.php +++ b/lib/ajax/getnavbranch.php @@ -103,6 +103,9 @@ try { foreach ($branch->find_all_of_type(navigation_node::TYPE_CATEGORY) as $category) { $category->action = null; } + foreach ($branch->find_all_of_type(navigation_node::TYPE_MY_CATEGORY) as $category) { + $category->action = null; + } } // Stop buffering errors at this point