Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Static Public Member Functions | |
static | add_submission ($workshopid, $title, $content='', $contentformat=FORMAT_MOODLE, $inlineattachmentsid=0, $attachmentsid=0) |
Add a new submission to a given workshop. More... | |
static | add_submission_parameters () |
Returns the description of the external function parameters. More... | |
static | add_submission_returns () |
Returns the description of the external function return value. More... | |
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 | delete_submission ($submissionid) |
Deletes the given submission. More... | |
static | delete_submission_parameters () |
Returns the description of the external function parameters. More... | |
static | delete_submission_returns () |
Returns the description of the external function return value. More... | |
static | evaluate_assessment ($assessmentid, $feedbacktext='', $feedbackformat=FORMAT_MOODLE, $weight=1, $gradinggradeover='') |
Evaluates an assessment (used by teachers for provide feedback to the reviewer). More... | |
static | evaluate_assessment_parameters () |
Returns the description of the external function parameters. More... | |
static | evaluate_assessment_returns () |
Returns description of method result value. More... | |
static | evaluate_submission ($submissionid, $feedbacktext='', $feedbackformat=FORMAT_MOODLE, $published=1, $gradeover='') |
Evaluates a submission (used by teachers for provide feedback or override the submission grade). More... | |
static | evaluate_submission_parameters () |
Returns the description of the external function parameters. More... | |
static | evaluate_submission_returns () |
Returns description of method result value. More... | |
static | external_function_info ($function, $strictness=MUST_EXIST) |
Returns detailed function information. More... | |
static | get_assessment ($assessmentid) |
Retrieves the given assessment. More... | |
static | get_assessment_form_definition ($assessmentid, $mode='assessment') |
Retrieves the assessment form definition (data required to be able to display the assessment form). More... | |
static | get_assessment_form_definition_parameters () |
Returns the description of the external function parameters. More... | |
static | get_assessment_form_definition_returns () |
Returns description of method result value. More... | |
static | get_assessment_parameters () |
Returns the description of the external function parameters. More... | |
static | get_assessment_returns () |
Returns description of method result value. More... | |
static | get_grades ($workshopid, $userid=0) |
Returns the grades information for the given workshop and user. More... | |
static | get_grades_parameters () |
Returns the description of the external function parameters. More... | |
static | get_grades_report ($workshopid, $groupid=0, $sortby='lastname', $sortdirection='ASC', $page=0, $perpage=0) |
Retrieves the assessment grades report. More... | |
static | get_grades_report_parameters () |
Returns description of method parameters. More... | |
static | get_grades_report_returns () |
Returns description of method result value. More... | |
static | get_grades_returns () |
Returns description of method result value. More... | |
static | get_reviewer_assessments ($workshopid, $userid=0) |
Retrieves all the assessments reviewed by the given user. More... | |
static | get_reviewer_assessments_parameters () |
Returns the description of the external function parameters. More... | |
static | get_reviewer_assessments_returns () |
Returns description of method result value. More... | |
static | get_submission ($submissionid) |
Retrieves the given submission. More... | |
static | get_submission_assessments ($submissionid) |
Retrieves the given submission assessments. More... | |
static | get_submission_assessments_parameters () |
Returns the description of the external function parameters. More... | |
static | get_submission_assessments_returns () |
Returns description of method result value. More... | |
static | get_submission_parameters () |
Returns the description of the external function parameters. More... | |
static | get_submission_returns () |
Returns description of method result value. More... | |
static | get_submissions ($workshopid, $userid=0, $groupid=0, $page=0, $perpage=0) |
Retrieves all the workshop submissions visible by the current user or the one done by the given user (except example submissions). More... | |
static | get_submissions_parameters () |
Returns description of method parameters. More... | |
static | get_submissions_returns () |
Returns description of method result value. More... | |
static | get_user_plan ($workshopid, $userid=0) |
Return the planner information for the given user. More... | |
static | get_user_plan_parameters () |
Describes the parameters for get_user_plan. More... | |
static | get_user_plan_returns () |
Describes the get_user_plan return value. More... | |
static | get_workshop_access_information ($workshopid) |
Return access information for a given workshop. More... | |
static | get_workshop_access_information_parameters () |
Describes the parameters for get_workshop_access_information. More... | |
static | get_workshop_access_information_returns () |
Describes the get_workshop_access_information return value. More... | |
static | get_workshops_by_courses ($courseids=array()) |
Returns a list of workshops in a provided list of courses. More... | |
static | get_workshops_by_courses_parameters () |
Describes the parameters for get_workshops_by_courses. More... | |
static | get_workshops_by_courses_returns () |
Describes the get_workshops_by_courses 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 | update_assessment ($assessmentid, $data) |
Updates an assessment. More... | |
static | update_assessment_parameters () |
Returns the description of the external function parameters. More... | |
static | update_assessment_returns () |
Returns description of method result value. More... | |
static | update_submission ($submissionid, $title, $content='', $contentformat=FORMAT_MOODLE, $inlineattachmentsid=0, $attachmentsid=0) |
Updates the given submission. More... | |
static | update_submission_parameters () |
Returns the description of the external function parameters. More... | |
static | update_submission_returns () |
Returns the description of the external function return value. 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_submission ($submissionid) |
Trigger the submission viewed event. More... | |
static | view_submission_parameters () |
Describes the parameters for view_submission. More... | |
static | view_submission_returns () |
Describes the view_submission return value. More... | |
static | view_workshop ($workshopid) |
Trigger the course module viewed event and update the module completion status. More... | |
static | view_workshop_parameters () |
Describes the parameters for view_workshop. More... | |
static | view_workshop_returns () |
Describes the view_workshop return value. More... | |
Static Protected Member Functions | |
static | check_view_submission_assessments ($submission, workshop $workshop) |
Helper method for validating if the current user can view the submission assessments. 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... | |
static | prepare_assessment_for_external ($assessment, workshop $workshop) |
Helper method for returning the assessment data according the current user capabilities and current phase. More... | |
static | prepare_submission_for_external ($submission, workshop $workshop, $canviewauthorpublished=null, $canviewauthornames=null, $canviewallsubmissions=null) |
Helper method for returning the submission data according the current user capabilities and current phase. More... | |
static | validate_submission ($submission, workshop $workshop) |
Helper method for validating a submission. More... | |
static | validate_workshop ($workshopid) |
Utility function for validating a workshop. More... | |
|
static |
Add a new submission to a given workshop.
int | $workshopid | the workshop id |
string | $title | the submission title |
string | $content | the submission text content |
int | $contentformat | the format used for the content |
int | $inlineattachmentsid | the draft file area id for inline attachments in the content |
int | $attachmentsid | the draft file area id for attachments |
array | Containing the new created submission id and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
Returns the description of the external function return value.
external_description |
|
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. |
|
staticprotected |
Helper method for validating if the current user can view the submission assessments.
stdClass | $submission | submission object |
workshop | $workshop | workshop instance |
void |
|
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 |
|
static |
Deletes the given submission.
int | $submissionid | the submission id. |
array | containing the result status and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
Returns the description of the external function return value.
external_description |
|
static |
Evaluates an assessment (used by teachers for provide feedback to the reviewer).
int | $assessmentid | the assessment id |
str | $feedbacktext | the feedback for the reviewer |
int | $feedbackformat | the feedback format for the reviewer text |
int | $weight | the new weight for the assessment |
mixed | $gradinggradeover | the new grading grade (empty for no overriding the grade) |
array | containing the status and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
|
static |
Evaluates a submission (used by teachers for provide feedback or override the submission grade).
int | $submissionid | the submission id |
str | $feedbacktext | the feedback for the author |
int | $feedbackformat | the feedback format for the reviewer text |
bool | $published | whether to publish the submission for other users |
mixed | $gradeover | the new submission grade (empty for no overriding the grade) |
array | containing the status and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
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 |
|
static |
Retrieves the given assessment.
int | $assessmentid | the assessment id |
array | containing the assessment and warnings. |
moodle_exception |
|
static |
Retrieves the assessment form definition (data required to be able to display the assessment form).
int | $assessmentid | the assessment id |
string | $mode | the form mode (assessment or preview) |
array | containing the assessment and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
|
static |
Returns the description of the external function parameters.
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 grades information for the given workshop and user.
int | $workshopid | workshop instance id |
int | $userid | user id |
array | of warnings and the user plan |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_external_function_parameters |
|
static |
Retrieves the assessment grades report.
int | $workshopid | the workshop instance id |
int | $groupid | (optional) group id, 0 means that the function will determine the user group |
string | $sortby | sort by this element |
string | $sortdirection | sort direction: ASC or DESC |
int | $page | page of records to return |
int | $perpage | number of records to return per page |
array | of warnings and the report data |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
|
static |
Retrieves all the assessments reviewed by the given user.
int | $workshopid | the workshop instance id |
int | $userid | the reviewer user id |
array | containing the user assessments and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
|
static |
Retrieves the given submission.
int | $submissionid | the submission id |
array | containing the submission and warnings. |
moodle_exception |
|
static |
Retrieves the given submission assessments.
int | $submissionid | the submission id |
array | containing the assessments and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
|
static |
Retrieves all the workshop submissions visible by the current user or the one done by the given user (except example submissions).
int | $workshopid | the workshop instance id |
int | $userid | get submissions done by this user |
int | $groupid | (optional) group id, 0 means that the function will determine the user group |
int | $page | page of records to return |
int | $perpage | number of records to return per page |
array | of warnings and the entries |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Return the planner information for the given user.
int | $workshopid | workshop instance id |
int | $userid | user id |
array | of warnings and the user plan |
moodle_exception |
|
static |
Describes the parameters for get_user_plan.
external_external_function_parameters |
|
static |
|
static |
Return access information for a given workshop.
int | $workshopid | workshop instance id |
array | of warnings and the access information |
moodle_exception |
|
static |
Describes the parameters for get_workshop_access_information.
external_external_function_parameters |
|
static |
Describes the get_workshop_access_information return value.
external_single_structure |
|
static |
Returns a list of workshops in a provided list of courses.
If no list is provided all workshops that the user can view will be returned.
array | $courseids | course ids |
array | of warnings and workshops |
|
static |
Describes the parameters for get_workshops_by_courses.
external_function_parameters |
|
static |
Describes the get_workshops_by_courses return value.
external_single_structure |
|
staticprotected |
Helper method for returning the assessment data according the current user capabilities and current phase.
stdClass | $assessment | the assessment data |
workshop | $workshop | the workshop class |
stdClass | object with the assessment data filtered or null if is not viewable yet |
|
staticprotected |
Helper method for returning the submission data according the current user capabilities and current phase.
stdClass | $submission | the submission data |
workshop | $workshop | the workshop class |
bool | $canviewauthorpublished | whether the user has the capability mod/workshop:viewauthorpublished on |
bool | $canviewauthornames | whether the user has the capability mod/workshop:vviewauthornames on |
bool | $canviewallsubmissions | whether the user has the capability mod/workshop:viewallsubmissions on |
stdClass | object with the submission data filtered |
|
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 |
|
static |
Updates an assessment.
int | $assessmentid | the assessment id |
array | $data | the assessment data |
array | indicates if the assessment was updated, the new raw grade and possible warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
|
static |
Updates the given submission.
int | $submissionid | the submission id |
string | $title | the submission title |
string | $content | the submission text content |
int | $contentformat | the format used for the content |
int | $inlineattachmentsid | the draft file area id for inline attachments in the content |
int | $attachmentsid | the draft file area id for attachments |
array | whether the submission was updated and warnings. |
moodle_exception |
|
static |
Returns the description of the external function parameters.
external_function_parameters |
|
static |
Returns the description of the external function return value.
external_description |
|
staticinherited |
Makes sure user may execute functions in this context.
stdClass | $context |
|
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 |
|
staticprotected |
Helper method for validating a submission.
stdClass | $submission | submission object |
workshop | $workshop | workshop instance |
void |
|
staticprotected |
Utility function for validating a workshop.
int | $workshopid | workshop instance id |
array | array containing the workshop object, course, context and course module objects |
|
static |
Trigger the submission viewed event.
int | $submissionid | submission id |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for view_submission.
external_function_parameters |
|
static |
|
static |
Trigger the course module viewed event and update the module completion status.
int | $workshopid | workshop instance id |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for view_workshop.
external_function_parameters |
|
static |