Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/enrol/ -> renderer.php (source)

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

This is the main renderer for the enrol section.

Copyright: 2010 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 711 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 classes

core_enrol_renderer:: (6 methods):
  render_enrol_user_button()
  render_course_enrolment_other_users_table()
  user_roles_and_actions()
  user_groups_and_actions()
  user_enrolments_and_actions()
  render_user_enrolment_action()

course_enrolment_table:: (14 methods):
  __construct()
  get_manual_enrol_buttons()
  get_field_sort_direction()
  set_fields()
  set_total_users()
  set_users()
  initialise_javascript()
  get_paging_bar()
  get_direction_icon()
  get_url_params()
  get_combined_url_params()
  set_bulk_user_enrolment_operations()
  get_bulk_user_enrolment_operations()
  has_bulk_user_enrolment_operations()

course_enrolment_users_table:: (0 methods):

course_enrolment_other_users_table:: (2 methods):
  __construct()
  get_user_search_button()


Class: core_enrol_renderer  - X-Ref

This is the core renderer

render_enrol_user_button(enrol_user_button $button)   X-Ref
Renderers the enrol_user_button.

param: enrol_user_button $button
return: string XHTML

render_course_enrolment_other_users_table(course_enrolment_other_users_table $table)   X-Ref
Renders a course enrolment table

param: course_enrolment_table $table
return: string

user_roles_and_actions($userid, $roles, $assignableroles, $canassign, $pageurl)   X-Ref
Generates HTML to display the users roles and any available actions

param: int $userid
param: array $roles
param: array $assignableroles
param: moodle_url $pageurl
return: string

user_groups_and_actions($userid, $groups, $allgroups, $canmanagegroups, $pageurl)   X-Ref
Generates the HTML to view the users groups and available group actions

param: int $userid
param: array $groups
param: array $allgroups
param: bool $canmanagegroups
param: moodle_url $pageurl
return: string

user_enrolments_and_actions($enrolments)   X-Ref
Generates the HTML for the given enrolments + available actions

param: int $userid
param: array $enrolments
param: moodle_url $pageurl
return: string

render_user_enrolment_action(user_enrolment_action $icon)   X-Ref
Renders a user enrolment action

param: user_enrolment_action $icon
return: string

Class: course_enrolment_table  - X-Ref

Main course enrolment table

This table is used to display the enrolment information for a course.
It requires that a course enrolment manager be provided during constuct with
provides all of the information for the table.
The control then produces the table, the paging, and the associated JS actions
for the page.

__construct(course_enrolment_manager $manager)   X-Ref
Constructs the table

param: course_enrolment_manager $manager

get_manual_enrol_buttons()   X-Ref
Returns an array of enrol_user_buttons that are created by the different
enrolment plugins available.

return: array

get_field_sort_direction($field)   X-Ref
Gets the sort direction for a given field

param: string $field
return: string ASC or DESC

set_fields($fields, $output)   X-Ref
Sets the fields for this table. These get added to the tables head as well.

You can also use a multi dimensional array for this to have multiple fields
in a single column

param: array $fields An array of fields to set
param: string $output

set_total_users($totalusers)   X-Ref
Sets the total number of users

param: int $totalusers

set_users(array $users)   X-Ref
Sets the users for this table

param: array $users
return: void

initialise_javascript()   X-Ref
No description

get_paging_bar()   X-Ref
Gets the paging bar instance for this table

return: paging_bar

get_direction_icon($output, $field)   X-Ref
Gets the direction icon for the sortable field within this table

param: core_renderer $output
param: string $field
return: string

get_url_params()   X-Ref
Gets the params that will need to be added to the url in order to return to this page.

return: array

get_combined_url_params()   X-Ref
Returns an array of URL params for both the table and the manager.

return: array

set_bulk_user_enrolment_operations(array $bulkoperations)   X-Ref
Sets the bulk operations for this table.

param: array $bulkoperations

get_bulk_user_enrolment_operations()   X-Ref
Returns an array of bulk operations.

return: array

has_bulk_user_enrolment_operations()   X-Ref
Returns true fi the table is aware of any bulk operations that can be performed on users
selected from the currently filtered enrolment plugins.

return: bool

Class: course_enrolment_users_table  - X-Ref

Table control used for enrolled users

Class: course_enrolment_other_users_table  - X-Ref

Table used for other users

Other users are users who have roles but are not enrolled.

__construct(course_enrolment_manager $manager)   X-Ref
Constructs the table

param: course_enrolment_manager $manager

get_user_search_button()   X-Ref
Gets a button to search users and assign them roles in the course.

param: int $page
return: single_button