Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
/enrol/lti/ -> lib.php (source)

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

LTI enrolment plugin main library file.

Copyright: 2016 Mark Nelson <markn@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 496 lines (20 kb)
Included or required: 1 time
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class


Class: enrol_lti_plugin  - X-Ref

LTI enrolment plugin class.

can_add_instance($courseid)   X-Ref
Return true if we can add a new instance to this course.

param: int $courseid
return: boolean

can_delete_instance($instance)   X-Ref
Is it possible to delete enrol instance via standard UI?

param: object $instance
return: bool

can_hide_show_instance($instance)   X-Ref
Is it possible to hide/show enrol instance via standard UI?

param: stdClass $instance
return: bool

allow_unenrol(stdClass $instance)   X-Ref
Returns true if it's possible to unenrol users.

param: stdClass $instance course enrol instance
return: bool

use_standard_editing_ui()   X-Ref
We are a good plugin and don't invent our own UI/validation code path.

return: boolean

add_instance($course, array $fields = null)   X-Ref
Add new instance of enrol plugin.

param: object $course
param: array $fields instance fields
return: int id of new instance, null if can not be created

update_instance($instance, $data)   X-Ref
Update instance of enrol plugin.

param: stdClass $instance
param: stdClass $data modified instance fields
return: boolean

delete_instance($instance)   X-Ref
Delete plugin specific information.

param: stdClass $instance
return: void

unenrol_user(stdClass $instance, $userid)   X-Ref
Handles un-enrolling a user.

param: stdClass $instance
param: int $userid
return: void

edit_instance_form($instance, MoodleQuickForm $mform, $context)   X-Ref
Add elements to the edit instance form.

param: stdClass $instance
param: MoodleQuickForm $mform
param: context $context
return: bool

edit_instance_validation($data, $files, $instance, $context)   X-Ref
Perform custom validation of the data used to edit the instance.

param: array $data array of ("fieldname"=>value) of submitted data
param: array $files array of uploaded files "element_name"=>tmp_file_path
param: object $instance The instance loaded from the DB
param: context $context The context of the instance we are editing
return: array of "element_name"=>"error_description" if there are errors,
return: void

restore_instance(restore_enrolments_structure_step $step, stdClass $data, $course, $oldid)   X-Ref
Restore instance and map settings.

param: restore_enrolments_structure_step $step
param: stdClass $data
param: stdClass $course
param: int $oldid

enrol_lti_extend_navigation_course($navigation, $course, $context)   X-Ref
Display the LTI link in the course administration menu.

param: settings_navigation $navigation The settings navigation object
param: stdClass $course The course
param: stdclass $context Course context

enrol_lti_get_fontawesome_icon_map()   X-Ref
Get icon mapping for font-awesome.


enrol_lti_pre_course_module_delete(stdClass $cm)   X-Ref
Pre-delete course module hook which disables any methods referring to the deleted module, preventing launches and allowing remap.

param: stdClass $cm The deleted course module record.