Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core_course_management_renderer Class Reference

Main renderer for the course management pages. More...

Inheritance diagram for core_course_management_renderer:
plugin_renderer_base renderer_base

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. More...
 
 accessible_skipto_links ($displaycategorylisting, $displaycourselisting, $displaycoursedetail)
 Creates access hidden skip to links for the displayed sections. More...
 
 action_icon ($url, pix_icon $pixicon, component_action $action=null, array $attributes=null, $linktext=false)
 Renders an action_icon. More...
 
 add_action_handler (component_action $action, $id=null)
 Adds a JS action for the element with the provided id. More...
 
 category_bulk_actions (core_course_category $category=null)
 Renders bulk actions for categories. More...
 
 category_listing (core_course_category $category=null)
 Presents a course category listing. More...
 
 category_listing_actions (core_course_category $category=null)
 Renderers the actions that are possible for the course category listing. More...
 
 category_listitem (core_course_category $category, array $subcategories, $totalsubcategories, $selectedcategory=null, $selectedcategories=array())
 Renders a category list item. More...
 
 category_listitem_actions (core_course_category $category, array $actions=null)
 Renderers the actions for individual category list items. More...
 
 course_bulk_actions (core_course_category $category)
 Renderers bulk actions that can be performed on courses. More...
 
 course_detail (core_course_list_element $course)
 Renderers detailed course information. More...
 
 course_detail_actions (core_course_list_element $course)
 A collection of actions for a course. More...
 
 course_listing (core_course_category $category=null, core_course_list_element $course=null, $page=0, $perpage=20, $viewmode='default')
 Renders a course listing. More...
 
 course_listing_actions (core_course_category $category, core_course_list_element $course=null, $perpage=20)
 Renderers actions for the course listing. More...
 
 course_listitem (core_course_category $category, core_course_list_element $course, $selectedcourse)
 Renderers a course list item. More...
 
 course_listitem_actions (core_course_category $category, core_course_list_element $course)
 Renderers actions for individual course actions. More...
 
 course_search_bulk_actions ()
 Renderers bulk actions that can be performed on courses in search returns. More...
 
 course_search_form ($value='', $format='plain')
 Renders html to display a course search form. More...
 
 enhance_management_interface ()
 Initialises the JS required to enhance the management interface. More...
 
 get_compact_logo_url ($maxwidth=300, $maxheight=300)
 Return the site's compact logo URL, if any. More...
 
 get_logo_url ($maxwidth=null, $maxheight=200)
 Return the site's logo URL, if any. More...
 
 grid_column_end ()
 Closes a grid column. More...
 
 grid_column_start ($size, $id=null, $class=null)
 Opens a grid column. More...
 
 grid_end ()
 Closes the grid. More...
 
 grid_start ($id=null, $class=null)
 Opens a grid. More...
 
 has_started ()
 Returns true is output has already started, and false if not. More...
 
 image_url ($imagename, $component='moodle')
 Return the moodle_url for an image. More...
 
 management_form_end ()
 Closes the course category bulk management form. More...
 
 management_form_start ()
 Prepares the form element for the course category listing bulk actions. More...
 
 management_heading ($heading, $viewmode=null, $categoryid=null)
 Displays a heading for the management pages. More...
 
 pix_url ($imagename, $component='moodle')
 Return the direct URL for an image from the pix folder. More...
 
 render (renderable $widget)
 Renders the provided widget and returns the HTML to display it. More...
 
 render_action_menu ($menu)
 
 render_from_template ($templatename, $context)
 Renders a template by name with the given context. More...
 
 search_listing (array $courses, $totalcourses, core_course_list_element $course=null, $page=0, $perpage=20, $search='')
 Displays a search result listing. More...
 
 search_listitem (core_course_list_element $course, $selectedcourse)
 Renderers a search result course list item. More...
 
 search_listitem_actions (core_course_list_element $course)
 Renderers actions for individual course actions. More...
 
 should_display_main_logo ($headinglevel=1)
 Whether we should display the main logo. More...
 
 should_display_navbar_logo ()
 Whether we should display the logo in the navbar. More...
 
 view_mode_selector (array $modes, $currentmode, moodle_url $url=null, $param='view')
 Displays a view mode selector. More...
 

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. More...
 

