Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
mod_feedback_external Class Reference
Inheritance diagram for mod_feedback_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 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...
 

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

◆ 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_analysis()

static mod_feedback_external::get_analysis (   $feedbackid,
  $groupid = 0,
  $courseid = 0 
)
static

Retrieves the feedback analysis.

Parameters
array$feedbackidfeedback instance id
int$groupidgroup id, 0 means that the function will determine the user group
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and launch information
Since
Moodle 3.3

◆ get_analysis_parameters()

static mod_feedback_external::get_analysis_parameters ( )
static

Describes the parameters for get_analysis.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_analysis_returns()

static mod_feedback_external::get_analysis_returns ( )
static

Describes the get_analysis return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ 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_current_completed_tmp()

static mod_feedback_external::get_current_completed_tmp (   $feedbackid,
  $courseid = 0 
)
static

Returns the temporary completion record for the current user.

Parameters
int$feedbackidfeedback instance id
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_current_completed_tmp_parameters()

static mod_feedback_external::get_current_completed_tmp_parameters ( )
static

Describes the parameters for get_current_completed_tmp.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_current_completed_tmp_returns()

static mod_feedback_external::get_current_completed_tmp_returns ( )
static

Describes the get_current_completed_tmp return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_feedback_access_information()

static mod_feedback_external::get_feedback_access_information (   $feedbackid,
  $courseid = 0 
)
static

Return access information for a given feedback.

Parameters
int$feedbackidfeedback instance id
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and the access information
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_feedback_access_information_parameters()

static mod_feedback_external::get_feedback_access_information_parameters ( )
static

Describes the parameters for get_feedback_access_information.

Return values
external_external_function_parameters
Since
Moodle 3.3

◆ get_feedback_access_information_returns()

static mod_feedback_external::get_feedback_access_information_returns ( )
static

Describes the get_feedback_access_information return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_feedbacks_by_courses()

static mod_feedback_external::get_feedbacks_by_courses (   $courseids = array())
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.

Parameters
array$courseidscourse ids
Return values
arrayof warnings and feedbacks
Since
Moodle 3.3

◆ get_feedbacks_by_courses_parameters()

static mod_feedback_external::get_feedbacks_by_courses_parameters ( )
static

Describes the parameters for get_feedbacks_by_courses.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_feedbacks_by_courses_returns()

static mod_feedback_external::get_feedbacks_by_courses_returns ( )
static

Describes the get_feedbacks_by_courses return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_finished_responses()

static mod_feedback_external::get_finished_responses (   $feedbackid,
  $courseid = 0 
)
static

Retrieves responses from the last finished attempt.

Parameters
array$feedbackidfeedback instance id
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and the responses
Since
Moodle 3.3

◆ get_finished_responses_parameters()

static mod_feedback_external::get_finished_responses_parameters ( )
static

Describes the parameters for get_finished_responses.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_finished_responses_returns()

static mod_feedback_external::get_finished_responses_returns ( )
static

Describes the get_finished_responses return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_items()

static mod_feedback_external::get_items (   $feedbackid,
  $courseid = 0 
)
static

Returns the items (questions) in the given feedback.

Parameters
int$feedbackidfeedback instance id
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and feedbacks
Since
Moodle 3.3

◆ get_items_parameters()

static mod_feedback_external::get_items_parameters ( )
static

Describes the parameters for get_items.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_items_returns()

static mod_feedback_external::get_items_returns ( )
static

Describes the get_items return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_last_completed()

static mod_feedback_external::get_last_completed (   $feedbackid,
  $courseid = 0 
)
static

Retrieves the last completion record for the current user.

Parameters
int$feedbackidfeedback instance id
Return values
arrayof warnings and the last completed record
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_last_completed_parameters()

static mod_feedback_external::get_last_completed_parameters ( )
static

Describes the parameters for get_last_completed.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_last_completed_returns()

static mod_feedback_external::get_last_completed_returns ( )
static

Describes the get_last_completed return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_non_respondents()

static mod_feedback_external::get_non_respondents (   $feedbackid,
  $groupid = 0,
  $sort = 'lastaccess',
  $page = 0,
  $perpage = 0,
  $courseid = 0 
)
static

Retrieves a list of students who didn't submit the feedback.

Parameters
int$feedbackidfeedback instance id
int$groupidGroup id, 0 means that the function will determine the user group'
str$sortsort param, must be firstname, lastname or lastaccess (default)
int$pagethe page of records to return
int$perpagethe number of records to return per page
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and users ids
Since
Moodle 3.3

◆ get_non_respondents_parameters()

static mod_feedback_external::get_non_respondents_parameters ( )
static

Describes the parameters for get_non_respondents.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_non_respondents_returns()

static mod_feedback_external::get_non_respondents_returns ( )
static

Describes the get_non_respondents return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_page_items()

static mod_feedback_external::get_page_items (   $feedbackid,
  $page,
  $courseid = 0 
)
static

