Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 400 and 403] [Versions 401 and 403] [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: 281 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


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

get_availability_data($output, $availabilityinfo, $additionalclasses = '')   X-Ref
Get the basic availability information data.

param: \renderer_base $output typically, the renderer that's calling this function
param: string|core_availability_multiple_messages $availabilityinfo the avalability info
param: string $additionalclasses additional css classes
return: stdClass the availability information data

availability_info_from_string(\renderer_base $output, string $availabilityinfo)   X-Ref
Generate the basic availability information data from a string.
Just shorten availability text to generate the excerpt text.

param: \renderer_base $output typically, the renderer that's calling this function
param: string $availabilityinfo the avalability info
return: stdClass the availability information data

availability_info_from_output(\renderer_base $output,core_availability_multiple_messages $availabilityinfo)   X-Ref
Generate the basic availability information data from a renderable.
Use the header and the first item to generate the excerpt text.

param: \renderer_base $output typically, the renderer that's calling this function
param: core_availability_multiple_messages $availabilityinfo the avalability info
return: stdClass the availability information data

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