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.

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

Contains renderers for the course management pages.

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

Defines 3 classes

core_course_management_renderer:: (2 methods):
  enhance_management_interface()
  management_heading()

manage_categories_action_bar:: (32 methods):
  management_form_start()
  management_form_end()
  category_listing()
  category_listitem()
  category_listing_actions()
  category_listitem_actions()
  render_action_menu()
  category_bulk_actions()
  course_listing()
  listing_pagination()
  course_listitem()
  course_listing_actions()
  course_listitem_actions()
  course_bulk_actions()
  course_search_bulk_actions()
  course_detail()
  detail_pair()
  course_detail_actions()
  action_button()
  grid_start()
  grid_end()
  grid_column_start()
  grid_column_end()
  action_icon()
  view_mode_selector()
  search_listing()
  search_pagination()
  search_listitem()
  search_listitem_actions()
  course_search_form()
  accessible_skipto_links()
  render_action_bar()

manage_categories_action_bar:: (32 methods):
  management_form_start()
  management_form_end()
  category_listing()
  category_listitem()
  category_listing_actions()
  category_listitem_actions()
  render_action_menu()
  category_bulk_actions()
  course_listing()
  listing_pagination()
  course_listitem()
  course_listing_actions()
  course_listitem_actions()
  course_bulk_actions()
  course_search_bulk_actions()
  course_detail()
  detail_pair()
  course_detail_actions()
  action_button()
  grid_start()
  grid_end()
  grid_column_start()
  grid_column_end()
  action_icon()
  view_mode_selector()
  search_listing()
  search_pagination()
  search_listitem()
  search_listitem_actions()
  course_search_form()
  accessible_skipto_links()
  render_action_bar()


Class: core_course_management_renderer  - X-Ref

Main renderer for the course management pages.

enhance_management_interface()   X-Ref
Initialises the JS required to enhance the management interface.

Thunderbirds are go, this function kicks into gear the JS that makes the
course management pages that much cooler.

management_heading($heading, $viewmode = null, $categoryid = null)   X-Ref
Displays a heading for the management pages.

param: string $heading The heading to display
param: string|null $viewmode The current view mode if there are options.
param: int|null $categoryid The currently selected category if there is one.
return: string

Class: manage_categories_action_bar  - X-Ref

management_form_start()   X-Ref
Prepares the form element for the course category listing bulk actions.

return: string

management_form_end()   X-Ref
Closes the course category bulk management form.

return: string

category_listing(core_course_category $category = null)   X-Ref
Presents a course category listing.

param: core_course_category $category The currently selected category. Also the category to highlight in the listing.
return: string

