29 Commits

Author SHA1 Message Date
Paul Holden
4098af1c52 MDL-26171 user: implement method for retrieving fullname via SQL. 2021-06-29 16:35:35 +01:00
Eloy Lafuente (stronk7)
3ed772f418 Merge branch 'MDL-71099-master' of https://github.com/sammarshallou/moodle 2021-03-27 10:17:43 +01:00
sam marshall
5e72715e4f MDL-71099 Lib: Move new user_fields class from core to core_user
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.

Since the class has only just been added to Moodle, now is a good
time to move it.
2021-03-25 13:47:23 +00:00
Mikel Martín
8de59fc435 MDL-70871 user: Move 'Show all X' functionality to dynamic_table 2021-03-23 09:55:24 +01:00
Paul Holden
be2862fe6f MDL-70565 user: filter course participants by country. 2021-03-12 09:50:05 +00:00
sam marshall
e86ead1d91 MDL-45242 Course: Participants list supports custom profile fields 2021-03-10 10:57:11 +00:00
sam marshall
558cc1b85e MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
2021-03-10 10:57:10 +00:00
sam marshall
3f003455f3 MDL-45242 Lib: Replace direct references to ->showuseridentity 2021-03-08 09:20:18 +00:00
Paul Holden
0cfa744fd9 MDL-63387 user: show both role names on course participants page. 2020-09-01 12:05:20 +01:00
Paul Holden
ca02422d66 MDL-69214 user: correct participant table forced group SQL. 2020-07-07 14:31:31 +01:00
Andrew Nicols
8bcf74e9bc MDL-69026 user: Wrap sub-query in brackets
It is perfectly valid to have a query like:

Match None of the following:
- Role is ANY of the following:
-- 'Teacher'
-- 'Editing teacher'
-- 'Manager'; AND
- Keyword is NONE of the following:
-- 'Kevin'

However, due to the way in which the query is constructed, this leads to
a query which includes

    WHERE NOT ef.id IS NOT NULL
    AND NOT
        u.id IN (SELECT userid FROM {role_assignments} WHERE roleid IN (...) AND contextid IN (...))
    AND NOT
        NOT (u.firstname || ' ' || u.lastname LIKE '%Kevin%')

The use of NOT NOT is valid in Postgres, MariaDB, MySQL, and MSSQL, but
not in Oracle.

To counter this when the outer jointype is of type NONE, we must wrap
each of the inner WHERE clauses in a set of brackets, which makes the
query:

    WHERE NOT ef.id IS NOT NULL
    AND NOT
        (u.id IN (SELECT userid FROM {role_assignments} WHERE roleid IN (...) AND contextid IN (...)))
    AND NOT
        (NOT (u.firstname || ' ' || u.lastname LIKE '%Kevin%'))

Whilst Oracle does not support the use of `AND NOT NOT ...`, it does support
`AND NOT (NOT ...)`
2020-06-12 10:03:06 +08:00
Jun Pataleta
15823a94c1 Merge branch 'MDL-68989-master' of git://github.com/mickhawkins/moodle 2020-06-11 00:03:54 +08:00
Michael Hawkins
f2972e1dcb MDL-68989 user: Apply none filterset join correctly on keyword filter
Also improved behat coverage for filterset joins and keyword filtering.
2020-06-09 15:49:31 +08:00
Michael Hawkins
8ddfc963b9 MDL-68984 user: Ensure first/last name filtering is always applied
This ensures the firstname and surname filtering is applied in addition
to any other filtering, rather than using the filterset join type.
2020-06-09 12:36:11 +08:00
Michael Hawkins
d85315ee8c MDL-68612 user: Update participants group filtering to enforce groups
This is required to ensure regardless of user applied filters, only
members of groups visible to the user are ever fetched. This also
includes a fix to remove the groups filter option where no groups
mode is applied.
2020-05-29 10:10:33 +08:00
Michael Hawkins
a4bd55725b MDL-68829 user: Update participants SQL for Oracle/MSSQL compatibility
This refactors the SQL to join on a distinct list of users, removing
the need for GROUP BY statements, and fixing the related errors in
Oracle/MSSQL
2020-05-28 00:28:34 +02:00
Michael Hawkins
6a54e58a8c MDL-68348 user: User filter match types support - enrol method & status
Completed support for all join types (any/all/none) for enrolment
method and status filtering. This includes handling forced status
filtering where a user does not have the capability to view suspended
users, as well as handling front page (whole site) participants page.
2020-05-25 18:35:08 +08:00
Michael Hawkins
03397c817b MDL-68348 lib: User filter match types support - groups
Updated groups_get_members_join to support different filter match types
2020-05-25 18:35:08 +08:00
Michael Hawkins
25d9dabdcf MDL-68348 user: User filter match types support - keywords/last access
The last access implementation also fixes an existing bug,
where it was assumed never accessed would be 0, when it also needed to
handle null to return correct results. Related userlib unit tests also
updated to reflect this, as well as some incorrect comment wording.
2020-05-25 18:35:08 +08:00
Michael Hawkins
25d5be444f MDL-68348 user: User filter match types support - filterset and roles 2020-05-25 18:10:53 +08:00
Andrew Nicols
07c9106476 MDL-68463 user: Remove old selectall attribute 2020-05-18 20:03:38 +08:00
Michael Hawkins
86e71acc0c MDL-68246 user: Adding the participants_search class
This class introduces support for multiple values per filter to the
participants page.
2020-05-14 15:47:34 +08:00
Andrew Nicols
5615a772a6 MDL-68454 table: Move guessing of base URL to flexible 2020-05-04 11:52:19 +08:00
Andrew Nicols
56143dd622 MDL-68454 table: Move filterset functionality to flexible_table 2020-05-04 11:52:19 +08:00
Andrew Nicols
c00552b3b0 MDL-68454 table: Move get_context from dynamic to flexible 2020-05-04 11:52:19 +08:00
Andrew Nicols
ff475522fb MDL-68454 table: Drop get_unique_id_from_argument fn requirement
This was originally intended to be a way for the calling code to specify
data as part of the table construction which could then be used as
appropriate. When the filterset was created the requirement for this
function no longer existed.

Removing this to simplify the API.
2020-05-04 11:52:19 +08:00
Andrew Nicols
478039f99a MDL-68442 user: Rewrite participant status to work with dynamic tables 2020-04-28 10:21:45 +08:00
Simey Lameze
bc6f5f23ea MDL-68341 core_user: move and rename participants_table class 2020-04-09 07:08:44 +08:00
Andrew Nicols
c43bdf5e13 MDL-67913 user: Add participants table filterset 2020-03-16 11:44:31 +08:00