Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Paypal enrolment plugin. This plugin allows you to set up paid courses.

Copyright: 2010 Eugene Venter
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 424 lines (16 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: enrol_paypal_plugin  - X-Ref

Paypal enrolment plugin implementation.

get_currencies()   X-Ref
No description

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.

return: array of pix_icon
param: array $instances all enrol instances of this type in one course

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
Returns true if the user can add a new instance in this course.

return: boolean
param: int $courseid

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.

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

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

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

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

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

get_status_options()   X-Ref
Return an array of valid options for the status.

return: array

get_roleid_options($instance, $context)   X-Ref
Return an array of valid options for the roleid.

return: array
param: stdClass $instance
param: context $context

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

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

sync(progress_trace $trace)   X-Ref
Execute synchronisation.

return: int exit code, 0 means ok
param: progress_trace $trace

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

return: bool
param: stdClass $instance

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

return: bool
param: stdClass $instance