Merge branch '46499-28' of git://github.com/samhemelryk/moodle

This commit is contained in:
Damyon Wiese 2014-10-24 09:56:55 +08:00 committed by Eloy Lafuente (stronk7)
commit 0b9635cba4
2 changed files with 8 additions and 1 deletions

View File

@ -2282,7 +2282,14 @@ class global_navigation extends navigation_node {
$userscourses = enrol_get_users_courses($user->id);
$userscoursesnode = $usernode->add(get_string('courses'));
$count = 0;
foreach ($userscourses as $usercourse) {
if ($count === (int)$CFG->navcourselimit) {
$url = new moodle_url('/user/profile.php', array('id' => $user->id, 'showallcourses' => 1));
$userscoursesnode->add(get_string('showallcourses'), $url);
break;
}
$count++;
$usercoursecontext = context_course::instance($usercourse->id);
$usercourseshortname = format_string($usercourse->shortname, true, array('context' => $usercoursecontext));
$usercoursenode = $userscoursesnode->add($usercourseshortname, new moodle_url('/user/view.php', array('id'=>$user->id, 'course'=>$usercourse->id)), self::TYPE_CONTAINER);

View File

@ -398,7 +398,7 @@ if (!isset($hiddenfields['mycourses'])) {
$courselisting .= ', ';
}
$shown++;
if (!$showallcourses && $shown == 20) {
if (!$showallcourses && $shown == $CFG->navcourselimit) {
$url = new moodle_url('/user/profile.php', array('id' => $user->id, 'showallcourses' => 1));
$courselisting .= html_writer::link($url, '...', array('title' => get_string('viewmore')));
break;