Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | Static Protected Member Functions | List of all members
mod_glossary_external Class Reference
Inheritance diagram for mod_glossary_external:
external_api

Static Public Member Functions

static add_entry ($glossaryid, $concept, $definition, $definitionformat, $options=array())
 Add a new entry to a given glossary. More...
 
static add_entry_parameters ()
 Returns the description of the external function parameters. More...
 
static add_entry_returns ()
 Returns the description of the external function return value. More...
 
static call_external_function ($function, $args, $ajaxonly=false)
 Call an external function validating all params/returns correctly. More...
 
static clean_returnvalue (external_description $description, $response)
 Clean response If a response attribute is unknown from the description, we just ignore the attribute. More...
 
static external_function_info ($function, $strictness=MUST_EXIST)
 Returns detailed function information. More...
 
static get_authors ($id, $from, $limit, $options)
 Get the authors of a glossary. More...
 
static get_authors_parameters ()
 Returns the description of the external function parameters. More...
 
static get_authors_returns ()
 Returns the description of the external function return value. More...
 
static get_categories ($id, $from, $limit)
 Get the categories of a glossary. More...
 
static get_categories_parameters ()
 Returns the description of the external function parameters. More...
 
static get_categories_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_by_author ($id, $letter, $field, $sort, $from, $limit, $options)
 Browse a glossary entries by author. More...
 
static get_entries_by_author_id ($id, $authorid, $order, $sort, $from, $limit, $options)
 Browse a glossary entries by author. More...
 
static get_entries_by_author_id_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_by_author_id_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_by_author_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_by_author_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_by_category ($id, $categoryid, $from, $limit, $options)
 Browse a glossary entries by category. More...
 
static get_entries_by_category_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_by_category_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_by_date ($id, $order, $sort, $from, $limit, $options)
 Browse a glossary entries by date. More...
 
static get_entries_by_date_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_by_date_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_by_letter ($id, $letter, $from, $limit, $options)
 Browse a glossary entries by letter. More...
 
static get_entries_by_letter_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_by_letter_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_by_search ($id, $query, $fullsearch, $order, $sort, $from, $limit, $options)
 Browse a glossary entries using the search. More...
 
static get_entries_by_search_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_by_search_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_by_term ($id, $term, $from, $limit, $options)
 Browse a glossary entries using a term matching the concept or alias. More...
 
static get_entries_by_term_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_by_term_returns ()
 Returns the description of the external function return value. More...
 
static get_entries_to_approve ($id, $letter, $order, $sort, $from, $limit)
 Browse a glossary entries using a term matching the concept or alias. More...
 
static get_entries_to_approve_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entries_to_approve_returns ()
 Returns the description of the external function return value. More...
 
static get_entry_by_id ($id)
 Get an entry. More...
 
static get_entry_by_id_parameters ()
 Returns the description of the external function parameters. More...
 
static get_entry_by_id_returns ()
 Returns the description of the external function return value. More...
 
static get_glossaries_by_courses ($courseids=array())
 Returns a list of glossaries in a provided list of courses. More...
 
static get_glossaries_by_courses_parameters ()
 Describes the parameters for get_glossaries_by_courses. More...
 
static get_glossaries_by_courses_returns ()
 Describes the get_glossaries_by_courses return value. More...
 
static set_context_restriction ($context)
 Set context restriction for all following subsequent function calls. More...
 
static set_timeout ($seconds=360)
 This method has to be called before every operation that takes a longer time to finish! More...
 
static validate_context ($context)
 Makes sure user may execute functions in this context. More...
 
static validate_parameters (external_description $description, $params)
 Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown. More...
 
static view_entry ($id)
 Notify that the entry was viewed. More...
 
static view_entry_parameters ()
 Returns the description of the external function parameters. More...
 
static view_entry_returns ()
 Returns the description of the external function return value. More...
 
static view_glossary ($id, $mode)
 Notify that the course module was viewed. More...
 
static view_glossary_parameters ()
 Returns the description of the external function parameters. More...
 
static view_glossary_returns ()
 Returns the description of the external function return value. More...
 

Static Protected Member Functions

static fill_entry_details ($entry, $context)
 Fill in an entry object. More...
 
