Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 400 and 403] [Versions 401 and 403]

(no description)

File Size: 114 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

external_api:: (3 methods):
  generate_warning()
  validate_assign()
  get_user_or_group_submission()


Class: external_api  - X-Ref

Extend the base external_api class with mod_assign utility methods.

generate_warning(int $assignmentid, string $warningcode, string $detail)   X-Ref
Generate a warning in a standard structure for a known failure.

param: int $assignmentid - The assignment
param: string $warningcode - The key for the warning message
param: string $detail - A description of the error
return: array - Warning structure containing item, itemid, warningcode, message

validate_assign(int $assignid)   X-Ref
Utility function for validating an assign.

param: int $assignid assign instance id
return: array array containing the assign, course, context and course module objects

get_user_or_group_submission(\assign $assignment, int $userid = null,int $groupid = 0, bool $create = false, int $attemptnumber = -1)   X-Ref
Get a submission from an assignment for a user. Encapsulates checking whether it's a solo or team submission.

param: \assign $assignment Assignment object.
param: int|null $userid User id.
param: int $groupid Group id.
param: bool $create Whether a new submission should be created.
param: int $attemptnumber Attempt number. Use -1 for last attempt.
return: bool|\stdClass