|
Moodle
2.2.1
http://www.collinsharper.com
|
Public Member Functions | |
| is_available () | |
| get_remote_subscribers () | |
| get_remote_publishers () | |
| get_remote_courses ($mnethostid, $usecache=true) | |
| req_course_enrolments ($mnethostid, $remotecourseid) | |
| req_enrol_user (stdclass $user, stdclass $remotecourse) | |
| req_unenrol_user (stdclass $user, stdclass $remotecourse) | |
| format_error_message ($errormsg) | |
Static Public Member Functions | |
| static | get_instance () |
Protected Member Functions | |
| __construct () | |
Protected Attributes | |
| $cachesubscribers = null | |
| $cachepublishers = null | |
Static Protected Attributes | |
| static | $singleton |
Singleton providing various functionality usable by plugin(s) implementing this MNet service
Definition at line 37 of file locallib.php.
| __construct | ( | ) | [protected] |
This is singleton, use mnetservice_enrol::get_instance()
Definition at line 51 of file locallib.php.
| format_error_message | ( | $ | errormsg | ) |
Prepares error messages returned by our XML-RPC requests to be send as debug info to print_error()
MNet client-side methods in this class return request error as serialized array.
| string | $error | serialized array |
Definition at line 446 of file locallib.php.
| static get_instance | ( | ) | [static] |
Definition at line 57 of file locallib.php.

| get_remote_courses | ( | $ | mnethostid, |
| $ | usecache = true |
||
| ) |
Fetches the information about the courses available on remote host for our students
The information about remote courses available for us is cached in {mnetservice_enrol_courses}. This method either returns the cached information (typically when displaying the list to students) or fetch fresh data via new XML-RPC request (which updates the local cache, too). The lifetime of the cache is 1 day, so even if $usecache is set to true, the cache will be re-populated if we did not fetch from any server (not only the currently requested one) for some time.
| id | $mnethostid | MNet remote host id |
| bool | $usecache | use cached data or invoke new XML-RPC? mnet_xmlrpc_client Invokes XML-RPC request if the cache is not used |
Definition at line 156 of file locallib.php.

Returns a list of remote servers that offer their courses for our users
We must subscribe MNet service 'mnet_enrol' for the peers to allow our users to enrol into their courses.
once the MNet core is refactored this may be part of a parent class
the name of the service should be changed to the name of this plugin
Definition at line 122 of file locallib.php.
Returns a list of remote servers that can enrol their users into our courses
We must publish MNet service 'mnet_enrol' for the peers to allow them to enrol their users into our courses.
once the MNet core is refactored this may be part of a parent class
the name of the service should be changed to the name of this plugin
Definition at line 93 of file locallib.php.
| is_available | ( | ) |
Is this service enabled?
Currently, this checks if whole MNet is available. In the future, additional checks can be done. Probably the field 'offer' should be checked but it does not seem to be used so far.
Definition at line 74 of file locallib.php.
| req_course_enrolments | ( | $ | mnethostid, |
| $ | remotecourseid | ||
| ) |
Updates local cache about enrolments of our users in remote courses
The remote course must allow enrolments via our Remote enrolment service client. Because of legacy design of data structure returned by XML-RPC code, only one user enrolment per course is returned by 1.9 MNet servers. This may be an issue if the user is enrolled multiple times by various enrolment plugins. MNet 2.0 servers do not use user name as array keys - they do not need to due to side effect of MDL-19219.
| id | $mnethostid | MNet remote host id |
| int | $remotecourseid | ID of the course at the remote host |
| bool | $usecache | use cached data or invoke new XML-RPC? mnet_xmlrpc_client Invokes XML-RPC request |
Definition at line 257 of file locallib.php.

| req_enrol_user | ( | stdclass $ | user, |
| stdclass $ | remotecourse | ||
| ) |
Send request to enrol our user to the remote course
Updates our remote enrolments cache if the enrolment was successful.
mnet_xmlrpc_client Invokes XML-RPC request
| object | $user | our user |
| object | $remotecourse | record from mnetservice_enrol_courses table |
Definition at line 366 of file locallib.php.

| req_unenrol_user | ( | stdclass $ | user, |
| stdclass $ | remotecourse | ||
| ) |
Send request to unenrol our user from the remote course
Updates our remote enrolments cache if the unenrolment was successful.
mnet_xmlrpc_client Invokes XML-RPC request
| object | $user | our user |
| object | $remotecourse | record from mnetservice_enrol_courses table |
Definition at line 410 of file locallib.php.
$cachepublishers = null [protected] |
Definition at line 46 of file locallib.php.
$cachesubscribers = null [protected] |
Definition at line 43 of file locallib.php.
$singleton [static, protected] |
Definition at line 40 of file locallib.php.