Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Files | Namespaces | Classes | Functions | Variables
mod_lti

Files

file  access.php
 This file contains the capabilities used by the lti module.
 
file  activity.php
 Search area for mod_lti activities.
 
file  activity_base.php
 Activity base class.
 
file  backup_lti_activity_task.class.php
 Defines backup_lti_activity_task class.
 
file  backup_lti_stepslib.php
 This file contains all the backup steps that will be used by the backup_lti_activity_task.
 
file  caches.php
 This file contains the cache definitions for the lti plugin.
 
file  clean_access_tokens.php
 A scheduled task for lti module.
 
file  cognitive_depth.php
 Cognitive depth indicator - lti.
 
file  course_module_instance_list_viewed.php
 The mod_lti instance list viewed event.
 
file  course_module_viewed.php
 The mod_lti course module viewed event.
 
file  edit_form.php
 This file defines de main basiclti configuration form.
 
file  external.php
 External tool module external API.
 
file  external_registration_return_page.php
 Class containing data for external registration return page.
 
file  install.php
 Post installation and migration code.
 
file  lib.php
 1.9 to 2.0 backup format converter.
 
file  lib.php
 This file contains a library of functions and constants for the lti module.
 
file  lib.php
 mod_lti data generator
 
file  locallib.php
 This file contains the library of functions and constants for the lti module.
 
file  log.php
 LTI web service endpoints.
 
file  ltiservice.php
 LTI service plugin info.
 
file  ltisource.php
 LTI source plugin info.
 
file  mod_form.php
 This file defines the main lti configuration form.
 
file  provider.php
 Privacy Subsystem implementation for mod_lti.
 
file  register_form.php
 This file defines the main tool registration configuration form.
 
file  renderer.php
 Renderer class for template library.
 
file  repost_crosssite_page.php
 Render a page containing a simple form which reposts to self via JS.
 
file  resource_base.php
 This file contains an abstract definition of an LTI resource.
 
file  response.php
 This file contains an abstract definition of an LTI service.
 
file  restore_lti_activity_task.class.php
 This file contains the lti module restore class.
 
file  restore_lti_stepslib.php
 This file contains all the restore steps that will be used by the restore_lti_activity_task.
 
file  service_base.php
 This file contains an abstract definition of an LTI service.
 
file  service_exception_handler.php
 Exception handler for LTI services.
 
file  servicelib.php
 Utility code for LTI service handling.
 
file  services.php
 External tool external functions and service definitions.
 
file  settings.php
 This file defines the global lti administration form.
 
file  social_breadth.php
 Social breadth indicator - lti.
 
file  tasks.php
 This file defines tasks performed by the plugin.
 
file  tool_configure_page.php
 Class containing data for tool_configure page.
 
file  TrivialStore.php
 This file contains a Trivial memory-based store - no support for tokens.
 
file  unknown_service_api_called.php
 The mod_lti unknown service api called event.
 
file  upgrade.php
 This file keeps track of upgrades to the lti module.
 
file  upgradelib.php
 This file contains functions used by upgrade and install.
 
file  version.php
 This file defines the version of lti.
 

Namespaces

namespace  mod_lti
  
 
namespace  mod_lti\analytics\indicator
  
 
namespace  mod_lti\event
  
 
namespace  mod_lti\local\ltiservice
  
 
namespace  mod_lti\output
  
 
namespace  mod_lti\plugininfo
  
 
namespace  mod_lti\privacy
  
 
namespace  mod_lti\search
  
 
namespace  mod_lti\task
  
 
namespace  moodle\mod\lti
  
 

Classes

class  backup_lti_activity_structure_step
 Define the complete assignment structure for backup, with file and id annotations. More...
 
class  backup_lti_activity_task
 Provides the steps to perform one complete backup of the LTI instance. More...
 
class  mod_lti\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_lti\analytics\indicator\cognitive_depth
 Cognitive depth indicator - lti. More...
 
class  mod_lti\analytics\indicator\social_breadth
 Social breadth indicator - lti. More...
 
class  mod_lti\event\course_module_instance_list_viewed
 The mod_lti instance list viewed event class. More...
 
class  mod_lti\event\course_module_viewed
 The mod_lti course module viewed event class. More...
 
class  mod_lti\event\unknown_service_api_called
 The mod_lti unknown service api called event class. More...
 
class  mod_lti\local\ltiservice\resource_base
 The mod_lti::local::ltiservice::resource_base class. More...
 
class  mod_lti\local\ltiservice\response
 The mod_lti::local::ltiservice::response class. More...
 
class  mod_lti\local\ltiservice\service_base
 The mod_lti::local::ltiservice::service_base class. More...
 
class  mod_lti\output\external_registration_return_page
 Class containing data for tool_configure page. More...
 
class  mod_lti\output\renderer
 Renderer class for template library. More...
 
class  mod_lti\output\repost_crosssite_page
 Render a page containing a simple form which reposts to self via JS. More...
 
class  mod_lti\output\tool_configure_page
 Class containing data for tool_configure page. More...
 
class  mod_lti\plugininfo\ltiservice
 The mod_lti::plugininfo::ltiservice class. More...
 
class  mod_lti\plugininfo\ltisource
 
class  mod_lti\privacy\provider
 Privacy Subsystem implementation for mod_lti. More...
 
class  mod_lti\search\activity
 Search area for mod_lti activities. More...
 
class  mod_lti\service_exception_handler
 Handles exceptions when handling incoming LTI messages. More...
 
class  mod_lti\task\clean_access_tokens
 Class containing the scheduled task for lti module. More...
 
class  mod_lti_edit_types_form
 LTI Edit Form. More...
 
class  mod_lti_external
 
class  mod_lti_generator
 
class  mod_lti_mod_form
 
class  mod_lti_register_types_form
 The mod_lti_register_types_form class. More...
 
class  moodle1_mod_lti_handler
 
class  moodle\mod\lti\TrivialOAuthDataStore
 A Trivial memory-based store - no support for tokens. More...
 
class  restore_lti_activity_structure_step
 Structure step to restore one lti activity. More...
 
class  restore_lti_activity_task
 basiclti restore task that provides all the settings and steps to perform one complete restore of the activity More...
 

