Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/enrollib.php File Reference

Go to the source code of this file.

Data Structures

class  enrol_plugin

Namespaces

namespace  core

Enumerations

enum  ENROL_INSTANCE_ENABLED
enum  ENROL_INSTANCE_DISABLED
enum  ENROL_USER_ACTIVE
enum  ENROL_USER_SUSPENDED
enum  ENROL_REQUIRE_LOGIN_CACHE_PERIOD
enum  ENROL_MAX_TIMESTAMP
enum  ENROL_EXT_REMOVED_UNENROL
enum  ENROL_EXT_REMOVED_KEEP
enum  ENROL_RESTORE_TYPE
enum  ENROL_RESTORE_CLASS
enum  ENROL_RESTORE_EXACT
enum  ENROL_RESTORE_NOUSERS
enum  ENROL_EXT_REMOVED_SUSPEND
enum  ENROL_EXT_REMOVED_SUSPENDNOROLES

Functions

 enrol_get_plugins ($enabled)
 enrol_get_plugin ($name)
 enrol_get_instances ($courseid, $enabled)
 enrol_is_enabled ($enrol)
 enrol_check_plugins ($user)
 enrol_sharing_course ($user1, $user2)
 enrol_get_shared_courses ($user1, $user2, $preloadcontexts=false, $checkexistsonly=false)
 enrol_course_edit_form (MoodleQuickForm $mform, $data, $context)
 enrol_course_edit_validation (array $data, $context)
 enrol_course_updated ($inserted, $course, $data)
 enrol_add_course_navigation (navigation_node $coursenode, $course)
 enrol_get_my_courses ($fields=NULL, $sort= 'visible DESC, sortorder ASC', $limit=0)
 enrol_get_course_info_icons ($course, array $instances=NULL)
 enrol_get_course_description_texts ($course)
 enrol_get_users_courses ($userid, $onlyactive=false, $fields=NULL, $sort= 'visible DESC, sortorder ASC')
 enrol_user_delete ($user)
 enrol_course_delete ($course)
 enrol_try_internal_enrol ($courseid, $userid, $roleid=null, $timestart=0, $timeend=0)
 enrol_selfenrol_available ($courseid)
 enrol_get_enrolment_end ($courseid, $userid)

Enumeration Type Documentation

When user disappears from external source, the enrolment is kept as is - one way sync

Definition at line 52 of file enrollib.php.

When user disappears from external source, user enrolment is suspended, roles are kept as is. In some cases user needs a role with some capability to be visible in UI - suc has in gradebook, assignments, etc.

Definition at line 68 of file enrollib.php.

When user disappears from external source, the enrolment is suspended and roles assigned by enrol instance are removed. Please note that user may "disappear" from gradebook and other areas.

Definition at line 74 of file enrollib.php.

When user disappears from external source, the enrolment is completely removed

Definition at line 49 of file enrollib.php.

Course enrol instance disabled, user may enter course if other enrol instance enabled. (used in enrol->status)

Definition at line 34 of file enrollib.php.

Course enrol instance enabled. (used in enrol->status)

Definition at line 31 of file enrollib.php.

The timestamp indicating forever

Definition at line 46 of file enrollib.php.

Deprecated:
  • enrol caching was reworked, use ENROL_MAX_TIMESTAMP instead

Definition at line 43 of file enrollib.php.

User custom backup/restore class stored in backup/moodle2/ subdirectory

Definition at line 57 of file enrollib.php.

Restore all custom fields from enrol table without any changes and all user_enrolments records

Definition at line 59 of file enrollib.php.

Restore enrol record like ENROL_RESTORE_EXACT, but no user enrolments

Definition at line 61 of file enrollib.php.

enrol plugin feature describing requested restore type

Definition at line 55 of file enrollib.php.

User is active participant (used in user_enrolments->status)

Definition at line 37 of file enrollib.php.

User participation in course is suspended (used in user_enrolments->status)

Definition at line 40 of file enrollib.php.


Function Documentation

enrol_add_course_navigation ( navigation_node coursenode,
course 
)

Add navigation nodes

Parameters:
navigation_node$coursenode
object$course
Returns:
void

Definition at line 392 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_check_plugins ( user)

Check all the login enrolment information for the given user object by querying the enrolment plugins

This function may be very slow, use only once after log-in or login-as.

Parameters:
stdClass$user
Returns:
void

Definition at line 199 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_course_delete ( course)

Called when course is about to be deleted.

Parameters:
stdClass$course
Returns:
void

Definition at line 813 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_course_edit_form ( MoodleQuickForm mform,
data,
context 
)

This function adds necessary enrol plugins UI into the course edit form.

