Merge branch 'MDL-78100' of https://github.com/Chocolate-lightning/moodle
This commit is contained in:
@@ -60,7 +60,7 @@ class action_bar extends \core_grades\output\action_bar {
|
||||
* @throws \moodle_exception
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output): array {
|
||||
global $PAGE, $OUTPUT;
|
||||
global $PAGE, $OUTPUT, $SESSION, $USER;
|
||||
// If in the course context, we should display the general navigation selector in gradebook.
|
||||
$courseid = $this->context->instanceid;
|
||||
// Get the data used to output the general navigation selector.
|
||||
@@ -125,6 +125,25 @@ class action_bar extends \core_grades\output\action_bar {
|
||||
'classes' => 'd-none',
|
||||
'content' => $collapse->export_for_template($output)
|
||||
];
|
||||
|
||||
if ($course->groupmode == VISIBLEGROUPS || has_capability('moodle/site:accessallgroups', $this->context)) {
|
||||
$allowedgroups = groups_get_all_groups($course->id, 0, $course->defaultgroupingid);
|
||||
} else {
|
||||
$allowedgroups = groups_get_all_groups($course->id, $USER->id, $course->defaultgroupingid);
|
||||
}
|
||||
|
||||
if (!empty($SESSION->gradereport["filterfirstname-{$this->context->id}"]) ||
|
||||
!empty($SESSION->gradereport["filterlastname-{$this->context->id}"]) ||
|
||||
groups_get_course_group($course, true, $allowedgroups) ||
|
||||
$this->usersearch) {
|
||||
$reset = new moodle_url('/grade/report/grader/index.php', [
|
||||
'id' => $courseid,
|
||||
'group' => 0,
|
||||
'sifirst' => '',
|
||||
'silast' => ''
|
||||
]);
|
||||
$data['pagereset'] = $reset->out(false);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
|
||||
$string['aria:dropdowncolumns'] = 'Collapsed columns found';
|
||||
$string['clearall'] = 'Clear all';
|
||||
$string['clearsearch'] = 'Clear searched users';
|
||||
$string['collapsedcolumns'] = 'Collapsed columns <span class="badge badge-pill badge-primary ml-1" data-collapse="count">{$a}</span>';
|
||||
$string['eventgradereportviewed'] = 'Grader report viewed';
|
||||
$string['grader:manage'] = 'Manage the grader report';
|
||||
|
||||
@@ -61,7 +61,8 @@
|
||||
]
|
||||
},
|
||||
"groupselector": "<div class='group-selector'></div>",
|
||||
"collapsedcolumns": "<div class='collapse-columns'></div>"
|
||||
"collapsedcolumns": "<div class='collapse-columns'></div>",
|
||||
"pagereset": "http://moodle.local/grade/report/grader/index.php?id=2&userid=2&reset=1"
|
||||
}
|
||||
}}
|
||||
<div class="container-fluid tertiary-navigation full-width-bottom-border">
|
||||
@@ -90,6 +91,12 @@
|
||||
</div>
|
||||
<div class="navitem-divider"></div>
|
||||
{{/initialselector}}
|
||||
{{#pagereset}}
|
||||
<div class="navitem align-self-center">
|
||||
<a href="{{{.}}}" class="btn btn-link">{{#str}}clearall, gradereport_grader{{/str}}</a>
|
||||
</div>
|
||||
<div class="navitem-divider"></div>
|
||||
{{/pagereset}}
|
||||
{{#collapsedcolumns}}
|
||||
<div class="navitem flex-column align-self-center ml-auto {{#classes}}{{.}}{{/classes}}" aria-live="polite">
|
||||
{{#content}}
|
||||
|
||||
@@ -16,7 +16,6 @@ Feature: Within the grader report, test that we can search for users
|
||||
| student3 | User | Example | student3@example.com | s3 | 3243249087 | 0875421745 | ABC2 | ABCD | Olney | GB |
|
||||
| student4 | User | Test | student4@example.com | s4 | 0987532523 | 2149871323 | ABC3 | ABCD | Tokyo | JP |
|
||||
| student5 | Turtle | Manatee | student5@example.com | s5 | 1239087780 | 9873623589 | ABC3 | ABCD | Perth | AU |
|
||||
# Note: Add groups etc so we can test that the search ignores those filters as well if we go down the filter dataset path.
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@@ -25,6 +24,12 @@ Feature: Within the grader report, test that we can search for users
|
||||
| student3 | C1 | student |
|
||||
| student4 | C1 | student |
|
||||
| student5 | C1 | student |
|
||||
And the following "groups" exist:
|
||||
| name | course | idnumber |
|
||||
| Default group | C1 | dg |
|
||||
And the following "group members" exist:
|
||||
| user | group |
|
||||
| student5 | dg |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name |
|
||||
| assign | C1 | a1 | Test assignment one |
|
||||
@@ -315,6 +320,28 @@ Feature: Within the grader report, test that we can search for users
|
||||
When I set the field "Search users" to "Turtle"
|
||||
Then I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
|
||||
|
||||
Scenario: A teacher can reset the search and filters all at once
|
||||
Given I set the field "Search users" to "Turtle"
|
||||
And I click on "Turtle Manatee" "option_role"
|
||||
And I wait until the page is ready
|
||||
And the following should exist in the "user-grades" table:
|
||||
| -1- |
|
||||
| Turtle Manatee |
|
||||
And I press "Filter by name"
|
||||
And I select "T" in the "First name" "core_grades > initials bar"
|
||||
And I select "M" in the "Last name" "core_grades > initials bar"
|
||||
And the following should exist in the "user-grades" table:
|
||||
| -1- |
|
||||
| Turtle Manatee |
|
||||
And I click on "Default group" in the "group" search widget
|
||||
And the following should exist in the "user-grades" table:
|
||||
| -1- |
|
||||
| Turtle Manatee |
|
||||
And I wait until the page is ready
|
||||
When I click on "Clear all" "link" in the ".tertiary-navigation" "css_element"
|
||||
And I wait until the page is ready
|
||||
Then the field "Search users" matches value ""
|
||||
|
||||
Scenario: As a teacher I can dynamically find users whilst ignoring pagination
|
||||
Given "42" "users" exist with the following data:
|
||||
| username | students[count] |
|
||||
|
||||
Reference in New Issue
Block a user