Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-37644 navigation: new option to display course full names

  • Loading branch information...
commit d20337f180a716ce95a936c8ca0fb818b11590fe 1 parent b3778a0
Sam Hemelryk samhemelryk authored
1  admin/settings/appearance.php
@@ -110,6 +110,7 @@
110 110 );
111 111 $temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices));
112 112 $temp->add(new admin_setting_configcheckbox('allowguestmymoodle', new lang_string('allowguestmymoodle', 'admin'), new lang_string('configallowguestmymoodle', 'admin'), 1));
  113 + $temp->add(new admin_setting_configcheckbox('navshowfullcoursenames', new lang_string('navshowfullcoursenames', 'admin'), new lang_string('navshowfullcoursenames_help', 'admin'), 0));
113 114 $temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
114 115 $temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
115 116 $temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
2  lang/en/admin.php
@@ -737,6 +737,8 @@
737 737 $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.';
738 738 $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.';
739 739 $string['navcourselimit'] = 'Course limit';
  740 +$string['navshowfullcoursenames'] = 'Show course full names';
  741 +$string['navshowfullcoursenames_help'] = 'If enabled courses in the navigation will be shown with using their full name rather than their short name.';
740 742 $string['navshowfrontpagemods'] = 'Show front page activities in the navigation';
741 743 $string['navshowfrontpagemods_help'] = 'If enabled, front page activities will be shown on the navigation under site pages.';
742 744 $string['navshowallcourses'] = 'Show all courses';
9 lib/navigationlib.php
@@ -2339,12 +2339,15 @@ public function add_course(stdClass $course, $forcegeneric = false, $coursetype
2339 2339
2340 2340 $issite = ($course->id == $SITE->id);
2341 2341 $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
  2342 + $fullname = format_string($course->fullname, true, array('context' => $coursecontext));
  2343 + // This is the name that will be shown for the course.
  2344 + $coursename = empty($CFG->navshowfullcoursenames) ? $shortname : $fullname;
2342 2345
2343 2346 if ($issite) {
2344 2347 $parent = $this;
2345 2348 $url = null;
2346 2349 if (empty($CFG->usesitenameforsitepages)) {
2347   - $shortname = get_string('sitepages');
  2350 + $coursename = get_string('sitepages');
2348 2351 }
2349 2352 } else if ($coursetype == self::COURSE_CURRENT) {
2350 2353 $parent = $this->rootnodes['currentcourse'];
@@ -2374,10 +2377,10 @@ public function add_course(stdClass $course, $forcegeneric = false, $coursetype
2374 2377 }
2375 2378 }
2376 2379
2377   - $coursenode = $parent->add($shortname, $url, self::TYPE_COURSE, $shortname, $course->id);
  2380 + $coursenode = $parent->add($coursename, $url, self::TYPE_COURSE, $shortname, $course->id);
2378 2381 $coursenode->nodetype = self::NODETYPE_BRANCH;
2379 2382 $coursenode->hidden = (!$course->visible);
2380   - $coursenode->title(format_string($course->fullname, true, array('context' => context_course::instance($course->id))));
  2383 + $coursenode->title($fullname);
2381 2384 if (!$forcegeneric) {
2382 2385 $this->addedcourses[$course->id] = $coursenode;
2383 2386 }

0 comments on commit d20337f

Please sign in to comment.
Something went wrong with that request. Please try again.