static get_browse_modes_from_display_format ($format)
 Get the browse modes from the display format. More...
 
static get_context_from_params ($param)
 Get context from passed parameters. More...
 
static get_context_parameters ()
 Returns a prepared structure to use a context parameters. More...
 
static get_entry_return_structure ($includecat=false)
 Get the return value of an entry. More...
 
static validate_glossary ($id)
 Validate a glossary via ID. More...
 

Member Function Documentation

◆ add_entry()

static mod_glossary_external::add_entry (   $glossaryid,
  $concept,
  $definition,
  $definitionformat,
  $options = array() 
)
static

Add a new entry to a given glossary.

Parameters
int$glossaryidthe glosary id
string$conceptthe glossary concept
string$definitionthe concept definition
int$definitionformatthe concept definition format
array$optionsadditional settings
Return values
arrayContaining entry and warnings.
Since
Moodle 3.2
Exceptions
moodle_exception
invalid_parameter_exception

◆ add_entry_parameters()

static mod_glossary_external::add_entry_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ add_entry_returns()

static mod_glossary_external::add_entry_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.2

◆ call_external_function()

static external_api::call_external_function (   $function,
  $args,
  $ajaxonly = false 
)
staticinherited

Call an external function validating all params/returns correctly.

Note that an external function may modify the state of the current page, so this wrapper saves and restores tha PAGE and COURSE global variables before/after calling the external function.

Parameters
string$functionA webservice function name.
array$argsParams array (named params)
boolean$ajaxonlyIf true, an extra check will be peformed to see if ajax is required.
Return values
arraycontaining keys for error (bool), exception and data.

◆ clean_returnvalue()

static external_api::clean_returnvalue ( external_description  $description,
  $response 
)
staticinherited

Clean response If a response attribute is unknown from the description, we just ignore the attribute.

If a response attribute is incorrect, invalid_response_exception is thrown. Note: this function is similar to validate parameters, however it is distinct because parameters validation must be distinct from cleaning return values.

Parameters
external_description$descriptiondescription of the return values
mixed$responsethe actual response
Return values
mixedresponse with added defaults for optional items, invalid_response_exception thrown if any problem found
Author
2010 Jerome Mouneyrac
Since
Moodle 2.0

◆ external_function_info()

static external_api::external_function_info (   $function,
  $strictness = MUST_EXIST 
)
staticinherited

Returns detailed function information.

Parameters
string | object$functionname of external function or record from external_function
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found
Return values
stdClassdescription or false if not found or exception thrown
Since
Moodle 2.0

◆ fill_entry_details()

static mod_glossary_external::fill_entry_details (   $entry,
  $context 
)
staticprotected

Fill in an entry object.

This adds additional required fields for the external function to return.

Parameters
stdClass$entryThe entry.
context$contextThe context the entry belongs to.
Return values
void

◆ get_authors()

static mod_glossary_external::get_authors (   $id,
  $from,
  $limit,
  $options 
)
static

Get the authors of a glossary.

Parameters
int$idThe glossary ID.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, authors and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception

◆ get_authors_parameters()

static mod_glossary_external::get_authors_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_authors_returns()

static mod_glossary_external::get_authors_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_browse_modes_from_display_format()

static mod_glossary_external::get_browse_modes_from_display_format (   $format)
staticprotected

Get the browse modes from the display format.

This returns some of the terms that can be used when reporting a glossary being viewed.

Parameters
string$formatThe display format of the glossary.
Return values
arrayContaining some of all of the following: letter, cat, date, author.

◆ get_categories()

static mod_glossary_external::get_categories (   $id,
  $from,
  $limit 
)
static

Get the categories of a glossary.

Parameters
int$idThe glossary ID.
int$fromStart returning records from here.
int$limitNumber of records to return.
Return values
arrayContaining count, categories and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception

◆ get_categories_parameters()

static mod_glossary_external::get_categories_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_categories_returns()

static mod_glossary_external::get_categories_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_context_from_params()

static external_api::get_context_from_params (   $param)
staticprotectedinherited

Get context from passed parameters.

