Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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. More...
 
 add_system_context ()
 Adds the system context. More...
 
 add_user_context (int $userid)
 Adds the user context for a given user. More...
 
 add_user_contexts (array $userids)
 Adds the user contexts for given users. More...
 
 count ()
 Return the number of contexts.
 
 current ()
 Return the current context. More...
 
 get_component ()
 Get the name of the component to which this contextlist belongs. More...
 
 get_contextids ()
 Get the list of context IDs that relate to this request. More...
 
 get_contexts ()
 Get the complete list of context objects that relate to this request. More...
 
 key ()
 Return the key of the current element. More...
 
 next ()
 Move to the next context in the list.
 
 rewind ()
 Rewind to the first found context. More...
 
 set_component ($component)
 Sets the component for this contextlist. More...
 
 valid ()
 Check if the current position is valid. More...
 

Protected Member Functions

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

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: