Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
core_privacy\local\request\contextlist Class Reference

Privacy Fetch Result Set. More...

Inheritance diagram for core_privacy\local\request\contextlist:
core_privacy\local\request\contextlist_base

Public Member Functions

 add_from_sql (string $sql, array $params)
 Add a set of contexts from SQL.
 
 add_system_context ()
 Adds the system context.
 
 add_user_context (int $userid)
 Adds the user context for a given user.
 
 add_user_contexts (array $userids)
 Adds the user contexts for given users.
 
 count ()
 Return the number of contexts.
 
 current ()
 Return the current context.
 
 get_component ()
 Get the name of the component to which this contextlist belongs.
 
 get_contextids ()
 Get the list of context IDs that relate to this request.
 
 get_contexts ()
 Get the complete list of context objects that relate to this request.
 
 key ()
 Return the key of the current element.
 
 next ()
 Move to the next context in the list.
 
 rewind ()
 Rewind to the first found context.
 
 set_component ($component)
 Sets the component for this contextlist.
 
 valid ()
 Check if the current position is valid.
 

Protected Member Functions

 guess_id_field_from_sql (string $sql)
 Guess the name of the contextid field from the supplied SQL.
 
 set_contextids (array $contextids)
 Set the contextids.
 

Protected Attributes

string $component = ''
 component the frankenstyle component name.
 
int $iteratorposition = 0
 Current position of the iterator.
 

Detailed Description

Privacy Fetch Result Set.

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

Member Function Documentation

◆ add_from_sql()

core_privacy\local\request\contextlist::add_from_sql ( string $sql,
array $params )

Add a set of contexts from SQL.

The SQL should only return a list of context IDs.

Parameters
string$sqlThe SQL which will fetch the list of * context IDs
array$paramsThe set of SQL parameters
Return values
$this

◆ add_system_context()

core_privacy\local\request\contextlist::add_system_context ( )

Adds the system context.

Return values
$this

◆ add_user_context()

core_privacy\local\request\contextlist::add_user_context ( int $userid)

Adds the user context for a given user.

Parameters
int$userid
Return values
$this

◆ add_user_contexts()

core_privacy\local\request\contextlist::add_user_contexts ( array $userids)

Adds the user contexts for given users.

Parameters
array$userids
Return values
$this

◆ current()

core_privacy\local\request\contextlist_base::current ( )
inherited

Return the current context.

Return values
context

◆ get_component()

core_privacy\local\request\contextlist_base::get_component ( )
inherited

Get the name of the component to which this contextlist belongs.

Return values
stringthe component name associated with this contextlist.

◆ get_contextids()

core_privacy\local\request\contextlist_base::get_contextids ( )
inherited

Get the list of context IDs that relate to this request.

Return values
int[]

◆ get_contexts()

core_privacy\local\request\contextlist_base::get_contexts ( )
inherited

Get the complete list of context objects that relate to this request.

Return values
context[]

◆ guess_id_field_from_sql()

core_privacy\local\request\contextlist::guess_id_field_from_sql ( string $sql)
protected

Guess the name of the contextid field from the supplied SQL.

Parameters
string$sqlThe SQL to guess from
Return values
stringThe field name or a numeric value representing the context id

◆ key()

core_privacy\local\request\contextlist_base::key ( )
inherited

Return the key of the current element.

Return values
mixed

◆ rewind()

core_privacy\local\request\contextlist_base::rewind ( )
inherited

Rewind to the first found context.

The list of contexts is uniqued during the rewind. The rewind is called at the start of most iterations.

◆ set_component()

core_privacy\local\request\contextlist::set_component ( $component)

Sets the component for this contextlist.

Parameters
string$componentthe frankenstyle component name.

Reimplemented from core_privacy\local\request\contextlist_base.

◆ set_contextids()

core_privacy\local\request\contextlist_base::set_contextids ( array $contextids)
protectedinherited

Set the contextids.

Parameters
array$contextidsThe list of contexts.

◆ valid()

core_privacy\local\request\contextlist_base::valid ( )
inherited

Check if the current position is valid.

Return values
bool

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