Get a single feedback page items.

Parameters
int$feedbackidfeedback instance id
int$pagethe page to get starting by 0
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and launch information
Since
Moodle 3.3

◆ get_page_items_parameters()

static mod_feedback_external::get_page_items_parameters ( )
static

Describes the parameters for get_page_items.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_page_items_returns()

static mod_feedback_external::get_page_items_returns ( )
static

Describes the get_page_items return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_responses_analysis()

static mod_feedback_external::get_responses_analysis (   $feedbackid,
  $groupid = 0,
  $page = 0,
  $perpage = 0,
  $courseid = 0 
)
static

Return the feedback user responses.

Parameters
int$feedbackidfeedback instance id
int$groupidGroup id, 0 means that the function will determine the user group
int$pagethe page of records to return
int$perpagethe number of records to return per page
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and users attemps and responses
Exceptions
moodle_exception
Since
Moodle 3.3

◆ get_responses_analysis_parameters()

static mod_feedback_external::get_responses_analysis_parameters ( )
static

Describes the parameters for get_responses_analysis.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_responses_analysis_returns()

static mod_feedback_external::get_responses_analysis_returns ( )
static

Describes the get_responses_analysis return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_unfinished_responses()

static mod_feedback_external::get_unfinished_responses (   $feedbackid,
  $courseid = 0 
)
static

Retrieves responses from the current unfinished attempt.

Parameters
array$feedbackidfeedback instance id
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and launch information
Since
Moodle 3.3

◆ get_unfinished_responses_parameters()

static mod_feedback_external::get_unfinished_responses_parameters ( )
static

Describes the parameters for get_unfinished_responses.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_unfinished_responses_returns()

static mod_feedback_external::get_unfinished_responses_returns ( )
static

Describes the get_unfinished_responses return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ launch_feedback()

static mod_feedback_external::launch_feedback (   $feedbackid,
  $courseid = 0 
)
static

Starts or continues a feedback submission.

Parameters
array$feedbackidfeedback instance id
int$courseidcourse where user completes a feedback (for site feedbacks only).
Return values
arrayof warnings and launch information
Since
Moodle 3.3

◆ launch_feedback_parameters()

static mod_feedback_external::launch_feedback_parameters ( )
static

Describes the parameters for launch_feedback.

Return values
external_function_parameters
Since
Moodle 3.3

◆ launch_feedback_returns()

static mod_feedback_external::launch_feedback_returns ( )
static

Describes the launch_feedback return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ process_page()

static mod_feedback_external::process_page (   $feedbackid,
  $page,
  $responses = [],
  $goprevious = false,
  $courseid = 0 
)
static

Process a jump between pages.

Parameters
array$feedbackidfeedback instance id
array$pagethe page being processed
array$responsesthe responses to be processed
bool$gopreviouswhether we want to jump to previous page
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and launch information
Since
Moodle 3.3

◆ process_page_parameters()

static mod_feedback_external::process_page_parameters ( )
static

Describes the parameters for process_page.

Return values
external_function_parameters
Since
Moodle 3.3

◆ process_page_returns()

static mod_feedback_external::process_page_returns ( )
static

Describes the process_page return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ 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_feedback()

static mod_feedback_external::validate_feedback (   $feedbackid,
  $courseid = 0 
)
staticprotected

Utility function for validating a feedback.

Parameters
int$feedbackidfeedback instance id
int$courseidcourseid course where user completes the feedback (for site feedbacks only)
Return values
arraycontaining the feedback, feedback course, context, course module and the course where is being completed.
Exceptions
moodle_exception
Since
Moodle 3.3

◆ validate_feedback_access()

static mod_feedback_external::validate_feedback_access (   $feedback,
  $course,
  $cm,
  $context,
  $checksubmit = false 
)
staticprotected

Utility function for validating access to feedback.

Parameters
stdClass$feedbackfeedback object
stdClass$coursecourse where user completes the feedback (for site feedbacks only)
stdClass$cmcourse module
stdClass$contextcontext object
Exceptions
moodle_exception
Return values
mod_feedback_completionfeedback completion instance
Since
Moodle 3.3

◆ 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_feedback()

static mod_feedback_external::view_feedback (   $feedbackid,
  $moduleviewed = false,
  $courseid = 0 
)
static

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

Parameters
int$feedbackidfeedback instance id
bool$moduleviewedIf we need to mark the module as viewed for completion
int$courseidcourse where user completes the feedback (for site feedbacks only)
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ view_feedback_parameters()

static mod_feedback_external::view_feedback_parameters ( )
static

Describes the parameters for view_feedback.

Return values
external_function_parameters
Since
Moodle 3.3

◆ view_feedback_returns()

static mod_feedback_external::view_feedback_returns ( )
static

Describes the view_feedback return value.

Return values
external_single_structure
Since
Moodle 3.3

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