Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
mod_wiki_external Class Reference
Inheritance diagram for mod_wiki_external:
external_api

Static Public Member Functions

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 edit_page ($pageid, $content, $section=null)
 Edit a page contents. More...
 
static edit_page_parameters ()
 Describes the parameters for edit_page. More...
 
static edit_page_returns ()
 Describes the edit_page return value. More...
 
static external_function_info ($function, $strictness=MUST_EXIST)
 Returns detailed function information. More...
 
static get_page_contents ($pageid)
 Get a page contents. More...
 
static get_page_contents_parameters ()
 Describes the parameters for get_page_contents. More...
 
static get_page_contents_returns ()
 Describes the get_page_contents return value. More...
 
static get_page_for_editing ($pageid, $section=null, $lockonly=false)
 Locks and retrieves info of page-section to be edited. More...
 
static get_page_for_editing_parameters ()
 Describes the parameters for get_page_for_editing. More...
 
static get_page_for_editing_returns ()
 Describes the get_page_for_editing return value. More...
 
static get_subwiki_files ($wikiid, $groupid=-1, $userid=0)
 Returns the list of files from a specific subwiki. More...
 
static get_subwiki_files_parameters ()
 Describes the parameters for get_subwiki_files. More...
 
static get_subwiki_files_returns ()
 Describes the get_subwiki_pages return value. More...
 
static get_subwiki_pages ($wikiid, $groupid=-1, $userid=0, $options=array())
 Returns the list of pages from a specific subwiki. More...
 
static get_subwiki_pages_parameters ()
 Describes the parameters for get_subwiki_pages. More...
 
static get_subwiki_pages_returns ()
 Describes the get_subwiki_pages return value. More...
 
static get_subwikis ($wikiid)
 Returns the list of subwikis the user can see in a specific wiki. More...
 
static get_subwikis_parameters ()
 Describes the parameters for get_subwikis. More...
 
static get_subwikis_returns ()
 Describes the get_subwikis return value. More...
 
static get_wikis_by_courses ($courseids=array())
 Returns a list of wikis in a provided list of courses, if no list is provided all wikis that the user can view will be returned. More...
 
static get_wikis_by_courses_parameters ()
 Describes the parameters for get_wikis_by_courses. More...
 
static get_wikis_by_courses_returns ()
 Describes the get_wikis_by_courses return value. More...
 
static new_page ($title, $content, $contentformat=null, $subwikiid=null, $wikiid=null, $userid=null, $groupid=null)
 Creates a new page. More...
 
static new_page_parameters ()
 Describes the parameters for new_page. More...
 
static new_page_returns ()
 Describes the new_page 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_page ($pageid)
 Trigger the page viewed event and update the module completion status. More...
 
static view_page_parameters ()
 Describes the parameters for view_page. More...
 
static view_page_returns ()
 Describes the view_page return value. More...
 
static view_wiki ($wikiid)
 Trigger the course module viewed event and update the module completion status. More...
 
static view_wiki_parameters ()
 Describes the parameters for view_wiki. More...
 
static view_wiki_returns ()
 Describes the view_wiki return value. More...
 

Static Protected Member Functions

static determine_group_and_user ($cm, $wiki, $groupid=-1, $userid=0)
 Utility function for determining the groupid and userid to use. 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...
 

Member Function Documentation

◆ 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

◆ determine_group_and_user()

static mod_wiki_external::determine_group_and_user (   $cm,
  $wiki,
  $groupid = -1,
  $userid = 0 
)
staticprotected

Utility function for determining the groupid and userid to use.

Parameters
stdClass$cmThe course module.
stdClass$wikiThe wiki.
int$groupidGroup ID. If not defined, use current group.
int$useridUser ID. If not defined, use current user.
Return values
arrayArray containing the courseid and userid.
Since
Moodle 3.1

◆ edit_page()

static mod_wiki_external::edit_page (   $pageid,
  $content,
  $section = null 
)
static

Edit a page contents.

Parameters
int$pageidThe page ID.
string$contentPage contents.
int$sectionSection to be edited.
Return values
arrayof warnings and page data.
Since
Moodle 3.1

◆ edit_page_parameters()

static mod_wiki_external::edit_page_parameters ( )
static

Describes the parameters for edit_page.

Return values
external_function_parameters
Since
Moodle 3.1

◆ edit_page_returns()

static mod_wiki_external::edit_page_returns ( )
static

Describes the edit_page return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ 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

◆ 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 tool_lp\external, and core_competency\external.

◆ get_page_contents()

static mod_wiki_external::get_page_contents (   $pageid)
static

Get a page contents.

Parameters
int$pageidThe page ID.
Return values
arrayof warnings and page data.
Since
Moodle 3.1

◆ get_page_contents_parameters()

static mod_wiki_external::get_page_contents_parameters ( )
static

Describes the parameters for get_page_contents.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_page_contents_returns()

static mod_wiki_external::get_page_contents_returns ( )
static

Describes the get_page_contents return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ get_page_for_editing()

static mod_wiki_external::get_page_for_editing (   $pageid,
  $section = null,
  $lockonly = false 
)
static

Locks and retrieves info of page-section to be edited.

Parameters
int$pageidThe page ID.
string$sectionSection page title.
boolean$lockonlyIf true: Just renew lock and not return content.
Return values
arrayof warnings and page data.
Since
Moodle 3.1

◆ get_page_for_editing_parameters()