The passed array must either contain a contextid or a combination of context level and instance id to fetch the context. For example, the context level can be "course" and instanceid can be courseid.

See context_helper::get_all_levels() for a list of valid context levels.

Parameters
array$param
Since
Moodle 2.6
Exceptions
invalid_parameter_exception
Return values
context

◆ get_context_parameters()

static external_api::get_context_parameters ( )
staticprotectedinherited

Returns a prepared structure to use a context parameters.

Return values
external_single_structure

Reimplemented in core_competency\external, and tool_lp\external.

◆ get_entries_by_author()

static mod_glossary_external::get_entries_by_author (   $id,
  $letter,
  $field,
  $sort,
  $from,
  $limit,
  $options 
)
static

Browse a glossary entries by author.

Parameters
int$idThe glossary ID.
string$letterA letter, or a special keyword.
string$fieldThe field to search from.
string$sortThe direction of the order.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ get_entries_by_author_id()

static mod_glossary_external::get_entries_by_author_id (   $id,
  $authorid,
  $order,
  $sort,
  $from,
  $limit,
  $options 
)
static

Browse a glossary entries by author.

Parameters
int$idThe glossary ID.
int$authoridThe author ID.
string$orderThe way to order the results.
string$sortThe direction of the order.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ get_entries_by_author_id_parameters()

static mod_glossary_external::get_entries_by_author_id_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_by_author_id_returns()

static mod_glossary_external::get_entries_by_author_id_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entries_by_author_parameters()

static mod_glossary_external::get_entries_by_author_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_by_author_returns()

static mod_glossary_external::get_entries_by_author_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entries_by_category()

static mod_glossary_external::get_entries_by_category (   $id,
  $categoryid,
  $from,
  $limit,
  $options 
)
static

Browse a glossary entries by category.

Parameters
int$idThe glossary ID.
int$categoryidThe category ID.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ get_entries_by_category_parameters()

static mod_glossary_external::get_entries_by_category_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_by_category_returns()

static mod_glossary_external::get_entries_by_category_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entries_by_date()

static mod_glossary_external::get_entries_by_date (   $id,
  $order,
  $sort,
  $from,
  $limit,
  $options 
)
static

Browse a glossary entries by date.

Parameters
int$idThe glossary ID.
string$orderThe way to order the records.
string$sortThe direction of the order.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ get_entries_by_date_parameters()

static mod_glossary_external::get_entries_by_date_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_by_date_returns()

static mod_glossary_external::get_entries_by_date_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entries_by_letter()

static mod_glossary_external::get_entries_by_letter (   $id,
  $letter,
  $from,
  $limit,
  $options 
)
static

Browse a glossary entries by letter.

Parameters
int$idThe glossary ID.
string$letterA letter, or a special keyword.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ get_entries_by_letter_parameters()

static mod_glossary_external::get_entries_by_letter_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_by_letter_returns()

static mod_glossary_external::get_entries_by_letter_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entries_by_search()

static mod_glossary_external::get_entries_by_search (   $id,
  $query,
  $fullsearch,
  $order,
  $sort,
  $from,
  $limit,
  $options 
)
static

Browse a glossary entries using the search.

Parameters
int$idThe glossary ID.
string$queryThe search query.
bool$fullsearchWhether or not full search is required.
string$orderThe way to order the results.
string$sortThe direction of the order.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ get_entries_by_search_parameters()

static mod_glossary_external::get_entries_by_search_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_by_search_returns()

static mod_glossary_external::get_entries_by_search_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entries_by_term()

static mod_glossary_external::get_entries_by_term (   $id,
  $term,
  $from,
  $limit,
  $options 
)
static

Browse a glossary entries using a term matching the concept or alias.

Parameters
int$idThe glossary ID.
string$termThe term.
int$fromStart returning records from here.
int$limitNumber of records to return.
array$optionsArray of options.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception

◆ get_entries_by_term_parameters()

static mod_glossary_external::get_entries_by_term_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_by_term_returns()

static mod_glossary_external::get_entries_by_term_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entries_to_approve()

static mod_glossary_external::get_entries_to_approve (   $id,
  $letter,
  $order,
  $sort,
  $from,
  $limit 
)
static

