Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
LTI enrolment plugin helper class. More...
Static Public Member Functions | |
static | assign_user_tool_data ($tool, $user) |
Adds default values for the user object based on the tool provided. More... | |
static | count_lti_tools ($params=array()) |
Returns the number of LTI tools. More... | |
static | create_cartridge ($toolid) |
Create an IMS cartridge for the tool. More... | |
static | create_service_body ($source, $grade) |
Create a IMS POX body request for sync grades. More... | |
static | create_username ($consumerkey, $ltiuserid) |
Creates a unique username. More... | |
static | enrol_user ($tool, $userid) |
Enrol a user in a course. More... | |
static | generate_cartridge_token ($toolid) |
Returns a unique hash for this site and this enrolment instance. More... | |
static | generate_proxy_token ($toolid) |
Returns a unique hash for this site and this enrolment instance. More... | |
static | get_cartridge_url ($tool) |
Returns the url to the cartridge representing the tool. More... | |
static | get_description ($tool) |
Returns a description of the course or module that this lti instance points to. More... | |
static | get_icon ($tool) |
Returns the icon of the tool. More... | |
static | get_launch_url ($toolid) |
Returns the url to launch the lti tool. More... | |
static | get_lti_tool ($toolid) |
Returns the LTI tool. More... | |
static | get_lti_tools ($params=array(), $limitfrom=0, $limitnum=0) |
Returns the LTI tools requested. More... | |
static | get_name ($tool) |
Returns the name of the lti enrolment instance, or the name of the course/module being shared. More... | |
static | get_proxy_url ($tool) |
Returns the url to the tool proxy registration url. More... | |
static | update_user_profile_image ($userid, $url) |
Updates the users profile image. More... | |
static | user_match ($newuser, $olduser) |
Compares two users. More... | |
static | verify_cartridge_token ($toolid, $token) |
Verifies that the given token matches the cartridge token of the given shared tool. More... | |
static | verify_proxy_token ($toolid, $token) |
Verifies that the given token matches the proxy token of the given shared tool. More... | |
Public Attributes | |
const | ENROLMENT_FINISHED = 'enrolmentfinished' |
Error code for enrolment when enrolment has finished. | |
const | ENROLMENT_MAX_ENROLLED = 'maxenrolledreached' |
Error code for enrolment when max enrolled reached. | |
const | ENROLMENT_NOT_STARTED = 'enrolmentnotstarted' |
Error code for enrolment has not started. | |
const | ENROLMENT_SUCCESSFUL = true |
Code for when an enrolment was successful. | |
const | MEMBER_SYNC_ENROL_AND_UNENROL = 1 |
const | MEMBER_SYNC_ENROL_NEW = 2 |
const | MEMBER_SYNC_UNENROL_MISSING = 3 |
const | PROFILE_IMAGE_UPDATE_FAILED = 'profileimagefailed' |
Error code for when an image file fails to upload. | |
const | PROFILE_IMAGE_UPDATE_SUCCESSFUL = true |
Error code for when an image file fails to upload. | |
Static Protected Member Functions | |
static | get_cartridge_parameters ($toolid) |
Returns the parameters of the cartridge as an associative array of partial xpath. More... | |
static | set_xpath ($xpath, $parameters, $prefix='') |
Traverses a recursive associative array, setting the properties of the corresponding xpath element. More... | |
LTI enrolment plugin helper class.
|
static |
Adds default values for the user object based on the tool provided.
stdClass | $tool | |
stdClass | $user |
stdClass | The $user class with added default values |
|
static |
Returns the number of LTI tools.
array | $params | The list of SQL params (eg. array('columnname' => value, 'columnname2' => value)). |
int | The number of tools |
|
static |
Create an IMS cartridge for the tool.
int | $toolid | The id of the shared tool |
string | representing the generated cartridge |
|
static |
Create a IMS POX body request for sync grades.
string | $source | Sourceid required for the request |
float | $grade | User final grade |
string |
|
static |
Creates a unique username.
string | $consumerkey | Consumer key |
string | $ltiuserid | External tool user id |
string | The new username |
|
static |
Enrol a user in a course.
stdclass | $tool | The tool object (retrieved using self::get_lti_tool() or self::get_lti_tools()) |
int | $userid | The user id |
bool|string | returns true if successful, else an error code |
|
static |
Returns a unique hash for this site and this enrolment instance.
Used to verify that the link to the cartridge has not just been guessed.
int | $toolid | The id of the shared tool |
string | MD5 hash of combined site ID and enrolment instance ID. |
|
static |
Returns a unique hash for this site and this enrolment instance.
Used to verify that the link to the proxy has not just been guessed.
int | $toolid | The id of the shared tool |
string | MD5 hash of combined site ID and enrolment instance ID. |
|
staticprotected |
Returns the parameters of the cartridge as an associative array of partial xpath.
int | $toolid | The id of the shared tool |
array | Recursive associative array with partial xpath to be concatenated into an xpath expression before setting the value. |
|
static |
Returns the url to the cartridge representing the tool.
If you have slash arguments enabled, this will be a nice url ending in cartridge.xml. If not it will be a php page with some parameters passed.
stdClass | $tool | The lti tool |
string | The url to the cartridge representing the tool |
|
static |
Returns a description of the course or module that this lti instance points to.
stdClass | $tool | The lti tool |
string | A description of the tool |
|
static |
Returns the icon of the tool.
stdClass | $tool | The lti tool |
moodle_url | A url to the icon of the tool |
|
static |
Returns the url to launch the lti tool.
int | $toolid | the id of the shared tool |
moodle_url | the url to launch the tool |
|
static |
Returns the LTI tool.
int | $toolid |
stdClass | the tool |
|
static |
Returns the LTI tools requested.
array | $params | The list of SQL params (eg. array('columnname' => value, 'columnname2' => value)). |
int | $limitfrom | return a subset of records, starting at this point (optional). |
int | $limitnum | return a subset comprising this many records in total |
array | of tools |
|
static |
Returns the name of the lti enrolment instance, or the name of the course/module being shared.
stdClass | $tool | The lti tool |
string | The name of the tool |
|
static |
Returns the url to the tool proxy registration url.
If you have slash arguments enabled, this will be a nice url ending in cartridge.xml. If not it will be a php page with some parameters passed.
stdClass | $tool | The lti tool |
string | The url to the cartridge representing the tool |
|
staticprotected |
Traverses a recursive associative array, setting the properties of the corresponding xpath element.
DOMXPath | $xpath | The xpath with the xml to modify |
array | $parameters | The array of xpaths to search through |
string | $prefix | The current xpath prefix (gets longer the deeper into the array you go) |
void |
|
static |
Updates the users profile image.
int | $userid | the id of the user |
string | $url | the url of the image |
bool|string | true if successful, else a string explaining why it failed |
|
static |
Compares two users.
stdClass | $newuser | The new user |
stdClass | $olduser | The old user |
bool | True if both users are the same |
|
static |
Verifies that the given token matches the cartridge token of the given shared tool.
int | $toolid | The id of the shared tool |
string | $token | hash for this site and this enrolment instance |
boolean | True if the token matches, false if it does not |
|
static |
Verifies that the given token matches the proxy token of the given shared tool.
int | $toolid | The id of the shared tool |
string | $token | hash for this site and this enrolment instance |
boolean | True if the token matches, false if it does not |