Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
format_social\output\renderer Class Reference

Renderer for outputting the social course format. More...

Inheritance diagram for format_social\output\renderer:

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.
 
 add_action_handler (component_action $action, $id=null)
 Adds a JS action for the element with the provided id.
 
 add_new_course_button ()
 Returns HTML to the "add new course" button for the page.
 
 availability_info ($text, $additionalclasses='')
 Displays availability info for a course section or course module.
 
 bulk_editing_button (course_format $format)
 Render the enable bulk editing button.
 
 course_activitychooser ($courseid)
 Build the HTML for the module chooser javascript popup.
 
 course_category ($category)
 Renders HTML to display particular course category - list of it's subcategories and courses.
 
 course_category_tree (array $ignored)
 Renderers a structured array of courses and categories into a nice XHTML tree structure.
 
 course_index_drawer (course_format $format)
 Get the course index drawer with placeholder.
 
 course_info_box (stdClass $course)
 Renders course info box.
 
 course_modchooser ()
 
 course_search_form ($value='')
 Renders html to display a course search form.
 
 course_section_add_cm_control ($course, $section, $sectionreturn=null, $displayoptions=array())
 Renders HTML for the menus to add activities and resources to the current course.
 
 course_section_cm ($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions=[])
 Renders HTML to display one course module in a course section.
 
 course_section_cm_availability (cm_info $mod, $displayoptions=array())
 Renders HTML to show course module availability information (for someone who isn't allowed to see the activity itself, or for staff)
 
 course_section_cm_completion ()
 
 course_section_cm_edit_actions ($actions, cm_info $mod=null, $displayoptions=array())
 Renders HTML for displaying the sequence of course module editing buttons.
 
 course_section_cm_list ($course, $section, $sectionreturn=null, $displayoptions=[])
 Renders HTML to display a list of course modules in a course section Also displays "move here" controls in Javascript-disabled mode.
 
 course_section_cm_list_item ($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions=[])
 Renders HTML to display one course module for display within a section.
 
 course_section_cm_name (cm_info $mod, $displayoptions=array())
 Renders html to display a name with the link to the course module on a course page.
 
 course_section_cm_name_title (cm_info $mod, $displayoptions=array())
 Renders html to display a name with the link to the course module on a course page.
 
 course_section_cm_text (cm_info $mod, $displayoptions=array())
 Renders html to display the module content on the course page (i.e.
 
 course_section_cm_unavailable_error_message (cm_info $cm)
 Message displayed to the user when they try to access unavailable activity following URL.
 
 course_section_updated (course_format $format, section_info $section)
 Get the updated rendered version of a section.
 
 course_section_updated_cm_item (course_format $format, section_info $section, cm_info $cm, array $displayoptions=[])
 Get the updated rendered version of a cm list item.
 
 coursecat_ajax ()
 Serves requests to /course/category.ajax.php.
 
 courses_list ($courses, $showcategoryname=false, $additionalclasses=null, $paginationurl=null, $totalcount=null, $page=0, $perpage=null)
 Displays a custom list of courses with paging bar if necessary.
 
 frontpage ()
 Outputs contents for frontpage as configured in $CFG->frontpage or $CFG->frontpageloggedin.
 
 frontpage_available_courses ()
 Returns HTML to print list of available courses for the frontpage.
 
 frontpage_categories_list ()
 Returns HTML to print tree of course categories (with number of courses) for the frontpage.
 
 frontpage_combo_list ()
 Returns HTML to print tree with course categories and courses for the frontpage.
 
 frontpage_my_courses ()
 Returns HTML to print list of courses user is enrolled to for the frontpage.
 
 frontpage_section1 ()
 Output frontpage summary text and frontpage modules (stored as section 1 in site course)
 
 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.
 
 has_started ()
 Returns true is output has already started, and false if not.
 
 hubinfo ($hubinfo)
 Hub information (logo - name - description - link)
 
 image_url ($imagename, $component='moodle')
 Return the moodle_url for an image.
 
 is_cm_conditionally_hidden (cm_info $mod)
 Checks if course module has any conditions that may make it unavailable for all or some of the students.
 
 pix_url ($imagename, $component='moodle')
 Return the direct URL for an image from the pix folder.
 
 print_multiple_section_page ($course, $sections, $mods, $modnames, $modnamesused)
 Output the html for a multiple section page.
 
 print_single_section_page ($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
 Output the html for a single section page.
 
 render (renderable $widget)
 Renders the provided widget and returns the HTML to display it.
 
 render_activity_information (\core_course\output\activity_information $page)
 Renders the activity information.
 
 render_activity_navigation (\core_course\output\activity_navigation $page)
 Renders the activity navigation.
 
 render_from_template ($templatename, $context)
 Renders a template by name with the given context.
 
 render_modchooser (renderable $modchooser)
 Render a modchooser.
 
 search_courses ($searchcriteria)
 Renders html to display search result page.
 
 section_availability ($section)
 Displays availability information for the section (hidden, not available unles, etc.)
 
 section_title ($section, $course)
 Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page.
 
 section_title_without_link ($section, $course)
 Generate the section title to be displayed on the section page, without a link.
 
 sendingbackupinfo ($backupfile)
 Display waiting information about backup size during uploading backup process.
 
 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.
 
 tagged_courses ($tagid, $exclusivemode=true, $ctx=0, $rec=true, $displayoptions=null)
 Renders html to print list of courses tagged with particular tag.
 

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.
 

Public Attributes

const COURSECAT_SHOW_COURSES_AUTO = 15
 
const COURSECAT_SHOW_COURSES_COLLAPSED = 10
 
const COURSECAT_SHOW_COURSES_COUNT = 5
 
const COURSECAT_SHOW_COURSES_EXPANDED = 20
 
const COURSECAT_SHOW_COURSES_EXPANDED_WITH_CAT = 30
 
const COURSECAT_SHOW_COURSES_NONE = 0
 
const COURSECAT_TYPE_CATEGORY = 0
 
const COURSECAT_TYPE_COURSE = 1
 

Protected Member Functions

 add_modchoosertoggle ()
 
 change_number_sections ($course, $sectionreturn=null)
 Returns controls in the bottom of the page to increase/decrease number of sections.
 
 course_activity_clipboard ($course, $sectionno=null)
 Show if something is on on the course clipboard (moving around)
 
 course_category_name (coursecat_helper $chelper, core_course_list_element $course)
 Returns HTML to display course category name.
 
 course_category_tree_category (stdClass $category, $depth=1)
 Renderers a category for use with course_category_tree.
 
 course_contacts (core_course_list_element $course)
 Returns HTML to display course contacts.
 
 course_custom_fields (core_course_list_element $course)
 Returns HTML to display course custom fields.
 
 course_enrolment_icons (core_course_list_element $course)
 Returns HTML to display course enrolment icons.
 
 course_modchooser_module ($module, $classes=array('option'))
 Return the HTML for the specified module adding any required classes.
 
 course_modchooser_module_types ($modules)
 Build the HTML for a specified set of modules.
 
 course_modchooser_title ($title, $identifier=null)
 
 course_name (coursecat_helper $chelper, core_course_list_element $course)
 Returns HTML to display course name.
 
 course_overview_files (core_course_list_element $course)
 Returns HTML to display course overview files.
 
 course_section_cm_classes (cm_info $mod)
 Returns the CSS classes for the activity name/content.
 
 course_summary (coursecat_helper $chelper, core_course_list_element $course)
 Returns HTML to display course summary.
 
 coursecat_category (coursecat_helper $chelper, $coursecat, $depth)
 Returns HTML to display a course category as a part of a tree.
 
 coursecat_category_content (coursecat_helper $chelper, $coursecat, $depth)
 Returns HTML to display the subcategories and courses in the given category.
 
 coursecat_coursebox (coursecat_helper $chelper, $course, $additionalclasses='')
 Displays one course in the list of courses.
 
 coursecat_coursebox_content (coursecat_helper $chelper, $course)
 Returns HTML to display course content (summary, course contacts and optionally category name)
 
 coursecat_courses (coursecat_helper $chelper, $courses, $totalcount=null)
 Renders the list of courses.
 
 coursecat_include_js ()
 Make sure that javascript file for AJAX expanding of courses and categories content is included.
 
 coursecat_subcategories (coursecat_helper $chelper, $coursecat, $depth)
 Renders the list of subcategories in a category.
 
 coursecat_tree (coursecat_helper $chelper, $coursecat)
 Returns HTML to display a tree of subcategories and courses in the given category.
 
 end_section_list ()
 Generate the closing container html for a list of sections.
 
 format_summary_text ($section)
 Generate html for a section summary text.
 
 frontpage_news ($forum)
 Output news for the frontpage (extract from site-wide news forum)
 
 frontpage_part ($skipdivid, $contentsdivid, $header, $contents)
 Renders part of frontpage with a skip link (i.e.
 
 frontpage_remote_course (stdClass $course)
 Returns HTML to display one remote course.
 
 frontpage_remote_host ($host)
 Returns HTML to display one remote host.
 
 get_mustache ()
 Return an instance of the mustache class.
 
 get_nav_links ($course, $sections, $sectionno)
 Generate next/previous section links for naviation.
 
 section_activity_summary ($section, $course, $mods)
 Generate a summary of the activites in a section.
 
 section_availability_message ($section, $canviewhidden)
 If section is not visible, display the message about that ('Not available until...', that sort of thing).
 
 section_edit_control_items ($course, $section, $onsectionpage=false)
 Generate the edit control items of a section.
 
 section_edit_control_menu ($controls, $course, $section)
 Generate the edit control action menu.
 
 section_edit_controls ()
 Old method to print section edit controls.
 
 section_footer ()
 Generate the display of the footer part of a section.
 
 section_header ($section, $course, $onsectionpage, $sectionreturn=null)
 Generate the display of the header part of a section before course modules are included.
 
 section_hidden ($sectionno, $courseorid=null)
 Generate the html for a hidden section.
 
 section_left_content ($section, $course, $onsectionpage)
 Generate the content to displayed on the left part of a section before course modules are included.
 
 section_nav_selection ($course, $sections, $displaysection)
 Generate the html for the 'Jump to' menu on a single section page.
 
 section_right_content ($section, $course, $onsectionpage)
 Generate the content to displayed on the right part of a section before course modules are included.
 
 section_summary ($section, $course, $mods)
 Generate a summary of a section for display on the 'course index page'.
 
 start_section_list ()
 Generate the starting container html for a list of sections.
 
 stealth_section_footer ()
 Generate footer html of a stealth section.
 
 stealth_section_header ($sectionno)
 Generate the header html of a stealth section.
 

Protected Attributes

bool $categoryexpandedonload = false
 Whether a category content is being initially rendered with children.
 
core_course_renderer $courserenderer
 contains an instance of core course renderer
 
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.
 
stdClass $strings
 A cache of strings.
 
string $target
 The requested rendering target.
 
array $templatecache = []
 $templatecache The mustache template cache.
 

Detailed Description

Renderer for outputting the social course format.

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

◆ 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

◆ add_modchoosertoggle()

core_course_renderer::add_modchoosertoggle ( )
protectedinherited
Deprecated
since 3.2

◆ add_new_course_button()

core_course_renderer::add_new_course_button ( )
inherited

Returns HTML to the "add new course" button for the page.

Return values
string

◆ availability_info()

core_course_renderer::availability_info ( $text,
$additionalclasses = '' )
inherited

Displays availability info for a course section or course module.

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.
Parameters
string$text
string$additionalclasses
Return values
string

◆ bulk_editing_button()

core_courseformat\output\section_renderer::bulk_editing_button ( course_format $format)
inherited

Render the enable bulk editing button.

Parameters
course_format$formatthe course format
Return values
string|nullthe enable bulk button HTML (or null if no bulk available).

◆ change_number_sections()

core_courseformat\output\section_renderer::change_number_sections ( $course,
$sectionreturn = null )
protectedinherited

Returns controls in the bottom of the page to increase/decrease number of sections.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.
Parameters
stdClass$course
int | null$sectionreturn

◆ course_activity_clipboard()

core_courseformat\output\section_renderer::course_activity_clipboard ( $course,
$sectionno = null )
protectedinherited

Show if something is on on the course clipboard (moving around)

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

While the non ajax course eidtion is still supported, the old clipboard will be emulated by core_courseformat\output\local\content\section\cmlist.

Parameters
stdClass$courseThe course entry from DB
int$sectionnoThe section number in the course which is being displayed
Return values
stringHTML to output.

◆ course_activitychooser()

core_course_renderer::course_activitychooser ( $courseid)
inherited

Build the HTML for the module chooser javascript popup.

Parameters
int$courseidThe course id to fetch modules for.
Return values
string

◆ course_category()

core_course_renderer::course_category ( $category)
inherited

Renders HTML to display particular course category - list of it's subcategories and courses.

Invoked from /course/index.php

Parameters
int | stdClass | core_course_category$category

◆ course_category_name()

core_course_renderer::course_category_name ( coursecat_helper $chelper,
core_course_list_element $course )
protectedinherited

Returns HTML to display course category name.

Parameters
coursecat_helper$chelper
core_course_list_element$course
Return values
string

◆ course_category_tree()

core_course_renderer::course_category_tree ( array $ignored)
finalinherited

Renderers a structured array of courses and categories into a nice XHTML tree structure.

Deprecated
since 2.5
Parameters
array$ignoredargument ignored
Return values
string

◆ course_category_tree_category()

core_course_renderer::course_category_tree_category ( stdClass $category,
$depth = 1 )
finalprotectedinherited

Renderers a category for use with course_category_tree.

Deprecated
since 2.5
Parameters
array$category
int$depth
Return values
string

◆ course_contacts()

core_course_renderer::course_contacts ( core_course_list_element $course)
protectedinherited

Returns HTML to display course contacts.

Parameters
core_course_list_element$course
Return values
string

◆ course_custom_fields()

core_course_renderer::course_custom_fields ( core_course_list_element $course)
protectedinherited

Returns HTML to display course custom fields.

Parameters
core_course_list_element$course
Return values
string

◆ course_enrolment_icons()

core_course_renderer::course_enrolment_icons ( core_course_list_element $course)
protectedinherited

Returns HTML to display course enrolment icons.

Parameters
core_course_list_element$course
Return values
string

◆ course_index_drawer()

core_courseformat\output\section_renderer::course_index_drawer ( course_format $format)
inherited

Get the course index drawer with placeholder.

The default course index is loaded after the page is ready. Format plugins can override this method to provide an alternative course index.

If the format is not compatible with the course index, this method will return an empty string.

Parameters
course_format$formatthe course format
Return values
Stringthe course index HTML.

◆ course_info_box()

core_course_renderer::course_info_box ( stdClass $course)
inherited

Renders course info box.

Parameters
stdClass$course
Return values
string

◆ course_modchooser()

core_course_renderer::course_modchooser ( )
inherited
Deprecated
since 3.9

◆ course_modchooser_module()

core_course_renderer::course_modchooser_module ( $module,
$classes = array('option') )
protectedinherited

Return the HTML for the specified module adding any required classes.

Parameters
object$moduleAn object containing the title, and link. An icon, and help text may optionally be specified. If the module contains subtypes in the types option, then these will also be displayed.
array$classesAdditional classes to add to the encompassing div element
Return values
stringThe composed HTML for the module

◆ course_modchooser_module_types()

core_course_renderer::course_modchooser_module_types ( $modules)
protectedinherited

Build the HTML for a specified set of modules.

Parameters
array$modulesA set of modules as used by the course_modchooser_module function
Return values
stringThe composed HTML for the module

◆ course_name()

core_course_renderer::course_name ( coursecat_helper $chelper,
core_course_list_element $course )
protectedinherited

Returns HTML to display course name.

Parameters
coursecat_helper$chelper
core_course_list_element$course
Return values
string

◆ course_overview_files()

core_course_renderer::course_overview_files ( core_course_list_element $course)
protectedinherited

Returns HTML to display course overview files.

Parameters
core_course_list_element$course
Return values
string

◆ course_search_form()

core_course_renderer::course_search_form ( $value = '')
inherited

Renders html to display a course search form.

Parameters
string$valuedefault value to populate the search field
Return values
string

◆ course_section_add_cm_control()

core_course_renderer::course_section_add_cm_control ( $course,
$section,
$sectionreturn = null,
$displayoptions = array() )
inherited

Renders HTML for the menus to add activities and resources to the current course.

Renders the ajax control (the link which when clicked produces the activity chooser modal). No noscript fallback.

Parameters
stdClass$course
int$sectionrelative section number (field course_sections.section)
int$sectionreturnThe section to link back to
array$displayoptionsadditional display options, for example blocks add option 'inblock' => true, suggesting to display controls vertically
Return values
string

◆ course_section_cm()

core_course_renderer::course_section_cm ( $course,
& $completioninfo,
cm_info $mod,
$sectionreturn,
$displayoptions = [] )
inherited

Renders HTML to display one course module in a course section.

This includes link, content, availability, completion info and additional information that module type wants to display (i.e. number of unread forum posts)

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.
Parameters
stdClass$course
completion_info$completioninfo
cm_info$mod
int | null$sectionreturn
array$displayoptions
Return values
string

◆ course_section_cm_availability()

core_course_renderer::course_section_cm_availability ( cm_info $mod,
$displayoptions = array() )
inherited

Renders HTML to show course module availability information (for someone who isn't allowed to see the activity itself, or for staff)

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.
Parameters
cm_info$mod
array$displayoptions
Return values
string

◆ course_section_cm_classes()

core_course_renderer::course_section_cm_classes ( cm_info $mod)
protectedinherited

Returns the CSS classes for the activity name/content.

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.

For items which are hidden, unavailable or stealth but should be displayed to current user ($mod->is_visible_on_course_page()), we show those as dimmed. Students will also see as dimmed activities names that are not yet available but should still be displayed (without link) with availability info.

Parameters
cm_info$mod
Return values
arrayarray of two elements ($linkclasses, $textclasses)

◆ course_section_cm_completion()

core_course_renderer::course_section_cm_completion ( )
inherited
Deprecated
since Moodle 3.11

◆ course_section_cm_edit_actions()

core_course_renderer::course_section_cm_edit_actions ( $actions,
cm_info $mod = null,
$displayoptions = array() )
inherited

Renders HTML for displaying the sequence of course module editing buttons.

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.
See also
course_get_cm_edit_actions()
Parameters
action_link[]$actionsArray of action_link objects
cm_info$modThe module we are displaying actions for.
array$displayoptionsadditional display options: ownerselector => A JS/CSS selector that can be used to find an cm node. If specified the owning node will be given the class 'action-menu-shown' when the action menu is being displayed. donotenhance => If set to true the action menu that gets displayed won't be enhanced by JS.
Return values
string

◆ course_section_cm_list()

core_course_renderer::course_section_cm_list ( $course,
$section,
$sectionreturn = null,
$displayoptions = [] )
inherited

Renders HTML to display a list of course modules in a course section Also displays "move here" controls in Javascript-disabled mode.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This function calls core_course_renderer::course_section_cm()

Parameters
stdClass$coursecourse object
int | stdClass | section_info$sectionrelative section number or section object
int$sectionreturnsection number to return to
int$displayoptions
Return values
void

◆ course_section_cm_list_item()

core_course_renderer::course_section_cm_list_item ( $course,
& $completioninfo,
cm_info $mod,
$sectionreturn,
$displayoptions = [] )
inherited

Renders HTML to display one course module for display within a section.

Deprecated
since 4.0 - use core_course output components or course_format\course_section_updated_cm_item instead.

This function calls: core_course_renderer::course_section_cm()

Parameters
stdClass$course
completion_info$completioninfo
cm_info$mod
int | null$sectionreturn
array$displayoptions
Return values
String

◆ course_section_cm_name()

core_course_renderer::course_section_cm_name ( cm_info $mod,
$displayoptions = array() )
inherited

Renders html to display a name with the link to the course module on a course page.

If module is unavailable for user but still needs to be displayed in the list, just the name is returned without a link

Note, that for course modules that never have separate pages (i.e. labels) this function return an empty string

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.
Parameters
cm_info$mod
array$displayoptions
Return values
string

◆ course_section_cm_name_title()

core_course_renderer::course_section_cm_name_title ( cm_info $mod,
$displayoptions = array() )
inherited

Renders html to display a name with the link to the course module on a course page.

If module is unavailable for user but still needs to be displayed in the list, just the name is returned without a link

Note, that for course modules that never have separate pages (i.e. labels) this function return an empty string

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.
Parameters
cm_info$mod
array$displayoptions
Return values
string

◆ course_section_cm_text()

core_course_renderer::course_section_cm_text ( cm_info $mod,
$displayoptions = array() )
inherited

Renders html to display the module content on the course page (i.e.

text of the labels)

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.
Parameters
cm_info$mod
array$displayoptions
Return values
string

◆ course_section_cm_unavailable_error_message()

core_course_renderer::course_section_cm_unavailable_error_message ( cm_info $cm)
inherited

Message displayed to the user when they try to access unavailable activity following URL.

This method is a very simplified version of course_section_cm() to be part of the error notification only. It also does not check if module is visible on course page or not.

The message will be displayed inside notification!

Parameters
cm_info$cm
Return values
string

◆ course_section_updated()

core_courseformat\output\section_renderer::course_section_updated ( course_format $format,
section_info $section )
inherited

Get the updated rendered version of a section.

This method will only be used when the course editor requires to get an updated cm item HTML to perform partial page refresh. It will be used for supporting the course editor webservices.

By default, the template used for update a section is the same as when it renders initially, but format plugins are free to override this method to provide extra effects or so.

Parameters
course_format$formatthe course format
section_info$sectionthe section info
Return values
stringthe rendered element

◆ course_section_updated_cm_item()

core_courseformat\output\section_renderer::course_section_updated_cm_item ( course_format $format,
section_info $section,
cm_info $cm,
array $displayoptions = [] )
inherited

Get the updated rendered version of a cm list item.

This method is used when an activity is duplicated or copied in on the client side without refreshing the page. It replaces the course renderer course_section_cm_list_item method but it's scope is different. Note that the previous method is used every time an activity is rendered, independent of it is the initial page loading or an Ajax update. In this case, course_section_updated_cm_item will only be used when the course editor requires to get an updated cm item HTML to perform partial page refresh. It will be used for suporting the course editor webservices.

By default, the template used for update a cm_item is the same as when it renders initially, but format plugins are free to override this methos to provide extra affects or so.

Parameters
course_format$formatthe course format
section_info$sectionthe section info
cm_info$cmthe course module ionfo
array$displayoptionsoptional extra display options
Return values
stringthe rendered element

◆ course_summary()

core_course_renderer::course_summary ( coursecat_helper $chelper,
core_course_list_element $course )
protectedinherited

Returns HTML to display course summary.

Parameters
coursecat_helper$chelper
core_course_list_element$course
Return values
string

◆ coursecat_ajax()

core_course_renderer::coursecat_ajax ( )
inherited

Serves requests to /course/category.ajax.php.

In this renderer implementation it may expand the category content or course content.

Return values
string
Exceptions
coding_exception

◆ coursecat_category()

core_course_renderer::coursecat_category ( coursecat_helper $chelper,
$coursecat,
$depth )
protectedinherited

Returns HTML to display a course category as a part of a tree.

This is an internal function, to display a particular category and all its contents use core_course_renderer::course_category()

Parameters
coursecat_helper$chelpervarious display options
core_course_category$coursecat
int$depthdepth of this category in the current tree
Return values
string

◆ coursecat_category_content()

core_course_renderer::coursecat_category_content ( coursecat_helper $chelper,
$coursecat,
$depth )
protectedinherited

Returns HTML to display the subcategories and courses in the given category.

This method is re-used by AJAX to expand content of not loaded category

Parameters
coursecat_helper$chelpervarious display options
core_course_category$coursecat
int$depthdepth of the category in the current tree
Return values
string

◆ coursecat_coursebox()

core_course_renderer::coursecat_coursebox ( coursecat_helper $chelper,
$course,
$additionalclasses = '' )
protectedinherited

Displays one course in the list of courses.

This is an internal function, to display an information about just one course please use core_course_renderer::course_info_box()

Parameters
coursecat_helper$chelpervarious display options
core_course_list_element | stdClass$course
string$additionalclassesadditional classes to add to the main
tag (usually depend on the course position in list - first/last/even/odd)
Return values
string

◆ coursecat_coursebox_content()

core_course_renderer::coursecat_coursebox_content ( coursecat_helper $chelper,
$course )
protectedinherited

Returns HTML to display course content (summary, course contacts and optionally category name)

This method is called from coursecat_coursebox() and may be re-used in AJAX

Parameters
coursecat_helper$chelpervarious display options
stdClass | core_course_list_element$course
Return values
string

◆ coursecat_courses()

core_course_renderer::coursecat_courses ( coursecat_helper $chelper,
$courses,
$totalcount = null )
protectedinherited

Renders the list of courses.

This is internal function, please use core_course_renderer::courses_list() or another public method from outside of the class

If list of courses is specified in $courses; the argument $chelper is only used to retrieve display options and attributes, only methods get_show_courses(), get_courses_display_option() and get_and_erase_attributes() are called.

Parameters
coursecat_helper$chelpervarious display options
array$coursesthe list of courses to display
int | null$totalcounttotal number of courses (affects display mode if it is AUTO or pagination if applicable), defaulted to count($courses)
Return values
string

◆ coursecat_subcategories()

core_course_renderer::coursecat_subcategories ( coursecat_helper $chelper,
$coursecat,
$depth )
protectedinherited

Renders the list of subcategories in a category.

Parameters
coursecat_helper$chelpervarious display options
core_course_category$coursecat
int$depthdepth of the category in the current tree
Return values
string

◆ coursecat_tree()

core_course_renderer::coursecat_tree ( coursecat_helper $chelper,
$coursecat )
protectedinherited

Returns HTML to display a tree of subcategories and courses in the given category.

Parameters
coursecat_helper$chelpervarious display options
core_course_category$coursecattop category (this category's name and description will NOT be added to the tree)
Return values
string

◆ courses_list()

core_course_renderer::courses_list ( $courses,
$showcategoryname = false,
$additionalclasses = null,
$paginationurl = null,
$totalcount = null,
$page = 0,
$perpage = null )
inherited

Displays a custom list of courses with paging bar if necessary.

If $paginationurl is specified but $totalcount is not, the link 'View more' appears under the list.

If both $paginationurl and $totalcount are specified, and $totalcount is bigger than count($courses), a paging bar is displayed above and under the courses list.

Parameters
array$coursesarray of course records (or instances of core_course_list_element) to show on this page
bool$showcategorynamewhether to add category name to the course description
string$additionalclassesadditional CSS classes to add to the div.courses
moodle_url$paginationurlurl to view more or url to form links to the other pages in paging bar
int$totalcounttotal number of courses on all pages, if omitted $paginationurl will be displayed as 'View more' link
int$pagecurrent page number (defaults to 0 referring to the first page)
int$perpagenumber of records per page (defaults to $CFG->coursesperpage)
Return values
string

◆ end_section_list()

core_courseformat\output\section_renderer::end_section_list ( )
protectedinherited

Generate the closing container html for a list of sections.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.y
Return values
stringHTML to output.

◆ format_summary_text()

core_courseformat\output\section_renderer::format_summary_text ( $section)
protectedinherited

Generate html for a section summary text.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.
Parameters
stdClass$sectionThe course_section entry from DB
Return values
stringHTML to output.

◆ frontpage()

core_course_renderer::frontpage ( )
inherited

Outputs contents for frontpage as configured in $CFG->frontpage or $CFG->frontpageloggedin.

Return values
string

◆ frontpage_available_courses()

core_course_renderer::frontpage_available_courses ( )
inherited

Returns HTML to print list of available courses for the frontpage.

Return values
string

◆ frontpage_categories_list()

core_course_renderer::frontpage_categories_list ( )
inherited

Returns HTML to print tree of course categories (with number of courses) for the frontpage.

Return values
string

◆ frontpage_combo_list()

core_course_renderer::frontpage_combo_list ( )
inherited

Returns HTML to print tree with course categories and courses for the frontpage.

Return values
string

◆ frontpage_my_courses()

core_course_renderer::frontpage_my_courses ( )
inherited

Returns HTML to print list of courses user is enrolled to for the frontpage.

Also lists remote courses or remote hosts if MNET authorisation is used

Return values
string

◆ frontpage_news()

core_course_renderer::frontpage_news ( $forum)
protectedinherited

Output news for the frontpage (extract from site-wide news forum)

Parameters
stdClass$forumrecord from db table 'forum' that represents the site news forum
Return values
string

◆ frontpage_part()

core_course_renderer::frontpage_part ( $skipdivid,
$contentsdivid,
$header,
$contents )
protectedinherited

Renders part of frontpage with a skip link (i.e.

"My courses", "Site news", etc.)

Parameters
string$skipdivid
string$contentsdivid
string$headerHeader of the part
string$contentsContents of the part
Return values
string

◆ frontpage_remote_course()

core_course_renderer::frontpage_remote_course ( stdClass $course)
protectedinherited

Returns HTML to display one remote course.

Parameters
stdClass$courseremote course information, contains properties: id, remoteid, shortname, fullname, hostid, summary, summaryformat, cat_name, hostname
Return values
string

◆ frontpage_remote_host()

core_course_renderer::frontpage_remote_host ( $host)
protectedinherited

Returns HTML to display one remote host.

Parameters
array$hosthost information, contains properties: name, url, count
Return values
string

◆ frontpage_section1()

core_course_renderer::frontpage_section1 ( )
inherited

Output frontpage summary text and frontpage modules (stored as section 1 in site course)

This may be disabled in settings

Return values
string

◆ 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

◆ get_nav_links()

core_courseformat\output\section_renderer::get_nav_links ( $course,
$sections,
$sectionno )
protectedinherited

Generate next/previous section links for naviation.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
stdClass$courseThe course entry from DB
array$sectionsThe course_sections entries from the DB
int$sectionnoThe section number in the course which is being displayed
Return values
arrayassociative array with previous and next section link

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

◆ hubinfo()

core_course_renderer::hubinfo ( $hubinfo)
inherited

Hub information (logo - name - description - link)

Parameters
object$hubinfo
Return values
stringhtml code

◆ 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

◆ is_cm_conditionally_hidden()

core_course_renderer::is_cm_conditionally_hidden ( cm_info $mod)
inherited

Checks if course module has any conditions that may make it unavailable for all or some of the students.

Deprecated
since Moodle 4.0 MDL-72656 - please do not use this function any more.
Parameters
cm_info$mod
Return values
bool

◆ 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

◆ print_multiple_section_page()

core_courseformat\output\section_renderer::print_multiple_section_page ( $course,
$sections,
$mods,
$modnames,
$modnamesused )
inherited

Output the html for a multiple section page.

Deprecated
since 4.0

This is a deprecated method and it is mantain only for compatibilitiy with legacy course formats. Please, to render a single section page use:

$format = course_get_format($course); $outputclass = $format->get_output_classname('content'); $widget = new $outputclass($format); echo $this->render($widget);

Parameters
stdClass$courseThe course entry from DB
array$sections(argument not used)
array$mods(argument not used)
array$modnames(argument not used)
array$modnamesused(argument not used)

◆ print_single_section_page()

core_courseformat\output\section_renderer::print_single_section_page ( $course,
$sections,
$mods,
$modnames,
$modnamesused,
$displaysection )
inherited

Output the html for a single section page.

Deprecated
since 4.0

This is a deprecated method and it is mantain only for compatibilitiy with legacy course formats. Please, to render a single section page use:

$format = course_get_format($course); // Set the section to display. $format->set_section_number($displaysection); $outputclass = $format->get_output_classname('content'); $widget = new $outputclass($format); echo $this->render($widget);

Parameters
stdClass$courseThe course entry from DB
array$sections(argument not used)
array$mods(argument not used)
array$modnames(argument not used)
array$modnamesused(argument not used)
int$displaysectionThe section number in the course which is being displayed

◆ render()

core_courseformat\output\section_renderer::render ( renderable $widget)
inherited

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

Course format templates uses a similar subfolder structure to the renderable classes. This method find out the specific template for a course widget. That's the reason why this render method is different from the normal plugin renderer one.

course format templatables can be rendered using the core_course/local/* templates. Format plugins are free to override the default template location using render_xxx methods as usual.

Parameters
renderable$widgetinstance with renderable interface
Return values
stringthe widget HTML

Reimplemented from plugin_renderer_base.

◆ render_activity_information()

core_course_renderer::render_activity_information ( \core_course\output\activity_information $page)
inherited

Renders the activity information.

Defer to template.

Deprecated
since Moodle 4.3 MDL-78744
Todo
MDL-78926 This method will be deleted in Moodle 4.7
Parameters
core_course\output\activity_information$page
Return values
stringhtml for the page

◆ render_activity_navigation()

core_course_renderer::render_activity_navigation ( \core_course\output\activity_navigation $page)
inherited

Renders the activity navigation.

Defer to template.

Parameters
core_course\output\activity_navigation$page
Return values
stringhtml for the page

◆ 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

◆ render_modchooser()

core_course_renderer::render_modchooser ( renderable $modchooser)
inherited

Render a modchooser.

Parameters
renderable$modchooserThe chooser.
Return values
string

◆ search_courses()

core_course_renderer::search_courses ( $searchcriteria)
inherited

Renders html to display search result page.

Parameters
array$searchcriteriamay contain elements: search, blocklist, modulelist, tagid
Return values
string

◆ section_activity_summary()

core_courseformat\output\section_renderer::section_activity_summary ( $section,
$course,
$mods )
protectedinherited

Generate a summary of the activites in a section.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
stdClass$sectionThe course_section entry from DB
stdClass$coursethe course record from DB
array$mods(argument not used)
Return values
stringHTML to output.

◆ section_availability()

core_courseformat\output\section_renderer::section_availability ( $section)
inherited

Displays availability information for the section (hidden, not available unles, etc.)

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
section_info$section
Return values
string

◆ section_availability_message()

core_courseformat\output\section_renderer::section_availability_message ( $section,
$canviewhidden )
protectedinherited

If section is not visible, display the message about that ('Not available until...', that sort of thing).

Otherwise, returns blank.

For users with the ability to view hidden sections, it shows the information even though you can view the section and also may include slightly fuller information (so that teachers can tell when sections are going to be unavailable etc). This logic is the same as for activities.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
section_info$sectionThe course_section entry from DB
bool$canviewhiddenTrue if user can view hidden sections
Return values
stringHTML to output

◆ section_edit_control_items()

core_courseformat\output\section_renderer::section_edit_control_items ( $course,
$section,
$onsectionpage = false )
protectedinherited

Generate the edit control items of a section.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
stdClass$courseThe course entry from DB
stdClass$sectionThe course_section entry from DB
bool$onsectionpagetrue if being printed on a section page
Return values
arrayof edit control items

◆ section_edit_control_menu()

core_courseformat\output\section_renderer::section_edit_control_menu ( $controls,
$course,
$section )
protectedinherited

Generate the edit control action menu.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

The section edit controls are now part of the main core_courseformat\output\local\content\section output and does not use renderer methods anymore.

Parameters
array$controlsThe edit control items from section_edit_control_items
stdClass$courseThe course entry from DB (not used)
stdClass$sectionThe course_section entry from DB
Return values
stringHTML to output.

◆ section_edit_controls()

core_courseformat\output\section_renderer::section_edit_controls ( )
protectedinherited

Old method to print section edit controls.

Do not use it!

Deprecated
since Moodle 3.0 MDL-48947 - Use core_courseformat\output\section_renderer\section_edit_control_items() instead

◆ section_footer()

core_courseformat\output\section_renderer::section_footer ( )
protectedinherited

Generate the display of the footer part of a section.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is integrated into core_courseformat\output\local\content\section output component and it is displayed using mustache templates instead of a renderer method.

Return values
stringHTML to output.

◆ section_header()

core_courseformat\output\section_renderer::section_header ( $section,
$course,
$onsectionpage,
$sectionreturn = null )
protectedinherited

Generate the display of the header part of a section before course modules are included.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
stdClass$sectionThe course_section entry from DB
stdClass$courseThe course entry from DB
bool$onsectionpagetrue if being printed on a single-section page
int$sectionreturnThe section to return to after an action
Return values
stringHTML to output.

◆ section_hidden()

core_courseformat\output\section_renderer::section_hidden ( $sectionno,
$courseorid = null )
protectedinherited

Generate the html for a hidden section.

Parameters
int$sectionnoThe section number in the course which is being displayed
int | stdClass$courseoridThe course to get the section name for (object or just course id)
Return values
stringHTML to output.

◆ section_left_content()

core_courseformat\output\section_renderer::section_left_content ( $section,
$course,
$onsectionpage )
protectedinherited

Generate the content to displayed on the left part of a section before course modules are included.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

Spatial references like "left" or "right" are limiting the way formats and themes can extend courses. The elements from this method are now included in the core_courseformat\output\local\content\section output components.

Parameters
stdClass$sectionThe course_section entry from DB
stdClass$courseThe course entry from DB
bool$onsectionpagetrue if being printed on a section page
Return values
stringHTML to output.

◆ section_nav_selection()

core_courseformat\output\section_renderer::section_nav_selection ( $course,
$sections,
$displaysection )
protectedinherited

Generate the html for the 'Jump to' menu on a single section page.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
stdClass$courseThe course entry from DB
array$sectionsThe course_sections entries from the DB
int$displaysectionthe current displayed section number.
Return values
stringHTML to output.

◆ section_right_content()

core_courseformat\output\section_renderer::section_right_content ( $section,
$course,
$onsectionpage )
protectedinherited

Generate the content to displayed on the right part of a section before course modules are included.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

Spatial references like "left" or "right" are limiting the way formats and themes can extend courses. The elements from this method are now included in the core_courseformat\output\local\content\section output components.

Parameters
stdClass$sectionThe course_section entry from DB
stdClass$courseThe course entry from DB
bool$onsectionpagetrue if being printed on a section page
Return values
stringHTML to output.

◆ section_summary()

core_courseformat\output\section_renderer::section_summary ( $section,
$course,
$mods )
protectedinherited

Generate a summary of a section for display on the 'course index page'.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
stdClass$sectionThe course_section entry from DB
stdClass$courseThe course entry from DB
array$mods(argument not used)
Return values
stringHTML to output.

◆ section_title()

core_courseformat\output\section_renderer::section_title ( $section,
$course )
inherited

Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page.

Parameters
stdClass$sectionThe course_section entry from DB
stdClass$courseThe course entry from DB
Return values
stringHTML to output.

Reimplemented in format_topics\output\renderer, and format_weeks\output\renderer.

◆ section_title_without_link()

core_courseformat\output\section_renderer::section_title_without_link ( $section,
$course )
inherited

Generate the section title to be displayed on the section page, without a link.

Parameters
stdClass$sectionThe course_section entry from DB
stdClass$courseThe course entry from DB
Return values
stringHTML to output.

Reimplemented in format_topics\output\renderer, and format_weeks\output\renderer.

◆ sendingbackupinfo()

core_course_renderer::sendingbackupinfo ( $backupfile)
inherited

Display waiting information about backup size during uploading backup process.

Parameters
object$backupfilethe backup stored_file
Return values
$htmlstring

◆ should_display_main_logo()

renderer_base::should_display_main_logo ( $headinglevel = 1)
inherited

Whether we should display the main logo.

Deprecated
since Moodle 4.0
Todo
final deprecation. To be removed in Moodle 4.4 MDL-73165.
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

◆ start_section_list()

core_courseformat\output\section_renderer::start_section_list ( )
protectedinherited

Generate the starting container html for a list of sections.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.
Return values
stringHTML to output.

◆ stealth_section_footer()

core_courseformat\output\section_renderer::stealth_section_footer ( )
protectedinherited

Generate footer html of a stealth section.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Return values
stringHTML to output.

◆ stealth_section_header()

core_courseformat\output\section_renderer::stealth_section_header ( $sectionno)
protectedinherited

Generate the header html of a stealth section.

Deprecated
since 4.0 MDL-72656 - use core_course output components instead.

This element is now a core_courseformat\output\content\section output component and it is displayed using mustache templates instead of a renderer method.

Parameters
int$sectionnoThe section number in the course which is being displayed
Return values
stringHTML to output.

◆ tagged_courses()

core_course_renderer::tagged_courses ( $tagid,
$exclusivemode = true,
$ctx = 0,
$rec = true,
$displayoptions = null )
inherited

Renders html to print list of courses tagged with particular tag.

Parameters
int$tagidid of the tag
bool$exclusivemodeif set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger
int$fromctxcontext id where the link was displayed, may be used by callbacks to display items in the same context first
int$ctxcontext id where to search for records
bool$recsearch in subcontexts as well
array$displayoptions
Return values
stringempty string if no courses are marked with this tag or rendered list of courses

Member Data Documentation

◆ $categoryexpandedonload

bool core_course_renderer::$categoryexpandedonload = false
protectedinherited

Whether a category content is being initially rendered with children.

This is mainly used by the core_course_renderer\corsecat_tree() to render the appropriate action for the Expand/Collapse all link on page load.

◆ $courserenderer

core_course_renderer core_courseformat\output\section_renderer::$courserenderer
protectedinherited

contains an instance of core course renderer

Deprecated
since 4.0 - use $this to access course renderer methods

◆ $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: