1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 02:16:06 +02:00

MDL-10115 User profile: Allow full list of courses to be viewed on a user's profile

This commit is contained in:
John Okely 2014-06-12 14:02:04 +08:00
parent ca4f7f6105
commit 9594f50af3
2 changed files with 17 additions and 13 deletions

@ -38,9 +38,10 @@ require_once($CFG->dirroot . '/tag/lib.php');
require_once($CFG->dirroot . '/user/profile/lib.php');
require_once($CFG->libdir.'/filelib.php');
$userid = optional_param('id', 0, PARAM_INT);
$edit = optional_param('edit', null, PARAM_BOOL); // Turn editing on and off.
$reset = optional_param('reset', null, PARAM_BOOL);
$userid = optional_param('id', 0, PARAM_INT);
$edit = optional_param('edit', null, PARAM_BOOL); // Turn editing on and off.
$reset = optional_param('reset', null, PARAM_BOOL);
$showallcourses = optional_param('showallcourses', 0, PARAM_INT);
$PAGE->set_url('/user/profile.php', array('id' => $userid));
@ -381,12 +382,13 @@ if (!isset($hiddenfields['mycourses'])) {
}
$class = 'class="dimmed"';
}
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}\" $class >" .
$ccontext->get_context_name(false) . "</a>, ";
$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>, ";
}
$shown++;
if ($shown == 20) {
$courselisting .= "...";
if (!$showallcourses && $shown == 20) {
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/profile.php?id={$user->id}&amp;showallcourses=1\">...</a>";
break;
}
}

@ -28,8 +28,9 @@ require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/badgeslib.php');
$id = optional_param('id', 0, PARAM_INT); // User id.
$courseid = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site).
$id = optional_param('id', 0, PARAM_INT); // User id.
$courseid = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site).
$showallcourses = optional_param('showallcourses', 0, PARAM_INT);
// See your own profile by default.
if (empty($id)) {
@ -325,16 +326,17 @@ if (!isset($hiddenfields['mycourses'])) {
}
$class = 'class="dimmed"';
}
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}\" $class >"
. $cfullname . "</a>, ";
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}" .
($showallcourses ? "&amp;showallcourses=1" : "") . "\" $class >" . $cfullname . "</a>, ";
} else {
$courselisting .= $cfullname . ", ";
$PAGE->navbar->add($cfullname);
}
}
$shown++;
if ($shown >= 20) {
$courselisting .= "...";
if (!$showallcourses && $shown >= 20) {
$courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}" .
"&amp;course=$courseid&amp;showallcourses=1\">...</a>";
break;
}
}