Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Typical crappy helper class with tiny functions.

Copyright: 2017 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 158 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

helper:: (5 methods):
  class_to_option()
  option_to_class()
  set_navbar()
  reset_page()
  prediction_context_selector()


Class: helper  - X-Ref

Helper class with general purpose tiny functions.

class_to_option($class)   X-Ref
Converts a class full name to a select option key

return: string
param: string $class

option_to_class($option)   X-Ref
option_to_class

return: string
param: string $option

set_navbar(string $title, \moodle_url $url, ?\context $context = null)   X-Ref
Sets an analytics > analytics models > $title breadcrumb.

return: null
param: string $title
param: \moodle_url $url
param: \context|null $context Defaults to context_system

reset_page()   X-Ref
Resets the current page.

Note that this function can only be used by analytics pages that work at the system context.

return: null

prediction_context_selector(array $contexts, \moodle_url $url, \renderer_base $output,?int $selected = null, ?bool $includeall = false, ?bool $shortentext = true)   X-Ref
Convert a list of contexts to an associative array where the value is the context name.

return: \stdClass
param: array            $contexts
param: \moodle_url      $url
param: \renderer_base   $output
param: int|null         $selected
param: bool             $includeall
param: bool             $shortentext