MDL-40159 Fixing bug with empty variable, regression from MDL-21097
authorMarina Glancy <marina@moodle.com>
Mon, 17 Jun 2013 04:26:10 +0000 (14:26 +1000)
committerMarina Glancy <marina@moodle.com>
Mon, 17 Jun 2013 04:33:59 +0000 (14:33 +1000)
lib/navigationlib.php

index 07eea13..37b6669 100644 (file)
@@ -3604,12 +3604,11 @@ class settings_navigation extends navigation_node {
                 $editstring = get_string('turneditingon');
             }
             $coursenode->add($editstring, $editurl, self::TYPE_SETTING, null, null, new pix_icon('i/edit', ''));
                 $editstring = get_string('turneditingon');
             }
             $coursenode->add($editstring, $editurl, self::TYPE_SETTING, null, null, new pix_icon('i/edit', ''));
-        }
 
 
-        if (has_capability('moodle/course:manageactivities', $coursecontext)) {
             // Add the module chooser toggle
             // Add the module chooser toggle
-            $modchoosertoggleurl = clone($baseurl);
-            if ($this->page->user_is_editing() && course_ajax_enabled($course)) {
+            if ($this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $coursecontext)
+                    && course_ajax_enabled($course)) {
+                $modchoosertoggleurl = clone($baseurl);
                 if ($usemodchooser = get_user_preferences('usemodchooser', $CFG->modchooserdefault)) {
                     $modchoosertogglestring = get_string('modchooserdisable', 'moodle');
                     $modchoosertoggleurl->param('modchooser', 'off');
                 if ($usemodchooser = get_user_preferences('usemodchooser', $CFG->modchooserdefault)) {
                     $modchoosertogglestring = get_string('modchooserdisable', 'moodle');
                     $modchoosertoggleurl->param('modchooser', 'off');