Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

Contains the default section course format output class.

Copyright: 2020 Ferran Recio <ferran@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1131 lines (49 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: section_renderer  - X-Ref

Base class to render a course add section buttons.

__construct(moodle_page $page, $target)   X-Ref
Constructor method, calls the parent constructor.

param: moodle_page $page
param: string $target one of rendering target constants

render(renderable $widget)   X-Ref
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.

param: renderable $widget instance with renderable interface
return: string the widget HTML

section_title($section, $course)   X-Ref
Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page

param: stdClass $section The course_section entry from DB
param: stdClass $course The course entry from DB
return: string HTML to output.

section_title_without_link($section, $course)   X-Ref
Generate the section title to be displayed on the section page, without a link

param: stdClass $section The course_section entry from DB
param: stdClass $course The course entry from DB
return: string HTML to output.

course_section_updated_cm_item(course_format $format,section_info $section,cm_info $cm,array $displayoptions = [])   X-Ref
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.

param: course_format $format the course format
param: section_info $section the section info
param: cm_info $cm the course module ionfo
param: array $displayoptions optional extra display options
return: string the rendered element

course_section_updated(course_format $format,section_info $section)   X-Ref
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.

param: course_format $format the course format
param: section_info $section the section info
return: string the rendered element

course_index_drawer(course_format $format)   X-Ref
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.

param: course_format $format the course format
return: String the course index HTML.

section_edit_control_menu($controls, $course, $section)   X-Ref
Generate the edit control action menu

param: array $controls The edit control items from section_edit_control_items
param: stdClass $course The course entry from DB (not used)
param: stdClass $section The course_section entry from DB
return: string HTML to output.

section_right_content($section, $course, $onsectionpage)   X-Ref
Generate the content to displayed on the right part of a section
before course modules are included

param: stdClass $section The course_section entry from DB
param: stdClass $course The course entry from DB
param: bool $onsectionpage true if being printed on a section page
return: string HTML to output.

section_left_content($section, $course, $onsectionpage)   X-Ref
Generate the content to displayed on the left part of a section
before course modules are included

param: stdClass $section The course_section entry from DB
param: stdClass $course The course entry from DB
param: bool $onsectionpage true if being printed on a section page
return: string HTML to output.

section_header($section, $course, $onsectionpage, $sectionreturn = null)   X-Ref
Generate the display of the header part of a section before
course modules are included

param: stdClass $section The course_section entry from DB
param: stdClass $course The course entry from DB
param: bool $onsectionpage true if being printed on a single-section page
param: int $sectionreturn The section to return to after an action
return: string HTML to output.

section_footer()   X-Ref
Generate the display of the footer part of a section.

return: string HTML to output.

start_section_list()   X-Ref
Generate the starting container html for a list of sections.

return: string HTML to output.

end_section_list()   X-Ref
Generate the closing container html for a list of sections.

return: string HTML to output.

section_edit_controls()   X-Ref
Old method to print section edit controls. Do not use it!


section_edit_control_items($course, $section, $onsectionpage = false)   X-Ref
Generate the edit control items of a section

param: stdClass $course The course entry from DB
param: stdClass $section The course_section entry from DB
param: bool $onsectionpage true if being printed on a section page
return: array of edit control items

section_summary($section, $course, $mods)   X-Ref
Generate a summary of a section for display on the 'course index page'

param: stdClass $section The course_section entry from DB
param: stdClass $course The course entry from DB
param: array    $mods (argument not used)
return: string HTML to output.

section_activity_summary($section, $course, $mods)   X-Ref
Generate a summary of the activites in a section

param: stdClass $section The course_section entry from DB
param: stdClass $course the course record from DB
param: array    $mods (argument not used)
return: string HTML to output.

section_availability_message($section, $canviewhidden)   X-Ref
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.

param: section_info $section The course_section entry from DB
param: bool $canviewhidden True if user can view hidden sections
return: string HTML to output

section_availability($section)   X-Ref
Displays availability information for the section (hidden, not available unles, etc.)

param: section_info $section
return: string

course_activity_clipboard($course, $sectionno = null)   X-Ref
Show if something is on on the course clipboard (moving around)

param: stdClass $course The course entry from DB
param: int $sectionno The section number in the course which is being displayed
return: string HTML to output.

get_nav_links($course, $sections, $sectionno)   X-Ref
Generate next/previous section links for naviation.

param: stdClass $course The course entry from DB
param: array $sections The course_sections entries from the DB
param: int $sectionno The section number in the course which is being displayed
return: array associative array with previous and next section link

stealth_section_header($sectionno)   X-Ref
Generate the header html of a stealth section

param: int $sectionno The section number in the course which is being displayed
return: string HTML to output.

stealth_section_footer()   X-Ref
Generate footer html of a stealth section

return: string HTML to output.

section_hidden($sectionno, $courseorid = null)   X-Ref
Generate the html for a hidden section

param: int $sectionno The section number in the course which is being displayed
param: int|stdClass $courseorid The course to get the section name for (object or just course id)
return: string HTML to output.

section_nav_selection($course, $sections, $displaysection)   X-Ref
Generate the html for the 'Jump to' menu on a single section page.

param: stdClass $course The course entry from DB
param: array $sections The course_sections entries from the DB
param: int $displaysection the current displayed section number.
return: string HTML to output.

print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)   X-Ref
Output the html for a single section page.

param: stdClass $course The course entry from DB
param: array $sections (argument not used)
param: array $mods (argument not used)
param: array $modnames (argument not used)
param: array $modnamesused (argument not used)
param: int $displaysection The section number in the course which is being displayed

print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)   X-Ref
Output the html for a multiple section page

param: stdClass $course The course entry from DB
param: array $sections (argument not used)
param: array $mods (argument not used)
param: array $modnames (argument not used)
param: array $modnamesused (argument not used)

change_number_sections($course, $sectionreturn = null)   X-Ref
Returns controls in the bottom of the page to increase/decrease number of sections

param: stdClass $course
param: int|null $sectionreturn

format_summary_text($section)   X-Ref
Generate html for a section summary text

param: stdClass $section The course_section entry from DB
return: string HTML to output.