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]

Library of functions and constants for module glossary (replace glossary with the name of your module and delete this line)

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 4509 lines (169 kb)
Included or required: 13 times
Referenced: 3 times
Includes or requires: 2 files
 lib/xmlize.php
 mod/glossary/deprecatedlib.php

Defines 105 functions

  glossary_add_instance()
  glossary_update_instance()
  glossary_delete_instance()
  glossary_user_outline()
  glossary_get_user_entries()
  glossary_user_complete()
  glossary_get_recent_mod_activity()
  glossary_print_recent_mod_activity()
  glossary_print_recent_activity()
  glossary_log_info()
  glossary_cron()
  glossary_get_user_grades()
  glossary_rating_permissions()
  glossary_rating_validate()
  glossary_update_grades()
  glossary_grade_item_update()
  glossary_grade_item_delete()
  glossary_scale_used()
  glossary_scale_used_anywhere()
  glossary_get_available_formats()
  glossary_debug()
  glossary_get_entries()
  glossary_get_entries_search()
  glossary_print_entry()
  glossary_print_entry_default()
  glossary_print_entry_concept()
  glossary_print_entry_definition()
  glossary_print_entry_aliases()
  glossary_print_entry_icons()
  glossary_print_entry_lower_section()
  glossary_print_entry_attachment()
  glossary_print_entry_approval()
  glossary_search()
  glossary_search_entries()
  glossary_print_attachments()
  glossary_get_file_areas()
  glossary_get_file_info()
  glossary_pluginfile()
  glossary_print_tabbed_table_end()
  glossary_print_approval_menu()
  glossary_print_import_menu()
  glossary_print_export_menu()
  glossary_print_alphabet_menu()
  glossary_print_author_menu()
  glossary_print_categories_menu()
  glossary_print_all_links()
  glossary_print_special_links()
  glossary_print_alphabet_links()
  glossary_print_sorting_links()
  glossary_sort_entries()
  glossary_print_entry_ratings()
  glossary_print_dynaentry()
  glossary_generate_export_csv()
  glossary_generate_export_file()
  glossary_read_imported_file()
  glossary_start_tag()
  glossary_end_tag()
  glossary_full_tag()
  glossary_xml_export_files()
  glossary_xml_import_files()
  glossary_count_unrated_entries()
  glossary_get_paging_bar()
  glossary_get_view_actions()
  glossary_get_post_actions()
  glossary_reset_course_form_definition()
  glossary_reset_course_form_defaults()
  glossary_reset_gradebook()
  glossary_reset_userdata()
  glossary_get_extra_capabilities()
  glossary_supports()
  glossary_extend_navigation()
  glossary_extend_settings_navigation()
  glossary_comment_permissions()
  glossary_comment_validate()
  glossary_page_type_list()
  glossary_get_all_tabs()
  glossary_set_default_visible_tabs()
  glossary_get_visible_tabs()
  glossary_view()
  glossary_entry_view()
  glossary_get_entries_by_letter()
  glossary_get_entries_by_date()
  glossary_get_entries_by_category()
  glossary_get_entries_by_author()
  glossary_get_entries_by_author_id()
  glossary_get_authors()
  glossary_get_categories()
  glossary_get_search_terms_sql()
  glossary_get_entries_by_search()
  glossary_get_entries_by_term()
  glossary_get_entries_to_approve()
  glossary_get_entry_by_id()
  glossary_can_view_entry()
  glossary_concept_exists()
  glossary_get_editor_and_attachment_options()
  glossary_edit_entry()
  glossary_check_updates_since()
  mod_glossary_get_fontawesome_icon_map()
  mod_glossary_core_calendar_provide_event_action()
  glossary_get_coursemodule_info()
  mod_glossary_get_completion_active_rule_descriptions()
  mod_glossary_can_delete_entry()
  mod_glossary_delete_entry()
  mod_glossary_can_update_entry()
  mod_glossary_prepare_entry_for_edition()

Functions that are not part of a class:

glossary_add_instance($glossary)   X-Ref

return: int
param: object $glossary

