Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 402 and 403]
Self enrolment plugin.
Copyright: | 2010 Petr Skoda {@link http://skodak.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1092 lines (44 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
enrol_self_plugin:: (36 methods):
get_info_icons()
get_instance_name()
roles_protected()
allow_unenrol()
allow_manage()
show_enrolme_link()
can_add_instance()
enrol_self()
enrol_page_hook()
can_self_enrol()
is_self_enrol_available()
get_enrol_info()
add_default_instance()
get_instance_defaults()
email_welcome_message()
sync()
get_enroller()
restore_instance()
restore_user_enrolment()
restore_role_assignment()
can_delete_instance()
can_hide_show_instance()
get_status_options()
get_newenrols_options()
get_groupkey_options()
get_expirynotify_options()
get_longtimenosee_options()
get_bulk_operations()
edit_instance_form()
use_standard_editing_ui()
edit_instance_validation()
add_instance()
update_instance()
extend_assignable_roles()
get_welcome_email_contact()
enrol_self_get_fontawesome_icon_map()
Class: enrol_self_plugin - X-Ref
Self enrolment plugin implementation.get_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. param: array $instances all enrol instances of this type in one course return: array of pix_icon |
get_instance_name($instance) X-Ref |
Returns localised name of enrol instance param: stdClass $instance (null is accepted too) return: string |
roles_protected() X-Ref |
No description |
allow_unenrol(stdClass $instance) X-Ref |
No description |
allow_manage(stdClass $instance) X-Ref |
No description |
show_enrolme_link(stdClass $instance) X-Ref |
No description |
can_add_instance($courseid) X-Ref |
Return true if we can add a new instance to this course. param: int $courseid return: boolean |
enrol_self(stdClass $instance, $data = null) X-Ref |
Self enrol user to course param: stdClass $instance enrolment instance param: stdClass $data data needed for enrolment. return: bool|array true if enroled else eddor code and messege |
enrol_page_hook(stdClass $instance) X-Ref |
Creates course enrol form, checks if form submitted and enrols user if necessary. It can also redirect. param: stdClass $instance return: string html text, usually a form in a text box |
can_self_enrol(stdClass $instance, $checkuserenrolment = true) X-Ref |
Checks if user can self enrol. param: stdClass $instance enrolment instance param: bool $checkuserenrolment if true will check if user enrolment is inactive. return: bool|string true if successful, else error message or false. |
is_self_enrol_available(stdClass $instance) X-Ref |
Does this plugin support some way to self enrol? This function doesn't check user capabilities. Use can_self_enrol to check capabilities. param: stdClass $instance enrolment instance return: bool - true means "Enrol me in this course" link could be available |
get_enrol_info(stdClass $instance) X-Ref |
Return information for enrolment instance containing list of parameters required for enrolment, name of enrolment plugin etc. param: stdClass $instance enrolment instance return: stdClass instance info. |
add_default_instance($course) X-Ref |
Add new instance of enrol plugin with default settings. param: stdClass $course return: int id of new instance |
get_instance_defaults() X-Ref |
Returns defaults for new instances. return: array |
email_welcome_message($instance, $user) X-Ref |
Send welcome email to specified user. param: stdClass $instance param: stdClass $user user record return: void |
sync(progress_trace $trace, $courseid = null) X-Ref |
Sync all meta course links. param: progress_trace $trace param: int $courseid one course, empty mean all return: int 0 means ok, 1 means error, 2 means plugin disabled |
get_enroller($instanceid) X-Ref |
Returns the user who is responsible for self enrolments in given instance. Usually it is the first editing teacher - the person with "highest authority" as defined by sort_by_roleassignment_authority() having 'enrol/self:manage' capability. param: int $instanceid enrolment instance id return: stdClass user record |
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 |
restore_user_enrolment(restore_enrolments_structure_step $step, $data, $instance, $userid, $oldinstancestatus) X-Ref |
Restore user enrolment. param: restore_enrolments_structure_step $step param: stdClass $data param: stdClass $instance param: int $oldinstancestatus param: int $userid |
restore_role_assignment($instance, $roleid, $userid, $contextid) X-Ref |
Restore role assignment. param: stdClass $instance param: int $roleid param: int $userid param: int $contextid |
can_delete_instance($instance) X-Ref |
Is it possible to delete enrol instance via standard UI? param: stdClass $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 |
get_status_options() X-Ref |
Return an array of valid options for the status. return: array |
get_newenrols_options() X-Ref |
Return an array of valid options for the newenrols property. return: array |
get_groupkey_options() X-Ref |
Return an array of valid options for the groupkey property. return: array |
get_expirynotify_options() X-Ref |
Return an array of valid options for the expirynotify property. return: array |
get_longtimenosee_options() X-Ref |
Return an array of valid options for the longtimenosee property. return: array |
get_bulk_operations(course_enrolment_manager $manager) X-Ref |
The self enrollment plugin has several bulk operations that can be performed. param: course_enrolment_manager $manager return: array |
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 |
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. 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 |
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 |
extend_assignable_roles($context, $defaultrole) X-Ref |
Gets a list of roles that this user can assign for the course as the default for self-enrolment. param: context $context the context. param: integer $defaultrole the id of the role that is set as the default for self-enrolment return: array index is the role id, value is the role name |
get_welcome_email_contact($sendoption, $context) X-Ref |
Get the "from" contact which the email will be sent from. param: int $sendoption send email from constant ENROL_SEND_EMAIL_FROM_* param: $context context where the user will be fetched return: mixed|stdClass the contact user object. |
enrol_self_get_fontawesome_icon_map() X-Ref |
Get icon mapping for font-awesome. |