Search moodle.org's
Developer Documentation


  • Bug fixes for general core bugs in 2.8.x ended 9 November 2015 (12 months).
  • Bug fixes for security issues in 2.8.x ended 9 May 2016 (18 months).
  • minimum PHP 5.4.4 (always use latest PHP 5.4.x or 5.5.x on Windows - http://windows.php.net/download/), PHP 7 is NOT supported
  • Differences Between: [Versions 28 and 29] [Versions 28 and 30] [Versions 28 and 31] [Versions 28 and 32] [Versions 28 and 33] [Versions 28 and 34] [Versions 28 and 35] [Versions 28 and 36] [Versions 28 and 37]

    External assign API

    Copyright: 2012 Paul Charsley
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 2013 lines (90 kb)
    Included or required:0 times
    Referenced: 15 times
    Includes or requires: 0 files

    Defines 1 class

    mod_assign_external:: (56 methods):
      generate_warning()
      get_grades_parameters()
      get_grades()
      assign_grades()
      get_grades_returns()
      get_assignments_parameters()
      get_assignments()
      get_assignments_assignment_structure()
      get_assignments_config_structure()
      get_assignments_course_structure()
      get_assignments_returns()
      get_submissions_parameters()
      get_submissions()
      get_submissions_structure()
      get_submissions_returns()
      set_user_flags_parameters()
      set_user_flags()
      set_user_flags_returns()
      get_user_flags_parameters()
      get_user_flags()
      assign_user_flags()
      get_user_flags_returns()
      get_user_mappings_parameters()
      get_user_mappings()
      assign_user_mappings()
      get_user_mappings_returns()
      lock_submissions_parameters()
      lock_submissions()
      lock_submissions_returns()
      revert_submissions_to_draft_parameters()
      revert_submissions_to_draft()
      revert_submissions_to_draft_returns()
      unlock_submissions_parameters()
      unlock_submissions()
      unlock_submissions_returns()
      submit_for_grading_parameters()
      submit_for_grading()
      submit_for_grading_returns()
      save_user_extensions_parameters()
      save_user_extensions()
      save_user_extensions_returns()
      reveal_identities_parameters()
      reveal_identities()
      reveal_identities_returns()
      save_submission_parameters()
      save_submission()
      save_submission_returns()
      save_grade_parameters()
      save_grade()
      save_grade_returns()
      save_grades_parameters()
      save_grades()
      save_grades_returns()
      copy_previous_attempt_parameters()
      copy_previous_attempt()
      copy_previous_attempt_returns()


    Class: mod_assign_external  - X-Ref

    Assign functions

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

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

    get_grades_parameters()   X-Ref
    Describes the parameters for get_grades

    return: external_external_function_parameters

    get_grades($assignmentids, $since = 0)   X-Ref
    Returns grade information from assign_grades for the requested assignment ids

    return: array of grade records for each requested assignment
    param: int[] $assignmentids
    param: int $since only return records with timemodified >= since

    assign_grades()   X-Ref
    Creates an assign_grades external_single_structure

    return: external_single_structure

    get_grades_returns()   X-Ref
    Describes the get_grades return value

    return: external_single_structure

    get_assignments_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    get_assignments($courseids = array()   X-Ref
    Returns an array of courses the user is enrolled in, and for each course all of the assignments that the user can
    view within that course.

    return: An array of courses and warnings.
    param: array $courseids An optional array of course ids. If provided only assignments within the given course
    param: array $capabilities An array of additional capability checks you wish to be made on the course context.

    get_assignments_assignment_structure()   X-Ref
    Creates an assignment external_single_structure

    return: external_single_structure

    get_assignments_config_structure()   X-Ref
    Creates an assign_plugin_config external_single_structure

    return: external_single_structure

    get_assignments_course_structure()   X-Ref
    Creates a course external_single_structure

    return: external_single_structure

    get_assignments_returns()   X-Ref
    Describes the return value for get_assignments

    return: external_single_structure

    get_submissions_parameters()   X-Ref
    Describes the parameters for get_submissions

    return: external_external_function_parameters

    get_submissions($assignmentids, $status = '', $since = 0, $before = 0)   X-Ref
    Returns submissions for the requested assignment ids

    return: array of submissions for each requested assignment
    param: int[] $assignmentids
    param: string $status only return submissions with this status
    param: int $since only return submissions with timemodified >= since
    param: int $before only return submissions with timemodified <= before

    get_submissions_structure()   X-Ref
    Creates an assign_submissions external_single_structure

    return: external_single_structure

    get_submissions_returns()   X-Ref
    Describes the get_submissions return value

    return: external_single_structure

    set_user_flags_parameters()   X-Ref
    Describes the parameters for set_user_flags

    return: external_function_parameters

    set_user_flags($assignmentid, $userflags = array()   X-Ref
    Create or update user_flags records

    return: array containing success or failure information for each record
    param: int $assignmentid the assignment for which the userflags are created or updated
    param: array $userflags  An array of userflags to create or update

    set_user_flags_returns()   X-Ref
    Describes the set_user_flags return value

    return: external_multiple_structure

    get_user_flags_parameters()   X-Ref
    Describes the parameters for get_user_flags

    return: external_function_parameters

    get_user_flags($assignmentids)   X-Ref
    Returns user flag information from assign_user_flags for the requested assignment ids

    return: array of user flag records for each requested assignment
    param: int[] $assignmentids

    assign_user_flags()   X-Ref
    Creates an assign_user_flags external_single_structure

    return: external_single_structure

    get_user_flags_returns()   X-Ref
    Describes the get_user_flags return value

    return: external_single_structure

    get_user_mappings_parameters()   X-Ref
    Describes the parameters for get_user_mappings

    return: external_function_parameters

    get_user_mappings($assignmentids)   X-Ref
    Returns user mapping information from assign_user_mapping for the requested assignment ids

    return: array of user mapping records for each requested assignment
    param: int[] $assignmentids

    assign_user_mappings()   X-Ref
    Creates an assign_user_mappings external_single_structure

    return: external_single_structure

    get_user_mappings_returns()   X-Ref
    Describes the get_user_mappings return value

    return: external_single_structure

    lock_submissions_parameters()   X-Ref
    Describes the parameters for lock_submissions

    return: external_external_function_parameters

    lock_submissions($assignmentid, $userids)   X-Ref
    Locks (prevent updates to) submissions in this assignment.

    return: array of warnings for each submission that could not be locked.
    param: int $assignmentid The id of the assignment
    param: array $userids Array of user ids to lock

    lock_submissions_returns()   X-Ref
    Describes the return value for lock_submissions

    return: external_single_structure

    revert_submissions_to_draft_parameters()   X-Ref
    Describes the parameters for revert_submissions_to_draft

    return: external_external_function_parameters

    revert_submissions_to_draft($assignmentid, $userids)   X-Ref
    Reverts a list of user submissions to draft for a single assignment.

    return: array of warnings for each submission that could not be reverted.
    param: int $assignmentid The id of the assignment
    param: array $userids Array of user ids to revert

    revert_submissions_to_draft_returns()   X-Ref
    Describes the return value for revert_submissions_to_draft

    return: external_single_structure

    unlock_submissions_parameters()   X-Ref
    Describes the parameters for unlock_submissions

    return: external_external_function_parameters

    unlock_submissions($assignmentid, $userids)   X-Ref
    Locks (prevent updates to) submissions in this assignment.

    return: array of warnings for each submission that could not be locked.
    param: int $assignmentid The id of the assignment
    param: array $userids Array of user ids to lock

    unlock_submissions_returns()   X-Ref
    Describes the return value for unlock_submissions

    return: external_single_structure

    submit_for_grading_parameters()   X-Ref
    Describes the parameters for submit_for_grading

    return: external_external_function_parameters

    submit_for_grading($assignmentid, $acceptsubmissionstatement)   X-Ref
    Submit the logged in users assignment for grading.

    return: array of warnings to indicate any errors.
    param: int $assignmentid The id of the assignment

    submit_for_grading_returns()   X-Ref
    Describes the return value for submit_for_grading

    return: external_single_structure

    save_user_extensions_parameters()   X-Ref
    Describes the parameters for save_user_extensions

    return: external_external_function_parameters

    save_user_extensions($assignmentid, $userids, $dates)   X-Ref
    Grant extension dates to students for an assignment.

    return: array of warnings for each extension date that could not be granted
    param: int $assignmentid The id of the assignment
    param: array $userids Array of user ids to grant extensions to
    param: array $dates Array of extension dates

    save_user_extensions_returns()   X-Ref
    Describes the return value for save_user_extensions

    return: external_single_structure

    reveal_identities_parameters()   X-Ref
    Describes the parameters for reveal_identities

    return: external_external_function_parameters

    reveal_identities($assignmentid)   X-Ref
    Reveal the identities of anonymous students to markers for a single assignment.

    return: array of warnings to indicate any errors.
    param: int $assignmentid The id of the assignment

    reveal_identities_returns()   X-Ref
    Describes the return value for reveal_identities

    return: external_single_structure

    save_submission_parameters()   X-Ref
    Describes the parameters for save_submission

    return: external_external_function_parameters

    save_submission($assignmentid, $plugindata)   X-Ref
    Save a student submission for a single assignment

    return: array of warnings to indicate any errors
    param: int $assignmentid The id of the assignment
    param: array $plugindata - The submitted data for plugins

    save_submission_returns()   X-Ref
    Describes the return value for save_submission

    return: external_single_structure

    save_grade_parameters()   X-Ref
    Describes the parameters for save_grade

    return: external_external_function_parameters

    save_grade($assignmentid,$userid,$grade,$attemptnumber,$addattempt,$workflowstate,$applytoall,$plugindata = array()   X-Ref
    Save a student grade for a single assignment.

    return: null
    param: int $assignmentid The id of the assignment
    param: int $userid The id of the user
    param: float $grade The grade (ignored if the assignment uses advanced grading)
    param: int $attemptnumber The attempt number
    param: bool $addattempt Allow another attempt
    param: string $workflowstate New workflow state
    param: bool $applytoall Apply the grade to all members of the group
    param: array $plugindata Custom data used by plugins
    param: array $advancedgradingdata Advanced grading data

    save_grade_returns()   X-Ref
    Describes the return value for save_grade

    return: external_single_structure

    save_grades_parameters()   X-Ref
    Describes the parameters for save_grades

    return: external_external_function_parameters

    save_grades($assignmentid, $applytoall = false, $grades)   X-Ref
    Save multiple student grades for a single assignment.

    return: null
    param: int $assignmentid The id of the assignment
    param: boolean $applytoall If set to true and this is a team assignment,
    param: array $grades grade data for one or more students that includes

    save_grades_returns()   X-Ref
    Describes the return value for save_grades

    return: external_single_structure

    copy_previous_attempt_parameters()   X-Ref
    Describes the parameters for copy_previous_attempt

    return: external_external_function_parameters

    copy_previous_attempt($assignmentid)   X-Ref
    Copy a students previous attempt to a new attempt.

    return: array of warnings to indicate any errors.
    param: int $assignmentid

    copy_previous_attempt_returns()   X-Ref
    Describes the return value for save_submission

    return: external_single_structure

    Search This Site: