Skip to content

Commit

Permalink
MDL-10115 User profile: Allow full list of courses to be viewed on a …
Browse files Browse the repository at this point in the history
…user's profile
  • Loading branch information
John Okely committed Jun 12, 2014
1 parent ca4f7f6 commit 9594f50
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
16 changes: 9 additions & 7 deletions user/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
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));

Expand Down Expand Up @@ -381,12 +382,13 @@
}
$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;
}
}
Expand Down
14 changes: 8 additions & 6 deletions user/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
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)) {
Expand Down Expand Up @@ -325,16 +326,17 @@
}
$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;
}
}
Expand Down

0 comments on commit 9594f50

Please sign in to comment.