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 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]

Base class for course format plugins

Copyright: 2012 Marina Glancy
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 261 lines (9 kb)
Included or required:0 times
Referenced: 5 times
Includes or requires: 0 files

Defines 1 class

Defines 12 functions


Class: format_site  - X-Ref

Pseudo course format used for the site main page

get_section_name($section)   X-Ref
Returns the display name of the given section that the course prefers.

param: int|stdClass $section Section object from database or just field section.section
return: Display name that the course format prefers, e.g. "Topic 2"

get_view_url($section, $options = array()   X-Ref
For this fake course referring to the whole site, the site homepage is always returned
regardless of arguments

param: int|stdClass $section
param: array $options
return: null|moodle_url

get_default_blocks()   X-Ref
Returns the list of blocks to be automatically added on the site frontpage when moodle is installed

return: array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT

course_format_options($foreditform = false)   X-Ref
Definitions of the additional options that site uses

param: bool $foreditform
return: array of options

allow_stealth_module_visibility($cm, $section)   X-Ref
Returns whether this course format allows the activity to
have "triple visibility state" - visible always, hidden on course page but available, hidden.

param: stdClass|cm_info $cm course module (may be null if we are displaying a form for adding a module)
param: stdClass|section_info $section section where this module is located or will be added to
return: bool

get_renderer(moodle_page $page)   X-Ref
Returns instance of page renderer used by the site page

param: moodle_page $page the current page
return: renderer_base

get_section_number()   X-Ref
Site format uses only section 1.

return: int

contract_value(array &$dest, array $source, array $option, string $optionname)   X-Ref
'Converts' a value from what is stored in the database into what is used by edit forms.

param: array $dest The destination array
param: array $source The source array
param: array $option The definition structure of the option.
param: string $optionname The name of the option, as provided in the definition.

clean_param_if_not_null($param, string $type = PARAM_RAW)   X-Ref
Cleans the given param, unless it is null.

param: mixed $param The variable we are cleaning.
param: string $type Expected format of param after cleaning.
return: mixed Null if $param is null, otherwise the cleaned value.

expand_value(array &$dest, array $source, array $option, string $optionname)   X-Ref
'Converts' a value from what is used in edit forms into a value(s) to be stored in the database.

param: array $dest The destination array
param: array $source The source array
param: array $option The definition structure of the option.
param: string $optionname The name of the option, as provided in the definition.

core_courseformat_output_fragment_cmitem($args)   X-Ref
Course-module fragment renderer method.

The fragment arguments are id and sr (section return).

param: array $args The fragment arguments.
return: string The rendered cm item.

core_courseformat_output_fragment_section($args)   X-Ref
Section fragment renderer method.

The fragment arguments are courseid, section id and sr (section return).

param: array $args The fragment arguments.
return: string The rendered section.

Functions that are not part of a class:

course_get_format($courseorid)   X-Ref
Returns an instance of format class (extending course_format) for given course

param: int|stdClass $courseorid either course id or
return: course_format