Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 402 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.

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

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

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

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.

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

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

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