Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 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: 0 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

param: object $glossary
return: int

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.

param: object $glossary
return: bool

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.

param: int $id glossary id
return: bool success

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

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

glossary_get_user_entries($glossaryid, $userid)   X-Ref

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

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

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
return: void adds items into $activities and increases $index

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

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
return: void

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.

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

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.

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

glossary_rating_permissions($contextid, $component, $ratingarea)   X-Ref
Return rating related 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
return: array an associative array of the user's rating permissions

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

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

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

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

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

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

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

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

glossary_get_entries_search($concept, $courseid)   X-Ref

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

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

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
return: mixed

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

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

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

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

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

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

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

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.
return: void

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.

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

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

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

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.

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

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

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

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

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
return: file_info_stored file_info_stored instance or null if not found

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

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
return: bool false if file not found, does not return if found - justsend the file

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

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

glossary_print_entry_ratings($course, $entry)   X-Ref

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

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

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

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

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

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

param: string $file
return: string

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

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

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

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

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

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

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

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

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

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

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

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

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. ;-)

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
return: string

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: MoodleQuickForm $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.

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

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

return: array

glossary_supports($feature)   X-Ref

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

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.

param: stdClass $comment_param {
return: array

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

param: stdClass $comment_param {
return: boolean

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

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

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.

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:
return: array The first element being the recordset, the second the number of entries.

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

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:
return: array The first element being the recordset, the second the number of entries.

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

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:
return: array The first element being the recordset, the second the number of entries.

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

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:
return: array The first element being the recordset, the second the number of entries.

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.

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:
return: array The first element being the recordset, the second the number of entries.

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

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:
return: array The first element being the recordset, the second the number of entries.

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

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

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.

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.
return: array The first element being the where clause, the second array of parameters.

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.

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:
return: array The first element being the array of results, the second the number of entries.

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

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:
return: array The first element being the recordset, the second the number of entries.

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

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.
return: array The first element being the recordset, the second the number of entries.

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

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

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

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

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

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

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

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

glossary_edit_entry($entry, $course, $cm, $glossary, $context)   X-Ref
Creates or updates a glossary 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
return: stdClass the complete new or updated entry

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.

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
return: stdClass an object with the different type of areas indicating if they were updated or not

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.

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).
return: \core_calendar\local\event\entities\action_interface|null

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.

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

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.

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

mod_glossary_can_delete_entry($entry, $glossary, $context, $return = true)   X-Ref
Checks if the current user can delete the given glossary 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)
return: bool if the user can delete the entry

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.

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)
return: bool if the user can update the entry

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

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