Browse a glossary entries using a term matching the concept or alias.

Parameters
int$idThe glossary ID.
string$letterA letter, or a special keyword.
string$orderThe way to order the records.
string$sortThe direction of the order.
int$fromStart returning records from here.
int$limitNumber of records to return.
Return values
arrayContaining count, entries and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception

◆ get_entries_to_approve_parameters()

static mod_glossary_external::get_entries_to_approve_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entries_to_approve_returns()

static mod_glossary_external::get_entries_to_approve_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entry_by_id()

static mod_glossary_external::get_entry_by_id (   $id)
static

Get an entry.

Parameters
int$idThe entry ID.
Return values
arrayContaining entry and warnings.
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ get_entry_by_id_parameters()

static mod_glossary_external::get_entry_by_id_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_entry_by_id_returns()

static mod_glossary_external::get_entry_by_id_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ get_entry_return_structure()

static mod_glossary_external::get_entry_return_structure (   $includecat = false)
staticprotected

Get the return value of an entry.

Parameters
bool$includecatWhether the definition should include category info.
Return values
external_definition

◆ get_glossaries_by_courses()

static mod_glossary_external::get_glossaries_by_courses (   $courseids = array())
static

Returns a list of glossaries in a provided list of courses.

If no list is provided all glossaries that the user can view will be returned.

Parameters
array$courseidsthe course IDs.
Return values
arrayof glossaries
Since
Moodle 3.1

◆ get_glossaries_by_courses_parameters()

static mod_glossary_external::get_glossaries_by_courses_parameters ( )
static

Describes the parameters for get_glossaries_by_courses.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_glossaries_by_courses_returns()

static mod_glossary_external::get_glossaries_by_courses_returns ( )
static

Describes the get_glossaries_by_courses return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ set_context_restriction()

static external_api::set_context_restriction (   $context)
staticinherited

Set context restriction for all following subsequent function calls.

Parameters
stdClass$contextthe context restriction
Since
Moodle 2.0

◆ set_timeout()

static external_api::set_timeout (   $seconds = 360)
staticinherited

This method has to be called before every operation that takes a longer time to finish!

Parameters
int$secondsmax expected time the next operation needs
Since
Moodle 2.0

◆ validate_context()

static external_api::validate_context (   $context)
staticinherited

Makes sure user may execute functions in this context.

Parameters
stdClass$context
Since
Moodle 2.0

◆ validate_glossary()

static mod_glossary_external::validate_glossary (   $id)
staticprotected

Validate a glossary via ID.

Parameters
int$idThe glossary ID.
Return values
arrayContains glossary, context, course and cm.

◆ validate_parameters()

static external_api::validate_parameters ( external_description  $description,
  $params 
)
staticinherited

Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.

This is a simple recursive method which is intended to be called from each implementation method of external API.

Parameters
external_description$descriptiondescription of parameters
mixed$paramsthe actual parameters
Return values
mixedparams with added defaults for optional items, invalid_parameters_exception thrown if any problem found
Since
Moodle 2.0

◆ view_entry()

static mod_glossary_external::view_entry (   $id)
static

Notify that the entry was viewed.

Parameters
int$idThe entry ID.
Return values
arrayof warnings and status result
Since
Moodle 3.1
Exceptions
moodle_exception
invalid_parameter_exception

◆ view_entry_parameters()

static mod_glossary_external::view_entry_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ view_entry_returns()

static mod_glossary_external::view_entry_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

◆ view_glossary()

static mod_glossary_external::view_glossary (   $id,
  $mode 
)
static

Notify that the course module was viewed.

Parameters
int$idThe glossary instance ID.
string$modeThe view mode.
Return values
arrayof warnings and status result
Since
Moodle 3.1
Exceptions
moodle_exception

◆ view_glossary_parameters()

static mod_glossary_external::view_glossary_parameters ( )
static

Returns the description of the external function parameters.

Return values
external_function_parameters
Since
Moodle 3.1

◆ view_glossary_returns()

static mod_glossary_external::view_glossary_returns ( )
static

Returns the description of the external function return value.

Return values
external_description
Since
Moodle 3.1

The documentation for this class was generated from the following file: