mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Merge branch 'MDL-71347' of https://github.com/paulholden/moodle
This commit is contained in:
commit
123c8dd896
@ -42,6 +42,7 @@ if ($hassiteconfig
|
||||
$choices['firstaccess'] = new lang_string('firstaccess', 'filters');
|
||||
$choices['lastaccess'] = new lang_string('lastaccess');
|
||||
$choices['neveraccessed'] = new lang_string('neveraccessed', 'filters');
|
||||
$choices['timecreated'] = new lang_string('timecreated');
|
||||
$choices['timemodified'] = new lang_string('lastmodified');
|
||||
$choices['nevermodified'] = new lang_string('nevermodified', 'filters');
|
||||
$choices['auth'] = new lang_string('authentication');
|
||||
|
@ -2128,6 +2128,7 @@ $string['therearecourses'] = 'There are {$a} courses';
|
||||
$string['thiscategory'] = 'This category';
|
||||
$string['thiscategorycontains'] = 'This category contains';
|
||||
$string['time'] = 'Time';
|
||||
$string['timecreated'] = 'Time created';
|
||||
$string['timecreatedcourse'] = 'Course time created';
|
||||
$string['timezone'] = 'Timezone';
|
||||
$string['to'] = 'To';
|
||||
|
@ -68,8 +68,8 @@ class user_filtering {
|
||||
$fieldnames = array('realname' => 1, 'lastname' => 1, 'firstname' => 1, 'username' => 1, 'email' => 1, 'city' => 1,
|
||||
'country' => 1, 'confirmed' => 1, 'suspended' => 1, 'profile' => 1, 'courserole' => 1,
|
||||
'anycourses' => 1, 'systemrole' => 1, 'cohort' => 1, 'firstaccess' => 1, 'lastaccess' => 1,
|
||||
'neveraccessed' => 1, 'timemodified' => 1, 'nevermodified' => 1, 'auth' => 1, 'mnethostid' => 1,
|
||||
'idnumber' => 1, 'institution' => 1, 'department' => 1, 'lastip' => 1);
|
||||
'neveraccessed' => 1, 'timecreated' => 1, 'timemodified' => 1, 'nevermodified' => 1, 'auth' => 1,
|
||||
'mnethostid' => 1, 'idnumber' => 1, 'institution' => 1, 'department' => 1, 'lastip' => 1);
|
||||
|
||||
// Get the config which filters the admin wanted to show by default.
|
||||
$userfiltersdefault = get_config('core', 'userfiltersdefault');
|
||||
@ -175,6 +175,7 @@ class user_filtering {
|
||||
case 'firstaccess': return new user_filter_date('firstaccess', get_string('firstaccess', 'filters'), $advanced, 'firstaccess');
|
||||
case 'lastaccess': return new user_filter_date('lastaccess', get_string('lastaccess'), $advanced, 'lastaccess');
|
||||
case 'neveraccessed': return new user_filter_checkbox('neveraccessed', get_string('neveraccessed', 'filters'), $advanced, 'firstaccess', array('lastaccess_sck', 'lastaccess_eck', 'firstaccess_eck', 'firstaccess_sck'));
|
||||
case 'timecreated': return new user_filter_date('timecreated', get_string('timecreated'), $advanced, 'timecreated');
|
||||
case 'timemodified': return new user_filter_date('timemodified', get_string('lastmodified'), $advanced, 'timemodified');
|
||||
case 'nevermodified': return new user_filter_checkbox('nevermodified', get_string('nevermodified', 'filters'), $advanced, array('timemodified', 'timecreated'), array('timemodified_sck', 'timemodified_eck'));
|
||||
case 'cohort': return new user_filter_cohort($advanced);
|
||||
|
52
user/tests/behat/filter_timecreated.feature
Normal file
52
user/tests/behat/filter_timecreated.feature
Normal file
@ -0,0 +1,52 @@
|
||||
@core @core_user
|
||||
Feature: Filter users by time created
|
||||
In order to find users created relative to a date
|
||||
As an admin
|
||||
I need to be able to filter users by their time created date
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user01 | User | One | user01@example.com |
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Matching user filter by time created
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "Show more..."
|
||||
# Set the filter fields, excluding admin.
|
||||
When I set the following fields to these values:
|
||||
| <enablefield>[enabled] | 1 |
|
||||
| <enablefield>[year] | <year> |
|
||||
| Username field limiter | doesn't contain |
|
||||
| Username value | admin |
|
||||
And I press "Add filter"
|
||||
Then I should see "User One" in the "users" "table"
|
||||
And I should see "1 / 2 Users"
|
||||
Examples:
|
||||
| enablefield | year |
|
||||
# Time created, is after.
|
||||
| timecreated_sdt | ## -1 year ## %Y ## |
|
||||
# Time created, is before.
|
||||
| timecreated_edt | ## +1 year ## %Y ## |
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Non-matching user filter by time created
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "Show more..."
|
||||
# Set the filter fields, excluding admin.
|
||||
When I set the following fields to these values:
|
||||
| <enablefield>[enabled] | 1 |
|
||||
| <enablefield>[year] | <year> |
|
||||
| Username field limiter | doesn't contain |
|
||||
| Username value | admin |
|
||||
And I press "Add filter"
|
||||
Then "Users" "table" should not exist
|
||||
And I should see "0 / 2 Users"
|
||||
Examples:
|
||||
| enablefield | year |
|
||||
# Time created, is after.
|
||||
| timecreated_sdt | ## +1 year ## %Y ## |
|
||||
# Time created, is before.
|
||||
| timecreated_edt | ## -1 year ## %Y ## |
|
Loading…
x
Reference in New Issue
Block a user