Functions

 get_tag ($tagname, $xpath, $attribute=null)
 Search for a tag within an XML DOMDocument. More...
 
 get_tool_proxy_edit_url (stdClass $proxy)
 Returns the edit url for the given tool proxy. More...
 
 get_tool_proxy_urls (stdClass $proxy)
 Returns the icon and edit urls for the tool proxy. More...
 
 get_tool_type_capability_groups ($type)
 Returns a summary of each LTI capability this tool type requires in plain language. More...
 
 get_tool_type_config ($type)
 Returns information on the configuration of the tool type. More...
 
 get_tool_type_course_url (stdClass $type)
 Returns the course url for the given tool type. More...
 
 get_tool_type_edit_url (stdClass $type)
 Returns the edit url for the given tool type. More...
 
 get_tool_type_icon_url (stdClass $type)
 Returns the icon for the given tool type. More...
 
 get_tool_type_instance_ids ($type)
 Returns the ids of each instance of this tool type. More...
 
 get_tool_type_state_info (stdClass $type)
 Returns information on the current state of the tool type. More...
 
 get_tool_type_urls (stdClass $type)
 Returns the icon and edit urls for the tool type and the course url if it is a course type. More...
 
 lti_accepts_grades ($ltiinstance)
 
 lti_add_config ($config)
 Add a tool configuration in the database. More...
 
 lti_add_instance ($lti, $mform)
 Given an object containing all the necessary data, (defined by the form in mod.html) this function will create a new instance and return the id number of the new instance. More...
 
 lti_add_tool_proxy ($config)
 Update the database with a tool proxy instance. More...
 
 lti_add_type ($type, $config)
 
 lti_build_content_item_selection_request ($id, $course, moodle_url $returnurl, $title='', $text='', $mediatypes=[], $presentationtargets=[], $autocreate=false, $multiple=false, $unsigned=false, $canconfirm=false, $copyadvice=false, $nonce='')
 Builds a standard LTI Content-Item selection request. More...
 
 lti_build_custom_parameters ($toolproxy, $tool, $instance, $params, $customstr, $instructorcustomstr, $islti2)
 This function builds the custom parameters. More...
 
 lti_build_login_request ($courseid, $id, $instance, $config, $messagetype)
 Prepares an LTI 1.3 login request. More...
 
 lti_build_registration_request ($toolproxy)
 Gets the parameters for the regirstration request. More...
 
 lti_build_request ($instance, $typeconfig, $course, $typeid=null, $islti2=false)
 This function builds the request that must be sent to the tool producer. More...
 
 lti_build_request_lti2 ($tool, $params)
 This function builds the request that must be sent to an LTI 2 tool provider. More...
 
 lti_build_sourcedid ($instanceid, $userid, $servicesalt, $typeid=null, $launchid=null)
 Build source ID. More...
 
 lti_build_standard_message ($instance, $orgid, $ltiversion, $messagetype='basic-lti-launch-request')
 This function builds the standard parameters for an LTI message that must be sent to the tool producer. More...
 
 lti_build_standard_request ($instance, $orgid, $islti2, $messagetype='basic-lti-launch-request')
 This function builds the standard parameters for an LTI 1 or 2 request that must be sent to the tool producer. More...
 
 lti_calculate_custom_parameter ($value)
 Calculates the value of a custom parameter that has not been specified earlier. More...
 
 lti_check_updates_since (cm_info $cm, $from, $filter=array())
 Check if the module has any update that affects the current user since a given time. More...
 
 lti_convert_content_items ($param)
 Converts the new Deep-Linking format for Content-Items to the old format. More...
 
 lti_convert_from_jwt ($typeid, $jwtparam)
 Verfies the JWT and converts its claims to their equivalent message parameter. More...
 
 lti_cron ()
 Function to be run periodically according to the moodle cron This function searches for things that need to be done, such as sending out mail, toggling flags etc ... More...
 
 lti_delete_grade ($ltiinstance, $userid)
 
 lti_delete_instance ($id)
 Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it. More...
 
 lti_delete_tool_proxy ($id)
 Delete a Tool Proxy. More...
 
 lti_delete_type ($id)
 Delete a Basic LTI configuration. More...
 
 lti_ensure_url_is_https ($url)
 
 lti_extend_lti_services ($data)
 Extend the LTI services through the ltisource plugins. More...
 
 lti_filter_get_types ($course)
 Returns all basicLTI tools configured by the administrator. More...
 
 lti_filter_tool_proxy_types (array $toolproxies, $state)
 Given an array of tool proxies, filter them based on their state. More...
 
 lti_filter_tool_types (array $tools, $state)
 Given an array of tools, filter them based on their state. More...
 
 lti_force_type_config_settings ($instance, array $typeconfig)
 Enforce type config settings onto the LTI instance. More...
 
 lti_get_best_tool_by_url ($url, $tools, $courseid=null)
 
 lti_get_capabilities ()
 Initializes an array with the capabilities supported by the LTI module. More...
 
 lti_get_config ($ltiobject)
 Transforms a basic LTI object to an array. More...
 
 lti_get_configured_types ($courseid, $sectionreturn=0)
 Returns a list of configured types in the given course. More...
 
 lti_get_contexts ($json)
 Extracts the named contexts from a tool proxy. More...
 
 lti_get_course_content_items (\core_course\local\entity\content_item $defaultmodulecontentitem, stdClass $user, stdClass $course)
 Return the preconfigured tools which are configured for inclusion in the activity picker. More...
 
 lti_get_coursemodule_info ($coursemodule)
 Given a coursemodule object, this function returns the extra information needed to print this activity in various places. More...
 
 lti_get_custom_parameters ($toolproxy, $tool, $params, $parameters)
 Adds the custom parameters to an array. More...
 
 lti_get_domain_from_url ($url)
 
 lti_get_enabled_capabilities ($tool)
 Extracts the enabled capabilities into an array, including those implicitly declared in a parameter. More...
 
 lti_get_fqid ($contexts, $id)
 Converts an ID to a fully-qualified ID. More...
 
 lti_get_ims_role ($user, $cmid, $courseid, $islti2)
 Gets the IMS role string for the specified user and LTI course module. More...
 
 lti_get_instance_type (object $instance)
 Return the type of the instance, using domain matching if no explicit type is set. More...
 
 lti_get_jwt_claim_mapping ()
 Return the mapping for standard message parameters to JWT claim. More...
 
 lti_get_jwt_message_type_mapping ()
 Return the mapping for standard message types to JWT message_type claim. More...
 
 lti_get_launch_container ($lti, $toolconfig)
 
 lti_get_launch_data ($instance, $nonce='')
 Return the launch data required for opening the external tool. More...
 
 lti_get_lti_types ()
 Returns available Basic LTI types. More...
 
 lti_get_lti_types_by_course ($courseid, $coursevisible=null)
 Returns all lti types visible in this course. More...
 
 lti_get_lti_types_from_proxy_id ($toolproxyid)
 Returns available Basic LTI types that match the given tool proxy id. More...
 
 lti_get_organizationid ($typeconfig)
 get Organization ID using default if no value provided More...
 
 lti_get_permitted_service_scopes ($type, $typeconfig)
 Initializes an array with the scopes for services supported by the LTI module. More...
 
 lti_get_post_actions ()
 Log post actions. More...
 
 lti_get_response_xml ($codemajor, $description, $messageref, $messagetype)
 
 lti_get_service_by_name ($servicename)
 Initializes an instance of the named service. More...
 
 lti_get_service_by_resource_id ($services, $resourceid)
 Finds a service by id. More...
 
 lti_get_services ()
 Initializes an array with the services supported by the LTI module. More...
 
 lti_get_shared_secrets_by_key ($key)
 
 lti_get_shortcuts ($defaultitem)
 Return aliases of this activity. More...
 
 lti_get_tool_by_url_match ($url, $courseid=null, $state=LTI_TOOL_STATE_CONFIGURED)
 
 lti_get_tool_proxies ($orphanedonly)
 Returns lti tool proxies. More...
 
 lti_get_tool_proxies_from_registration_url ($regurl)
 Get the tool proxy instance given its registration URL. More...
 
 lti_get_tool_proxy ($id)
 Generates some of the tool proxy configuration based on the admin configuration details. More...
 
 lti_get_tool_proxy_config ($id)
 Generates some of the tool proxy configuration based on the admin configuration details. More...
 
 lti_get_tool_proxy_from_guid ($toolproxyguid)
 Get the tool proxy instance given its GUID. More...
 
 lti_get_tool_proxy_table ($toolproxies, $id)
 This function builds the tab for a category of tool proxies. More...
 
 lti_get_tool_settings ($toolproxyid, $courseid=null, $instanceid=null)
 Gets the tool settings. More...
 
 lti_get_tool_table ($tools, $id)
 
 lti_get_tools_by_domain ($domain, $state=null, $courseid=null)
 
 lti_get_tools_by_url ($url, $state, $courseid=null)
 
 lti_get_type ($typeid)
 
 lti_get_type_config ($typeid)
 Returns configuration details for the tool. More...
 
 lti_get_type_config_by_instance ($instance)
 Fetches LTI type configuration for an LTI instance. More...
 
 lti_get_type_config_from_instance ($id)
 Generates some of the tool configuration based on the instance details. More...
 
 lti_get_type_type_config ($id)
 Generates some of the tool configuration based on the admin configuration details. More...
 
 lti_get_types_for_add_instance ()
 Returns tool types for lti add instance and edit page. More...
 
 lti_get_url_thumbprint ($url)
 
 lti_get_view_actions ()
 Log view actions. More...
 
 lti_grade_item_delete ($basiclti)
 
 lti_grade_item_update ($basiclti, $grades=null)
 
 lti_grades ($basicltiid)
 Must return an array of grades for a given instance of this module, indexed by user. More...
 
 lti_initiate_login ($courseid, $id, $instance, $config, $messagetype='basic-lti-launch-request', $title='', $text='')
 Generate the form for initiating a login request for an LTI 1.3 message. More...
 
 lti_install ()
 Execute post-install custom actions for the module This function was added in 1.9. More...
 
 lti_is_cartridge ($url)
 Determines if the given url is for a IMS basic cartridge. More...
 
 lti_launch_tool ($instance)
 Launch an external tool activity. More...
 
 lti_load_cartridge ($url, $map, $propertiesmap=array())
 Search for a tag within an XML DOMDocument. More...
 
 lti_load_tool_from_cartridge ($url, $lti)
 Allows you to load in the configuration for an external tool from an IMS cartridge. More...
 
 lti_load_tool_if_cartridge ($lti)
 Loads the cartridge information into the new tool, if the launch url is for a cartridge file. More...
 
 lti_load_type_from_cartridge ($url, $type)
 Allows you to load settings for an external tool type from an IMS cartridge. More...
 
 lti_load_type_if_cartridge ($type)
 Loads the cartridge information into the tool type, if the launch url is for a cartridge file. More...
 
 lti_log_request ($rawbody)
 Logs the request to a file in temp dir. More...
 
 lti_log_response ($responsexml, $e=null)
 Log an LTI response. More...
 
 lti_map_keyname ($key, $tolower=true)
 Used for building the names of the different custom parameters. More...
 
 lti_new_access_token ($typeid, $scopes)
 Create a new access token. More...
 
 lti_parse_custom_parameter ($toolproxy, $tool, $params, $value, $islti2)
 Parse a custom parameter to replace any substitution variables. More...
 
 lti_parse_grade_delete_message ($xml)
 
 lti_parse_grade_read_message ($xml)
 
 lti_parse_grade_replace_message ($xml)
 
 lti_parse_message_id ($xml)
 
 lti_post_launch_html ($newparms, $endpoint, $debug=false)
 Posts the launch petition HTML. More...
 
 lti_prepare_type_for_save ($type, $config)
 
 lti_print_recent_activity ($course, $isteacher, $timestart)
 Given a course and a time, this module should find recent activity that has occurred in basiclti activities and print it out. More...
 
 lti_read_grade ($ltiinstance, $userid)
 
 lti_register ($toolproxy)
 Prepares an LTI registration request message. More...
 
 lti_request_is_using_ssl ()
 
 lti_scale_used ()
 
 lti_scale_used_anywhere ($scaleid)
 Checks if scale is being used by any instance of basiclti. More...
 
 lti_set_session_user ($userid)
 Set the passed user ID to the session user. More...
 
 lti_set_state_for_type ($id, $state)
 
 lti_set_tool_settings ($settings, $toolproxyid, $courseid=null, $instanceid=null)
 Sets the tool settings (. More...
 
 lti_should_log_request ($rawbody)
 Determines if we should try to log the request. More...
 
 lti_sign_jwt ($parms, $endpoint, $oauthconsumerkey, $typeid=0, $nonce='')
 Converts the message paramters to their equivalent JWT claim and signs the payload to launch the external tool using JWT. More...
 
 lti_sign_parameters ($oldparms, $endpoint, $method, $oauthconsumerkey, $oauthconsumersecret)
 Signs the petition to launch the external tool using OAuth. More...
 
 lti_split_custom_parameters ($toolproxy, $tool, $params, $customstr, $islti2=false)
 Splits the custom parameters field to the various parameters. More...
 
 lti_supports ($feature)
 List of features supported in URL module. More...
 
 lti_tool_configuration_from_content_item ($typeid, $messagetype, $ltiversion, $consumerkey, $contentitemsjson)
 Processes the tool provider's response to the ContentItemSelectionRequest and builds the configuration data from the selected content item. More...
 
 lti_uninstall ()
 Execute post-uninstall custom actions for the module This function was added in 1.9. More...
 
 lti_update_config ($config)
 Updates a tool configuration in the database. More...
 
 lti_update_grade ($ltiinstance, $userid, $launchid, $gradeval)
 
 lti_update_grades ($basiclti, $userid=0, $nullifnone=true)
 Update activity grades. More...
 
 lti_update_instance ($lti, $mform)
 Given an object containing all the necessary data, (defined by the form in mod.html) this function will update an existing instance with new data. More...
 
 lti_update_tool_proxy ($toolproxy)
 Updates a tool proxy in the database. More...
 
 lti_update_type ($type, $config)
 
 lti_user_complete ($course, $user, $mod, $basiclti)
 Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports. More...
 
 lti_user_outline ($course, $user, $mod, $basiclti)
 Return a small object with summary information about what a user has done with a given particular instance of this module Used for user activity reports. More...
 
 lti_verify_jwt_signature ($typeid, $consumerkey, $jwtparam)
 Verifies the JWT signature of an incoming message. More...
 
 lti_verify_message ($key, $sharedsecrets, $body, $headers=null)
 
 lti_verify_oauth_signature ($typeid, $consumerkey)
 Verifies the OAuth signature of an incoming message. More...
 
 lti_verify_sourcedid ($ltiinstance, $parsed)
 Validate source ID from external request. More...
 
 lti_verify_with_keyset ($jwtparam, $keyseturl, $clientid)
 Verifies the JWT signature using a JWK keyset. More...
 
 lti_view ($lti, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event. More...
 
 mod_lti_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none. More...
 
 mod_lti_get_all_content_items (\core_course\local\entity\content_item $defaultmodulecontentitem)
 Return all content items which can be added to any course. More...
 
 mod_lti_get_fontawesome_icon_map ()
 Get icon mapping for font-awesome.
 
 mod_lti_verify_private_key ()
 This function checks if a private key has been generated for this site. More...
 
 serialise_tool_proxy (stdClass $proxy)
 Serialises this tool proxy. More...
 
 serialise_tool_type (stdClass $type)
 Serialises this tool type. More...
 
 xmldb_lti_install ()
 Stub for database installation.
 
 xmldb_lti_upgrade ($oldversion)
 xmldb_lti_upgrade is the function that upgrades the lti module database when is needed More...
 

Variables

 $capabilities
 
global mod_lti\local\ltiservice::$CFG
 
global $CFG
 
global $CFG
 
 $definitions
 
 $functions
 
 $logs
 
admin_settingpage $modltifolder = new admin_category('modltifolder', new lang_string('pluginname', 'mod_lti'), $module->is_enabled() === false)
 
 $plugin = 2020060900
 
 $proxieslink
 
if($ADMIN->fulltree) $settings = null
 
 $tasks
 
foreach(core_plugin_manager::instance() ->get_plugins_of_type('ltisource') as $plugin) $toolproxiesurl = new moodle_url('/mod/lti/toolproxies.php')
 
$plugin component = 'mod_lti'
 
$plugin cron = 0
 
$settings hidden = true
 
const LTI_ACCESS_TOKEN_LIFE 3600
 
const LTI_COURSEVISIBLE_ACTIVITYCHOOSER 2
 
const LTI_COURSEVISIBLE_NO 0
 
const LTI_COURSEVISIBLE_PRECONFIGURED 1
 
const LTI_DEFAULT_ORGID_SITEHOST 'SITEHOST'
 
const LTI_DEFAULT_ORGID_SITEID 'SITEID'
 
const LTI_ITEM_MODULE 'lti'
 
const LTI_ITEM_TYPE 'mod'
 
const LTI_JWK_KEYSET 'JWK_KEYSET'
 
const LTI_JWT_CLAIM_PREFIX 'https://purl.imsglobal.org/spec/lti'
 
const LTI_LAUNCH_CONTAINER_DEFAULT 1
 
const LTI_LAUNCH_CONTAINER_EMBED 2
 
const LTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS 3
 
const LTI_LAUNCH_CONTAINER_REPLACE_MOODLE_WINDOW 5
 
const LTI_LAUNCH_CONTAINER_WINDOW 4
 
const LTI_RSA_KEY 'RSA_KEY'
 
const LTI_SETTING_ALWAYS 1
 
const LTI_SETTING_DELEGATE 2
 
const LTI_SETTING_NEVER 0
 
const LTI_SOURCE 'mod/lti'
 
const LTI_TOOL_PROXY_STATE_ACCEPTED 3
 
const LTI_TOOL_PROXY_STATE_CONFIGURED 1
 
const LTI_TOOL_PROXY_STATE_PENDING 2
 
const LTI_TOOL_PROXY_STATE_REJECTED 4
 
const LTI_TOOL_PROXY_TAB 4
 
const LTI_TOOL_STATE_ANY 0
 
const LTI_TOOL_STATE_CONFIGURED 1
 
const LTI_TOOL_STATE_PENDING 2
 
const LTI_TOOL_STATE_REJECTED 3
 
const LTI_URL_DOMAIN_REGEX '/(?:https?:\/\/)?(?:www\.)?([^\/]+)(?:\/|$)/i'
 
const LTI_VERSION_1 'LTI-1p0'
 
const LTI_VERSION_1P3 '1.3.0'
 
const LTI_VERSION_2 'LTI-2p0'
 
$plugin version = 2020061501
 
$settings visiblename = new lang_string('manage_tools', 'mod_lti')
 

Detailed Description

Function Documentation

◆ get_tag()

get_tag (   $tagname,
  $xpath,
  $attribute = null 
)

Search for a tag within an XML DOMDocument.

Parameters
stdClass$tagnameThe name of the tag to search for
XPath$xpathThe XML to find the tag in
XPath$attributeThe attribute to search for (if we should search for a child node with the given value for the name attribute
Since
Moodle 3.1

◆ get_tool_proxy_edit_url()

get_tool_proxy_edit_url ( stdClass  $proxy)

Returns the edit url for the given tool proxy.

Parameters
stdClass$proxyThe tool proxy
Return values
stringThe url to edit the tool type

◆ get_tool_proxy_urls()

get_tool_proxy_urls ( stdClass  $proxy)

Returns the icon and edit urls for the tool proxy.

Parameters
stdClass$proxyThe tool proxy
Return values
arrayThe urls of the tool proxy

◆ get_tool_type_capability_groups()

get_tool_type_capability_groups (   $type)

Returns a summary of each LTI capability this tool type requires in plain language.

Parameters
stdClass$typeThe tool type
Return values
arrayAn array of text descriptions of each of the capabilities this tool type requires

◆ get_tool_type_config()

get_tool_type_config (   $type)

Returns information on the configuration of the tool type.

Parameters
stdClass$typeThe tool type
Return values
arrayAn array with configuration details

◆ get_tool_type_course_url()

get_tool_type_course_url ( stdClass  $type)

Returns the course url for the given tool type.

Parameters
stdClass$typeThe tool type
Return values
stringThe url to the course of the tool type, void if it is a site wide type

◆ get_tool_type_edit_url()

get_tool_type_edit_url ( stdClass  $type)

Returns the edit url for the given tool type.

Parameters
stdClass$typeThe tool type
Return values
stringThe url to edit the tool type

◆ get_tool_type_icon_url()

get_tool_type_icon_url ( stdClass  $type)

Returns the icon for the given tool type.

Parameters
stdClass$typeThe tool type
Return values
stringThe url to the tool type's corresponding icon

◆ get_tool_type_instance_ids()

get_tool_type_instance_ids (   $type)

Returns the ids of each instance of this tool type.

Parameters
stdClass$typeThe tool type
Return values
arrayAn array of ids of the instances of this tool type

◆ get_tool_type_state_info()

get_tool_type_state_info ( stdClass  $type)

Returns information on the current state of the tool type.

Parameters
stdClass$typeThe tool type
Return values
arrayAn array with a text description of the state, and boolean for whether it is in each state: pending, configured, rejected, unknown

◆ get_tool_type_urls()

get_tool_type_urls ( stdClass  $type)

Returns the icon and edit urls for the tool type and the course url if it is a course type.

Parameters
stdClass$typeThe tool type
Return values
arrayThe urls of the tool type

◆ lti_add_config()

lti_add_config (   $config)

Add a tool configuration in the database.

Parameters
object$configTool configuration
Return values
intRecord id number

◆ lti_add_instance()

lti_add_instance (   $lti,
  $mform 
)

Given an object containing all the necessary data, (defined by the form in mod.html) this function will create a new instance and return the id number of the new instance.

Parameters
object$instanceAn object from the form in mod.html
Return values
intThe id of the newly inserted basiclti record

◆ lti_add_tool_proxy()

lti_add_tool_proxy (   $config)

Update the database with a tool proxy instance.

Parameters
object$configTool proxy definition
Return values
intRecord id number

◆ lti_build_content_item_selection_request()

lti_build_content_item_selection_request (   $id,
  $course,
moodle_url  $returnurl,
  $title = '',
  $text = '',
  $mediatypes = [],
  $presentationtargets = [],
  $autocreate = false,
  $multiple = false,
  $unsigned = false,
  $canconfirm = false,
  $copyadvice = false,
  $nonce = '' 
)

Builds a standard LTI Content-Item selection request.

Parameters
int$idThe tool type ID.
stdClass$courseThe course object.
moodle_url$returnurlThe return URL in the tool consumer (TC) that the tool provider (TP) will use to return the Content-Item message.
string$titleThe tool's title, if available.
string$textThe text to display to represent the content item. This value may be a long description of the content item.
array$mediatypesArray of MIME types types supported by the TC. If empty, the TC will support ltilink by default.
array$presentationtargetsArray of ways in which the selected content item(s) can be requested to be opened (via the presentationDocumentTarget element for a returned content item). If empty, "frame", "iframe", and "window" will be supported by default.
bool$autocreateIndicates whether any content items returned by the TP would be automatically persisted without
bool$multipleIndicates whether the user should be permitted to select more than one item. False by default. any option for the user to cancel the operation. False by default.
bool$unsignedIndicates whether the TC is willing to accept an unsigned return message, or not. A signed message should always be required when the content item is being created automatically in the TC without further interaction from the user. False by default.
bool$canconfirmFlag for can_confirm parameter. False by default.
bool$copyadviceIndicates whether the TC is able and willing to make a local copy of a content item. False by default.
string$nonce
Return values
stdClassThe object containing the signed request parameters and the URL to the TP's Content-Item selection interface.
Exceptions
moodle_exceptionWhen the LTI tool type does not exist.`
coding_exceptionFor invalid media type and presentation target parameters.

◆ lti_build_custom_parameters()

lti_build_custom_parameters (   $toolproxy,
  $tool,
  $instance,
  $params,
  $customstr,
  $instructorcustomstr,
  $islti2 
)

This function builds the custom parameters.

Parameters
object$toolproxyTool proxy instance object
object$toolTool instance object
object$instanceTool placement instance object
array$paramsLTI launch parameters
string$customstrCustom parameters defined for tool
string$instructorcustomstrCustom parameters defined for this placement
boolean$islti2True if an LTI 2 tool is being launched
Return values
arrayCustom parameters

◆ lti_build_login_request()

lti_build_login_request (   $courseid,
  $id,
  $instance,
  $config,
  $messagetype 
)

Prepares an LTI 1.3 login request.

Parameters
int$courseidCourse ID
int$idLTI instance ID
stdClass | null$instanceLTI instance
stdClass$configTool type configuration
string$messagetypeLTI message type
Return values
arrayLogin request parameters

◆ lti_build_registration_request()

lti_build_registration_request (   $toolproxy)

Gets the parameters for the regirstration request.

Parameters
object$toolproxyTool Proxy instance object
Return values
arrayRegistration request parameters

◆ lti_build_request()

lti_build_request (   $instance,
  $typeconfig,
  $course,
  $typeid = null,
  $islti2 = false 
)

This function builds the request that must be sent to the tool producer.

Parameters
object$instanceBasic LTI instance object
array$typeconfigBasic LTI tool configuration
object$courseCourse object
int | null$typeidBasic LTI tool ID
boolean$islti2True if an LTI 2 tool is being launched
Return values
arrayRequest details

◆ lti_build_request_lti2()

lti_build_request_lti2 (   $tool,
  $params 
)

This function builds the request that must be sent to an LTI 2 tool provider.

Parameters
object$toolBasic LTI tool object
array$paramsCustom launch parameters
Return values
arrayRequest details

◆ lti_build_sourcedid()

lti_build_sourcedid (   $instanceid,
  $userid,
  $servicesalt,
  $typeid = null,
  $launchid = null 
)

Build source ID.

Parameters
int$instanceid
int$userid
string$servicesalt
null | int$typeid
null | int$launchid
Return values
stdClass

◆ lti_build_standard_message()

lti_build_standard_message (   $instance,
  $orgid,
  $ltiversion,
  $messagetype = 'basic-lti-launch-request' 
)

This function builds the standard parameters for an LTI message that must be sent to the tool producer.

Parameters
stdClass$instanceBasic LTI instance object
string$orgidOrganisation ID
boolean$ltiversionLTI version to be used for tool messages
string$messagetypeThe request message type. Defaults to basic-lti-launch-request if empty.
Return values
arrayMessage parameters

◆ lti_build_standard_request()

lti_build_standard_request (   $instance,
  $orgid,
  $islti2,
  $messagetype = 'basic-lti-launch-request' 
)

This function builds the standard parameters for an LTI 1 or 2 request that must be sent to the tool producer.

Parameters
stdClass$instanceBasic LTI instance object
string$orgidOrganisation ID
boolean$islti2True if an LTI 2 tool is being launched
string$messagetypeThe request message type. Defaults to basic-lti-launch-request if empty.
Return values
arrayRequest details
Deprecated:
since Moodle 3.7 MDL-62599 - please do not use this function any more.
See also
lti_build_standard_message()

◆ lti_calculate_custom_parameter()

lti_calculate_custom_parameter (   $value)

Calculates the value of a custom parameter that has not been specified earlier.

Parameters
string$valueCustom parameter value
Return values
stringCalculated value of custom parameter

◆ lti_check_updates_since()

lti_check_updates_since ( cm_info  $cm,
  $from,
  $filter = array() 
)

Check if the module has any update that affects the current user since a given time.

Parameters
cm_info$cmcourse module data
int$fromthe time to check updates from
array$filterif we need to check only specific updates
Return values
stdClassan object with the different type of areas indicating if they were updated or not
Since
Moodle 3.2

◆ lti_convert_content_items()

lti_convert_content_items (   $param)

Converts the new Deep-Linking format for Content-Items to the old format.

Parameters
string$paramJSON string representing new Deep-Linking format
Return values
stringJSON representation of content-items

◆ lti_convert_from_jwt()

lti_convert_from_jwt (   $typeid,
  $jwtparam 
)

Verfies the JWT and converts its claims to their equivalent message parameter.

Parameters
int$typeid
string$jwtparamJWT parameter
Return values
arraymessage parameters
Exceptions
moodle_exception

◆ lti_cron()

lti_cron ( )

Function to be run periodically according to the moodle cron This function searches for things that need to be done, such as sending out mail, toggling flags etc ...

@uses $CFG

Return values
boolean

◆ lti_delete_instance()

lti_delete_instance (   $id)

Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.

Parameters
int$idId of the module instance
Return values
booleanSuccess/Failure

◆ lti_delete_tool_proxy()

lti_delete_tool_proxy (   $id)

Delete a Tool Proxy.

Parameters
int$idTool Proxy id

◆ lti_delete_type()

lti_delete_type (   $id)

Delete a Basic LTI configuration.

Parameters
int$idConfiguration id

◆ lti_extend_lti_services()

lti_extend_lti_services (   $data)

Extend the LTI services through the ltisource plugins.

Parameters
stdClass$dataLTI request data
Return values
bool
Exceptions
coding_exception

◆ lti_filter_get_types()

lti_filter_get_types (   $course)

Returns all basicLTI tools configured by the administrator.

Parameters
int$course
Return values
array

◆ lti_filter_tool_proxy_types()

lti_filter_tool_proxy_types ( array  $toolproxies,
  $state 
)

Given an array of tool proxies, filter them based on their state.

Parameters
array$toolproxiesAn array of lti_tool_proxies records
int$stateOne of the LTI_TOOL_PROXY_STATE_* constants
Return values
array

◆ lti_filter_tool_types()

lti_filter_tool_types ( array  $tools,
  $state 
)

Given an array of tools, filter them based on their state.

Parameters
array$toolsAn array of lti_types records
int$stateOne of the LTI_TOOL_STATE_* constants
Return values
array

◆ lti_force_type_config_settings()

lti_force_type_config_settings (   $instance,
array  $typeconfig 
)

Enforce type config settings onto the LTI instance.

Parameters
stdClass$instance
array$typeconfig

◆ lti_get_capabilities()

lti_get_capabilities ( )

Initializes an array with the capabilities supported by the LTI module.

Return values
arrayList of capability names (without a dollar sign prefix)

◆ lti_get_config()

lti_get_config (   $ltiobject)

Transforms a basic LTI object to an array.

Parameters
object$ltiobjectBasic LTI object
Return values
arrayBasic LTI configuration details

◆ lti_get_configured_types()

lti_get_configured_types (   $courseid,
  $sectionreturn = 0 
)

Returns a list of configured types in the given course.

Parameters
int$courseidThe id of the course to retieve types for
int$sectionreturnsection to return to for forming the URLs
Return values
arrayArray of lti types. Each element is object with properties: name, title, icon, help, helplink, link

◆ lti_get_contexts()

lti_get_contexts (   $json)

Extracts the named contexts from a tool proxy.

Parameters
object$json
Return values
arrayContexts

◆ lti_get_course_content_items()

lti_get_course_content_items ( \core_course\local\entity\content_item  $defaultmodulecontentitem,
stdClass  $user,
stdClass  $course 
)

Return the preconfigured tools which are configured for inclusion in the activity picker.

Parameters
core_course::local::entity::content_item$defaultmodulecontentitemreference to the content item for the LTI module.
stdClass$userthe user object, to use for cap checks if desired.
stdClass$coursethe course to scope items to.
Return values
arraythe array of content items.

◆ lti_get_coursemodule_info()

lti_get_coursemodule_info (   $coursemodule)

Given a coursemodule object, this function returns the extra information needed to print this activity in various places.

For this module we just need to support external urls as activity icons

Parameters
stdClass$coursemodule
Return values
cached_cm_infoinfo

◆ lti_get_custom_parameters()

lti_get_custom_parameters (   $toolproxy,
  $tool,
  $params,
  $parameters 
)

Adds the custom parameters to an array.

Parameters
object$toolproxyTool proxy instance object
object$toolTool instance object
array$paramsLTI launch parameters
array$parametersArray containing the parameters
Return values
arrayArray of custom parameters

◆ lti_get_enabled_capabilities()

lti_get_enabled_capabilities (   $tool)

Extracts the enabled capabilities into an array, including those implicitly declared in a parameter.

Parameters
object$toolTool instance object
Return values
arrayList of enabled capabilities

◆ lti_get_fqid()

lti_get_fqid (   $contexts,
  $id 
)

Converts an ID to a fully-qualified ID.

Parameters
array$contexts
string$id
Return values
stringFully-qualified ID

◆ lti_get_ims_role()

lti_get_ims_role (   $user,
  $cmid,
  $courseid,
  $islti2 
)

Gets the IMS role string for the specified user and LTI course module.

Parameters
mixed$userUser object or user id
int$cmidThe course module id of the LTI activity
int$courseidThe course id of the LTI activity
boolean$islti2True if an LTI 2 tool is being launched
Return values
stringA role string suitable for passing with an LTI launch

◆ lti_get_instance_type()

lti_get_instance_type ( object  $instance)

Return the type of the instance, using domain matching if no explicit type is set.

Parameters
object$instancethe external tool activity settings
Return values
object|null
Since
Moodle 3.9

◆ lti_get_jwt_claim_mapping()

lti_get_jwt_claim_mapping ( )

Return the mapping for standard message parameters to JWT claim.

Return values
array

◆ lti_get_jwt_message_type_mapping()

lti_get_jwt_message_type_mapping ( )

Return the mapping for standard message types to JWT message_type claim.

Return values
array

◆ lti_get_launch_data()

lti_get_launch_data (   $instance,
  $nonce = '' 
)

Return the launch data required for opening the external tool.

Parameters
stdClass$instancethe external tool activity settings
string$noncethe nonce value to use (applies to LTI 1.3 only)
Return values
arraythe endpoint URL and parameters (including the signature)
Since
Moodle 3.0

◆ lti_get_lti_types()

lti_get_lti_types ( )

Returns available Basic LTI types.

Return values
arrayof basicLTI types

◆ lti_get_lti_types_by_course()

lti_get_lti_types_by_course (   $courseid,
  $coursevisible = null 
)

Returns all lti types visible in this course.

Parameters
int$courseidThe id of the course to retieve types for
array$coursevisibleoptions for 'coursevisible' field, default [LTI_COURSEVISIBLE_PRECONFIGURED, LTI_COURSEVISIBLE_ACTIVITYCHOOSER]
Return values
stdClass[]All the lti types visible in the given course

◆ lti_get_lti_types_from_proxy_id()

lti_get_lti_types_from_proxy_id (   $toolproxyid)

Returns available Basic LTI types that match the given tool proxy id.

Parameters
int$toolproxyidTool proxy id
Return values
arrayof basicLTI types

◆ lti_get_organizationid()

lti_get_organizationid (   $typeconfig)

get Organization ID using default if no value provided

Parameters
object$typeconfig
Return values
string

◆ lti_get_permitted_service_scopes()

lti_get_permitted_service_scopes (   $type,
  $typeconfig 
)

Initializes an array with the scopes for services supported by the LTI module.

Parameters
object$typeLTI tool type
array$typeconfigLTI tool type configuration
Return values
arrayList of scopes

◆ lti_get_post_actions()

lti_get_post_actions ( )

Log post actions.

Return values
array

◆ lti_get_service_by_name()

lti_get_service_by_name (   $servicename)

Initializes an instance of the named service.

Parameters
string$servicenameName of service
Return values
bool|mod_lti::local::ltiservice::service_baseService

◆ lti_get_service_by_resource_id()

lti_get_service_by_resource_id (   $services,
  $resourceid 
)

Finds a service by id.

Parameters
mod_lti::local::ltiservice::service_base[]$servicesArray of services
string$resourceidID of resource
Return values
mod_lti::local::ltiservice::service_baseService

◆ lti_get_services()

lti_get_services ( )

Initializes an array with the services supported by the LTI module.

Return values
arrayList of services

◆ lti_get_shortcuts()

lti_get_shortcuts (   $defaultitem)

Return aliases of this activity.

LTI should have an alias for each configured tool type This is so you can add an external tool types directly to the activity chooser

Deprecated:
since 3.9
Todo:
MDL-68011 This is to be moved from here to deprecatedlib.php in Moodle 4.3
Parameters
stdClass$defaultitemdefault item that would be added to the activity chooser if this callback was not present. It has properties: archetype, name, title, help, icon, link
Return values
arrayAn array of aliases for this activity. Each element is an object with same list of properties as $defaultitem, plus an additional property, helplink. Properties title and link are required

◆ lti_get_tool_proxies()

lti_get_tool_proxies (   $orphanedonly)

Returns lti tool proxies.

Parameters
bool$orphanedonlyOnly retrieves tool proxies that have no type associated with them
Return values
arrayof basicLTI types

◆ lti_get_tool_proxies_from_registration_url()

lti_get_tool_proxies_from_registration_url (   $regurl)

Get the tool proxy instance given its registration URL.

Parameters
string$regurlTool proxy registration URL
Return values
arrayThe record of the tool proxy with this url

◆ lti_get_tool_proxy()

lti_get_tool_proxy (   $id)

Generates some of the tool proxy configuration based on the admin configuration details.

Parameters
int$id
Return values
mixedTool Proxy details

◆ lti_get_tool_proxy_config()

lti_get_tool_proxy_config (   $id)

Generates some of the tool proxy configuration based on the admin configuration details.

Parameters
int$id
Return values
mixedTool Proxy details

◆ lti_get_tool_proxy_from_guid()

lti_get_tool_proxy_from_guid (   $toolproxyguid)

Get the tool proxy instance given its GUID.

Parameters
string$toolproxyguidTool proxy GUID value
Return values
object

◆ lti_get_tool_proxy_table()

lti_get_tool_proxy_table (   $toolproxies,
  $id 
)

This function builds the tab for a category of tool proxies.

Parameters
object$toolproxiesTool proxy instance objects
string$idCategory ID
Return values
stringHTML for tab

◆ lti_get_tool_settings()

lti_get_tool_settings (   $toolproxyid,
  $courseid = null,
  $instanceid = null 
)

Gets the tool settings.

Parameters
int$toolproxyidId of tool proxy record (or tool ID if negative)
int$courseidId of course (null if system settings)
int$instanceidId of course module (null if system or context settings)
Return values
arrayArray settings

◆ lti_get_type_config()

lti_get_type_config (   $typeid)

Returns configuration details for the tool.

Parameters
int$typeidBasic LTI tool typeid
Return values
arrayTool Configuration

◆ lti_get_type_config_by_instance()

lti_get_type_config_by_instance (   $instance)

Fetches LTI type configuration for an LTI instance.

Parameters
stdClass$instance
Return values
arrayCan be empty if no type is found

◆ lti_get_type_config_from_instance()

lti_get_type_config_from_instance (   $id)

Generates some of the tool configuration based on the instance details.

Parameters
int$id
Return values
objectconfiguration

◆ lti_get_type_type_config()

lti_get_type_type_config (   $id)

Generates some of the tool configuration based on the admin configuration details.

Parameters
int$id
Return values
stdClassConfiguration details

◆ lti_get_types_for_add_instance()

lti_get_types_for_add_instance ( )

Returns tool types for lti add instance and edit page.

Return values
arrayArray of lti types

◆ lti_get_view_actions()

lti_get_view_actions ( )

Log view actions.

Return values
array

◆ lti_grades()

lti_grades (   $basicltiid)

Must return an array of grades for a given instance of this module, indexed by user.

It also returns a maximum allowed grade.

Example: $return->grades = array of grades; $return->maxgrade = maximum allowed grade;

return $return;

Parameters
int$basicltiidID of an instance of this module
Return values
mixedNull or object with an array of grades and with the maximum grade

@TODO: implement this moodle function (if needed)

◆ lti_initiate_login()

lti_initiate_login (   $courseid,
  $id,
  $instance,
  $config,
  $messagetype = 'basic-lti-launch-request',
  $title = '',
  $text = '' 
)

Generate the form for initiating a login request for an LTI 1.3 message.

Parameters
int$courseidCourse ID
int$idLTI instance ID
stdClass | null$instanceLTI instance
stdClass$configTool type configuration
string$messagetypeLTI message type
string$titleTitle of content item
string$textDescription of content item
Return values
string

◆ lti_install()

lti_install ( )

Execute post-install custom actions for the module This function was added in 1.9.

Return values
booleantrue if success, false on error

◆ lti_is_cartridge()

lti_is_cartridge (   $url)

Determines if the given url is for a IMS basic cartridge.

Parameters
string$urlThe url to be checked
Return values
Trueif the url is for a cartridge
Since
Moodle 3.1

◆ lti_launch_tool()

lti_launch_tool (   $instance)

Launch an external tool activity.

Parameters
stdClass$instancethe external tool activity settings
Return values
stringThe HTML code containing the javascript code for the launch

◆ lti_load_cartridge()

lti_load_cartridge (   $url,
  $map,
  $propertiesmap = array() 
)

Search for a tag within an XML DOMDocument.

Parameters
string$urlThe url of the cartridge to be loaded
array$mapThe map of tags to keys in the return array
array$propertiesmapThe map of properties to keys in the return array
Return values
arrayAn associative array with the given keys and their values from the cartridge
Exceptions
moodle_exceptionif the cartridge could not be loaded correctly
Since
Moodle 3.1

◆ lti_load_tool_from_cartridge()

lti_load_tool_from_cartridge (   $url,
  $lti 
)

Allows you to load in the configuration for an external tool from an IMS cartridge.

Parameters
string$urlThe URL to the cartridge
stdClass$ltiLTI object
Exceptions
moodle_exceptionif the cartridge could not be loaded correctly
Since
Moodle 3.1

◆ lti_load_tool_if_cartridge()

lti_load_tool_if_cartridge (   $lti)

Loads the cartridge information into the new tool, if the launch url is for a cartridge file.

Parameters
stdClass$ltiThe tools config
Since
Moodle 3.1

◆ lti_load_type_from_cartridge()

lti_load_type_from_cartridge (   $url,
  $type 
)

Allows you to load settings for an external tool type from an IMS cartridge.

Parameters
string$urlThe URL to the cartridge
stdClass$typeThe tool type object to be filled in
Exceptions
moodle_exceptionif the cartridge could not be loaded correctly
Since
Moodle 3.1

◆ lti_load_type_if_cartridge()

lti_load_type_if_cartridge (   $type)

Loads the cartridge information into the tool type, if the launch url is for a cartridge file.

Parameters
stdClass$typeThe tool type object to be filled in
Since
Moodle 3.1

◆ lti_log_request()

lti_log_request (   $rawbody)

Logs the request to a file in temp dir.

Parameters
string$rawbody

◆ lti_log_response()

lti_log_response (   $responsexml,
  $e = null 
)

Log an LTI response.

Parameters
string$responsexmlThe response XML
Exception$eIf there was an exception, pass that too

◆ lti_map_keyname()

lti_map_keyname (   $key,
  $tolower = true 
)

Used for building the names of the different custom parameters.

Parameters
string$keyParameter name
bool$tolowerDo we want to convert the key into lower case?
Return values
stringProcessed name

◆ lti_new_access_token()

lti_new_access_token (   $typeid,
  $scopes 
)

Create a new access token.

Parameters
int$typeidTool type ID
string[]$scopesScopes permitted for new token
Return values
stdClassAccess token

◆ lti_parse_custom_parameter()

lti_parse_custom_parameter (   $toolproxy,
  $tool,
  $params,
  $value,
  $islti2 
)

Parse a custom parameter to replace any substitution variables.

Parameters
object$toolproxyTool proxy instance object
object$toolTool instance object
array$paramsLTI launch parameters
string$valueCustom parameter value
boolean$islti2True if an LTI 2 tool is being launched
Return values
stringParsed value of custom parameter

◆ lti_post_launch_html()

lti_post_launch_html (   $newparms,
  $endpoint,
  $debug = false 
)

Posts the launch petition HTML.

Parameters
array$newparmsSigned parameters
string$endpointURL of the external tool
bool$debugDebug (true/false)
Return values
string

◆ lti_print_recent_activity()

lti_print_recent_activity (   $course,
  $isteacher,
  $timestart 
)

Given a course and a time, this module should find recent activity that has occurred in basiclti activities and print it out.

Return true if there was output, or false is there was none.

@uses $CFG

Return values
boolean@TODO: implement this moodle function

◆ lti_register()

lti_register (   $toolproxy)

Prepares an LTI registration request message.

Parameters
object$toolproxyTool Proxy instance object

◆ lti_scale_used()

lti_scale_used ( )
Deprecated:
since Moodle 3.8

◆ lti_scale_used_anywhere()

lti_scale_used_anywhere (   $scaleid)

Checks if scale is being used by any instance of basiclti.

This function was added in 1.9

This is used to find out if scale used anywhere

Parameters
$scaleidint
Return values
booleanTrue if the scale is used by any basiclti

◆ lti_set_session_user()

lti_set_session_user (   $userid)

Set the passed user ID to the session user.

Parameters
int$userid

◆ lti_set_tool_settings()

lti_set_tool_settings (   $settings,
  $toolproxyid,
  $courseid = null,
  $instanceid = null 
)

Sets the tool settings (.

Parameters
array$settingsArray of settings
int$toolproxyidId of tool proxy record (or tool ID if negative)
int$courseidId of course (null if system settings)
int$instanceidId of course module (null if system or context settings)

◆ lti_should_log_request()

lti_should_log_request (   $rawbody)

Determines if we should try to log the request.

Parameters
string$rawbody
Return values
bool

◆ lti_sign_jwt()

lti_sign_jwt (   $parms,
  $endpoint,
  $oauthconsumerkey,
  $typeid = 0,
  $nonce = '' 
)

Converts the message paramters to their equivalent JWT claim and signs the payload to launch the external tool using JWT.

Parameters
array$parmsParameters to be passed for signing
string$endpointurl of the external tool
string$oauthconsumerkey
string$typeidID of LTI tool type
string$nonceNonce value to use
Return values
array|null

◆ lti_sign_parameters()

lti_sign_parameters (   $oldparms,
  $endpoint,
  $method,
  $oauthconsumerkey,
  $oauthconsumersecret 
)

Signs the petition to launch the external tool using OAuth.

Parameters
array$oldparmsParameters to be passed for signing
string$endpointurl of the external tool
string$methodMethod for sending the parameters (e.g. POST)
string$oauthconsumerkey
string$oauthconsumersecret
Return values
array|null

◆ lti_split_custom_parameters()

lti_split_custom_parameters (   $toolproxy,
  $tool,
  $params,
  $customstr,
  $islti2 = false 
)

Splits the custom parameters field to the various parameters.

Parameters
object$toolproxyTool proxy instance object
object$toolTool instance object
array$paramsLTI launch parameters
string$customstrString containing the parameters
boolean$islti2True if an LTI 2 tool is being launched
Return values
arrayof custom parameters

◆ lti_supports()

lti_supports (   $feature)

List of features supported in URL module.

Parameters
string$featureFEATURE_xx constant for requested feature
Return values
mixedTrue if module supports feature, false if not, null if doesn't know

◆ lti_tool_configuration_from_content_item()

lti_tool_configuration_from_content_item (   $typeid,
  $messagetype,
  $ltiversion,
  $consumerkey,
  $contentitemsjson 
)

Processes the tool provider's response to the ContentItemSelectionRequest and builds the configuration data from the selected content item.

This configuration data can be then used when adding a tool into the course.

Parameters
int$typeidThe tool type ID.
string$messagetypeThe value for the lti_message_type parameter.
string$ltiversionThe value for the lti_version parameter.
string$consumerkeyThe consumer key.
string$contentitemsjsonThe JSON string for the content_items parameter.
Return values
stdClassThe array of module information objects.
Exceptions
moodle_exception
lti::OAuthException

◆ lti_uninstall()

lti_uninstall ( )

Execute post-uninstall custom actions for the module This function was added in 1.9.

Return values
booleantrue if success, false on error

◆ lti_update_config()

lti_update_config (   $config)

Updates a tool configuration in the database.

Parameters
object$configTool configuration
Return values
mixedRecord id number

◆ lti_update_grades()

lti_update_grades (   $basiclti,
  $userid = 0,
  $nullifnone = true 
)

Update activity grades.

Parameters
stdClass$basicltiThe LTI instance
int$useridSpecific user only, 0 means all.
bool$nullifnoneNot used

◆ lti_update_instance()

lti_update_instance (   $lti,
  $mform 
)

Given an object containing all the necessary data, (defined by the form in mod.html) this function will update an existing instance with new data.

Parameters
object$instanceAn object from the form in mod.html
Return values
booleanSuccess/Fail

◆ lti_update_tool_proxy()

lti_update_tool_proxy (   $toolproxy)

Updates a tool proxy in the database.

Parameters
object$toolproxyTool proxy
Return values
intRecord id number

◆ lti_user_complete()

lti_user_complete (   $course,
  $user,
  $mod,
  $basiclti 
)

Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports.

Return values
boolean@TODO: implement this moodle function (if needed)

◆ lti_user_outline()

lti_user_outline (   $course,
  $user,
  $mod,
  $basiclti 
)

Return a small object with summary information about what a user has done with a given particular instance of this module Used for user activity reports.

$return->time = the time they did it $return->info = a short text description

Return values
null@TODO: implement this moodle function (if needed)

◆ lti_verify_jwt_signature()

lti_verify_jwt_signature (   $typeid,
  $consumerkey,
  $jwtparam 
)

Verifies the JWT signature of an incoming message.

Parameters
int$typeidThe tool type ID.
string$consumerkeyThe consumer key.
string$jwtparamJWT parameter value
Return values
stdClassTool type
Exceptions
moodle_exception
UnexpectedValueExceptionProvided JWT was invalid
SignatureInvalidExceptionProvided JWT was invalid because the signature verification failed
BeforeValidExceptionProvided JWT is trying to be used before it's eligible as defined by 'nbf'
BeforeValidExceptionProvided JWT is trying to be used before it's been created as defined by 'iat'
ExpiredExceptionProvided JWT has since expired, as defined by the 'exp' claim

◆ lti_verify_oauth_signature()

lti_verify_oauth_signature (   $typeid,
  $consumerkey 
)

Verifies the OAuth signature of an incoming message.

Parameters
int$typeidThe tool type ID.
string$consumerkeyThe consumer key.
Return values
stdClassTool type
Exceptions
moodle_exception
lti::OAuthException

◆ lti_verify_sourcedid()

lti_verify_sourcedid (   $ltiinstance,
  $parsed 
)

Validate source ID from external request.

Parameters
object$ltiinstance
object$parsed
Exceptions
Exception

◆ lti_verify_with_keyset()

lti_verify_with_keyset (   $jwtparam,
  $keyseturl,
  $clientid 
)

Verifies the JWT signature using a JWK keyset.

Parameters
string$jwtparamJWT parameter value.
string$keyseturlThe tool keyseturl.
string$clientidThe tool client id.
Return values
objectThe JWT's payload as a PHP object
Exceptions
moodle_exception
UnexpectedValueExceptionProvided JWT was invalid
SignatureInvalidExceptionProvided JWT was invalid because the signature verification failed
BeforeValidExceptionProvided JWT is trying to be used before it's eligible as defined by 'nbf'
BeforeValidExceptionProvided JWT is trying to be used before it's been created as defined by 'iat'
ExpiredExceptionProvided JWT has since expired, as defined by the 'exp' claim

◆ lti_view()

lti_view (   $lti,
  $course,
  $cm,
  $context 
)

Mark the activity completed (if required) and trigger the course_module_viewed event.

Parameters
stdClass$ltilti object
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Since
Moodle 3.0

◆ mod_lti_core_calendar_provide_event_action()

mod_lti_core_calendar_provide_event_action ( calendar_event  $event,
core_calendar\action_factory  $factory,
int  $userid = 0 
)

This function receives a calendar event and returns the action associated with it, or null if there is none.

This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.

Parameters
calendar_event$event
core_calendar::action_factory$factory
int$useridUser id to use for all capability checks, etc. Set to 0 for current user (default).
Return values
core_calendar::local::event::entities::action_interface|null

◆ mod_lti_get_all_content_items()

mod_lti_get_all_content_items ( \core_course\local\entity\content_item  $defaultmodulecontentitem)

Return all content items which can be added to any course.

Parameters
core_course::local::entity::content_item$defaultmodulecontentitem
Return values
arraythe array of content items.

◆ mod_lti_verify_private_key()

mod_lti_verify_private_key ( )

This function checks if a private key has been generated for this site.

If the key does not exist it generates a new one. If the openssl extension is not installed or configured properly it returns a warning message.

Return values
stringA warning message if a private key does not exist and cannot be generated.

◆ serialise_tool_proxy()

serialise_tool_proxy ( stdClass  $proxy)

Serialises this tool proxy.

Parameters
stdClass$proxyThe tool proxy
Return values
arrayAn array of values representing this type

◆ serialise_tool_type()

serialise_tool_type ( stdClass  $type)

Serialises this tool type.

Parameters
stdClass$typeThe tool type
Return values
arrayAn array of values representing this type

◆ xmldb_lti_upgrade()

xmldb_lti_upgrade (   $oldversion)

xmldb_lti_upgrade is the function that upgrades the lti module database when is needed

This function is automaticly called when version number in version.php changes.

Parameters
int$oldversionNew old version number.
Return values
boolean

Variable Documentation

◆ $definitions

$definitions
Initial value:
= [
'keyset' => [
]
]
const MODE_APPLICATION
Application caches.
Definition: store.php:138

◆ $logs

$logs
Initial value:
= array(
array('module' => 'lti', 'action' => 'view', 'mtable' => 'lti', 'field' => 'name'),
array('module' => 'lti', 'action' => 'launch', 'mtable' => 'lti', 'field' => 'name'),
array('module' => 'lti', 'action' => 'view all', 'mtable' => 'lti', 'field' => 'name')
)

◆ $proxieslink

$proxieslink
Initial value:
= new admin_externalpage('ltitoolproxies',
get_string('manage_tool_proxies', 'lti'),
new moodle_url('/mod/lti/toolproxies.php'))
Links external PHP pages into the admin tree.
Definition: adminlib.php:1193
Class for creating and manipulating urls.
Definition: weblib.php:255

◆ $tasks

$tasks
Initial value:
= array(
array(
'classname' => 'mod_lti\task\clean_access_tokens',
'blocking' => 0,
'minute' => 'R',
'hour' => 'R',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
)
)