glossary_update_instance($glossary)   X-Ref
Given an object containing all the necessary data,
(defined by the form in mod_form.php) this function
will update an existing instance with new data.

return: bool
param: object $glossary

glossary_delete_instance($id)   X-Ref
Given an ID of an instance of this module,
this function will permanently delete the instance
and any data that depends on it.

return: bool success
param: int $id glossary id

glossary_user_outline($course, $user, $mod, $glossary)   X-Ref
Return a small object with summary information about what a
user has done with a given particular instance of this module
Used for user activity reports.
$return->time = the time they did it
$return->info = a short text description

return: object|null
param: object $course
param: object $user
param: object $mod
param: object $glossary

glossary_get_user_entries($glossaryid, $userid)   X-Ref

return: array
param: int $glossaryid
param: int $userid

glossary_user_complete($course, $user, $mod, $glossary)   X-Ref
Print a detailed representation of what a  user has done with
a given particular instance of this module, for user activity reports.

param: object $course
param: object $user
param: object $mod
param: object $glossary

glossary_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0)   X-Ref
Returns all glossary entries since a given time for specified glossary

return: void adds items into $activities and increases $index
param: array $activities sequentially indexed array of objects
param: int   $index
param: int   $timestart
param: int   $courseid
param: int   $cmid
param: int   $userid defaults to 0
param: int   $groupid defaults to 0

glossary_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames)   X-Ref
Outputs the glossary entry indicated by $activity

return: void
param: object $activity      the activity object the glossary resides in
param: int    $courseid      the id of the course the glossary resides in
param: bool   $detail        not used, but required for compatibilty with other modules
param: int    $modnames      not used, but required for compatibilty with other modules
param: bool   $viewfullnames not used, but required for compatibilty with other modules

glossary_print_recent_activity($course, $viewfullnames, $timestart)   X-Ref
Given a course and a time, this module should find recent activity
that has occurred in glossary activities and print it out.
Return true if there was output, or false is there was none.

return: bool
param: object $course
param: object $viewfullnames
param: int $timestart

glossary_log_info($log)   X-Ref

param: object $log

glossary_cron()   X-Ref
Function to be run periodically according to the moodle cron
This function searches for things that need to be done, such
as sending out mail, toggling flags etc ...

return: bool

glossary_get_user_grades($glossary, $userid=0)   X-Ref
Return grade for given user or all users.

return: array An array of grades, false if none
param: stdClass $glossary A glossary instance
param: int $userid Optional user id, 0 means all users

glossary_rating_permissions($contextid, $component, $ratingarea)   X-Ref
Return rating related permissions

return: array an associative array of the user's rating permissions
param: int $contextid the context id
param: string $component The component we want to get permissions for
param: string $ratingarea The ratingarea that we want to get permissions for

glossary_rating_validate($params)   X-Ref
Validates a submitted rating

return: boolean true if the rating is valid. Will throw rating_exception if not
param: array $params submitted data

glossary_update_grades($glossary=null, $userid=0, $nullifnone=true)   X-Ref
Update activity grades

param: stdClass $glossary Null means all glossaries (with extra cmidnumber property)
param: int $userid specific user only, 0 means all
param: bool $nullifnone If true and the user has no grade then a grade item with rawgrade == null will be inserted

glossary_grade_item_update($glossary, $grades=NULL)   X-Ref
Create/update grade item for given glossary

return: int, 0 if ok, error code otherwise
param: stdClass $glossary object with extra cmidnumber
param: mixed $grades Optional array/object of grade(s); 'reset' means reset grades in gradebook

glossary_grade_item_delete($glossary)   X-Ref
Delete grade item for given glossary

param: object $glossary object

glossary_scale_used()   X-Ref


glossary_scale_used_anywhere($scaleid)   X-Ref
Checks if scale is being used by any instance of glossary

This is used to find out if scale used anywhere

return: boolean True if the scale is used by any glossary
param: int $scaleid

glossary_get_available_formats()   X-Ref
This function return an array of valid glossary_formats records
Everytime it's called, every existing format is checked, new formats
are included if detected and old formats are deleted and any glossary
using an invalid format is updated to the default (dictionary).

