Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 403]

Contains the default section availability output class.

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

Defines 1 class

availability:: (6 methods):
  __construct()
  export_for_template()
  has_availability()
  build_export_data()
  get_info()
  availability_info()


Class: availability  - X-Ref

Base class to render section availability.

__construct(course_format $format, section_info $section)   X-Ref
Constructor.

param: course_format $format the course format
param: section_info $section the section info

export_for_template(\renderer_base $output)   X-Ref
Export this data so it can be used as the context for a mustache template.

return: stdClass data context for a mustache template
param: \renderer_base $output typically, the renderer that's calling this function

has_availability(\renderer_base $output)   X-Ref
Returns if the output has availability info to display.

return: bool if the element has availability data to display
param: \renderer_base $output typically, the renderer that's calling this function

build_export_data(\renderer_base $output)   X-Ref
Protected method to build the export data.

param: \renderer_base $output typically, the renderer that's calling this function

get_info(\renderer_base $output)   X-Ref
Export this data so it can be used as the context for a mustache template.

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.

return: stdclass data context for a mustache template
param: renderer_base $output typically, the renderer that's calling this function

availability_info($text, $additionalclasses = '')   X-Ref
Generate the basic availability information data.

return: stdClass the availability information data
param: string $text the formatted avalability text
param: string $additionalclasses additional css classes