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).
This commit is contained in:
Dan Poltawski 2015-12-30 14:52:29 +00:00
parent afbb53d70b
commit 7057c3efa9

View File

@ -506,6 +506,11 @@ if (count($rolenames) > 1) {
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 @@ if ($roleid > 0) {
$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 {