diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index da078d78247..f3f63c91e39 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -110,6 +110,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page ); $temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices)); $temp->add(new admin_setting_configcheckbox('allowguestmymoodle', new lang_string('allowguestmymoodle', 'admin'), new lang_string('configallowguestmymoodle', 'admin'), 1)); + $temp->add(new admin_setting_configcheckbox('navshowfullcoursenames', new lang_string('navshowfullcoursenames', 'admin'), new lang_string('navshowfullcoursenames_help', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1)); $temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0)); diff --git a/lang/en/admin.php b/lang/en/admin.php index 12854e1e2eb..4996af6f254 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -739,6 +739,8 @@ $string['navadduserpostslinks'] = 'Add links to view user posts'; $string['navadduserpostslinks_help'] = 'If enabled two links will be added to each user in the navigation to view discussions the user has started and posts the user has made in forums throughout the site or in specific courses.'; $string['navigationupgrade'] = 'This upgrade introduces two new navigation blocks that will replace these blocks: Administration, Courses, Activities and Participants. If you had set any special permissions on those blocks you should check to make sure everything is behaving as you want it.'; $string['navcourselimit'] = 'Course limit'; +$string['navshowfullcoursenames'] = 'Show course full names'; +$string['navshowfullcoursenames_help'] = 'If enabled courses in the navigation will be shown with using their full name rather than their short name.'; $string['navshowfrontpagemods'] = 'Show front page activities in the navigation'; $string['navshowfrontpagemods_help'] = 'If enabled, front page activities will be shown on the navigation under site pages.'; $string['navshowallcourses'] = 'Show all courses'; diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 7f4c0701b7d..185d960b6a8 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2339,12 +2339,15 @@ class global_navigation extends navigation_node { $issite = ($course->id == $SITE->id); $shortname = format_string($course->shortname, true, array('context' => $coursecontext)); + $fullname = format_string($course->fullname, true, array('context' => $coursecontext)); + // This is the name that will be shown for the course. + $coursename = empty($CFG->navshowfullcoursenames) ? $shortname : $fullname; if ($issite) { $parent = $this; $url = null; if (empty($CFG->usesitenameforsitepages)) { - $shortname = get_string('sitepages'); + $coursename = get_string('sitepages'); } } else if ($coursetype == self::COURSE_CURRENT) { $parent = $this->rootnodes['currentcourse']; @@ -2374,10 +2377,10 @@ class global_navigation extends navigation_node { } } - $coursenode = $parent->add($shortname, $url, self::TYPE_COURSE, $shortname, $course->id); + $coursenode = $parent->add($coursename, $url, self::TYPE_COURSE, $shortname, $course->id); $coursenode->nodetype = self::NODETYPE_BRANCH; $coursenode->hidden = (!$course->visible); - $coursenode->title(format_string($course->fullname, true, array('context' => context_course::instance($course->id)))); + $coursenode->title($fullname); if (!$forcegeneric) { $this->addedcourses[$course->id] = $coursenode; }