return: array

glossary_debug($debug,$text,$br=1)   X-Ref

param: bool $debug
param: string $text
param: int $br

glossary_get_entries($glossaryid, $entrylist, $pivot = "")   X-Ref

return: array
param: int $glossaryid
param: string $entrylist
param: string $pivot

glossary_get_entries_search($concept, $courseid)   X-Ref

return: array
param: object $concept
param: string $courseid

glossary_print_entry($course, $cm, $glossary, $entry, $mode='',$hook='',$printicons = 1, $displayformat = -1, $printview = false)   X-Ref

return: mixed
param: object $course
param: object $course
param: object $glossary
param: object $entry
param: string $mode
param: string $hook
param: int $printicons
param: int $displayformat
param: bool $printview

glossary_print_entry_default($entry, $glossary, $cm)   X-Ref
Default (old) print format used if custom function doesn't exist in format

return: void Output is echo'd
param: object $entry
param: object $glossary
param: object $cm

glossary_print_entry_concept($entry, $return=false)   X-Ref
Print glossary concept/term as a heading <h4>

param: object $entry

glossary_print_entry_definition($entry, $glossary, $cm)   X-Ref

param: object $entry
param: object $glossary
param: object $cm

glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode='',$hook='', $type = 'print')   X-Ref

return: string|void
param: object $course
param: object $cm
param: object $glossary
param: object $entry
param: string $mode
param: string $hook
param: string $type

glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$hook='', $type = 'print')   X-Ref

return: string|void
param: object $course
param: object $cm
param: object $glossary
param: object $entry
param: string $mode
param: string $hook
param: string $type

glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases = true,$printseparator = true)   X-Ref

return: void
param: object $course
param: object $cm
param: object $glossary
param: object $entry
param: string $mode
param: object $hook
param: bool $printicons
param: bool $aliases
param: bool $printseparator Whether to print a thematic break (separator) at the end of the lower section.

glossary_print_entry_attachment($entry, $cm, $format = null, $unused1 = null, $unused2 = null)   X-Ref
Print the list of attachments for this glossary entry

param: object $entry
param: object $cm The coursemodule
param: string $format The format for this view (html, or text)
param: string $unused1 This parameter is no longer used
param: string $unused2 This parameter is no longer used

glossary_print_entry_approval($cm, $entry, $mode, $align="right", $insidetable=true)   X-Ref

param: object $cm
param: object $entry
param: string $mode
param: string $align
param: bool $insidetable

glossary_search($course, $searchterms, $extended = 0, $glossary = NULL)   X-Ref
It returns all entries from all glossaries that matches the specified criteria
within a given $course. It performs an $extended search if necessary.
It restrict the search to only one $glossary if the $glossary parameter is set.

return: array
param: object $course
param: array $searchterms
param: int $extended
param: object $glossary

glossary_search_entries($searchterms, $glossary, $extended)   X-Ref

return: array
param: array $searchterms
param: object $glossary
param: bool $extended

glossary_print_attachments($entry, $cm, $type=NULL, $unused = null)   X-Ref
if return=html, then return a html string.
if return=text, then return a text-only string.
otherwise, print HTML for non-images, and return image HTML
if attachment is an image, $align set its aligment.

return: string image string or nothing depending on $type param
param: object $entry
param: object $cm
param: string $type html, txt, empty
param: string $unused This parameter is no longer used

glossary_get_file_areas($course, $cm, $context)   X-Ref
Lists all browsable file areas

return: array
param: stdClass $course course object
param: stdClass $cm course module object
param: stdClass $context context object

glossary_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)   X-Ref
File browsing support for glossary module.

return: file_info_stored file_info_stored instance or null if not found
param: file_browser $browser
param: array $areas
param: stdClass $course
param: cm_info $cm
param: context $context
param: string $filearea
param: int $itemid
param: string $filepath
param: string $filename

glossary_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()   X-Ref
Serves the glossary attachments. Implements needed access control ;-)

