Merge branch 'MDL-38020-29' of git://github.com/danpoltawski/moodle into MOODLE_29_STABLE

This commit is contained in:
Andrew Nicols
2016-01-12 12:24:18 +08:00
2 changed files with 50 additions and 10 deletions
@@ -0,0 +1,37 @@
@core_enrol
Feature: Manage enrollments from participants page
In order to manage course participants
As a teacher
In need to get to the enrolment page from the course participants page
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| teacher1 | teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Participants" node in "Current course > C1"
@javascript
Scenario: Check the participants link when "All partipants" selected
Given I set the field "roleid" to "All participants"
When I follow "Edit"
Then I should see "Enrolled users" in the "h2" "css_element"
And the field "Role" matches value "All"
@javascript
Scenario: Check the participants link when "Student" selected
Given I set the field "roleid" to "Student"
When I follow "Edit"
Then I should see "Enrolled users" in the "h2" "css_element"
And the field "Role" matches value "Student"
+13 -10
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 {