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]

Library of functions and constants for module glossary outside of what is required for the core moodle api

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 766 lines (30 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 3 classes

glossary_full_portfolio_caller:: (8 methods):
  expected_callbackargs()
  load_data()
  expected_time()
  get_sha1()
  prepare_package()
  check_permissions()
  display_name()
  base_supported_formats()

glossary_entry_portfolio_caller:: (9 methods):
  expected_callbackargs()
  load_data()
  expected_time()
  check_permissions()
  display_name()
  prepare_package()
  get_sha1()
  base_supported_formats()
  entry_content()

glossary_file_info_container:: (11 methods):
  __construct()
  get_params()
  is_writable()
  is_directory()
  get_visible_name()
  get_children()
  get_filtered_children()
  get_non_empty_children()
  count_non_empty_children()
  get_parent()
  mod_glossary_get_tagged_entries()


Class: glossary_full_portfolio_caller  - X-Ref

class to handle exporting an entire glossary database

expected_callbackargs()   X-Ref
return array of expected call back arguments
and whether they are required or not

return: array

load_data()   X-Ref
load up all data required for this export.

return: void

expected_time()   X-Ref
how long might we expect this export to take

return: constant one of PORTFOLIO_TIME_XX

get_sha1()   X-Ref
return the sha1 of this content

return: string

prepare_package()   X-Ref
prepare the package ready to be passed off to the portfolio plugin

return: void

check_permissions()   X-Ref
make sure that the current user is allowed to do this

return: boolean

display_name()   X-Ref
return a nice name to be displayed about this export location

return: string

base_supported_formats()   X-Ref
what formats this function *generally* supports

return: array

Class: glossary_entry_portfolio_caller  - X-Ref

class to export a single glossary entry

expected_callbackargs()   X-Ref
No description

load_data()   X-Ref
load up all data required for this export.

return: void

expected_time()   X-Ref
how long might we expect this export to take

return: constant one of PORTFOLIO_TIME_XX

check_permissions()   X-Ref
make sure that the current user is allowed to do this

return: boolean

display_name()   X-Ref
return a nice name to be displayed about this export location

return: string

prepare_package()   X-Ref
prepare the package ready to be passed off to the portfolio plugin

return: void

get_sha1()   X-Ref
return the sha1 of this content

return: string

base_supported_formats()   X-Ref
what formats this function *generally* supports

return: array

entry_content($course, $cm, $glossary, $entry, $aliases, $format)   X-Ref
helper function to get the html content of an entry
for both this class and the full glossary exporter
this is a very simplified version of the dictionary format output,
but with its 500 levels of indirection removed
and file rewriting handled by the portfolio export format.

param: stdclass $course
param: stdclass $cm
param: stdclass $glossary
param: stdclass $entry
return: string

Class: glossary_file_info_container  - X-Ref

Class representing the virtual node with all itemids in the file browser

__construct($browser, $course, $cm, $context, $areas, $filearea)   X-Ref
Constructor (in case you did not realize it ;-)

param: file_browser $browser
param: stdClass $course
param: stdClass $cm
param: stdClass $context
param: array $areas
param: string $filearea

get_params()   X-Ref

return: array with keys contextid, filearea, itemid, filepath and filename

is_writable()   X-Ref
Can new files or directories be added via the file browser

return: bool

is_directory()   X-Ref
Should this node be considered as a folder in the file browser

return: bool

get_visible_name()   X-Ref
Returns localised visible name of this node

return: string

get_children()   X-Ref
Returns list of children nodes

return: array of file_info instances

get_filtered_children($extensions = '*', $countonly = false, $returnemptyfolders = false)   X-Ref
Help function to return files matching extensions or their count

param: string|array $extensions, either '*' or array of lowercase extensions, i.e. array('.gif','.jpg')
param: bool|int $countonly if false returns the children, if an int returns just the
param: bool $returnemptyfolders if true returns items that don't have matching files inside
return: array|int array of file_info instances or the count

get_non_empty_children($extensions = '*')   X-Ref
Returns list of children which are either files matching the specified extensions
or folders that contain at least one such file.

param: string|array $extensions, either '*' or array of lowercase extensions, i.e. array('.gif','.jpg')
return: array of file_info instances

count_non_empty_children($extensions = '*', $limit = 1)   X-Ref
Returns the number of children which are either files matching the specified extensions
or folders containing at least one such file.

param: string|array $extensions, for example '*' or array('.gif','.jpg')
param: int $limit stop counting after at least $limit non-empty children are found
return: int

get_parent()   X-Ref
Returns parent file_info instance

return: file_info or null for root

mod_glossary_get_tagged_entries($tag, $exclusivemode = false, $fromctx = 0, $ctx = 0, $rec = 1, $page = 0)   X-Ref
Returns glossary entries tagged with a specified tag.

This is a callback used by the tag area mod_glossary/glossary_entries to search for glossary entries
tagged with a specific tag.

param: core_tag_tag $tag
param: bool $exclusivemode if set to true it means that no other entities tagged with this tag
param: int $fromctx context id where the link was displayed, may be used by callbacks
param: int $ctx context id where to search for records
param: bool $rec search in subcontexts as well
param: int $page 0-based number of page being displayed
return: \core_tag\output\tagindex