category_listitem(core_course_category $category, array $subcategories, $totalsubcategories,$selectedcategory = null, $selectedcategories = array()   X-Ref
Renders a category list item.

This function gets called recursively to render sub categories.

param: core_course_category $category The category to render as listitem.
param: core_course_category[] $subcategories The subcategories belonging to the category being rented.
param: int $totalsubcategories The total number of sub categories.
param: int $selectedcategory The currently selected category
param: int[] $selectedcategories The path to the selected category and its ID.
return: string

category_listing_actions(core_course_category $category = null)   X-Ref
Renderers the actions that are possible for the course category listing.

These are not the actions associated with an individual category listing.
That happens through category_listitem_actions.

param: core_course_category $category
return: string

category_listitem_actions(core_course_category $category, array $actions = null)   X-Ref
Renderers the actions for individual category list items.

param: core_course_category $category
param: array $actions
return: string

render_action_menu($menu)   X-Ref
No description

category_bulk_actions(core_course_category $category = null)   X-Ref
Renders bulk actions for categories.

param: core_course_category $category The currently selected category if there is one.
return: string

course_listing(core_course_category $category = null, core_course_list_element $course = null,$page = 0, $perpage = 20, $viewmode = 'default')   X-Ref
Renders a course listing.

param: core_course_category $category The currently selected category. This is what the listing is focused on.
param: core_course_list_element $course The currently selected course.
param: int $page The page being displayed.
param: int $perpage The number of courses to display per page.
param: string|null $viewmode The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
return: string

listing_pagination(core_course_category $category, $page, $perpage, $showtotals = false,$viewmode = 'default')   X-Ref
Renders pagination for a course listing.

param: core_course_category $category The category to produce pagination for.
param: int $page The current page.
param: int $perpage The number of courses to display per page.
param: bool $showtotals Set to true to show the total number of courses and what is being displayed.
param: string|null $viewmode The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
return: string

course_listitem(core_course_category $category, core_course_list_element $course, $selectedcourse)   X-Ref
Renderers a course list item.

This function will be called for every course being displayed by course_listing.

param: core_course_category $category The currently selected category and the category the course belongs to.
param: core_course_list_element $course The course to produce HTML for.
param: int $selectedcourse The id of the currently selected course.
return: string

course_listing_actions(core_course_category $category, core_course_list_element $course = null, $perpage = 20)   X-Ref
Renderers actions for the course listing.

Not to be confused with course_listitem_actions which renderers the actions for individual courses.

param: core_course_category $category
param: core_course_list_element $course The currently selected course.
param: int $perpage
return: string

course_listitem_actions(core_course_category $category, core_course_list_element $course)   X-Ref
Renderers actions for individual course actions.

param: core_course_category $category The currently selected category.
param: core_course_list_element  $course The course to renderer actions for.
return: string

course_bulk_actions(core_course_category $category)   X-Ref
Renderers bulk actions that can be performed on courses.

param: core_course_category $category The currently selected category and the category in which courses that
return: string

course_search_bulk_actions()   X-Ref
Renderers bulk actions that can be performed on courses in search returns

return: string

course_detail(core_course_list_element $course)   X-Ref
Renderers detailed course information.

param: core_course_list_element $course The course to display details for.
return: string

detail_pair($key, $value, $class ='')   X-Ref
Renderers a key value pair of information for display.

param: string $key
param: string $value
param: string $class
return: string

course_detail_actions(core_course_list_element $course)   X-Ref
A collection of actions for a course.

param: core_course_list_element $course The course to display actions for.
return: string

action_button(moodle_url $url, $text, $id = null, $class = null, $title = null, array $attributes = array()   X-Ref
Creates an action button (styled link)

param: moodle_url $url The URL to go to when clicked.
param: string $text The text for the button.
param: string $id An id to give the button.
param: string $class A class to give the button.
param: array $attributes Any additional attributes
return: string

grid_start($id = null, $class = null)   X-Ref
Opens a grid.

Call {@link core_course_management_renderer::grid_column_start()} to create columns.

param: string $id An id to give this grid.
param: string $class A class to give this grid.
return: string

grid_end()   X-Ref
Closes the grid.

return: string

grid_column_start($size, $id = null, $class = null)   X-Ref
Opens a grid column

param: int $size The number of segments this column should span.
param: string $id An id to give the column.
param: string $class A class to give the column.
return: string

grid_column_end()   X-Ref
Closes a grid column.

return: string

action_icon($url, pix_icon $pixicon, component_action $action = null,array $attributes = null, $linktext = false)   X-Ref
Renders an action_icon.

This function uses the {@link core_renderer::action_link()} method for the
most part. What it does different is prepare the icon as HTML and use it
as the link text.

param: string|moodle_url $url A string URL or moodel_url
param: pix_icon $pixicon
param: component_action $action
param: array $attributes associative array of html link attributes + disabled
param: bool $linktext show title next to image in link
return: string HTML fragment

view_mode_selector(array $modes, $currentmode, moodle_url $url = null, $param = 'view')   X-Ref
Displays a view mode selector.

param: array $modes An array of view modes.
param: string $currentmode The current view mode.
param: moodle_url $url The URL to use when changing actions. Defaults to the page URL.
param: string $param The param name.
return: string

search_listing(array $courses, $totalcourses, core_course_list_element $course = null, $page = 0, $perpage = 20,$search = '')   X-Ref
Displays a search result listing.

param: array $courses The courses to display.
param: int $totalcourses The total number of courses to display.
param: core_course_list_element $course The currently selected course if there is one.
param: int $page The current page, starting at 0.
param: int $perpage The number of courses to display per page.
param: string $search The string we are searching for.
return: string

search_pagination($totalcourses, $page, $perpage, $showtotals = false, $search = '')   X-Ref
Displays pagination for search results.

param: int $totalcourses The total number of courses to be displayed.
param: int $page The current page.
param: int $perpage The number of courses being displayed.
param: bool $showtotals Whether or not to print total information.
param: string $search The string we are searching for.
return: string

search_listitem(core_course_list_element $course, $selectedcourse)   X-Ref
Renderers a search result course list item.

This function will be called for every course being displayed by course_listing.

param: core_course_list_element $course The course to produce HTML for.
param: int $selectedcourse The id of the currently selected course.
return: string

search_listitem_actions(core_course_list_element $course)   X-Ref
Renderers actions for individual course actions.

param: core_course_list_element  $course The course to renderer actions for.
return: string

course_search_form($value = '')   X-Ref
Renders html to display a course search form

param: string $value default value to populate the search field
return: string

accessible_skipto_links($displaycategorylisting, $displaycourselisting, $displaycoursedetail)   X-Ref
Creates access hidden skip to links for the displayed sections.

param: bool $displaycategorylisting
param: bool $displaycourselisting
param: bool $displaycoursedetail
return: string

render_action_bar(\core_course\output\manage_categories_action_bar $actionbar)   X-Ref
Render the tertiary nav for the manage categories page.

param: \core_course\output\manage_categories_action_bar $actionbar
return: string The renderered template

Class: manage_categories_action_bar  - X-Ref

management_form_start()   X-Ref
Prepares the form element for the course category listing bulk actions.

return: string

management_form_end()   X-Ref
Closes the course category bulk management form.

return: string

category_listing(core_course_category $category = null)   X-Ref
Presents a course category listing.

param: core_course_category $category The currently selected category. Also the category to highlight in the listing.
return: string

category_listitem(core_course_category $category, array $subcategories, $totalsubcategories,$selectedcategory = null, $selectedcategories = array()   X-Ref
Renders a category list item.

This function gets called recursively to render sub categories.

param: core_course_category $category The category to render as listitem.
param: core_course_category[] $subcategories The subcategories belonging to the category being rented.
param: int $totalsubcategories The total number of sub categories.
param: int $selectedcategory The currently selected category
param: int[] $selectedcategories The path to the selected category and its ID.
return: string

category_listing_actions(core_course_category $category = null)   X-Ref
Renderers the actions that are possible for the course category listing.

These are not the actions associated with an individual category listing.
That happens through category_listitem_actions.

param: core_course_category $category
return: string

category_listitem_actions(core_course_category $category, array $actions = null)   X-Ref
Renderers the actions for individual category list items.

param: core_course_category $category
param: array $actions
return: string

render_action_menu($menu)   X-Ref
No description

category_bulk_actions(core_course_category $category = null)   X-Ref
Renders bulk actions for categories.

param: core_course_category $category The currently selected category if there is one.
return: string

course_listing(core_course_category $category = null, core_course_list_element $course = null,$page = 0, $perpage = 20, $viewmode = 'default')   X-Ref
Renders a course listing.

param: core_course_category $category The currently selected category. This is what the listing is focused on.
param: core_course_list_element $course The currently selected course.
param: int $page The page being displayed.
param: int $perpage The number of courses to display per page.
param: string|null $viewmode The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
return: string

listing_pagination(core_course_category $category, $page, $perpage, $showtotals = false,$viewmode = 'default')   X-Ref
Renders pagination for a course listing.

param: core_course_category $category The category to produce pagination for.
param: int $page The current page.
param: int $perpage The number of courses to display per page.
param: bool $showtotals Set to true to show the total number of courses and what is being displayed.
param: string|null $viewmode The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
return: string

course_listitem(core_course_category $category, core_course_list_element $course, $selectedcourse)   X-Ref
Renderers a course list item.

This function will be called for every course being displayed by course_listing.

param: core_course_category $category The currently selected category and the category the course belongs to.
param: core_course_list_element $course The course to produce HTML for.
param: int $selectedcourse The id of the currently selected course.
return: string

course_listing_actions(core_course_category $category, core_course_list_element $course = null, $perpage = 20)   X-Ref
Renderers actions for the course listing.

Not to be confused with course_listitem_actions which renderers the actions for individual courses.

param: core_course_category $category
param: core_course_list_element $course The currently selected course.
param: int $perpage
return: string

course_listitem_actions(core_course_category $category, core_course_list_element $course)   X-Ref
Renderers actions for individual course actions.

param: core_course_category $category The currently selected category.
param: core_course_list_element  $course The course to renderer actions for.
return: string

course_bulk_actions(core_course_category $category)   X-Ref
Renderers bulk actions that can be performed on courses.

param: core_course_category $category The currently selected category and the category in which courses that
return: string

course_search_bulk_actions()   X-Ref
Renderers bulk actions that can be performed on courses in search returns

return: string

course_detail(core_course_list_element $course)   X-Ref
Renderers detailed course information.

param: core_course_list_element $course The course to display details for.
return: string

detail_pair($key, $value, $class ='')   X-Ref
Renderers a key value pair of information for display.

param: string $key
param: string $value
param: string $class
return: string

course_detail_actions(core_course_list_element $course)   X-Ref
A collection of actions for a course.

param: core_course_list_element $course The course to display actions for.
return: string

action_button(moodle_url $url, $text, $id = null, $class = null, $title = null, array $attributes = array()   X-Ref
Creates an action button (styled link)

param: moodle_url $url The URL to go to when clicked.
param: string $text The text for the button.
param: string $id An id to give the button.
param: string $class A class to give the button.
param: array $attributes Any additional attributes
return: string

grid_start($id = null, $class = null)   X-Ref
Opens a grid.

Call {@link core_course_management_renderer::grid_column_start()} to create columns.

param: string $id An id to give this grid.
param: string $class A class to give this grid.
return: string

grid_end()   X-Ref
Closes the grid.

return: string

grid_column_start($size, $id = null, $class = null)   X-Ref
Opens a grid column

param: int $size The number of segments this column should span.
param: string $id An id to give the column.
param: string $class A class to give the column.
return: string

grid_column_end()   X-Ref
Closes a grid column.

return: string

action_icon($url, pix_icon $pixicon, component_action $action = null,array $attributes = null, $linktext = false)   X-Ref
Renders an action_icon.

This function uses the {@link core_renderer::action_link()} method for the
most part. What it does different is prepare the icon as HTML and use it
as the link text.

param: string|moodle_url $url A string URL or moodel_url
param: pix_icon $pixicon
param: component_action $action
param: array $attributes associative array of html link attributes + disabled
param: bool $linktext show title next to image in link
return: string HTML fragment

view_mode_selector(array $modes, $currentmode, moodle_url $url = null, $param = 'view')   X-Ref
Displays a view mode selector.

param: array $modes An array of view modes.
param: string $currentmode The current view mode.
param: moodle_url $url The URL to use when changing actions. Defaults to the page URL.
param: string $param The param name.
return: string

search_listing(array $courses, $totalcourses, core_course_list_element $course = null, $page = 0, $perpage = 20,$search = '')   X-Ref
Displays a search result listing.

param: array $courses The courses to display.
param: int $totalcourses The total number of courses to display.
param: core_course_list_element $course The currently selected course if there is one.
param: int $page The current page, starting at 0.
param: int $perpage The number of courses to display per page.
param: string $search The string we are searching for.
return: string

search_pagination($totalcourses, $page, $perpage, $showtotals = false, $search = '')   X-Ref
Displays pagination for search results.

param: int $totalcourses The total number of courses to be displayed.
param: int $page The current page.
param: int $perpage The number of courses being displayed.
param: bool $showtotals Whether or not to print total information.
param: string $search The string we are searching for.
return: string

search_listitem(core_course_list_element $course, $selectedcourse)   X-Ref
Renderers a search result course list item.

This function will be called for every course being displayed by course_listing.

param: core_course_list_element $course The course to produce HTML for.
param: int $selectedcourse The id of the currently selected course.
return: string

search_listitem_actions(core_course_list_element $course)   X-Ref
Renderers actions for individual course actions.

param: core_course_list_element  $course The course to renderer actions for.
return: string

course_search_form($value = '')   X-Ref
Renders html to display a course search form

param: string $value default value to populate the search field
return: string

accessible_skipto_links($displaycategorylisting, $displaycourselisting, $displaycoursedetail)   X-Ref
Creates access hidden skip to links for the displayed sections.

param: bool $displaycategorylisting
param: bool $displaycourselisting
param: bool $displaycoursedetail
return: string

render_action_bar(\core_course\output\manage_categories_action_bar $actionbar)   X-Ref
Render the tertiary nav for the manage categories page.

param: \core_course\output\manage_categories_action_bar $actionbar
return: string The renderered template