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

Class containing data for my overview block.

Copyright: 2017 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 481 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: main  - X-Ref

Class containing data for my overview block.

__construct($grouping, $sort, $view, $paging, $customfieldvalue = null)   X-Ref
main constructor.
Initialize the user preferences

param: string $grouping Grouping user preference
param: string $sort Sort user preference
param: string $view Display user preference
param: int $paging
param: string $customfieldvalue

get_fallback_grouping($config)   X-Ref
Determine the most sensible fallback grouping to use (in cases where the stored selection
is no longer available).

param: object $config
return: string

set_available_layouts()   X-Ref
Set the available layouts based on the config table settings,
if none are available, defaults to the cards view.


get_preferences_as_booleans()   X-Ref
Get the user preferences as an array to figure out what has been selected.

return: array $preferences Array with the pref as key and value set to true

format_layout_for_export($layoutname)   X-Ref
Format a layout into an object for export as a Context variable to template.

param: string $layoutname
return: \stdClass $layout an object representation of a layout

get_formatted_available_layouts_for_export()   X-Ref
Get the available layouts formatted for export.

return: array an array of objects representing available layouts

get_customfield_values_for_export()   X-Ref
Get the list of values to add to the grouping dropdown

return: object[] containing name, value and active fields

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
return: array Context variables for the template