Protected Member Functions

 action_button (moodle_url $url, $text, $id=null, $class=null, $title=null, array $attributes=array())
 Creates an action button (styled link) More...
 
 detail_pair ($key, $value, $class='')
 Renderers a key value pair of information for display. More...
 
 get_mustache ()
 Return an instance of the mustache class. More...
 
 listing_pagination (core_course_category $category, $page, $perpage, $showtotals=false, $viewmode='default')
 Renders pagination for a course listing. More...
 
 search_pagination ($totalcourses, $page, $perpage, $showtotals=false, $search='')
 Displays pagination for search results. More...
 

Protected Attributes

xhtml_container_stack $opencontainers
 The xhtml_container_stack to use.
 
renderer_base core_renderer $output
 A reference to the current renderer. More...
 
moodle_page $page
 The Moodle page the renderer has been created to assist with.
 
string $target
 The requested rendering target.
 

Detailed Description

Main renderer for the course management pages.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ __call()

plugin_renderer_base::__call (   $method,
  $arguments 
)
inherited

Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief.

Parameters
string$method
array$arguments
Return values
mixed

◆ accessible_skipto_links()

core_course_management_renderer::accessible_skipto_links (   $displaycategorylisting,
  $displaycourselisting,
  $displaycoursedetail 
)

Creates access hidden skip to links for the displayed sections.

Parameters
bool$displaycategorylisting
bool$displaycourselisting
bool$displaycoursedetail
Return values
string

◆ action_button()

core_course_management_renderer::action_button ( moodle_url  $url,
  $text,
  $id = null,
  $class = null,
  $title = null,
array  $attributes = array() 
)
protected

Creates an action button (styled link)

Parameters
moodle_url$urlThe URL to go to when clicked.
string$textThe text for the button.
string$idAn id to give the button.
string$classA class to give the button.
array$attributesAny additional attributes
Return values
string

◆ action_icon()

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.

Parameters
string | moodle_url$urlA string URL or moodel_url
pix_icon$pixicon
component_action$action
array$attributesassociative array of html link attributes + disabled
bool$linktextshow title next to image in link
Return values
stringHTML fragment

◆ add_action_handler()

renderer_base::add_action_handler ( component_action  $action,
  $id = null 
)
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()

Parameters
component_action$action
string$id
Return values
stringid of element, either original submitted or random new if not supplied

◆ category_bulk_actions()

core_course_management_renderer::category_bulk_actions ( core_course_category  $category = null)

Renders bulk actions for categories.

Parameters
core_course_category$categoryThe currently selected category if there is one.
Return values
string

◆ category_listing()

core_course_management_renderer::category_listing ( core_course_category  $category = null)

Presents a course category listing.

Parameters
core_course_category$categoryThe currently selected category. Also the category to highlight in the listing.
Return values
string

◆ category_listing_actions()

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.

Parameters
core_course_category$category
Return values
string

◆ category_listitem()

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.

Parameters
core_course_category$categoryThe category to render as listitem.
core_course_category[]$subcategoriesThe subcategories belonging to the category being rented.
int$totalsubcategoriesThe total number of sub categories.
int$selectedcategoryThe currently selected category
int[]$selectedcategoriesThe path to the selected category and its ID.
Return values
string

◆ category_listitem_actions()

core_course_management_renderer::category_listitem_actions ( core_course_category  $category,
array  $actions = null 
)

Renderers the actions for individual category list items.

Parameters
core_course_category$category
array$actions
Return values
string

◆ course_bulk_actions()

core_course_management_renderer::course_bulk_actions ( core_course_category  $category)

Renderers bulk actions that can be performed on courses.

Parameters
core_course_category$categoryThe currently selected category and the category in which courses that are selectable belong.
Return values
string

◆ course_detail()

core_course_management_renderer::course_detail ( core_course_list_element  $course)

Renderers detailed course information.

