Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Main renderer for the course management pages. More...
Public Member Functions | |
__call ($method, $arguments) | |
Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief. | |
accessible_skipto_links ($displaycategorylisting, $displaycourselisting, $displaycoursedetail) | |
Creates access hidden skip to links for the displayed sections. | |
action_icon ($url, pix_icon $pixicon, component_action $action=null, array $attributes=null, $linktext=false) | |
Renders an action_icon. | |
add_action_handler (component_action $action, $id=null) | |
Adds a JS action for the element with the provided id. | |
category_bulk_actions (core_course_category $category=null) | |
Renders bulk actions for categories. | |
category_listing (core_course_category $category=null) | |
Presents a course category listing. | |
category_listing_actions (core_course_category $category=null) | |
Renderers the actions that are possible for the course category listing. | |
category_listitem (core_course_category $category, array $subcategories, $totalsubcategories, $selectedcategory=null, $selectedcategories=array()) | |
Renders a category list item. | |
category_listitem_actions (core_course_category $category, array $actions=null) | |
Renderers the actions for individual category list items. | |
course_bulk_actions (core_course_category $category) | |
Renderers bulk actions that can be performed on courses. | |
course_detail (core_course_list_element $course) | |
Renderers detailed course information. | |
course_detail_actions (core_course_list_element $course) | |
A collection of actions for a course. | |
course_listing (core_course_category $category=null, core_course_list_element $course=null, $page=0, $perpage=20, $viewmode='default') | |
Renders a course listing. | |
course_listing_actions (core_course_category $category, core_course_list_element $course=null, $perpage=20) | |
Renderers actions for the course listing. | |
course_listitem (core_course_category $category, core_course_list_element $course, $selectedcourse) | |
Renderers a course list item. | |
course_listitem_actions (core_course_category $category, core_course_list_element $course) | |
Renderers actions for individual course actions. | |
course_search_bulk_actions () | |
Renderers bulk actions that can be performed on courses in search returns. | |
course_search_form ($value='') | |
Renders html to display a course search form. | |
enhance_management_interface () | |
Initialises the JS required to enhance the management interface. | |
get_compact_logo_url ($maxwidth=300, $maxheight=300) | |
Return the site's compact logo URL, if any. | |
get_logo_url ($maxwidth=null, $maxheight=200) | |
Return the site's logo URL, if any. | |
grid_column_end () | |
Closes a grid column. | |
grid_column_start ($size, $id=null, $class=null) | |
Opens a grid column. | |
grid_end () | |
Closes the grid. | |
grid_start ($id=null, $class=null) | |
Opens a grid. | |
has_started () | |
Returns true is output has already started, and false if not. | |
image_url ($imagename, $component='moodle') | |
Return the moodle_url for an image. | |
management_form_end () | |
Closes the course category bulk management form. | |
management_form_start () | |
Prepares the form element for the course category listing bulk actions. | |
management_heading ($heading, $viewmode=null, $categoryid=null) | |
Displays a heading for the management pages. | |
pix_url ($imagename, $component='moodle') | |
Return the direct URL for an image from the pix folder. | |
render (renderable $widget) | |
Renders the provided widget and returns the HTML to display it. | |
render_action_bar (\core_course\output\manage_categories_action_bar $actionbar) | |
Render the tertiary nav for the manage categories page. | |
render_action_menu ($menu) | |
render_from_template ($templatename, $context) | |
Renders a template by name with the given context. | |
search_listing (array $courses, $totalcourses, core_course_list_element $course=null, $page=0, $perpage=20, $search='') | |
Displays a search result listing. | |
search_listitem (core_course_list_element $course, $selectedcourse) | |
Renderers a search result course list item. | |
search_listitem_actions (core_course_list_element $course) | |
Renderers actions for individual course actions. | |
should_display_main_logo ($headinglevel=1) | |
Whether we should display the main logo. | |
should_display_navbar_logo () | |
Whether we should display the logo in the navbar. | |
view_mode_selector (array $modes, $currentmode, moodle_url $url=null, $param='view') | |
Displays a view mode selector. | |
Static Public Member Functions | |
static | prepare_classes ($classes) |
Given an array or space-separated list of classes, prepares and returns the HTML class attribute value. | |
Protected Member Functions | |
action_button (moodle_url $url, $text, $id=null, $class=null, $title=null, array $attributes=array()) | |
Creates an action button (styled link) | |
detail_pair ($key, $value, $class='') | |
Renderers a key value pair of information for display. | |
get_mustache () | |
Return an instance of the mustache class. | |
listing_pagination (core_course_category $category, $page, $perpage, $showtotals=false, $viewmode='default') | |
Renders pagination for a course listing. | |
search_pagination ($totalcourses, $page, $perpage, $showtotals=false, $search='') | |
Displays pagination for search results. | |
Protected Attributes | |
xhtml_container_stack | $opencontainers |
The xhtml_container_stack to use. | |
renderer_base core_renderer | $output |
A reference to the current renderer. | |
moodle_page | $page |
The Moodle page the renderer has been created to assist with. | |
string | $target |
The requested rendering target. | |
array | $templatecache = [] |
$templatecache The mustache template cache. | |
Main renderer for the course management pages.
|
inherited |
Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief.
string | $method | |
array | $arguments |
mixed |
core_course_management_renderer::accessible_skipto_links | ( | $displaycategorylisting, | |
$displaycourselisting, | |||
$displaycoursedetail ) |
Creates access hidden skip to links for the displayed sections.
bool | $displaycategorylisting | |
bool | $displaycourselisting | |
bool | $displaycoursedetail |
string |
|
protected |
Creates an action button (styled link)
moodle_url | $url | The URL to go to when clicked. |
string | $text | The text for the button. |
string | $id | An id to give the button. |
string | $class | A class to give the button. |
array | $attributes | Any additional attributes |
string |
core_course_management_renderer::action_icon | ( | $url, | |
pix_icon | $pixicon, | ||
component_action | $action = null, | ||
array | $attributes = null, | ||
$linktext = false ) |
Renders an action_icon.
This function uses the 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.
string | moodle_url | $url | A string URL or moodel_url |
pix_icon | $pixicon | |
component_action | $action | |
array | $attributes | associative array of html link attributes + disabled |
bool | $linktext | show title next to image in link |
string | HTML fragment |
|
inherited |
Adds a JS action for the element with the provided id.
This method adds a JS event for the provided component action to the page and then returns the id that the event has been attached to. If no id has been provided then a new ID is generated by html_writer::random_id()
component_action | $action | |
string | $id |
string | id of element, either original submitted or random new if not supplied |
core_course_management_renderer::category_bulk_actions | ( | core_course_category | $category = null | ) |
Renders bulk actions for categories.
core_course_category | $category | The currently selected category if there is one. |
string |
core_course_management_renderer::category_listing | ( | core_course_category | $category = null | ) |
Presents a course category listing.
core_course_category | $category | The currently selected category. Also the category to highlight in the listing. |
string |
core_course_management_renderer::category_listing_actions | ( | core_course_category | $category = null | ) |
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.
core_course_category | $category |
string |
core_course_management_renderer::category_listitem | ( | core_course_category | $category, |
array | $subcategories, | ||
$totalsubcategories, | |||
$selectedcategory = null, | |||
$selectedcategories = array() ) |
Renders a category list item.
This function gets called recursively to render sub categories.
core_course_category | $category | The category to render as listitem. |
core_course_category[] | $subcategories | The subcategories belonging to the category being rented. |
int | $totalsubcategories | The total number of sub categories. |
int | $selectedcategory | The currently selected category |
int[] | $selectedcategories | The path to the selected category and its ID. |
string |
core_course_management_renderer::category_listitem_actions | ( | core_course_category | $category, |
array | $actions = null ) |
Renderers the actions for individual category list items.
core_course_category | $category | |
array | $actions |
string |
core_course_management_renderer::course_bulk_actions | ( | core_course_category | $category | ) |
Renderers bulk actions that can be performed on courses.
core_course_category | $category | The currently selected category and the category in which courses that are selectable belong. |
string |
core_course_management_renderer::course_detail | ( | core_course_list_element | $course | ) |
Renderers detailed course information.
core_course_list_element | $course | The course to display details for. |
string |
core_course_management_renderer::course_detail_actions | ( | core_course_list_element | $course | ) |
A collection of actions for a course.
core_course_list_element | $course | The course to display actions for. |
string |
core_course_management_renderer::course_listing | ( | core_course_category | $category = null, |
core_course_list_element | $course = null, | ||
$page = 0, | |||
$perpage = 20, | |||
$viewmode = 'default' ) |
Renders a course listing.
core_course_category | $category | The currently selected category. This is what the listing is focused on. |
core_course_list_element | $course | The currently selected course. |
int | $page | The page being displayed. |
int | $perpage | The number of courses to display per page. |
string | null | $viewmode | The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'. |
string |
core_course_management_renderer::course_listing_actions | ( | core_course_category | $category, |
core_course_list_element | $course = null, | ||
$perpage = 20 ) |
Renderers actions for the course listing.
Not to be confused with course_listitem_actions which renderers the actions for individual courses.
core_course_category | $category | |
core_course_list_element | $course | The currently selected course. |
int | $perpage |
string |
core_course_management_renderer::course_listitem | ( | core_course_category | $category, |
core_course_list_element | $course, | ||
$selectedcourse ) |
Renderers a course list item.
This function will be called for every course being displayed by course_listing.
core_course_category | $category | The currently selected category and the category the course belongs to. |
core_course_list_element | $course | The course to produce HTML for. |
int | $selectedcourse | The id of the currently selected course. |
string |
core_course_management_renderer::course_listitem_actions | ( | core_course_category | $category, |
core_course_list_element | $course ) |
Renderers actions for individual course actions.
core_course_category | $category | The currently selected category. |
core_course_list_element | $course | The course to renderer actions for. |
string |
core_course_management_renderer::course_search_bulk_actions | ( | ) |
Renderers bulk actions that can be performed on courses in search returns.
string |
core_course_management_renderer::course_search_form | ( | $value = '' | ) |
Renders html to display a course search form.
string | $value | default value to populate the search field |
string |
|
protected |
Renderers a key value pair of information for display.
string | $key | |
string | $value | |
string | $class |
string |
core_course_management_renderer::enhance_management_interface | ( | ) |
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.
|
inherited |
Return the site's compact logo URL, if any.
int | $maxwidth | The maximum width, or null when the maximum width does not matter. |
int | $maxheight | The maximum height, or null when the maximum height does not matter. |
moodle_url|false |
|
inherited |
Return the site's logo URL, if any.
int | $maxwidth | The maximum width, or null when the maximum width does not matter. |
int | $maxheight | The maximum height, or null when the maximum height does not matter. |
moodle_url|false |
|
protectedinherited |
core_course_management_renderer::grid_column_end | ( | ) |
Closes a grid column.
string |
core_course_management_renderer::grid_column_start | ( | $size, | |
$id = null, | |||
$class = null ) |
Opens a grid column.
int | $size | The number of segments this column should span. |
string | $id | An id to give the column. |
string | $class | A class to give the column. |
string |
core_course_management_renderer::grid_end | ( | ) |
Closes the grid.
string |
core_course_management_renderer::grid_start | ( | $id = null, | |
$class = null ) |
Opens a grid.
Call core_course_management_renderer::grid_column_start() to create columns.
string | $id | An id to give this grid. |
string | $class | A class to give this grid. |
string |
|
inherited |
Returns true is output has already started, and false if not.
boolean | true if the header has been printed. |
|
inherited |
Return the moodle_url for an image.
The exact image location and extension is determined automatically by searching for gif|png|jpg|jpeg, please note there can not be diferent images with the different extension. The imagename is for historical reasons a relative path name, it may be changed later for core images. It is recommended to not use subdirectories in plugin and theme pix directories.
There are three types of images: 1/ theme images - stored in theme/mytheme/pix/, use component 'theme' 2/ core images - stored in /pix/, overridden via theme/mytheme/pix_core/ 3/ plugin images - stored in mod/mymodule/pix, overridden via theme/mytheme/pix_plugins/mod/mymodule/, example: image_url('comment', 'mod_glossary')
string | $imagename | the pathname of the image |
string | $component | full plugin name (aka component) or 'theme' |
moodle_url |
|
protected |
Renders pagination for a course listing.
core_course_category | $category | The category to produce pagination for. |
int | $page | The current page. |
int | $perpage | The number of courses to display per page. |
bool | $showtotals | Set to true to show the total number of courses and what is being displayed. |
string | null | $viewmode | The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'. |
string |
core_course_management_renderer::management_form_end | ( | ) |
Closes the course category bulk management form.
string |
core_course_management_renderer::management_form_start | ( | ) |
Prepares the form element for the course category listing bulk actions.
string |
core_course_management_renderer::management_heading | ( | $heading, | |
$viewmode = null, | |||
$categoryid = null ) |
Displays a heading for the management pages.
string | $heading | The heading to display |
string | null | $viewmode | The current view mode if there are options. |
int | null | $categoryid | The currently selected category if there is one. |
string |
|
inherited |
Return the direct URL for an image from the pix folder.
Use this function sparingly and never for icons. For icons use pix_icon or the pix helper in a mustache template.
string | $imagename | the name of the icon. |
string | $component | specification of one plugin like in get_string() |
moodle_url |
|
staticinherited |
Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.
mixed | $classes | Space-separated string or array of classes |
string | HTML class attribute value |
|
inherited |
Renders the provided widget and returns the HTML to display it.
renderable | $widget | instance with renderable interface |
string |
Reimplemented from renderer_base.
Reimplemented in core_courseformat\output\section_renderer, and tool_policy\output\renderer.
core_course_management_renderer::render_action_bar | ( | \core_course\output\manage_categories_action_bar | $actionbar | ) |
Render the tertiary nav for the manage categories page.
core_course\output\manage_categories_action_bar | $actionbar |
string | The renderered template |
|
inherited |
Renders a template by name with the given context.
The provided data needs to be array/stdClass made up of only simple types. Simple types are array,stdClass,bool,int,float,string
array | stdClass | $context | Context containing data for the template. |
string|boolean |
core_course_management_renderer::search_listing | ( | array | $courses, |
$totalcourses, | |||
core_course_list_element | $course = null, | ||
$page = 0, | |||
$perpage = 20, | |||
$search = '' ) |
Displays a search result listing.
array | $courses | The courses to display. |
int | $totalcourses | The total number of courses to display. |
core_course_list_element | $course | The currently selected course if there is one. |
int | $page | The current page, starting at 0. |
int | $perpage | The number of courses to display per page. |
string | $search | The string we are searching for. |
string |
core_course_management_renderer::search_listitem | ( | core_course_list_element | $course, |
$selectedcourse ) |
Renderers a search result course list item.
This function will be called for every course being displayed by course_listing.
core_course_list_element | $course | The course to produce HTML for. |
int | $selectedcourse | The id of the currently selected course. |
string |
core_course_management_renderer::search_listitem_actions | ( | core_course_list_element | $course | ) |
Renderers actions for individual course actions.
core_course_list_element | $course | The course to renderer actions for. |
string |
|
protected |
Displays pagination for search results.
int | $totalcourses | The total number of courses to be displayed. |
int | $page | The current page. |
int | $perpage | The number of courses being displayed. |
bool | $showtotals | Whether or not to print total information. |
string | $search | The string we are searching for. |
string |
|
inherited |
Whether we should display the main logo.
int | $headinglevel | The heading level we want to check against. |
bool |
|
inherited |
Whether we should display the logo in the navbar.
We will when there are no main logos, and we have compact logo.
bool |
core_course_management_renderer::view_mode_selector | ( | array | $modes, |
$currentmode, | |||
moodle_url | $url = null, | ||
$param = 'view' ) |
Displays a view mode selector.
array | $modes | An array of view modes. |
string | $currentmode | The current view mode. |
moodle_url | $url | The URL to use when changing actions. Defaults to the page URL. |
string | $param | The param name. |
string |
|
protectedinherited |
A reference to the current renderer.
The renderer provided here will be determined by the page but will in 90% of cases by the core_renderer