Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
graded_users_iterator Class Reference

This class iterates over all users that are graded in a course. More...

Public Member Functions

 __construct ($course, $grade_items=null, $groupid=0, $sortfield1='lastname', $sortorder1='ASC', $sortfield2='firstname', $sortorder2='ASC')
 Constructor.
 
 allow_user_custom_fields ($allow=true)
 Allow custom fields to be included.
 
 close ()
 Close the iterator, do not forget to call this function.
 
 init ()
 Initialise the iterator.
 
 next_user ()
 Returns information about the next user.
 
 require_active_enrolment ($onlyactive=true)
 Should all enrolled users be exported or just those with an active enrolment?
 

Protected Attributes

 $allowusercustomfields = false
 Enable user custom fields.
 
 $course
 The couse whose users we are interested in.
 
 $grade_items
 An array of grade items or null if only user data was requested.
 
 $grades_rs
 A recordset of user grades (grade_grade instances)
 
 $gradestack
 Array used when moving to next user while iterating through the grades recordset.
 
 $groupid
 The group ID we are interested in.
 
 $onlyactive = false
 Should users whose enrolment has been suspended be ignored?
 
 $sortfield1
 The first field of the users table by which the array of users will be sorted.
 
 $sortfield2
 The second field of the users table by which the array of users will be sorted.
 
 $sortorder1
 Should sortfield1 be ASC or DESC.
 
 $sortorder2
 Should sortfield2 be ASC or DESC.
 
 $suspendedusers = array()
 List of suspended users in course.
 
 $users_rs
 A recordset of graded users.
 

Detailed Description

This class iterates over all users that are graded in a course.

Returns detailed info about users and their grades.

Author
Petr Skoda skoda.nosp@m.k@mo.nosp@m.odle..nosp@m.org
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

graded_users_iterator::__construct ( $course,
$grade_items = null,
$groupid = 0,
$sortfield1 = 'lastname',
$sortorder1 = 'ASC',
$sortfield2 = 'firstname',
$sortorder2 = 'ASC' )

Constructor.

Parameters
object$courseA course object
array$grade_itemsarray of grade items, if not specified only user info returned
int$groupiditerate only group users if present
string$sortfield1The first field of the users table by which the array of users will be sorted
string$sortorder1The order in which the first sorting field will be sorted (ASC or DESC)
string$sortfield2The second field of the users table by which the array of users will be sorted
string$sortorder2The order in which the second sorting field will be sorted (ASC or DESC)

Member Function Documentation

◆ allow_user_custom_fields()

graded_users_iterator::allow_user_custom_fields ( $allow = true)

Allow custom fields to be included.

Parameters
bool$allowWhether to allow custom fields or not
Return values
void

◆ init()

graded_users_iterator::init ( )

Initialise the iterator.

Return values
booleansuccess

◆ next_user()

graded_users_iterator::next_user ( )

Returns information about the next user.

Return values
mixedarray of user info, all grades and feedback or null when no more users found

◆ require_active_enrolment()

graded_users_iterator::require_active_enrolment ( $onlyactive = true)

Should all enrolled users be exported or just those with an active enrolment?

Parameters
bool$onlyactiveTrue to limit the export to users with an active enrolment

Member Data Documentation

◆ $groupid

graded_users_iterator::$groupid
protected

The group ID we are interested in.

0 means all groups.

◆ $suspendedusers

graded_users_iterator::$suspendedusers = array()
protected

List of suspended users in course.

This includes users whose enrolment status is suspended or enrolment has expired or not started.


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