Parameters
core_course_list_element$courseThe course to display details for.
Return values
string

◆ course_detail_actions()

core_course_management_renderer::course_detail_actions ( core_course_list_element  $course)

A collection of actions for a course.

Parameters
core_course_list_element$courseThe course to display actions for.
Return values
string

◆ course_listing()

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.

Parameters
core_course_category$categoryThe currently selected category. This is what the listing is focused on.
core_course_list_element$courseThe currently selected course.
int$pageThe page being displayed.
int$perpageThe number of courses to display per page.
string | null$viewmodeThe view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
Return values
string

◆ course_listing_actions()

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.

Parameters
core_course_category$category
core_course_list_element$courseThe currently selected course.
int$perpage
Return values
string

◆ course_listitem()

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.

Parameters
core_course_category$categoryThe currently selected category and the category the course belongs to.
core_course_list_element$courseThe course to produce HTML for.
int$selectedcourseThe id of the currently selected course.
Return values
string

◆ course_listitem_actions()

core_course_management_renderer::course_listitem_actions ( core_course_category  $category,
core_course_list_element  $course 
)

Renderers actions for individual course actions.

Parameters
core_course_category$categoryThe currently selected category.
core_course_list_element$courseThe course to renderer actions for.
Return values
string

◆ course_search_bulk_actions()

core_course_management_renderer::course_search_bulk_actions ( )

Renderers bulk actions that can be performed on courses in search returns.

Return values
string

◆ course_search_form()

core_course_management_renderer::course_search_form (   $value = '',
  $format = 'plain' 
)

Renders html to display a course search form.

Parameters
string$valuedefault value to populate the search field
string$formatdisplay format - 'plain' (default), 'short' or 'navbar'
Return values
string

◆ detail_pair()

core_course_management_renderer::detail_pair (   $key,
  $value,
  $class = '' 
)
protected

Renderers a key value pair of information for display.

Parameters
string$key
string$value
string$class
Return values
string

◆ enhance_management_interface()

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.

◆ get_compact_logo_url()

renderer_base::get_compact_logo_url (   $maxwidth = 300,
  $maxheight = 300 
)
inherited

Return the site's compact logo URL, if any.

Parameters
int$maxwidthThe maximum width, or null when the maximum width does not matter.
int$maxheightThe maximum height, or null when the maximum height does not matter.
Return values
moodle_url|false

◆ get_logo_url()

renderer_base::get_logo_url (   $maxwidth = null,
  $maxheight = 200 
)
inherited

Return the site's logo URL, if any.

Parameters
int$maxwidthThe maximum width, or null when the maximum width does not matter.
int$maxheightThe maximum height, or null when the maximum height does not matter.
Return values
moodle_url|false

◆ get_mustache()

renderer_base::get_mustache ( )
protectedinherited

Return an instance of the mustache class.

Since
2.9
Return values
Mustache_Engine

◆ grid_column_end()

core_course_management_renderer::grid_column_end ( )

Closes a grid column.

Return values
string

◆ grid_column_start()

core_course_management_renderer::grid_column_start (   $size,
  $id = null,
  $class = null 
)

Opens a grid column.

Parameters
int$sizeThe number of segments this column should span.
string$idAn id to give the column.
string$classA class to give the column.
Return values
string

◆ grid_end()

core_course_management_renderer::grid_end ( )

Closes the grid.

Return values
string

◆ grid_start()

core_course_management_renderer::grid_start (   $id = null,
  $class = null 
)

Opens a grid.

Call core_course_management_renderer::grid_column_start() to create columns.

Parameters
string$idAn id to give this grid.
string$classA class to give this grid.
Return values
string

◆ has_started()

renderer_base::has_started ( )
inherited

Returns true is output has already started, and false if not.

Return values
booleantrue if the header has been printed.

◆ image_url()

renderer_base::image_url (   $imagename,
  $component = 'moodle' 
)
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')

Parameters
string$imagenamethe pathname of the image
string$componentfull plugin name (aka component) or 'theme'
Return values
moodle_url

◆ listing_pagination()

