Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

Workshop external API

Copyright: 2017 Juan Leyva <juan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2141 lines (92 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

mod_workshop_external:: (62 methods):
  get_workshops_by_courses_parameters()
  get_workshops_by_courses()
  get_workshops_by_courses_returns()
  validate_workshop()
  get_workshop_access_information_parameters()
  get_workshop_access_information()
  get_workshop_access_information_returns()
  get_user_plan_parameters()
  get_user_plan()
  get_user_plan_returns()
  view_workshop_parameters()
  view_workshop()
  view_workshop_returns()
  add_submission_parameters()
  add_submission()
  add_submission_returns()
  update_submission_parameters()
  update_submission()
  update_submission_returns()
  delete_submission_parameters()
  delete_submission()
  delete_submission_returns()
  prepare_submission_for_external()
  get_submissions_parameters()
  get_submissions()
  get_submissions_returns()
  validate_submission()
  get_submission_parameters()
  get_submission()
  get_submission_returns()
  check_view_submission_assessments()
  prepare_assessment_for_external()
  get_submission_assessments_parameters()
  get_submission_assessments()
  get_submission_assessments_returns()
  get_assessment_parameters()
  get_assessment()
  get_assessment_returns()
  get_assessment_form_definition_parameters()
  get_assessment_form_definition()
  get_assessment_form_definition_returns()
  get_reviewer_assessments_parameters()
  get_reviewer_assessments()
  get_reviewer_assessments_returns()
  update_assessment_parameters()
  update_assessment()
  update_assessment_returns()
  get_grades_parameters()
  get_grades()
  get_grades_returns()
  evaluate_assessment_parameters()
  evaluate_assessment()
  evaluate_assessment_returns()
  get_grades_report_parameters()
  get_grades_report()
  get_grades_report_returns()
  view_submission_parameters()
  view_submission()
  view_submission_returns()
  evaluate_submission_parameters()
  evaluate_submission()
  evaluate_submission_returns()


Class: mod_workshop_external  - X-Ref

Workshop external functions

get_workshops_by_courses_parameters()   X-Ref
Describes the parameters for get_workshops_by_courses.

return: external_function_parameters

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

param: array $courseids course ids
return: array of warnings and workshops

get_workshops_by_courses_returns()   X-Ref
Describes the get_workshops_by_courses return value.

return: external_single_structure

validate_workshop($workshopid)   X-Ref
Utility function for validating a workshop.

param: int $workshopid workshop instance id
return: array array containing the workshop object, course, context and course module objects

get_workshop_access_information_parameters()   X-Ref
Describes the parameters for get_workshop_access_information.

return: external_external_function_parameters

get_workshop_access_information($workshopid)   X-Ref
Return access information for a given workshop.

param: int $workshopid workshop instance id
return: array of warnings and the access information

get_workshop_access_information_returns()   X-Ref
Describes the get_workshop_access_information return value.

return: external_single_structure

get_user_plan_parameters()   X-Ref
Describes the parameters for get_user_plan.

return: external_external_function_parameters

get_user_plan($workshopid, $userid = 0)   X-Ref
Return the planner information for the given user.

param: int $workshopid workshop instance id
param: int $userid user id
return: array of warnings and the user plan

get_user_plan_returns()   X-Ref
Describes the get_user_plan return value.

return: external_single_structure

view_workshop_parameters()   X-Ref
Describes the parameters for view_workshop.

return: external_function_parameters

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

param: int $workshopid workshop instance id
return: array of warnings and status result

view_workshop_returns()   X-Ref
Describes the view_workshop return value.

return: external_single_structure

add_submission_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

add_submission($workshopid, $title, $content = '', $contentformat = FORMAT_MOODLE,$inlineattachmentsid = 0, $attachmentsid = 0)   X-Ref
Add a new submission to a given workshop.

param: int $workshopid the workshop id
param: string $title             the submission title
param: string  $content          the submission text content
param: int  $contentformat       the format used for the content
param: int $inlineattachmentsid  the draft file area id for inline attachments in the content
param: int $attachmentsid        the draft file area id for attachments
return: array Containing the new created submission id and warnings.

add_submission_returns()   X-Ref
Returns the description of the external function return value.

return: \core_external\external_description

update_submission_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

update_submission($submissionid, $title, $content = '', $contentformat = FORMAT_MOODLE,$inlineattachmentsid = 0, $attachmentsid = 0)   X-Ref
Updates the given submission.

param: int $submissionid         the submission id
param: string $title             the submission title
param: string  $content          the submission text content
param: int  $contentformat       the format used for the content
param: int $inlineattachmentsid  the draft file area id for inline attachments in the content
param: int $attachmentsid        the draft file area id for attachments
return: array whether the submission was updated and warnings.

update_submission_returns()   X-Ref
Returns the description of the external function return value.

return: \core_external\external_description

delete_submission_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

delete_submission($submissionid)   X-Ref
Deletes the given submission.

param: int $submissionid the submission id.
return: array containing the result status and warnings.

delete_submission_returns()   X-Ref
Returns the description of the external function return value.

return: \core_external\external_description

prepare_submission_for_external($submission, workshop $workshop, $canviewauthorpublished = null,$canviewauthornames = null, $canviewallsubmissions = null)   X-Ref
Helper method for returning the submission data according the current user capabilities and current phase.

param: stdClass $submission the submission data
param: workshop $workshop   the workshop class
param: bool $canviewauthorpublished whether the user has the capability mod/workshop:viewauthorpublished on
param: bool $canviewauthornames whether the user has the capability mod/workshop:vviewauthornames on
param: bool $canviewallsubmissions whether the user has the capability mod/workshop:viewallsubmissions on
return: stdClass object with the submission data filtered

get_submissions_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_submissions($workshopid, $userid = 0, $groupid = 0, $page = 0, $perpage = 0)   X-Ref
Retrieves all the workshop submissions visible by the current user or the one done by the given user
(except example submissions).

param: int $workshopid       the workshop instance id
param: int $userid           get submissions done by this user
param: int $groupid          (optional) group id, 0 means that the function will determine the user group
param: int $page             page of records to return
param: int $perpage          number of records to return per page
return: array of warnings and the entries

get_submissions_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

validate_submission($submission, workshop $workshop)   X-Ref
Helper method for validating a submission.

param: stdClass   $submission submission object
param: workshop   $workshop     workshop instance
return: void

get_submission_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

get_submission($submissionid)   X-Ref
Retrieves the given submission.

param: int $submissionid the submission id
return: array containing the submission and warnings.

get_submission_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

check_view_submission_assessments($submission, workshop $workshop)   X-Ref
Helper method for validating if the current user can view the submission assessments.

param: stdClass   $submission submission object
param: workshop   $workshop     workshop instance
return: void

prepare_assessment_for_external($assessment, workshop $workshop)   X-Ref
Helper method for returning the assessment data according the current user capabilities and current phase.

param: stdClass $assessment the assessment data
param: workshop $workshop   the workshop class
return: stdClass object with the assessment data filtered or null if is not viewable yet

get_submission_assessments_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

get_submission_assessments($submissionid)   X-Ref
Retrieves the given submission assessments.

param: int $submissionid the submission id
return: array containing the assessments and warnings.

get_submission_assessments_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

get_assessment_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

get_assessment($assessmentid)   X-Ref
Retrieves the given assessment.

param: int $assessmentid the assessment id
return: array containing the assessment and warnings.

get_assessment_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

get_assessment_form_definition_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

get_assessment_form_definition($assessmentid, $mode = 'assessment')   X-Ref
Retrieves the assessment form definition (data required to be able to display the assessment form).

param: int $assessmentid the assessment id
param: string $mode the form mode (assessment or preview)
return: array containing the assessment and warnings.

get_assessment_form_definition_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

get_reviewer_assessments_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

get_reviewer_assessments($workshopid, $userid = 0)   X-Ref
Retrieves all the assessments reviewed by the given user.

param: int $workshopid   the workshop instance id
param: int $userid       the reviewer user id
return: array containing the user assessments and warnings.

get_reviewer_assessments_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

update_assessment_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

update_assessment($assessmentid, $data)   X-Ref
Updates an assessment.

param: int $assessmentid the assessment id
param: array $data the assessment data
return: array indicates if the assessment was updated, the new raw grade and possible warnings.

update_assessment_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

get_grades_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_external_function_parameters

get_grades($workshopid, $userid = 0)   X-Ref
Returns the grades information for the given workshop and user.

param: int $workshopid workshop instance id
param: int $userid user id
return: array of warnings and the user plan

get_grades_returns()   X-Ref
Returns description of method result value.

return: external_single_structure

evaluate_assessment_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

evaluate_assessment($assessmentid, $feedbacktext = '', $feedbackformat = FORMAT_MOODLE, $weight = 1,$gradinggradeover = '')   X-Ref
Evaluates an assessment (used by teachers for provide feedback to the reviewer).

param: int $assessmentid the assessment id
param: str $feedbacktext the feedback for the reviewer
param: int $feedbackformat the feedback format for the reviewer text
param: int $weight the new weight for the assessment
param: mixed $gradinggradeover the new grading grade (empty for no overriding the grade)
return: array containing the status and warnings.

evaluate_assessment_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

get_grades_report_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_grades_report($workshopid, $groupid = 0, $sortby = 'lastname', $sortdirection = 'ASC',$page = 0, $perpage = 0)   X-Ref
Retrieves the assessment grades report.

param: int $workshopid       the workshop instance id
param: int $groupid          (optional) group id, 0 means that the function will determine the user group
param: string $sortby        sort by this element
param: string $sortdirection sort direction: ASC or DESC
param: int $page             page of records to return
param: int $perpage          number of records to return per page
return: array of warnings and the report data

get_grades_report_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

view_submission_parameters()   X-Ref
Describes the parameters for view_submission.

return: external_function_parameters

view_submission($submissionid)   X-Ref
Trigger the submission viewed event.

param: int $submissionid submission id
return: array of warnings and status result

view_submission_returns()   X-Ref
Describes the view_submission return value.

return: external_single_structure

evaluate_submission_parameters()   X-Ref
Returns the description of the external function parameters.

return: external_function_parameters

evaluate_submission($submissionid, $feedbacktext = '', $feedbackformat = FORMAT_MOODLE, $published = 1,$gradeover = '')   X-Ref
Evaluates a submission (used by teachers for provide feedback or override the submission grade).

param: int $submissionid the submission id
param: str $feedbacktext the feedback for the author
param: int $feedbackformat the feedback format for the reviewer text
param: bool $published whether to publish the submission for other users
param: mixed $gradeover the new submission grade (empty for no overriding the grade)
return: array containing the status and warnings.

evaluate_submission_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description