return: bool false if file not found, does not return if found - justsend the file
param: stdClass $course course object
param: stdClass $cm course module object
param: stdClsss $context context object
param: string $filearea file area
param: array $args extra arguments
param: bool $forcedownload whether or not force download
param: array $options additional options affecting the file serving

glossary_print_tabbed_table_end()   X-Ref
No description

glossary_print_approval_menu($cm, $glossary,$mode, $hook, $sortkey = '', $sortorder = '')   X-Ref

param: object $cm
param: object $glossary
param: string $mode
param: string $hook
param: string $sortkey
param: string $sortorder

glossary_print_import_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '')   X-Ref

param: object $cm
param: object $glossary
param: string $hook
param: string $sortkey
param: string $sortorder

glossary_print_export_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '')   X-Ref

param: object $cm
param: object $glossary
param: string $hook
param: string $sortkey
param: string $sortorder

glossary_print_alphabet_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '')   X-Ref

param: object $cm
param: object $glossary
param: string $hook
param: string $sortkey
param: string $sortorder

glossary_print_author_menu($cm, $glossary,$mode, $hook, $sortkey = '', $sortorder = '')   X-Ref

param: object $cm
param: object $glossary
param: string $hook
param: string $sortkey
param: string $sortorder

glossary_print_categories_menu($cm, $glossary, $hook, $category)   X-Ref

param: object $cm
param: object $glossary
param: string $hook
param: object $category

glossary_print_all_links($cm, $glossary, $mode, $hook)   X-Ref

param: object $cm
param: object $glossary
param: string $mode
param: string $hook

glossary_print_special_links($cm, $glossary, $mode, $hook)   X-Ref

param: object $cm
param: object $glossary
param: string $mode
param: string $hook

glossary_print_alphabet_links($cm, $glossary, $mode, $hook, $sortkey, $sortorder)   X-Ref

param: object $glossary
param: string $mode
param: string $hook
param: string $sortkey
param: string $sortorder

glossary_print_sorting_links($cm, $mode, $sortkey = '',$sortorder = '')   X-Ref

param: object $cm
param: string $mode
param: string $sortkey
param: string $sortorder

glossary_sort_entries( $entry0, $entry1 )   X-Ref

return: int [-1 | 0 | 1]
param: object $entry0
param: object $entry1

glossary_print_entry_ratings($course, $entry)   X-Ref

return: bool
param: object $course
param: object $entry

glossary_print_dynaentry($courseid, $entries, $displayformat = -1)   X-Ref

param: int $courseid
param: array $entries
param: int $displayformat

glossary_generate_export_csv($entries, $aliases, $categories)   X-Ref

return: string
param: array $entries
param: array $aliases
param: array $categories

glossary_generate_export_file($glossary, $ignored = "", $hook = 0)   X-Ref

return: string
param: object $glossary
param: string $ignored invalid parameter
param: int|string $hook

glossary_read_imported_file($file_content)   X-Ref
Read import file and convert to current charset

return: string
param: string $file

glossary_start_tag($tag,$level=0,$endline=false)   X-Ref
Return the xml start tag

return: string
param: string $tag
param: int $level
param: bool $endline

glossary_end_tag($tag,$level=0,$endline=true)   X-Ref
Return the xml end tag

return: string
param: string $tag
param: int $level
param: bool $endline

glossary_full_tag($tag, $level, $endline, $content)   X-Ref
Return the start tag, the contents and the end tag

return: string
param: string $tag
param: int $level
param: bool $endline
param: string $content

glossary_xml_export_files($tag, $taglevel, $contextid, $filearea, $itemid)   X-Ref
Prepares file area to export as part of XML export

return: string
param: string $tag XML tag to use for the group
param: int $taglevel
param: int $contextid
param: string $filearea
param: int $itemid

glossary_xml_import_files($xmlparent, $tag, $contextid, $filearea, $itemid)   X-Ref
Parses files from XML import and inserts them into file system

return: int
param: array $xmlparent parent element in parsed XML tree
param: string $tag
param: int $contextid
param: string $filearea
param: int $itemid

glossary_count_unrated_entries($glossaryid, $userid)   X-Ref
How many unrated entries are in the given glossary for a given user?

return: int
param: int $glossaryid
param: int $userid

glossary_get_paging_bar($totalcount, $page, $perpage, $baseurl, $maxpageallowed=99999, $maxdisplay=20, $separator=" ", $specialtext="", $specialvalue=-1, $previousandnext = true)   X-Ref
Returns the html code to represent any pagging bar. Paramenters are:

The function dinamically show the first and last pages, and "scroll" over pages.
Fully compatible with Moodle's print_paging_bar() function. Perhaps some day this
could replace the general one. ;-)

return: string
param: int $totalcount total number of records to be displayed
param: int $page page currently selected (0 based)
param: int $perpage number of records per page
param: string $baseurl url to link in each page, the string 'page=XX' will be added automatically.
param: int $maxpageallowed Optional maximum number of page allowed.
param: int $maxdisplay Optional maximum number of page links to show in the bar
param: string $separator Optional string to be used between pages in the bar
param: string $specialtext Optional string to be showed as an special link
param: string $specialvalue Optional value (page) to be used in the special link
param: bool $previousandnext Optional to decide if we want the previous and next links

glossary_get_view_actions()   X-Ref
List the actions that correspond to a view of this module.
This is used by the participation report.

Note: This is not used by new logging system. Event with
crud = 'r' and edulevel = LEVEL_PARTICIPATING will
be considered as view action.

return: array

glossary_get_post_actions()   X-Ref
List the actions that correspond to a post of this module.
This is used by the participation report.

Note: This is not used by new logging system. Event with
crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING
will be considered as post action.

return: array

glossary_reset_course_form_definition(&$mform)   X-Ref
Implementation of the function for printing the form elements that control
whether the course reset functionality affects the glossary.

param: object $mform form passed by reference

glossary_reset_course_form_defaults($course)   X-Ref
Course reset form defaults.

return: array

glossary_reset_gradebook($courseid, $type='')   X-Ref
Removes all grades from gradebook

param: int $courseid The ID of the course to reset
param: string $type The optional type of glossary. 'main', 'secondary' or ''

glossary_reset_userdata($data)   X-Ref
Actual implementation of the reset course functionality, delete all the
glossary responses for course $data->courseid.

return: array status array
param: $data the data submitted from the reset course.

glossary_get_extra_capabilities()   X-Ref
Returns all other caps used in module

return: array

glossary_supports($feature)   X-Ref

return: mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
param: string $feature FEATURE_xx constant for requested feature

glossary_extend_navigation($navigation, $course, $module, $cm)   X-Ref
No description

glossary_extend_settings_navigation(settings_navigation $settings, navigation_node $glossarynode)   X-Ref
Adds module specific settings to the settings block

param: settings_navigation $settings The settings navigation object
param: navigation_node $glossarynode The node to add module settings to

glossary_comment_permissions($comment_param)   X-Ref
Running addtional permission check on plugin, for example, plugins
may have switch to turn on/off comments option, this callback will
affect UI display, not like pluginname_comment_validate only throw
exceptions.
Capability check has been done in comment->check_permissions(), we
don't need to do it again here.

return: array
param: stdClass $comment_param {

glossary_comment_validate($comment_param)   X-Ref
Validate comment parameter before perform other comments actions

return: boolean
param: stdClass $comment_param {

glossary_page_type_list($pagetype, $parentcontext, $currentcontext)   X-Ref
Return a list of page types

param: string $pagetype current page type
param: stdClass $parentcontext Block's parent context
param: stdClass $currentcontext Current context of block

glossary_get_all_tabs()   X-Ref
Return list of all glossary tabs.

return: array

glossary_set_default_visible_tabs($glossaryformat)   X-Ref
Set 'showtabs' value for glossary formats

param: stdClass $glossaryformat record from 'glossary_formats' table

glossary_get_visible_tabs($displayformat)   X-Ref
Convert 'showtabs' string to array

return: array
param: stdClass $displayformat record from 'glossary_formats' table

glossary_view($glossary, $course, $cm, $context, $mode)   X-Ref
Notify that the glossary was viewed.

This will trigger relevant events and activity completion.

param: stdClass $glossary The glossary object.
param: stdClass $course   The course object.
param: stdClass $cm       The course module object.
param: stdClass $context  The context object.
param: string   $mode     The mode in which the glossary was viewed.

glossary_entry_view($entry, $context)   X-Ref
Notify that a glossary entry was viewed.

This will trigger relevant events.

param: stdClass $entry    The entry object.
param: stdClass $context  The context object.

glossary_get_entries_by_letter($glossary, $context, $letter, $from, $limit, $options = array()   X-Ref
Returns the entries of a glossary by letter.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: string $letter The letter, or ALL, or SPECIAL.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.
param: array $options Accepts:

glossary_get_entries_by_date($glossary, $context, $order, $sort, $from, $limit, $options = array()   X-Ref
Returns the entries of a glossary by date.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: string $order The mode of ordering: CREATION or UPDATE.
param: string $sort The direction of the ordering: ASC or DESC.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.
param: array $options Accepts:

glossary_get_entries_by_category($glossary, $context, $categoryid, $from, $limit, $options = array()   X-Ref
Returns the entries of a glossary by category.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: int $categoryid The category ID, or GLOSSARY_SHOW_* constant.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.
param: array $options Accepts:

glossary_get_entries_by_author($glossary, $context, $letter, $field, $sort, $from, $limit, $options = array()   X-Ref
Returns the entries of a glossary by author.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: string $letter The letter
param: string $field The field to search: FIRSTNAME or LASTNAME.
param: string $sort The sorting: ASC or DESC.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.
param: array $options Accepts:

glossary_get_entries_by_author_id($glossary, $context, $authorid, $order, $sort, $from, $limit, $options = array()   X-Ref
Returns the entries of a glossary by category.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: int $authorid The author ID.
param: string $order The mode of ordering: CONCEPT, CREATION or UPDATE.
param: string $sort The direction of the ordering: ASC or DESC.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.
param: array $options Accepts:

glossary_get_authors($glossary, $context, $limit, $from, $options = array()   X-Ref
Returns the authors in a glossary

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: int $limit Number of records to fetch.
param: int $from Fetch records from.
param: array $options Accepts:

glossary_get_categories($glossary, $from, $limit)   X-Ref
Returns the categories of a glossary.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.

glossary_get_search_terms_sql(array $terms, $fullsearch = true, $glossaryid = null)   X-Ref
Get the SQL where clause for searching terms.

Note that this does not handle invalid or too short terms.

return: array The first element being the where clause, the second array of parameters.
param: array   $terms      Array of terms.
param: bool    $fullsearch Whether or not full search should be enabled.
param: int     $glossaryid The ID of a glossary to reduce the search results.

glossary_get_entries_by_search($glossary, $context, $query, $fullsearch, $order, $sort, $from, $limit,$options = array()   X-Ref
Returns the entries of a glossary by search.

return: array The first element being the array of results, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: string $query The search query.
param: bool $fullsearch Whether or not full search is required.
param: string $order The mode of ordering: CONCEPT, CREATION or UPDATE.
param: string $sort The direction of the ordering: ASC or DESC.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.
param: array $options Accepts:

glossary_get_entries_by_term($glossary, $context, $term, $from, $limit, $options = array()   X-Ref
Returns the entries of a glossary by term.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: string $term The term we are searching for, a concept or alias.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.
param: array $options Accepts:

glossary_get_entries_to_approve($glossary, $context, $letter, $order, $sort, $from, $limit)   X-Ref
Returns the entries to be approved.

return: array The first element being the recordset, the second the number of entries.
param: object $glossary The glossary.
param: context $context The context of the glossary.
param: string $letter The letter, or ALL, or SPECIAL.
param: string $order The mode of ordering: CONCEPT, CREATION or UPDATE.
param: string $sort The direction of the ordering: ASC or DESC.
param: int $from Fetch records from.
param: int $limit Number of records to fetch.

glossary_get_entry_by_id($id)   X-Ref
Fetch an entry.

return: object|false The entry, or false when not found.
param: int $id The entry ID.

glossary_can_view_entry($entry, $cminfo)   X-Ref
Checks if the current user can see the glossary entry.

return: bool
param: stdClass $entry
param: cm_info  $cminfo

glossary_concept_exists($glossary, $concept)   X-Ref
Check if a concept exists in a glossary.

return: bool true if exists
param: stdClass $glossary glossary object
param: string $concept the concept to check

glossary_get_editor_and_attachment_options($course, $context, $entry)   X-Ref
Return the editor and attachment options when editing a glossary entry

return: array array containing the editor and attachment options
param: stdClass $course  course object
param: stdClass $context context object
param: stdClass $entry   entry object

glossary_edit_entry($entry, $course, $cm, $glossary, $context)   X-Ref
Creates or updates a glossary entry

return: stdClass the complete new or updated entry
param: stdClass $entry entry data
param: stdClass $course course object
param: stdClass $cm course module object
param: stdClass $glossary glossary object
param: stdClass $context context object

glossary_check_updates_since(cm_info $cm, $from, $filter = array()   X-Ref
Check if the module has any update that affects the current user since a given time.

return: stdClass an object with the different type of areas indicating if they were updated or not
param: cm_info $cm course module data
param: int $from the time to check updates from
param: array $filter  if we need to check only specific updates

mod_glossary_get_fontawesome_icon_map()   X-Ref
Get icon mapping for font-awesome.

return: array

mod_glossary_core_calendar_provide_event_action(calendar_event $event,\core_calendar\action_factory $factory,int $userid = 0)   X-Ref
This function receives a calendar event and returns the action associated with it, or null if there is none.

This is used by block_myoverview in order to display the event appropriately. If null is returned then the event
is not displayed on the block.

return: \core_calendar\local\event\entities\action_interface|null
param: calendar_event $event
param: \core_calendar\action_factory $factory
param: int $userid User id to use for all capability checks, etc. Set to 0 for current user (default).

glossary_get_coursemodule_info($coursemodule)   X-Ref
Add a get_coursemodule_info function in case any glossary type wants to add 'extra' information
for the course (see resource).

Given a course_module object, this function returns any "extra" information that may be needed
when printing this activity in a course listing.  See get_array_of_activities() in course/lib.php.

return: cached_cm_info An object on information that the courses
param: stdClass $coursemodule The coursemodule object (record).

mod_glossary_get_completion_active_rule_descriptions($cm)   X-Ref
Callback which returns human-readable strings describing the active completion custom rules for the module instance.

return: array $descriptions the array of descriptions for the custom rules.
param: cm_info|stdClass $cm object with fields ->completion and ->customdata['customcompletionrules']

mod_glossary_can_delete_entry($entry, $glossary, $context, $return = true)   X-Ref
Checks if the current user can delete the given glossary entry.

return: bool if the user can delete the entry
param: stdClass $entry the entry database object
param: stdClass $glossary the glossary database object
param: stdClass $context the glossary context
param: bool $return Whether to return a boolean value or stop the execution (exception)

mod_glossary_delete_entry($entry, $glossary, $cm, $context, $course, $hook = '', $prevmode = '')   X-Ref
Deletes the given entry, this function does not perform capabilities/permission checks.

param: stdClass $entry the entry database object
param: stdClass $glossary the glossary database object
param: stdClass $cm the glossary course moduule object
param: stdClass $context the glossary context
param: stdClass $course the glossary course
param: string $hook the hook, usually type of filtering, value
param: string $prevmode the previsualisation mode

mod_glossary_can_update_entry(stdClass $entry, stdClass $glossary, stdClass $context, object $cm,bool $return = true)   X-Ref
Checks if the current user can update the given glossary entry.

return: bool if the user can update the entry
param: stdClass $entry the entry database object
param: stdClass $glossary the glossary database object
param: stdClass $context the glossary context
param: object $cm the course module object (cm record or cm_info instance)
param: bool $return Whether to return a boolean value or stop the execution (exception)

mod_glossary_prepare_entry_for_edition(stdClass $entry)   X-Ref
Prepares an entry for editing, adding aliases and category information.

return: stdClass the entry with the additional data
param: stdClass $entry the entry being edited