core_course_management_renderer::listing_pagination ( core_course_category  $category,
  $page,
  $perpage,
  $showtotals = false,
  $viewmode = 'default' 
)
protected

Renders pagination for a course listing.

Parameters
core_course_category$categoryThe category to produce pagination for.
int$pageThe current page.
int$perpageThe number of courses to display per page.
bool$showtotalsSet to true to show the total number of courses and what is being displayed.
string | null$viewmodeThe view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
Return values
string

◆ management_form_end()

core_course_management_renderer::management_form_end ( )

Closes the course category bulk management form.

Return values
string

◆ management_form_start()

core_course_management_renderer::management_form_start ( )

Prepares the form element for the course category listing bulk actions.

Return values
string

◆ management_heading()

core_course_management_renderer::management_heading (   $heading,
  $viewmode = null,
  $categoryid = null 
)

Displays a heading for the management pages.

Parameters
string$headingThe heading to display
string | null$viewmodeThe current view mode if there are options.
int | null$categoryidThe currently selected category if there is one.
Return values
string

◆ pix_url()

renderer_base::pix_url (   $imagename,
  $component = 'moodle' 
)
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.

Deprecated:
since Moodle 3.3
Parameters
string$imagenamethe name of the icon.
string$componentspecification of one plugin like in get_string()
Return values
moodle_url

◆ prepare_classes()

static renderer_base::prepare_classes (   $classes)
staticinherited

Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.

Parameters
mixed$classesSpace-separated string or array of classes
Return values
stringHTML class attribute value

◆ render()

plugin_renderer_base::render ( renderable  $widget)
inherited

Renders the provided widget and returns the HTML to display it.

Parameters
renderable$widgetinstance with renderable interface
Return values
string

Reimplemented from renderer_base.

Reimplemented in tool_policy\output\renderer.

◆ render_from_template()

renderer_base::render_from_template (   $templatename,
  $context 
)
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

Since
2.9
Parameters
array | stdClass$contextContext containing data for the template.
Return values
string|boolean

◆ search_listing()

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.

Parameters
array$coursesThe courses to display.
int$totalcoursesThe total number of courses to display.
core_course_list_element$courseThe currently selected course if there is one.
int$pageThe current page, starting at 0.
int$perpageThe number of courses to display per page.
string$searchThe string we are searching for.
Return values
string

◆ search_listitem()

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.

Parameters
core_course_list_element$courseThe course to produce HTML for.
int$selectedcourseThe id of the currently selected course.
Return values
string

◆ search_listitem_actions()

core_course_management_renderer::search_listitem_actions ( core_course_list_element  $course)

Renderers actions for individual course actions.

Parameters
core_course_list_element$courseThe course to renderer actions for.
Return values
string

◆ search_pagination()

core_course_management_renderer::search_pagination (   $totalcourses,
  $page,
  $perpage,
  $showtotals = false,
  $search = '' 
)
protected

Displays pagination for search results.

Parameters
int$totalcoursesThe total number of courses to be displayed.
int$pageThe current page.
int$perpageThe number of courses being displayed.
bool$showtotalsWhether or not to print total information.
string$searchThe string we are searching for.
Return values
string

◆ should_display_main_logo()

renderer_base::should_display_main_logo (   $headinglevel = 1)
inherited

Whether we should display the main logo.

Parameters
int$headinglevelThe heading level we want to check against.
Return values
bool

◆ should_display_navbar_logo()

renderer_base::should_display_navbar_logo ( )
inherited

Whether we should display the logo in the navbar.

We will when there are no main logos, and we have compact logo.

Return values
bool

◆ view_mode_selector()

core_course_management_renderer::view_mode_selector ( array  $modes,
  $currentmode,
moodle_url  $url = null,
  $param = 'view' 
)

Displays a view mode selector.

Parameters
array$modesAn array of view modes.
string$currentmodeThe current view mode.
moodle_url$urlThe URL to use when changing actions. Defaults to the page URL.
string$paramThe param name.
Return values
string

Member Data Documentation

◆ $output

renderer_base core_renderer plugin_renderer_base::$output
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


The documentation for this class was generated from the following file: