Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core_user\table\participants_search Class Reference

Class used to fetch participants based on a filterset. More...

Public Member Functions

 __construct (stdClass $course, context $context, filterset $filterset)
 Class constructor. More...
 
 get_participants (string $additionalwhere='', array $additionalparams=[], string $sort='', int $limitfrom=0, int $limitnum=0)
 Fetch participants matching the filterset. More...
 
 get_total_participants_count (string $additionalwhere='', array $additionalparams=[])
 Returns the total number of participants for a given course. More...
 

Protected Member Functions

 get_enrol_method_sql ($useridcolumn)
 Prepare the enrolment methods filter SQL content. More...
 
 get_enrolled_sql ()
 Prepare SQL and associated parameters for users enrolled in the course. More...
 
 get_groups_jointype (?int $forcedjointype=null)
 Fetch the groups filter's grouplib jointype, based on its filterset jointype. More...
 
 get_keywords_search_sql ()
 Prepare SQL where clause and associated parameters for any keyword searches being performed. More...
 
 get_participants_sql (string $additionalwhere, array $additionalparams)
 Generate the SQL used to fetch filtered data for the participants table. More...
 
 get_roles_sql ()
 Prepare SQL where clause and associated parameters for any roles filtering being performed. More...
 
 get_status_sql ($filteruidcolumn, $forceduidcolumn, $forcedprefix)
 Prepare the status filter SQL content. More...
 

Protected Attributes

context_course $context
 $context The course context being searched.
 
stdClass $course
 $course The course being searched.
 
filterset $filterset
 $filterset The filterset describing which participants to include in the search.
 
string[] $userfields
 $userfields Names of any extra user fields to be shown when listing users.
 

Detailed Description

Class used to fetch participants based on a filterset.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_user\table\participants_search::__construct ( stdClass  $course,
context  $context,
filterset  $filterset 
)

Class constructor.

Parameters
stdClass$courseThe course being searched.
context$contextThe context of the search.
filterset$filtersetThe filterset used to filter the participants in a course.

Member Function Documentation

◆ get_enrol_method_sql()

core_user\table\participants_search::get_enrol_method_sql (   $useridcolumn)
protected

Prepare the enrolment methods filter SQL content.

Parameters
string$useridcolumnUser ID column used in the calling query, e.g. u.id
Return values
arraySQL query data in the format ['joins' => [], 'where' => '', 'params' => []].

◆ get_enrolled_sql()

core_user\table\participants_search::get_enrolled_sql ( )
protected

Prepare SQL and associated parameters for users enrolled in the course.

Return values
arraySQL query data in the format ['sql' => '', 'forcedsql' => '', 'params' => []].

◆ get_groups_jointype()

core_user\table\participants_search::get_groups_jointype ( ?int  $forcedjointype = null)
protected

Fetch the groups filter's grouplib jointype, based on its filterset jointype.

This mapping is to ensure compatibility between the two, should their values ever differ.

Parameters
int | null$forcedjointypeIf set, specifies the join type to fetch mapping for (used when applying forced filtering). If null, then user defined filter join type is used.
Return values
int

◆ get_keywords_search_sql()

core_user\table\participants_search::get_keywords_search_sql ( )
protected

Prepare SQL where clause and associated parameters for any keyword searches being performed.

Return values
arraySQL query data in the format ['where' => '', 'params' => []].

◆ get_participants()

core_user\table\participants_search::get_participants ( string  $additionalwhere = '',
array  $additionalparams = [],
string  $sort = '',
int  $limitfrom = 0,
int  $limitnum = 0 
)

Fetch participants matching the filterset.

Parameters
string$additionalwhereAny additional SQL to add to where.
array$additionalparamsThe additional params used by $additionalwhere.
string$sortOptional SQL sort.
int$limitfromReturn a subset of records, starting at this point (optional).
int$limitnumReturn a subset comprising this many records (optional, required if $limitfrom is set).
Return values
moodle_recordset

◆ get_participants_sql()

core_user\table\participants_search::get_participants_sql ( string  $additionalwhere,
array  $additionalparams 
)
protected

Generate the SQL used to fetch filtered data for the participants table.

Parameters
string$additionalwhereAny additional SQL to add to where
array$additionalparamsThe additional params
Return values
array

◆ get_roles_sql()

core_user\table\participants_search::get_roles_sql ( )
protected

Prepare SQL where clause and associated parameters for any roles filtering being performed.

Return values
arraySQL query data in the format ['where' => '', 'params' => []].

◆ get_status_sql()

core_user\table\participants_search::get_status_sql (   $filteruidcolumn,
  $forceduidcolumn,
  $forcedprefix 
)
protected

Prepare the status filter SQL content.

Note: Users who cannot view suspended users will always have their results filtered to only show active participants.

Parameters
string$filteruidcolumnUser ID column used in the calling query, e.g. eu_u.id
string$forceduidcolumnUser ID column used in any forced query, e.g. feu_u.id
string$forcedprefixThe prefix to use if forced filtering is required
Return values
arraySQL query data in the format ['joins' => [], 'where' => '', 'params' => [], 'forcestatus' => true]

◆ get_total_participants_count()

core_user\table\participants_search::get_total_participants_count ( string  $additionalwhere = '',
array  $additionalparams = [] 
)

Returns the total number of participants for a given course.

Parameters
string$additionalwhereAny additional SQL to add to where.
array$additionalparamsThe additional params used by $additionalwhere.
Return values
int

The documentation for this class was generated from the following file: