Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
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 | external_function_info ($function, $strictness=MUST_EXIST) |
Returns detailed function information. More... | |
static | get_analysis ($feedbackid, $groupid=0, $courseid=0) |
Retrieves the feedback analysis. More... | |
static | get_analysis_parameters () |
Describes the parameters for get_analysis. More... | |
static | get_analysis_returns () |
Describes the get_analysis return value. More... | |
static | get_current_completed_tmp ($feedbackid, $courseid=0) |
Returns the temporary completion record for the current user. More... | |
static | get_current_completed_tmp_parameters () |
Describes the parameters for get_current_completed_tmp. More... | |
static | get_current_completed_tmp_returns () |
Describes the get_current_completed_tmp return value. More... | |
static | get_feedback_access_information ($feedbackid, $courseid=0) |
Return access information for a given feedback. More... | |
static | get_feedback_access_information_parameters () |
Describes the parameters for get_feedback_access_information. More... | |
static | get_feedback_access_information_returns () |
Describes the get_feedback_access_information return value. More... | |
static | get_feedbacks_by_courses ($courseids=array()) |
Returns a list of feedbacks in a provided list of courses. More... | |
static | get_feedbacks_by_courses_parameters () |
Describes the parameters for get_feedbacks_by_courses. More... | |
static | get_feedbacks_by_courses_returns () |
Describes the get_feedbacks_by_courses return value. More... | |
static | get_finished_responses ($feedbackid, $courseid=0) |
Retrieves responses from the last finished attempt. More... | |
static | get_finished_responses_parameters () |
Describes the parameters for get_finished_responses. More... | |
static | get_finished_responses_returns () |
Describes the get_finished_responses return value. More... | |
static | get_items ($feedbackid, $courseid=0) |
Returns the items (questions) in the given feedback. More... | |
static | get_items_parameters () |
Describes the parameters for get_items. More... | |
static | get_items_returns () |
Describes the get_items return value. More... | |
static | get_last_completed ($feedbackid, $courseid=0) |
Retrieves the last completion record for the current user. More... | |
static | get_last_completed_parameters () |
Describes the parameters for get_last_completed. More... | |
static | get_last_completed_returns () |
Describes the get_last_completed return value. More... | |
static | get_non_respondents ($feedbackid, $groupid=0, $sort='lastaccess', $page=0, $perpage=0, $courseid=0) |
Retrieves a list of students who didn't submit the feedback. More... | |
static | get_non_respondents_parameters () |
Describes the parameters for get_non_respondents. More... | |
static | get_non_respondents_returns () |
Describes the get_non_respondents return value. More... | |
static | get_page_items ($feedbackid, $page, $courseid=0) |
Get a single feedback page items. More... | |
static | get_page_items_parameters () |
Describes the parameters for get_page_items. More... | |
static | get_page_items_returns () |
Describes the get_page_items return value. More... | |
static | get_responses_analysis ($feedbackid, $groupid=0, $page=0, $perpage=0, $courseid=0) |
Return the feedback user responses. More... | |
static | get_responses_analysis_parameters () |
Describes the parameters for get_responses_analysis. More... | |
static | get_responses_analysis_returns () |
Describes the get_responses_analysis return value. More... | |
static | get_unfinished_responses ($feedbackid, $courseid=0) |
Retrieves responses from the current unfinished attempt. More... | |
static | get_unfinished_responses_parameters () |
Describes the parameters for get_unfinished_responses. More... | |
static | get_unfinished_responses_returns () |
Describes the get_unfinished_responses return value. More... | |
static | launch_feedback ($feedbackid, $courseid=0) |
Starts or continues a feedback submission. More... | |
static | launch_feedback_parameters () |
Describes the parameters for launch_feedback. More... | |
static | launch_feedback_returns () |
Describes the launch_feedback return value. More... | |
static | process_page ($feedbackid, $page, $responses=[], $goprevious=false, $courseid=0) |
Process a jump between pages. More... | |
static | process_page_parameters () |
Describes the parameters for process_page. More... | |
static | process_page_returns () |
Describes the process_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_feedback ($feedbackid, $moduleviewed=false, $courseid=0) |
Trigger the course module viewed event and update the module completion status. More... | |
static | view_feedback_parameters () |
Describes the parameters for view_feedback. More... | |
static | view_feedback_returns () |
Describes the view_feedback return value. More... | |
Static Protected Member Functions | |
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 | validate_feedback ($feedbackid, $courseid=0) |
Utility function for validating a feedback. More... | |
static | validate_feedback_access ($feedback, $course, $cm, $context, $checksubmit=false) |
Utility function for validating access to feedback. More... | |
|
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 |
|
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 |
|
static |
Retrieves the feedback analysis.
array | $feedbackid | feedback instance id |
int | $groupid | group id, 0 means that the function will determine the user group |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and launch information |
|
static |
Describes the parameters for get_analysis.
external_function_parameters |
|
static |
|
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 tool_lp\external, and core_competency\external.
|
static |
Returns the temporary completion record for the current user.
int | $feedbackid | feedback instance id |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for get_current_completed_tmp.
external_function_parameters |
|
static |
Describes the get_current_completed_tmp return value.
external_single_structure |
|
static |
Return access information for a given feedback.
int | $feedbackid | feedback instance id |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and the access information |
moodle_exception |
|
static |
Describes the parameters for get_feedback_access_information.
external_external_function_parameters |
|
static |
Describes the get_feedback_access_information return value.
external_single_structure |
|
static |
Returns a list of feedbacks in a provided list of courses.
If no list is provided all feedbacks that the user can view will be returned.
array | $courseids | course ids |
array | of warnings and feedbacks |
|
static |
Describes the parameters for get_feedbacks_by_courses.
external_function_parameters |
|
static |
Describes the get_feedbacks_by_courses return value.
external_single_structure |
|
static |
Retrieves responses from the last finished attempt.
array | $feedbackid | feedback instance id |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and the responses |
|
static |
Describes the parameters for get_finished_responses.
external_function_parameters |
|
static |
Describes the get_finished_responses return value.
external_single_structure |
|
static |
Returns the items (questions) in the given feedback.
int | $feedbackid | feedback instance id |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and feedbacks |
|
static |
|
static |
|
static |
Retrieves the last completion record for the current user.
int | $feedbackid | feedback instance id |
array | of warnings and the last completed record |
moodle_exception |
|
static |
Describes the parameters for get_last_completed.
external_function_parameters |
|
static |
Describes the get_last_completed return value.
external_single_structure |
|
static |
Retrieves a list of students who didn't submit the feedback.
int | $feedbackid | feedback instance id |
int | $groupid | Group id, 0 means that the function will determine the user group' |
str | $sort | sort param, must be firstname, lastname or lastaccess (default) |
int | $page | the page of records to return |
int | $perpage | the number of records to return per page |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and users ids |
|
static |
Describes the parameters for get_non_respondents.
external_function_parameters |
|
static |
Describes the get_non_respondents return value.
external_single_structure |
|
static |
Get a single feedback page items.
int | $feedbackid | feedback instance id |
int | $page | the page to get starting by 0 |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and launch information |
|
static |
Describes the parameters for get_page_items.
external_function_parameters |
|
static |
|
static |
Return the feedback user responses.
int | $feedbackid | feedback instance id |
int | $groupid | Group id, 0 means that the function will determine the user group |
int | $page | the page of records to return |
int | $perpage | the number of records to return per page |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and users attemps and responses |
moodle_exception |
|
static |
Describes the parameters for get_responses_analysis.
external_function_parameters |
|
static |
Describes the get_responses_analysis return value.
external_single_structure |
|
static |
Retrieves responses from the current unfinished attempt.
array | $feedbackid | feedback instance id |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and launch information |
|
static |
Describes the parameters for get_unfinished_responses.
external_function_parameters |
|
static |
Describes the get_unfinished_responses return value.
external_single_structure |
|
static |
Starts or continues a feedback submission.
array | $feedbackid | feedback instance id |
int | $courseid | course where user completes a feedback (for site feedbacks only). |
array | of warnings and launch information |
|
static |
Describes the parameters for launch_feedback.
external_function_parameters |
|
static |
|
static |
Process a jump between pages.
array | $feedbackid | feedback instance id |
array | $page | the page being processed |
array | $responses | the responses to be processed |
bool | $goprevious | whether we want to jump to previous page |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and launch information |
|
static |
Describes the parameters for process_page.
external_function_parameters |
|
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 |
Makes sure user may execute functions in this context.
stdClass | $context |
|
staticprotected |
Utility function for validating a feedback.
int | $feedbackid | feedback instance id |
int | $courseid | courseid course where user completes the feedback (for site feedbacks only) |
array | containing the feedback, feedback course, context, course module and the course where is being completed. |
moodle_exception |
|
staticprotected |
Utility function for validating access to feedback.
stdClass | $feedback | feedback object |
stdClass | $course | course where user completes the feedback (for site feedbacks only) |
stdClass | $cm | course module |
stdClass | $context | context object |
moodle_exception |
mod_feedback_completion | feedback completion instance |
|
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 course module viewed event and update the module completion status.
int | $feedbackid | feedback instance id |
bool | $moduleviewed | If we need to mark the module as viewed for completion |
int | $courseid | course where user completes the feedback (for site feedbacks only) |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for view_feedback.
external_function_parameters |
|
static |