Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
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. | |
static | count_lti_tools ($params=array()) |
Returns the number of LTI tools. | |
static | create_cartridge ($toolid) |
Create an IMS cartridge for the tool. | |
static | create_service_body ($source, $grade) |
Create a IMS POX body request for sync grades. | |
static | create_username ($consumerkey, $ltiuserid) |
Creates a unique username. | |
static | enrol_user ($tool, $userid) |
Enrol a user in a course. | |
static | generate_cartridge_token ($toolid) |
Returns a unique hash for this site and this enrolment instance. | |
static | generate_proxy_token ($toolid) |
Returns a unique hash for this site and this enrolment instance. | |
static | get_cartridge_url ($tool) |
Returns the url to the cartridge representing the tool. | |
static | get_description ($tool) |
Returns a description of the course or module that this lti instance points to. | |
static | get_icon ($tool) |
Returns the icon of the tool. | |
static | get_launch_url ($toolid) |
Returns the url to launch the lti tool. | |
static | get_lti_tool ($toolid) |
Returns the LTI tool. | |
static | get_lti_tools ($params=array(), $limitfrom=0, $limitnum=0) |
Returns the LTI tools requested. | |
static | get_name ($tool) |
Returns the name of the lti enrolment instance, or the name of the course/module being shared. | |
static | get_proxy_url ($tool) |
Returns the url to the tool proxy registration url. | |
static | update_user_profile_image ($userid, $url) |
Updates the users profile image. | |
static | user_match ($newuser, $olduser) |
Compares two users. | |
static | verify_cartridge_token ($toolid, $token) |
Verifies that the given token matches the cartridge token of the given shared tool. | |
static | verify_proxy_token ($toolid, $token) |
Verifies that the given token matches the proxy token of the given shared tool. | |
Static Protected Member Functions | |
static | get_cartridge_parameters ($toolid) |
Returns the parameters of the cartridge as an associative array of partial xpath. | |
static | set_xpath ($xpath, $parameters, $prefix='') |
Traverses a recursive associative array, setting the properties of the corresponding xpath element. | |
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 |