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_collection Class Reference

A collection of contextlist items. More...

Inheritance diagram for core_privacy\local\request\contextlist_collection:

Public Member Functions

 __construct ($userid)
 Constructor to create a new contextlist_collection. More...
 
 add_contextlist (contextlist_base $contextlist)
 Add a contextlist to this collection. More...
 
 count ()
 Return the number of contexts.
 
 current ()
 Return the current contexlist. More...
 
 get_contextlist_for_component (string $component)
 Get the contextlist for the specified component. More...
 
 get_contextlists ()
 Get the contextlists in this collection. More...
 
 get_userid ()
 Return the ID of the user whose collection this is. 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...
 
 valid ()
 Check if the current position is valid. More...
 

Protected Member Functions

 get_key_from_position ()
 Get the key for the current iterator position. More...
 

Protected Attributes

array $contextlists = []
 $contextlists the internal array of contextlist objects.
 
int $iteratorposition = 0
 Current position of the iterator.
 
int $userid = null
 $userid The ID of the user that the contextlist collection belongs to.
 

Detailed Description

A collection of contextlist items.

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

Constructor & Destructor Documentation

◆ __construct()

core_privacy\local\request\contextlist_collection::__construct (   $userid)

Constructor to create a new contextlist_collection.

Parameters
int$useridThe userid to which this collection belongs.

Member Function Documentation

◆ add_contextlist()

core_privacy\local\request\contextlist_collection::add_contextlist ( contextlist_base  $contextlist)

Add a contextlist to this collection.

Parameters
contextlist_base$contextlistthe contextlist to export.
Return values
$this

◆ current()

core_privacy\local\request\contextlist_collection::current ( )

Return the current contexlist.

Return values
context

◆ get_contextlist_for_component()

core_privacy\local\request\contextlist_collection::get_contextlist_for_component ( string  $component)

Get the contextlist for the specified component.

Parameters
string$componentthe frankenstyle name of the component to fetch for.
Return values
contextlist_base|null

◆ get_contextlists()

core_privacy\local\request\contextlist_collection::get_contextlists ( )

Get the contextlists in this collection.

Return values
arraythe associative array of contextlists in this collection, indexed by component name. E.g. mod_assign => contextlist, core_comment => contextlist.

◆ get_key_from_position()

core_privacy\local\request\contextlist_collection::get_key_from_position ( )
protected

Get the key for the current iterator position.

Return values
string

◆ get_userid()

core_privacy\local\request\contextlist_collection::get_userid ( )

Return the ID of the user whose collection this is.

Return values
int

◆ key()

core_privacy\local\request\contextlist_collection::key ( )

Return the key of the current element.

Return values
mixed

◆ rewind()

core_privacy\local\request\contextlist_collection::rewind ( )

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.

◆ valid()

core_privacy\local\request\contextlist_collection::valid ( )

Check if the current position is valid.

Return values
bool

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