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

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: 607 lines (24 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

export_for_zero_state_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

generate_zero_state_data(\moodle_url $imageurl, array $buttons, array $strings)   X-Ref
Generate the state zero data.

param: \moodle_url $imageurl The URL to the image to show
param: string[] $buttons Exported {@see \single_button} instances
param: array $strings Title and intro strings for the zero state if needed.
return: array Context variables for the template