Differences Between: [Versions 400 and 403]
Guest access plugin. This plugin does not add any entries into the user_enrolments table, the access control is granted on the fly via the tricks in require_login().
Copyright: | 2010 Petr Skoda {@link http://skodak.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 492 lines (17 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
enrol_guest_plugin:: (19 methods):
get_info_icons()
enrol_user()
unenrol_user()
try_guestaccess()
can_add_instance()
enrol_page_hook()
course_updated()
add_instance()
add_default_instance()
restore_instance()
can_delete_instance()
can_hide_show_instance()
get_instance_defaults()
get_enrol_info()
get_status_options()
edit_instance_form()
use_standard_editing_ui()
edit_instance_validation()
enrol_guest_get_fontawesome_icon_map()
Class: enrol_guest_plugin - X-Ref
Class enrol_guest_pluginget_info_icons(array $instances) X-Ref |
Returns optional enrolment information icons. This is used in course list for quick overview of enrolment options. We are not using single instance parameter because sometimes we might want to prevent icon repetition when multiple instances of one type exist. One instance may also produce several icons. return: array of pix_icon param: array $instances all enrol instances of this type in one course |
enrol_user(stdClass $instance, $userid, $roleid = null, $timestart = 0, $timeend = 0, $status = null, $recovergrades = null) X-Ref |
Enrol a user using a given enrolment instance. param: stdClass $instance param: int $userid param: null $roleid param: int $timestart param: int $timeend param: null $status param: null $recovergrades |
unenrol_user(stdClass $instance, $userid) X-Ref |
Enrol a user from a given enrolment instance. param: stdClass $instance param: int $userid |
try_guestaccess(stdClass $instance) X-Ref |
Attempt to automatically gain temporary guest access to course, calling code has to make sure the plugin and instance are active. return: bool|int false means no guest access, integer means end of cached time param: stdClass $instance course enrol instance |
can_add_instance($courseid) X-Ref |
Returns true if the current user can add a new instance of enrolment plugin in course. return: boolean param: int $courseid |
enrol_page_hook(stdClass $instance) X-Ref |
Creates course enrol form, checks if form submitted and enrols user if necessary. It can also redirect. return: string html text, usually a form in a text box param: stdClass $instance |
course_updated($inserted, $course, $data) X-Ref |
Called after updating/inserting course. return: void param: bool $inserted true if course just inserted param: object $course param: object $data form data |
add_instance($course, array $fields = NULL) X-Ref |
Add new instance of enrol plugin. return: int id of new instance, null if can not be created param: object $course param: array instance fields |
add_default_instance($course) X-Ref |
Add new instance of enrol plugin with default settings. return: int id of new instance param: object $course |
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 |
can_delete_instance($instance) X-Ref |
Is it possible to delete enrol instance via standard UI? return: bool param: object $instance |
can_hide_show_instance($instance) X-Ref |
Is it possible to hide/show enrol instance via standard UI? return: bool param: stdClass $instance |
get_instance_defaults() X-Ref |
Get default settings for enrol_guest. return: array |
get_enrol_info(stdClass $instance) X-Ref |
Return information for enrolment instance containing list of parameters required for enrolment, name of enrolment plugin etc. return: stdClass instance info. param: stdClass $instance enrolment instance |
get_status_options() X-Ref |
Return an array of valid options for the status. return: array |
edit_instance_form($instance, MoodleQuickForm $mform, $context) X-Ref |
Add elements to the edit instance form. return: bool param: stdClass $instance param: MoodleQuickForm $mform param: context $context |
use_standard_editing_ui() X-Ref |
We are a good plugin and don't invent our own UI/validation code path. return: boolean |
edit_instance_validation($data, $files, $instance, $context) X-Ref |
Perform custom validation of the data used to edit the instance. return: array of "element_name"=>"error_description" if there are errors, return: void 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 |
enrol_guest_get_fontawesome_icon_map() X-Ref |
Get icon mapping for font-awesome. |