Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
|
Wiki module external functions. More...
Static Public Member Functions | |
static | call_external_function ($function, $args, $ajaxonly=false) |
Call an external function validating all params/returns correctly. | |
static | clean_returnvalue (external_description $description, $response) |
Clean response If a response attribute is unknown from the description, we just ignore the attribute. | |
static | edit_page ($pageid, $content, $section=null) |
Edit a page contents. | |
static | edit_page_parameters () |
Describes the parameters for edit_page. | |
static | edit_page_returns () |
Describes the edit_page return value. | |
static | external_function_info ($function, $strictness=MUST_EXIST) |
Returns detailed function information. | |
static | get_page_contents ($pageid) |
Get a page contents. | |
static | get_page_contents_parameters () |
Describes the parameters for get_page_contents. | |
static | get_page_contents_returns () |
Describes the get_page_contents return value. | |
static | get_page_for_editing ($pageid, $section=null, $lockonly=false) |
Locks and retrieves info of page-section to be edited. | |
static | get_page_for_editing_parameters () |
Describes the parameters for get_page_for_editing. | |
static | get_page_for_editing_returns () |
Describes the get_page_for_editing return value. | |
static | get_subwiki_files ($wikiid, $groupid=-1, $userid=0) |
Returns the list of files from a specific subwiki. | |
static | get_subwiki_files_parameters () |
Describes the parameters for get_subwiki_files. | |
static | get_subwiki_files_returns () |
Describes the get_subwiki_pages return value. | |
static | get_subwiki_pages ($wikiid, $groupid=-1, $userid=0, $options=array()) |
Returns the list of pages from a specific subwiki. | |
static | get_subwiki_pages_parameters () |
Describes the parameters for get_subwiki_pages. | |
static | get_subwiki_pages_returns () |
Describes the get_subwiki_pages return value. | |
static | get_subwikis ($wikiid) |
Returns the list of subwikis the user can see in a specific wiki. | |
static | get_subwikis_parameters () |
Describes the parameters for get_subwikis. | |
static | get_subwikis_returns () |
Describes the get_subwikis return value. | |
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. | |
static | get_wikis_by_courses_parameters () |
Describes the parameters for get_wikis_by_courses. | |
static | get_wikis_by_courses_returns () |
Describes the get_wikis_by_courses return value. | |
static | new_page ($title, $content, $contentformat=null, $subwikiid=null, $wikiid=null, $userid=null, $groupid=null) |
Creates a new page. | |
static | new_page_parameters () |
Describes the parameters for new_page. | |
static | new_page_returns () |
Describes the new_page return value. | |
static | set_context_restriction ($context) |
Set context restriction for all following subsequent function calls. | |
static | set_timeout ($seconds=360) |
This method has to be called before every operation that takes a longer time to finish! | |
static | validate_context ($context) |
Makes sure user may execute functions in this context. | |
static | validate_parameters (external_description $description, $params) |
Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown. | |
static | view_page ($pageid) |
Trigger the page viewed event and update the module completion status. | |
static | view_page_parameters () |
Describes the parameters for view_page. | |
static | view_page_returns () |
Describes the view_page return value. | |
static | view_wiki ($wikiid) |
Trigger the course module viewed event and update the module completion status. | |
static | view_wiki_parameters () |
Describes the parameters for view_wiki. | |
static | view_wiki_returns () |
Describes the view_wiki return value. | |
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. | |
static | get_context_from_params ($param) |
Get context from passed parameters. | |
static | get_context_parameters () |
Returns a prepared structure to use a context parameters. | |
Wiki module external functions.
|
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.
string | $function | A webservice function name. |
array | $args | Params array (named params) |
boolean | $ajaxonly | If true, an extra check will be peformed to see if ajax is required. |
array | containing keys for error (bool), exception and data. |
|
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.
external_description | $description | description of the return values |
mixed | $response | the actual response |
mixed | response with added defaults for optional items, invalid_response_exception thrown if any problem found |
|
staticprotected |
Utility function for determining the groupid and userid to use.
stdClass | $cm | The course module. |
stdClass | $wiki | The wiki. |
int | $groupid | Group ID. If not defined, use current group. |
int | $userid | User ID. If not defined, use current user. |
array | Array containing the courseid and userid. |
|
static |
|
static |
|
static |
|
staticinherited |
Returns detailed function information.
string | object | $function | name of external function or record from external_function |
int | $strictness | IGNORE_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 |
stdClass | description or false if not found or exception thrown |
coding_exception | for any property and/or method that is missing or invalid |
|
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.
array | $param |
invalid_parameter_exception |
context |
|
staticprotectedinherited |
Returns a prepared structure to use a context parameters.
external_single_structure |
Reimplemented in core_competency\external, and tool_lp\external.
|
static |
Get a page contents.
int | $pageid | The page ID. |
array | of warnings and page data. |
|
static |
Describes the parameters for get_page_contents.
external_function_parameters |
|
static |
Describes the get_page_contents return value.
external_single_structure |
|
static |
Locks and retrieves info of page-section to be edited.
int | $pageid | The page ID. |
string | $section | Section page title. |
boolean | $lockonly | If true: Just renew lock and not return content. |
array | of warnings and page data. |
|
static |
Describes the parameters for get_page_for_editing.
external_function_parameters |
|
static |
Describes the get_page_for_editing return value.
external_single_structure |
|
static |
Returns the list of files from a specific subwiki.
int | $wikiid | The wiki instance ID. |
int | $groupid | The group ID. If not defined, use current group. |
int | $userid | The user ID. If not defined, use current user. |
array | Containing a list of warnings and a list of files. |
moodle_exception |
|
static |
Describes the parameters for get_subwiki_files.
external_function_parameters |
|
static |
Describes the get_subwiki_pages return value.
external_single_structure |
|
static |
Returns the list of pages from a specific subwiki.
int | $wikiid | The wiki instance ID. |
int | $groupid | The group ID. If not defined, use current group. |
int | $userid | The user ID. If not defined, use current user. |
array | $options | Several options like sort by, sort direction, ... |
array | Containing a list of warnings and a list of pages. |
|
static |
Describes the parameters for get_subwiki_pages.
external_function_parameters |
|
static |
Describes the get_subwiki_pages return value.
external_single_structure |
|
static |
Returns the list of subwikis the user can see in a specific wiki.
int | $wikiid | The wiki instance ID. |
array | Containing a list of warnings and a list of subwikis. |
|
static |
Describes the parameters for get_subwikis.
external_function_parameters |
|
static |
|
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.
array | $courseids | The courses IDs. |
array | Containing a list of warnings and a list of wikis. |
|
static |
Describes the parameters for get_wikis_by_courses.
external_function_parameters |
|
static |
Describes the get_wikis_by_courses return value.
external_single_structure |
|
static |
Creates a new page.
string | $title | New page title. |
string | $content | Page contents. |
int | $contentformat | Page contents format. If an invalid format is provided, default wiki format is used. |
int | $subwikiid | The Subwiki ID where to store the page. |
int | $wikiid | Page::'s wiki ID. Used if subwiki does not exists. |
int | $userid | Subwiki::'s user ID. Used if subwiki does not exists. |
int | $groupid | Subwiki::'s group ID. Used if subwiki does not exists. |
array | of warnings and page data. |
|
static |
|
static |
|
staticinherited |
Set context restriction for all following subsequent function calls.
stdClass | $context | the context restriction |
|
staticinherited |
This method has to be called before every operation that takes a longer time to finish!
int | $seconds | max expected time the next operation needs |
|
staticinherited |
|
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.
external_description | $description | description of parameters |
mixed | $params | the actual parameters |
mixed | params with added defaults for optional items, invalid_parameters_exception thrown if any problem found |
|
static |
Trigger the page viewed event and update the module completion status.
int | $pageid | The page ID. |
array | of warnings and status result. |
moodle_exception | if page is not valid. |
|
static |
|
static |
|
static |
Trigger the course module viewed event and update the module completion status.
int | $wikiid | The wiki instance ID. |
array | of warnings and status result. |
|
static |
|
static |