Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class: mod_wiki_external  - X-Ref

Wiki module external functions.

get_wikis_by_courses_parameters()   X-Ref
Describes the parameters for get_wikis_by_courses.

return: external_function_parameters

get_wikis_by_courses($courseids = array()   X-Ref
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.

param: array $courseids The courses IDs.
return: array Containing a list of warnings and a list of wikis.

get_wikis_by_courses_returns()   X-Ref
Describes the get_wikis_by_courses return value.

return: external_single_structure

view_wiki_parameters()   X-Ref
Describes the parameters for view_wiki.

return: external_function_parameters

view_wiki($wikiid)   X-Ref
Trigger the course module viewed event and update the module completion status.

param: int $wikiid The wiki instance ID.
return: array of warnings and status result.

view_wiki_returns()   X-Ref
Describes the view_wiki return value.

return: external_single_structure

view_page_parameters()   X-Ref
Describes the parameters for view_page.

return: external_function_parameters

view_page($pageid)   X-Ref
Trigger the page viewed event and update the module completion status.

param: int $pageid The page ID.
return: array of warnings and status result.

view_page_returns()   X-Ref
Describes the view_page return value.

return: external_single_structure

get_subwikis_parameters()   X-Ref
Describes the parameters for get_subwikis.

return: external_function_parameters

get_subwikis($wikiid)   X-Ref
Returns the list of subwikis the user can see in a specific wiki.

param: int $wikiid The wiki instance ID.
return: array Containing a list of warnings and a list of subwikis.

get_subwikis_returns()   X-Ref
Describes the get_subwikis return value.

return: external_single_structure

get_subwiki_pages_parameters()   X-Ref
Describes the parameters for get_subwiki_pages.

return: external_function_parameters

get_subwiki_pages($wikiid, $groupid = -1, $userid = 0, $options = array()   X-Ref
Returns the list of pages from a specific subwiki.

param: int $wikiid The wiki instance ID.
param: int $groupid The group ID. If not defined, use current group.
param: int $userid The user ID. If not defined, use current user.
param: array $options Several options like sort by, sort direction, ...
return: array Containing a list of warnings and a list of pages.

get_subwiki_pages_returns()   X-Ref
Describes the get_subwiki_pages return value.

return: external_single_structure

get_page_contents_parameters()   X-Ref
Describes the parameters for get_page_contents.

return: external_function_parameters

get_page_contents($pageid)   X-Ref
Get a page contents.

param: int $pageid The page ID.
return: array of warnings and page data.

get_page_contents_returns()   X-Ref
Describes the get_page_contents return value.

return: external_single_structure

get_subwiki_files_parameters()   X-Ref
Describes the parameters for get_subwiki_files.

return: external_function_parameters

get_subwiki_files($wikiid, $groupid = -1, $userid = 0)   X-Ref
Returns the list of files from a specific subwiki.

param: int $wikiid The wiki instance ID.
param: int $groupid The group ID. If not defined, use current group.
param: int $userid The user ID. If not defined, use current user.
return: array Containing a list of warnings and a list of files.

get_subwiki_files_returns()   X-Ref
Describes the get_subwiki_pages return value.

return: external_single_structure

determine_group_and_user($cm, $wiki, $groupid = -1, $userid = 0)   X-Ref
Utility function for determining the groupid and userid to use.

param: stdClass $cm The course module.
param: stdClass $wiki The wiki.
param: int $groupid Group ID. If not defined, use current group.
param: int $userid User ID. If not defined, use current user.
return: array Array containing the courseid and userid.

get_page_for_editing_parameters()   X-Ref
Describes the parameters for get_page_for_editing.

return: external_function_parameters

get_page_for_editing($pageid, $section = null, $lockonly = false)   X-Ref
Locks and retrieves info of page-section to be edited.

param: int $pageid The page ID.
param: string $section Section page title.
param: boolean $lockonly If true: Just renew lock and not return content.
return: array of warnings and page data.

get_page_for_editing_returns()   X-Ref
Describes the get_page_for_editing return value.

return: external_single_structure

new_page_parameters()   X-Ref
Describes the parameters for new_page.

return: external_function_parameters

new_page($title, $content, $contentformat = null, $subwikiid = null, $wikiid = null, $userid = null,$groupid = null)   X-Ref
Creates a new page.

param: string $title New page title.
param: string $content Page contents.
param: int $contentformat Page contents format. If an invalid format is provided, default wiki format is used.
param: int $subwikiid The Subwiki ID where to store the page.
param: int $wikiid Page\'s wiki ID. Used if subwiki does not exists.
param: int $userid Subwiki\'s user ID. Used if subwiki does not exists.
param: int $groupid Subwiki\'s group ID. Used if subwiki does not exists.
return: array of warnings and page data.

new_page_returns()   X-Ref
Describes the new_page return value.

return: external_single_structure

edit_page_parameters()   X-Ref
Describes the parameters for edit_page.

return: external_function_parameters

edit_page($pageid, $content, $section = null)   X-Ref
Edit a page contents.

param: int $pageid The page ID.
param: string $content Page contents.
param: int $section Section to be edited.
return: array of warnings and page data.

edit_page_returns()   X-Ref
Describes the edit_page return value.

return: external_single_structure