Permalink
Browse files

MDL-38020 participants: Use consistent link for editing enrollments

Previously the role assignment url was used when a role was selected, but
this page doesn't enrol users into the course (its the old 1.9 way
before we had the enrollments table).
  • Loading branch information...
danpoltawski committed Dec 30, 2015
1 parent ebc7b73 commit a85c16aea5aac7999d01d6b52ef04407f2e87c4c
Showing with 13 additions and 10 deletions.
  1. +13 −10 user/index.php
View
@@ -506,6 +506,11 @@
echo '</div>';
}
$editlink = '';
if ($course->id != SITEID && has_capability('moodle/course:enrolreview', $context)) {
$editlink = new moodle_url('/enrol/users.php', array('id' => $course->id));
}
if ($roleid > 0) {
$a = new stdClass();
$a->number = $totalcount;
@@ -524,24 +529,22 @@
$heading .= ": $a->number";
if (user_can_assign($context, $roleid)) {
$headingurl = new moodle_url($CFG->wwwroot . '/' . $CFG->admin . '/roles/assign.php',
array('roleid' => $roleid, 'contextid' => $context->id));
$heading .= $OUTPUT->action_icon($headingurl, new pix_icon('t/edit', get_string('edit')));
if (!empty($editlink)) {
$editlink->param('role', $roleid);
$heading .= $OUTPUT->action_icon($editlink, new pix_icon('t/edit', get_string('edit')));
}
echo $OUTPUT->heading($heading, 3);
} else {
if ($course->id != SITEID && has_capability('moodle/course:enrolreview', $context)) {
$editlink = $OUTPUT->action_icon(new moodle_url('/enrol/users.php', array('id' => $course->id)),
new pix_icon('t/edit', get_string('edit')));
} else {
$editlink = '';
}
if ($course->id == SITEID and $roleid < 0) {
$strallparticipants = get_string('allsiteusers', 'role');
} else {
$strallparticipants = get_string('allparticipants');
}
if (!empty($editlink)) {
$editlink = $OUTPUT->action_icon($editlink, new pix_icon('t/edit', get_string('edit')));
}
if ($matchcount < $totalcount) {
echo $OUTPUT->heading($strallparticipants.get_string('labelsep', 'langconfig').$matchcount.'/'.$totalcount . $editlink, 3);
} else {

0 comments on commit a85c16a

Please sign in to comment.