static mod_wiki_external::get_page_for_editing_parameters ( )
static

Describes the parameters for get_page_for_editing.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_page_for_editing_returns()

static mod_wiki_external::get_page_for_editing_returns ( )
static

Describes the get_page_for_editing return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ get_subwiki_files()

static mod_wiki_external::get_subwiki_files (   $wikiid,
  $groupid = -1,
  $userid = 0 
)
static

Returns the list of files from a specific subwiki.

Parameters
int$wikiidThe wiki instance ID.
int$groupidThe group ID. If not defined, use current group.
int$useridThe user ID. If not defined, use current user.
Return values
arrayContaining a list of warnings and a list of files.
Since
Moodle 3.1
Exceptions
moodle_exception

◆ get_subwiki_files_parameters()

static mod_wiki_external::get_subwiki_files_parameters ( )
static

Describes the parameters for get_subwiki_files.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_subwiki_files_returns()

static mod_wiki_external::get_subwiki_files_returns ( )
static

Describes the get_subwiki_pages return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ get_subwiki_pages()

static mod_wiki_external::get_subwiki_pages (   $wikiid,
  $groupid = -1,
  $userid = 0,
  $options = array() 
)
static

Returns the list of pages from a specific subwiki.

Parameters
int$wikiidThe wiki instance ID.
int$groupidThe group ID. If not defined, use current group.
int$useridThe user ID. If not defined, use current user.
array$optionsSeveral options like sort by, sort direction, ...
Return values
arrayContaining a list of warnings and a list of pages.
Since
Moodle 3.1

◆ get_subwiki_pages_parameters()

static mod_wiki_external::get_subwiki_pages_parameters ( )
static

Describes the parameters for get_subwiki_pages.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_subwiki_pages_returns()

static mod_wiki_external::get_subwiki_pages_returns ( )
static

Describes the get_subwiki_pages return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ get_subwikis()

static mod_wiki_external::get_subwikis (   $wikiid)
static

Returns the list of subwikis the user can see in a specific wiki.

Parameters
int$wikiidThe wiki instance ID.
Return values
arrayContaining a list of warnings and a list of subwikis.
Since
Moodle 3.1

◆ get_subwikis_parameters()

static mod_wiki_external::get_subwikis_parameters ( )
static

Describes the parameters for get_subwikis.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_subwikis_returns()

static mod_wiki_external::get_subwikis_returns ( )
static

Describes the get_subwikis return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ get_wikis_by_courses()

static mod_wiki_external::get_wikis_by_courses (   $courseids = array())
static

Returns a list of wikis in a provided list of courses, if no list is provided all wikis that the user can view will be returned.

Parameters
array$courseidsThe courses IDs.
Return values
arrayContaining a list of warnings and a list of wikis.
Since
Moodle 3.1

◆ get_wikis_by_courses_parameters()

static mod_wiki_external::get_wikis_by_courses_parameters ( )
static

Describes the parameters for get_wikis_by_courses.

Return values
external_function_parameters
Since
Moodle 3.1

◆ get_wikis_by_courses_returns()

static mod_wiki_external::get_wikis_by_courses_returns ( )
static

Describes the get_wikis_by_courses return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ new_page()

static mod_wiki_external::new_page (   $title,
  $content,
  $contentformat = null,
  $subwikiid = null,
  $wikiid = null,
  $userid = null,
  $groupid = null 
)
static

Creates a new page.

Parameters
string$titleNew page title.
string$contentPage contents.
int$contentformatPage contents format. If an invalid format is provided, default wiki format is used.
int$subwikiidThe Subwiki ID where to store the page.
int$wikiidPage::'s wiki ID. Used if subwiki does not exists.
int$useridSubwiki::'s user ID. Used if subwiki does not exists.
int$groupidSubwiki::'s group ID. Used if subwiki does not exists.
Return values
arrayof warnings and page data.
Since
Moodle 3.1

◆ new_page_parameters()

static mod_wiki_external::new_page_parameters ( )
static

Describes the parameters for new_page.

Return values
external_function_parameters
Since
Moodle 3.1

◆ new_page_returns()

static mod_wiki_external::new_page_returns ( )
static

Describes the new_page 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_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_page()

static mod_wiki_external::view_page (   $pageid)
static

Trigger the page viewed event and update the module completion status.

Parameters
int$pageidThe page ID.
Return values
arrayof warnings and status result.
Since
Moodle 3.1
Exceptions
moodle_exceptionif page is not valid.

◆ view_page_parameters()

static mod_wiki_external::view_page_parameters ( )
static

Describes the parameters for view_page.

Return values
external_function_parameters
Since
Moodle 3.1

◆ view_page_returns()

static mod_wiki_external::view_page_returns ( )
static

Describes the view_page return value.

Return values
external_single_structure
Since
Moodle 3.1

◆ view_wiki()

static mod_wiki_external::view_wiki (   $wikiid)
static

Trigger the course module viewed event and update the module completion status.

Parameters
int$wikiidThe wiki instance ID.
Return values
arrayof warnings and status result.
Since
Moodle 3.1

◆ view_wiki_parameters()

static mod_wiki_external::view_wiki_parameters ( )
static

Describes the parameters for view_wiki.

Return values
external_function_parameters
Since
Moodle 3.1

◆ view_wiki_returns()

static mod_wiki_external::view_wiki_returns ( )
static

Describes the view_wiki return value.

Return values
external_single_structure
Since
Moodle 3.1

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