MDL-10115 User profile: Use moodle_url and html_writer::link for course links on user profiles

This commit is contained in:
John Okely 2014-06-16 13:22:18 +08:00
parent 9594f50af3
commit 8b05f3a355
2 changed files with 18 additions and 8 deletions

View File

@ -382,13 +382,18 @@ if (!isset($hiddenfields['mycourses'])) {
}
$class = 'class="dimmed"';
}
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}" .
($showallcourses ? "&amp;showallcourses=1" : "") . "\" $class >" .
$ccontext->get_context_name(false) . "</a>, ";
$params = array('id' => $user->id, 'course' => $mycourse->id);
if ($showallcourses) {
$params['showallcourses'] = 1;
}
$url = new moodle_url('/user/view.php', $params);
$courselisting .= html_writer::link($url, $ccontext->get_context_name(false), array('class' => $class));
$courselisting .= ', ';
}
$shown++;
if (!$showallcourses && $shown == 20) {
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/profile.php?id={$user->id}&amp;showallcourses=1\">...</a>";
$url = new moodle_url('/user/profile.php', array('id' => $user->id, 'showallcourses' => 1));
$courselisting .= html_writer::link($url, '...');
break;
}
}

View File

@ -326,8 +326,13 @@ if (!isset($hiddenfields['mycourses'])) {
}
$class = 'class="dimmed"';
}
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}" .
($showallcourses ? "&amp;showallcourses=1" : "") . "\" $class >" . $cfullname . "</a>, ";
$params = array('id' => $user->id, 'course' => $mycourse->id);
if ($showallcourses) {
$params['showallcourses'] = 1;
}
$url = new moodle_url('/user/view.php', $params);
$courselisting .= html_writer::link($url, $ccontext->get_context_name(false), array('class' => $class));
$courselisting .= ', ';
} else {
$courselisting .= $cfullname . ", ";
$PAGE->navbar->add($cfullname);
@ -335,8 +340,8 @@ if (!isset($hiddenfields['mycourses'])) {
}
$shown++;
if (!$showallcourses && $shown >= 20) {
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}" .
"&amp;course=$courseid&amp;showallcourses=1\">...</a>";
$url = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $courseid, 'showallcourses' => 1));
$courselisting .= html_writer::link($url, '...');
break;
}
}