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\userlist_collection Class Reference

A collection of userlist items. More...

Inheritance diagram for core_privacy\local\request\userlist_collection:

Public Member Functions

 __construct (\context $context)
 Constructor to create a new userlist_collection. More...
 
 add_userlist (userlist_base $userlist)
 Add a userlist to this collection. More...
 
 count ()
 Return the number of users.
 
 current ()
 Return the current contexlist. More...
 
 get_context ()
 Return the context that this collection relates to. More...
 
 get_userlist_for_component (string $component)
 Get the userlist for the specified component. More...
 
 get_userlists ()
 Get the userlists in this collection. More...
 
 key ()
 Return the key of the current element. More...
 
 next ()
 Move to the next user in the list.
 
 rewind ()
 Rewind to the first found user. 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

context $context = null
 $context The context that the userlist collection belongs to.
 
int $iteratorposition = 0
 Current position of the iterator.
 
array $userlists = []
 $userlists the internal array of userlist objects.
 

Detailed Description

A collection of userlist items.

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

Constructor & Destructor Documentation

◆ __construct()

core_privacy\local\request\userlist_collection::__construct ( \context  $context)

Constructor to create a new userlist_collection.

Parameters
context$contextThe context to which this collection belongs.

Member Function Documentation

◆ add_userlist()

core_privacy\local\request\userlist_collection::add_userlist ( userlist_base  $userlist)

Add a userlist to this collection.

Parameters
userlist_base$userlistthe userlist to export.
Return values
$this

◆ current()

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

Return the current contexlist.

Return values
user

◆ get_context()

core_privacy\local\request\userlist_collection::get_context ( )

Return the context that this collection relates to.

Return values
int

◆ get_key_from_position()

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

Get the key for the current iterator position.

Return values
string

◆ get_userlist_for_component()

core_privacy\local\request\userlist_collection::get_userlist_for_component ( string  $component)

Get the userlist for the specified component.

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

◆ get_userlists()

core_privacy\local\request\userlist_collection::get_userlists ( )

Get the userlists in this collection.

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

◆ key()

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

Return the key of the current element.

Return values
mixed

◆ rewind()

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

Rewind to the first found user.

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

◆ valid()

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

Check if the current position is valid.

Return values
bool

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