Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]
Provides various useful functionality to plugins that offer or use this MNet service Remote enrolment service is used by enrol_mnet plugin which publishes the server side methods. The client side is accessible from the admin tree.
Copyright: | 2010 David Mudrak <david@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 614 lines (25 kb) |
Included or required: | 0 times |
Referenced: | 5 times |
Includes or requires: | 0 files |
mnetservice_enrol:: (10 methods):
__construct()
get_instance()
is_available()
get_remote_subscribers()
get_remote_publishers()
get_remote_courses()
req_course_enrolments()
req_enrol_user()
req_unenrol_user()
format_error_message()
mnetservice_enrol_existing_users_selector:: (3 methods):
__construct()
find_users()
get_options()
mnetservice_enrol_potential_users_selector:: (3 methods):
__construct()
find_users()
get_options()
Class: mnetservice_enrol - X-Ref
Singleton providing various functionality usable by plugin(s) implementing this MNet service__construct() X-Ref |
This is singleton, use {@link mnetservice_enrol::get_instance()} |
get_instance() X-Ref |
return: mnetservice_enrol singleton instance |
is_available() X-Ref |
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. return: bool |
get_remote_subscribers() X-Ref |
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. return: array |
get_remote_publishers() X-Ref |
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. return: array |
get_remote_courses($mnethostid, $usecache=true) X-Ref |
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. param: id $mnethostid MNet remote host id param: bool $usecache use cached data or invoke new XML-RPC? return: array|string returned list or serialized array of mnet error messages |
req_course_enrolments($mnethostid, $remotecourseid) X-Ref |
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. param: id $mnethostid MNet remote host id param: int $remotecourseid ID of the course at the remote host param: bool $usecache use cached data or invoke new XML-RPC? return: bool|string true if success or serialized array of mnet error messages |
req_enrol_user(stdclass $user, stdclass $remotecourse) X-Ref |
Send request to enrol our user to the remote course Updates our remote enrolments cache if the enrolment was successful. param: object $user our user param: object $remotecourse record from mnetservice_enrol_courses table return: true|string true if success, error message from the remote host otherwise |
req_unenrol_user(stdclass $user, stdclass $remotecourse) X-Ref |
Send request to unenrol our user from the remote course Updates our remote enrolments cache if the unenrolment was successful. param: object $user our user param: object $remotecourse record from mnetservice_enrol_courses table return: true|string true if success, error message from the remote host otherwise |
format_error_message($errormsg) X-Ref |
Prepares error messages returned by our XML-RPC requests to be send as debug info to {@link print_error()} MNet client-side methods in this class return request error as serialized array. param: string $error serialized array return: string |
Class: mnetservice_enrol_existing_users_selector - X-Ref
Selector of our users enrolled into remote course via enrol_mnet plugin__construct($name, $options) X-Ref |
No description |
find_users($search) X-Ref |
Find our users currently enrolled into the remote course param: string $search return: array |
get_options() X-Ref |
No description |
Class: mnetservice_enrol_potential_users_selector - X-Ref
Selector of our users who could be enrolled into a remote course via their enrol_mnet__construct($name, $options) X-Ref |
No description |
find_users($search) X-Ref |
Find our users who could be enrolled into the remote course Our users must have 'moodle/site:mnetlogintoremote' capability assigned. Remote users, guests, deleted and not confirmed users are not returned. param: string $search return: array |
get_options() X-Ref |
No description |