Skip to content

Commit

Permalink
MDL-38020 participants: Use consistent link for editing enrollments
Browse files Browse the repository at this point in the history
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 a85c16a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions user/index.php
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down

0 comments on commit a85c16a

Please sign in to comment.