Parameters:
MoodleQuickForm$mform
object$datacourse edit form data
object$contextcontext of existing course or parent category if course does not exist
Returns:
void

Definition at line 322 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_course_edit_validation ( array data,
context 
)

Validate course edit form data

Parameters:
array$dataraw form data
object$contextcontext of existing course or parent category if course does not exist
Returns:
array errors array

Definition at line 347 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_course_updated ( inserted,
course,
data 
)

Update enrol instances after course edit form submission

Parameters:
bool$insertedtrue means new course added, false course already existed
object$course
object$dataform data
Returns:
void

Definition at line 376 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns course enrolment detailed information.

Parameters:
object$course
Returns:
array of html fragments - can be used to construct lists

Definition at line 661 of file enrollib.php.

Here is the call graph for this function:

enrol_get_course_info_icons ( course,
array instances = NULL 
)

Returns course enrolment information icons.

Parameters:
object$course
array$instancesenrol instances of this course, improves performance
Returns:
array of pix_icon

Definition at line 631 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_get_enrolment_end ( courseid,
userid 
)

This function returns the end of current active user enrolment.

It deals correctly with multiple overlapping user enrolments.

Parameters:
int$courseid
int$userid
Returns:
int|bool timestamp when active enrolment ends, false means no active enrolment now, 0 means never

Definition at line 900 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_get_instances ( courseid,
enabled 
)

Returns enrolment instances in given course.

Parameters:
int$courseid
bool$enabled
Returns:
array of enrol instances

Definition at line 150 of file enrollib.php.

Here is the caller graph for this function:

enrol_get_my_courses ( fields = NULL,
sort = 'visible DESC,
sortorder ASC'  ,
limit = 0 
)

Returns list of courses current $USER is enrolled in and can access

  • $fields is an array of field names to ADD so name the fields you really need, which will be added and uniq'd
Parameters:
string | array$fields
string$sort
int$limitmax number of courses
Returns:
array

Definition at line 526 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_get_plugin ( name)

Returns instance of enrol plugin

Parameters:
string$namename of enrol plugin ('manual', 'guest', ...)
Returns:
enrol_plugin

Definition at line 120 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_get_plugins ( enabled)

Returns instances of enrol plugins

Parameters:
bool$enabledreturn enabled only
Returns:
array of enrol plugins name=>instance

Definition at line 81 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_get_shared_courses ( user1,
user2,
preloadcontexts = false,
checkexistsonly = false 
)

Returns any courses shared by the two users

The courses has to be visible and enrolments has to be active, timestart and timeend restrictions are ignored.

moodle_database $DB

Parameters:
stdClass | int$user1
stdClass | int$user2
bool$preloadcontextsIf set to true contexts for the returned courses will be preloaded.
bool$checkexistsonlyIf set to true then this function will return true if the users share any courses and false if not.
Returns:
array|bool An array of courses that both users are enrolled in OR if $checkexistsonly set returns true if the users share any courses and false if not.

Definition at line 264 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_get_users_courses ( userid,
onlyactive = false,
fields = NULL,
sort = 'visible DESC,
sortorder ASC'   
)

Returns list of courses user is enrolled into.

  • $fields is an array of fieldnames to ADD so name the fields you really need, which will be added and uniq'd
Parameters:
int$userid
bool$onlyactivereturn only active enrolments in courses user may see
string | array$fields
string$sort
Returns:
array

Definition at line 692 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_is_enabled ( enrol)

Checks if a given plugin is in the list of enabled enrolment plugins.

Parameters:
string$enrolEnrolment plugin name
Returns:
boolean Whether the plugin is enabled

Definition at line 181 of file enrollib.php.

Here is the caller graph for this function:

enrol_selfenrol_available ( courseid)

Is there a chance users might self enrol

Parameters:
int$courseid
Returns:
bool

Definition at line 869 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_sharing_course ( user1,
user2 
)

Do these two students share any course?

The courses has to be visible and enrolments has to be active, timestart and timeend restrictions are ignored.

This function calls {

See also:
enrol_get_shared_courses()} setting checkexistsonly to true.
Parameters:
stdClass | int$user1
stdClass | int$user2
Returns:
bool

Definition at line 243 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_try_internal_enrol ( courseid,
userid,
roleid = null,
timestart = 0,
timeend = 0 
)

Try to enrol user via default internal auth plugin.

For now this is always using the manual enrol plugin...

Parameters:
$courseid
$userid
$roleid
$timestart
$timeend
Returns:
bool success

Definition at line 842 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enrol_user_delete ( user)

Called when user is about to be deleted.

Parameters:
object$user
Returns:
void

Definition at line 796 of file enrollib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations