Moodle  2.2.1
http://www.collinsharper.com
course_enrolment_manager Class Reference

Public Member Functions

 __construct (moodle_page $moodlepage, $course, $instancefilter=null)
 get_moodlepage ()
 get_total_users ()
 get_total_other_users ()
 get_users ($sort, $direction='ASC', $page=0, $perpage=25)
 get_other_users ($sort, $direction='ASC', $page=0, $perpage=25)
 get_potential_users ($enrolid, $search='', $searchanywhere=false, $page=0, $perpage=25)
 search_other_users ($search='', $searchanywhere=false, $page=0, $perpage=25)
 get_enrolment_instances ()
 get_enrolment_instance_names ()
 get_enrolment_plugins ()
 get_all_roles ()
 get_assignable_roles ($otherusers=false)
 get_all_groups ()
 unenrol_user ($ue)
 get_user_enrolment_components ($userenrolment)
 unassign_role_from_user ($userid, $roleid)
 assign_role_to_user ($roleid, $userid)
 add_user_to_group ($user, $groupid)
 remove_user_from_group ($user, $groupid)
 get_group ($groupid)
 edit_enrolment ($userenrolment, $data)
 get_enrolment_filter ()
 get_user_roles ($userid)
 get_user_enrolments ($userid)
 get_user_groups ($userid)
 get_url_params ()
 get_course ()
 get_context ()
 get_other_users_for_display (core_enrol_renderer $renderer, moodle_url $pageurl, $sort, $direction, $page, $perpage)
 get_users_for_display (course_enrolment_manager $manager, $sort, $direction, $page, $perpage)
 get_manual_enrol_buttons ()
 has_instance ($enrolpluginname)
 get_filtered_enrolment_plugin ()
 get_users_enrolments (array $userids)

Protected Member Functions

 get_instance_sql ()

Protected Attributes

 $context
 $course = null
 $instancefilter = null
 $totalusers = null
 $users = array()
 $otherusers = array()
 $totalotherusers = null
 $moodlepage = null

Detailed Description

This class provides a targeted tied together means of interfacing the enrolment tasks together with a course.

It is provided as a convenience more than anything else.

Definition at line 39 of file locallib.php.


Constructor & Destructor Documentation

__construct ( moodle_page moodlepage,
course,
instancefilter = null 
)

#@- Constructs the course enrolment manager

Parameters:
moodle_page$moodlepage
stdClass$course
string$instancefilter

Definition at line 113 of file locallib.php.

Here is the call graph for this function:


Member Function Documentation

add_user_to_group ( user,
groupid 
)

Adds a user to a group

Parameters:
stdClass$user
int$groupid
Returns:
bool

Definition at line 586 of file locallib.php.

Here is the call graph for this function:

assign_role_to_user ( roleid,
userid 
)

Assigns a role to a user.

Parameters:
int$roleid
int$userid
Returns:
int|false

Definition at line 568 of file locallib.php.

Here is the call graph for this function:

edit_enrolment ( userenrolment,
data 
)

Edits an enrolment

Parameters:
stdClass$userenrolment
stdClass$data
Returns:
bool

Definition at line 634 of file locallib.php.

Here is the call graph for this function:

Gets all of the groups for this course.

Returns:
array

Definition at line 489 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Gets all of the roles this course can contain.

Returns:
array

Definition at line 451 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_assignable_roles ( otherusers = false)

Gets all of the assignable roles for this course.

Returns:
array

Definition at line 463 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the course context

Returns:
stdClass

Definition at line 744 of file locallib.php.

Here is the caller graph for this function:

Returns the course this object is managing enrolments for

Returns:
stdClass

Definition at line 735 of file locallib.php.

Here is the caller graph for this function:

Returns the current enrolment filter that is being applied by this class

Returns:
string

Definition at line 652 of file locallib.php.

Here is the caller graph for this function:

Returns the names for all of the enrolment instances for this course.

Returns:
array

Definition at line 418 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns all of the enrolment instances for this course.

Returns:
array

Definition at line 406 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Gets all of the enrolment plugins that are active for this course.

Returns:
array

Definition at line 439 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the enrolment plugin that the course manager was being filtered to.

If no filter was being applied then this function returns false.

Returns:
enrol_plugin

Definition at line 932 of file locallib.php.

Here is the caller graph for this function:

get_group ( groupid)

Gets the requested group

Parameters:
int$groupid
Returns:
stdClass|int

Definition at line 619 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_instance_sql ( ) [protected]

Gets an array containing some SQL to user for when selecting, params for that SQL, and the filter that was used in constructing the sql.

moodle_database $DB

Returns:
string

Definition at line 377 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 901 of file locallib.php.

Returns the current moodle page

Returns:
moodle_page

Definition at line 124 of file locallib.php.

Here is the caller graph for this function:

get_other_users ( sort,
direction = 'ASC',
page = 0,
perpage = 25 
)

Gets and array of other users.

Other users are users who have been assigned roles or inherited roles within this course but who have not been enrolled in the course

moodle_database $DB

Parameters:
string$sort
string$direction
int$page
int$perpage
Returns:
array

Definition at line 237 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_other_users_for_display ( core_enrol_renderer renderer,
moodle_url pageurl,
sort,
direction,
page,
perpage 
)

Gets an array of other users in this course ready for display.

Other users are users who have been assigned or inherited roles within this course but have not been enrolled.

Parameters:
core_enrol_renderer$renderer
moodle_url$pageurl
string$sort
string$directionASC | DESC
int$pageStarting from 0
int$perpage
Returns:
array

Definition at line 762 of file locallib.php.

Here is the call graph for this function:

get_potential_users ( enrolid,
search = '',
searchanywhere = false,
page = 0,
perpage = 25 
)

Gets an array of the users that can be enrolled in this course.

moodle_database $DB

Parameters:
int$enrolid
string$search
bool$searchanywhere
int$pageDefaults to 0
int$perpageDefaults to 25
Returns:
array Array(totalusers => int, users => array)

Definition at line 277 of file locallib.php.

Here is the call graph for this function:

Returns the total number of enrolled users in the course.

If a filter was specificed this will be the total number of users enrolled in this course by means of that instance.

moodle_database $DB

Returns:
int

Definition at line 159 of file locallib.php.

Here is the call graph for this function:

Returns the total number of enrolled users in the course.

If a filter was specificed this will be the total number of users enrolled in this course by means of that instance.

moodle_database $DB

Returns:
int

Definition at line 137 of file locallib.php.

Here is the call graph for this function:

Retursn an array of params that would go into the URL to return to this exact page.

Returns:
array

Definition at line 720 of file locallib.php.

Here is the caller graph for this function:

get_user_enrolment_components ( userenrolment)

Given a user enrolment record this method returns the plugin and enrolment instance that relate to it.

Parameters:
stdClass | int$userenrolment
Returns:
array array($instance, $plugin)

Definition at line 523 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_user_enrolments ( userid)

Gets the enrolments this user has in the course

moodle_database $DB

Parameters:
int$userid
Returns:
array

Definition at line 688 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_user_groups ( userid)

Gets the groups this user belongs to

Parameters:
int$userid
Returns:
array

Definition at line 710 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_user_roles ( userid)

Gets the roles assigned to this user that are applicable for this course.

Parameters:
int$userid
Returns:
array

Definition at line 662 of file locallib.php.

Here is the caller graph for this function:

get_users ( sort,
direction = 'ASC',
page = 0,
perpage = 25 
)

Gets all of the users enrolled in this course.

If a filter was specified this will be the users who were enrolled in this course by means of that instance.

moodle_database $DB

Parameters:
string$sort
string$directionASC or DESC
int$pageFirst page should be 0
int$perpageDefaults to 25
Returns:
array

Definition at line 194 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_users_enrolments ( array userids)

Returns and array of users + enrolment details.

Given an array of user id's this function returns and array of user enrolments for those users as well as enough user information to display the users name and picture for each enrolment.

moodle_database $DB

Parameters:
array$userids
Returns:
array

Definition at line 954 of file locallib.php.

Here is the call graph for this function:

get_users_for_display ( course_enrolment_manager manager,
sort,
direction,
page,
perpage 
)

Gets an array of users for display, this includes minimal user information as well as minimal information on the users roles, groups, and enrolments.

Parameters:
core_enrol_renderer$renderer
moodle_url$pageurl
int$sort
string$directionASC or DESC
int$page
int$perpage
Returns:
array

Definition at line 823 of file locallib.php.

Here is the call graph for this function:

has_instance ( enrolpluginname)

Definition at line 915 of file locallib.php.

Here is the caller graph for this function:

remove_user_from_group ( user,
groupid 
)

Removes a user from a group

moodle_database $DB

Parameters:
StdClass$user
int$groupid
Returns:
bool

Definition at line 603 of file locallib.php.

Here is the call graph for this function:

search_other_users ( search = '',
searchanywhere = false,
page = 0,
perpage = 25 
)

Searches other users and returns paginated results

moodle_database $DB

Parameters:
string$search
bool$searchanywhere
int$pageStarting at 0
int$perpage
Returns:
array

Definition at line 330 of file locallib.php.

unassign_role_from_user ( userid,
roleid 
)

Removes an assigned role from a user.

moodle_database $DB

Parameters:
int$userid
int$roleid
Returns:
bool

Definition at line 546 of file locallib.php.

Here is the call graph for this function:

unenrol_user ( ue)

Unenrols a user from the course given the users ue entry

moodle_database $DB

Parameters:
stdClass$ue
Returns:
bool

Definition at line 506 of file locallib.php.

Here is the call graph for this function:


Field Documentation

$context [protected]

Definition at line 45 of file locallib.php.

$course = null [protected]

Definition at line 50 of file locallib.php.

$instancefilter = null [protected]

Definition at line 55 of file locallib.php.

$moodlepage = null [protected]

Definition at line 88 of file locallib.php.

$otherusers = array() [protected]

Definition at line 75 of file locallib.php.

$totalotherusers = null [protected]

Definition at line 82 of file locallib.php.

$totalusers = null [protected]

Definition at line 62 of file locallib.php.

$users = array() [protected]

Definition at line 68 of file locallib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations