Search moodle.org's
Developer Documentation


This file contains the definition for the class assignment This class provides all the functionality for the new assign module.

Copyright: 2012 NetSpot {@link http://www.netspot.com.au}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 7636 lines (314 kb)
Included or required: 1 time
Referenced: 35 times
Includes or requires: 1 file
 mod/assign/locallib.php

Defines 2 classes

assign:: (173 methods):
  __construct()
  register_return_link()
  get_return_action()
  show_intro()
  get_return_params()
  set_instance()
  set_context()
  set_course()
  get_feedback_plugins()
  get_submission_plugins()
  is_blind_marking()
  has_submissions_or_grades()
  get_plugin_by_type()
  get_feedback_plugin_by_type()
  get_submission_plugin_by_type()
  load_plugins()
  view()
  add_instance()
  delete_grades()
  delete_instance()
  reset_userdata()
  update_plugin_instance()
  update_gradebook()
  get_admin_config()
  update_calendar()
  update_instance()
  save_intro_draft_files()
  add_plugin_grade_elements()
  add_plugin_settings()
  add_all_plugin_settings()
  plugin_data_preprocessing()
  get_module_name()
  get_module_name_plural()
  has_instance()
  get_instance()
  get_grade_item()
  get_course_context()
  get_course_module()
  get_context()
  get_course()
  count_attachments()
  has_visible_attachments()
  display_grade()
  list_participants()
  count_teams()
  count_participants()
  count_submissions_need_grading()
  count_grades()
  count_submissions()
  count_submissions_with_status()
  get_grading_userid_list()
  pack_files()
  cron()
  notify_grade_modified()
  update_user_flags()
  update_grade()
  view_grant_extension()
  get_submission_group_members()
  get_submission_group_members_who_have_not_submitted()
  get_group_submission()
  view_course_index()
  view_plugin_page()
  get_submission_group()
  view_plugin_content()
  download_rewrite_pluginfile_urls()
  render_editor_content()
  view_savegrading_result()
  view_quickgrading_result()
  view_footer()
  require_view_submission()
  require_view_grades()
  can_view_grades()
  can_grade()
  download_submissions()
  add_to_log()
  get_renderer()
  get_user_submission()
  get_submission()
  get_user_flags()
  get_user_grade()
  get_grade()
  view_single_grade_page()
  view_reveal_identities_confirm()
  view_return_links()
  view_grading_table()
  view_grading_page()
  plagiarism_print_disclosure()
  view_notices()
  fullname()
  view_edit_submission_page()
  is_graded()
  can_view_group_submission()
  can_view_submission()
  view_plugin_grading_batch_operation()
  process_grading_batch_operation()
  view_batch_set_workflow_state()
  view_batch_markingallocation()
  check_submit_for_grading()
  view_student_summary()
  show_submit_button()
  get_all_grades()
  get_all_submissions()
  view_submission_page()
  convert_grade_for_gradebook()
  convert_submission_for_gradebook()
  gradebook_item_update()
  update_team_submission()
  update_submission()
  submissions_open()
  render_area_files()
  can_edit_submission()
  get_graders()
  get_notifiable_users()
  format_notification_message_text()
  format_notification_message_html()
  send_assignment_notification()
  send_notification()
  notify_student_submission_copied()
  notify_student_submission_receipt()
  notify_graders()
  submit_for_grading()
  process_submit_other_for_grading()
  process_submit_for_grading()
  save_user_extension()
  process_save_extension()
  process_save_quick_grades()
  reveal_identities()
  process_reveal_identities()
  process_save_grading_options()
  format_grade_for_log()
  format_submission_for_log()
  process_copy_previous_attempt()
  copy_previous_attempt()
  submission_empty()
  save_submission()
  process_save_submission()
  grading_disabled()
  get_grading_instance()
  add_grade_form_elements()
  add_plugin_submission_elements()
  is_any_feedback_plugin_enabled()
  is_any_submission_plugin_enabled()
  add_submission_form_elements()
  revert_to_draft()
  process_revert_to_draft()
  lock_submission()
  process_set_batch_marking_workflow_state()
  process_set_batch_marking_allocation()
  process_lock_submission()
  unlock_submission()
  process_unlock_submission()
  apply_grade_to_user()
  process_outcomes()
  reopen_submission_if_required()
  save_grade()
  process_save_grade()
  can_upgrade_assignment()
  can_upgrade()
  copy_area_files_for_upgrade()
  process_add_attempt_group()
  process_add_attempt()
  add_attempt()
  get_user_grades_for_gradebook()
  get_uniqueid_for_user()
  allocate_unique_ids()
  get_uniqueid_for_user_static()
  get_user_id_for_uniqueid()
  get_user_id_for_uniqueid_static()
  get_marking_workflow_states_for_current_user()
  show_only_active_users()
  is_active_user()
  is_gradebook_feedback_enabled()
  get_grading_status()

assign_portfolio_caller:: (10 methods):
  expected_callbackargs()
  __construct()
  load_data()
  prepare_package()
  get_submission_plugin()
  get_sha1()
  expected_time()
  check_permissions()
  display_name()
  base_supported_formats()


Class: assign  - X-Ref

Standard base class for mod_assign (assignment types).

__construct($coursemodulecontext, $coursemodule, $course)   X-Ref
Constructor for the base assign class.

Note: For $coursemodule you can supply a stdclass if you like, but it
will be more efficient to supply a cm_info object.

param: mixed $coursemodulecontext context|null the course module context
param: mixed $coursemodule the current course module if it was already loaded,
param: mixed $course the current course  if it was already loaded,

register_return_link($action, $params)   X-Ref
Set the action and parameters that can be used to return to the current page.

param: string $action The action for the current page
param: array $params An array of name value pairs which form the parameters
return: void

get_return_action()   X-Ref
Return an action that can be used to get back to the current page.

return: string action

show_intro()   X-Ref
Based on the current assignment settings should we display the intro.

return: bool showintro

get_return_params()   X-Ref
Return a list of parameters that can be used to get back to the current page.

return: array params

set_instance(stdClass $data)   X-Ref
Set the submitted form data.

param: stdClass $data The form data (instance)

set_context(context $context)   X-Ref
Set the context.

param: context $context The new context

set_course(stdClass $course)   X-Ref
Set the course data.

param: stdClass $course The course data

get_feedback_plugins()   X-Ref
Get list of feedback plugins installed.

return: array

get_submission_plugins()   X-Ref
Get list of submission plugins installed.

return: array

is_blind_marking()   X-Ref
Is blind marking enabled and reveal identities not set yet?

return: bool

has_submissions_or_grades()   X-Ref
Does an assignment have submission(s) or grade(s) already?

return: bool

get_plugin_by_type($subtype, $type)   X-Ref
Get a specific submission plugin by its type.

param: string $subtype assignsubmission | assignfeedback
param: string $type
return: mixed assign_plugin|null

get_feedback_plugin_by_type($type)   X-Ref
Get a feedback plugin by type.

param: string $type - The type of plugin e.g comments
return: mixed assign_feedback_plugin|null

get_submission_plugin_by_type($type)   X-Ref
Get a submission plugin by type.

param: string $type - The type of plugin e.g comments
return: mixed assign_submission_plugin|null

load_plugins($subtype)   X-Ref
Load the plugins from the sub folders under subtype.

param: string $subtype - either submission or feedback
return: array - The sorted list of plugins

view($action='')   X-Ref
Display the assignment, used by view.php

The assignment is displayed differently depending on your role,
the settings for the assignment and the status of the assignment.

param: string $action The current action if any.
return: string - The page output.

add_instance(stdClass $formdata, $callplugins)   X-Ref
Add this instance to the database.

param: stdClass $formdata The data submitted from the form
param: bool $callplugins This is used to skip the plugin code
return: mixed false if an error occurs or the int id of the new instance

delete_grades()   X-Ref
Delete all grades from the gradebook for this assignment.

return: bool

delete_instance()   X-Ref
Delete this instance from the database.

return: bool false if an error occurs

reset_userdata($data)   X-Ref
Actual implementation of the reset course functionality, delete all the
assignment submissions for course $data->courseid.

param: stdClass $data the data submitted from the reset course.
return: array status array

update_plugin_instance(assign_plugin $plugin, stdClass $formdata)   X-Ref
Update the settings for a single plugin.

param: assign_plugin $plugin The plugin to update
param: stdClass $formdata The form data
return: bool false if an error occurs

update_gradebook($reset, $coursemoduleid)   X-Ref
Update the gradebook information for this assignment.

param: bool $reset If true, will reset all grades in the gradbook for this assignment
param: int $coursemoduleid This is required because it might not exist in the database yet
return: bool

get_admin_config()   X-Ref
Load and cache the admin config for this module.

return: stdClass the plugin config

update_calendar($coursemoduleid)   X-Ref
Update the calendar entries for this assignment.

param: int $coursemoduleid - Required to pass this in because it might
return: bool

update_instance($formdata)   X-Ref
Update this instance in the database.

param: stdClass $formdata - the data submitted from the form
return: bool false if an error occurs

save_intro_draft_files($formdata)   X-Ref
Save the attachments in the draft areas.

param: stdClass $formdata

add_plugin_grade_elements($grade, MoodleQuickForm $mform, stdClass $data, $userid)   X-Ref
Add elements in grading plugin form.

param: mixed $grade stdClass|null
param: MoodleQuickForm $mform
param: stdClass $data
param: int $userid - The userid we are grading
return: void

add_plugin_settings(assign_plugin $plugin, MoodleQuickForm $mform, & $pluginsenabled)   X-Ref
Add one plugins settings to edit plugin form.

param: assign_plugin $plugin The plugin to add the settings from
param: MoodleQuickForm $mform The form to add the configuration settings to.
param: array $pluginsenabled A list of form elements to be added to a group.
return: void

add_all_plugin_settings(MoodleQuickForm $mform)   X-Ref
Add settings to edit plugin form.

param: MoodleQuickForm $mform The form to add the configuration settings to.
return: void

plugin_data_preprocessing(&$defaultvalues)   X-Ref
Allow each plugin an opportunity to update the defaultvalues
passed in to the settings form (needed to set up draft areas for
editor and filemanager elements)

param: array $defaultvalues

get_module_name()   X-Ref
Get the name of the current module.

return: string the module name (Assignment)

get_module_name_plural()   X-Ref
Get the plural name of the current module.

return: string the module name plural (Assignments)

has_instance()   X-Ref
Has this assignment been constructed from an instance?

return: bool

get_instance()   X-Ref
Get the settings for the current instance of this assignment

return: stdClass The settings

get_grade_item()   X-Ref
Get the primary grade item for this assign instance.

return: stdClass The grade_item record

get_course_context()   X-Ref
Get the context of the current course.

return: mixed context|null The course context

get_course_module()   X-Ref
Get the current course module.

return: cm_info|null The course module or null if not known

get_context()   X-Ref
Get context module.

return: context

get_course()   X-Ref
Get the current course.

return: mixed stdClass|null The course

count_attachments()   X-Ref
Count the number of intro attachments.

return: int

has_visible_attachments()   X-Ref
Are there any intro attachments to display?

return: boolean

display_grade($grade, $editing, $userid=0, $modified=0)   X-Ref
Return a grade in user-friendly form, whether it's a scale or not.

param: mixed $grade int|null
param: boolean $editing Are we allowing changes to this grade?
param: int $userid The user id the grade belongs to
param: int $modified Timestamp from when the grade was last modified
return: string User-friendly representation of grade

list_participants($currentgroup, $idsonly)   X-Ref
Load a list of users enrolled in the current course with the specified permission and group.
0 for no group.

param: int $currentgroup
param: bool $idsonly
return: array List of user records

count_teams($activitygroup = 0)   X-Ref
Load a count of valid teams for this assignment.

param: int $activitygroup Activity active group
return: int number of valid teams

count_participants($currentgroup)   X-Ref
Load a count of active users enrolled in the current course with the specified permission and group.
0 for no group.

param: int $currentgroup
return: int number of matching users

count_submissions_need_grading()   X-Ref
Load a count of active users submissions in the current module that require grading
This means the submission modification time is more recent than the
grading modification time and the status is SUBMITTED.

return: int number of matching submissions

count_grades()   X-Ref
Load a count of grades.

return: int number of grades

count_submissions($includenew = false)   X-Ref
Load a count of submissions.

param: bool $includenew When true, also counts the submissions with status 'new'.
return: int number of submissions

count_submissions_with_status($status)   X-Ref
Load a count of submissions with a specified status.

param: string $status The submission status - should match one of the constants
return: int number of matching submissions

get_grading_userid_list()   X-Ref
Utility function to get the userid for every row in the grading table
so the order can be frozen while we iterate it.

return: array An array of userids

pack_files($filesforzipping)   X-Ref
Generate zip file from array of given files.

param: array $filesforzipping - array of files to pass into archive_to_pathname.
return: path of temp file - note this returned file does

cron()   X-Ref
Finds all assignment notifications that have yet to be mailed out, and mails them.

Cron function to be run periodically according to the moodle cron.

return: bool

notify_grade_modified($grade, $mailedoverride = false)   X-Ref
Mark in the database that this grade record should have an update notification sent by cron.

param: stdClass $grade a grade record keyed on id
param: bool $mailedoverride when true, flag notification to be sent again.
return: bool true for success

update_user_flags($flags)   X-Ref
Update user flags for this user in this assignment.

param: stdClass $flags a flags record keyed on id
return: bool true for success

update_grade($grade, $reopenattempt = false)   X-Ref
Update a grade in the grade table for the assignment and in the gradebook.

param: stdClass $grade a grade record keyed on id
param: bool $reopenattempt If the attempt reopen method is manual, allow another attempt at this assignment.
return: bool true for success

view_grant_extension($mform)   X-Ref
View the grant extension date page.

Uses url parameters 'userid'
or from parameter 'selectedusers'

param: moodleform $mform - Used for validation of the submitted data
return: string

get_submission_group_members($groupid, $onlyids, $excludesuspended = false)   X-Ref
Get a list of the users in the same group as this user.

param: int $groupid The id of the group whose members we want or 0 for the default group
param: bool $onlyids Whether to retrieve only the user id's
param: bool $excludesuspended Whether to exclude suspended users
return: array The users (possibly id's only)

get_submission_group_members_who_have_not_submitted($groupid, $onlyids)   X-Ref
Get a list of the users in the same group as this user that have not submitted the assignment.

param: int $groupid The id of the group whose members we want or 0 for the default group
param: bool $onlyids Whether to retrieve only the user id's
return: array The users (possibly id's only)

get_group_submission($userid, $groupid, $create, $attemptnumber=-1)   X-Ref
Load the group submission object for a particular user, optionally creating it if required.

param: int $userid The id of the user whose submission we want
param: int $groupid The id of the group for this user - may be 0 in which
param: bool $create If set to true a new submission object will be created in the database
param: int $attemptnumber - -1 means the latest attempt
return: stdClass The submission

view_course_index()   X-Ref
View a summary listing of all assignments in the current course.

return: string

view_plugin_page()   X-Ref
View a page rendered by a plugin.

Uses url parameters 'pluginaction', 'pluginsubtype', 'plugin', and 'id'.

return: string

get_submission_group($userid)   X-Ref
This is used for team assignments to get the group for the specified user.
If the user is a member of multiple or no groups this will return false

param: int $userid The id of the user whose submission we want
return: mixed The group or false

view_plugin_content($pluginsubtype)   X-Ref
Display the submission that is used by a plugin.

Uses url parameters 'sid', 'gid' and 'plugin'.

param: string $pluginsubtype
return: string

download_rewrite_pluginfile_urls($text, $user, $plugin)   X-Ref
Rewrite plugin file urls so they resolve correctly in an exported zip.

param: string $text - The replacement text
param: stdClass $user - The user record
param: assign_plugin $plugin - The assignment plugin

render_editor_content($filearea, $submissionid, $plugintype, $editor, $component)   X-Ref
Render the content in editor that is often used by plugin.

param: string $filearea
param: int  $submissionid
param: string $plugintype
param: string $editor
param: string $component
return: string

view_savegrading_result($message)   X-Ref
Display a continue page after grading.

param: string $message - The message to display.
return: string

view_quickgrading_result($message)   X-Ref
Display a continue page after quickgrading.

param: string $message - The message to display.
return: string

view_footer()   X-Ref
Display the page footer.

return: string

require_view_submission($userid)   X-Ref
Throw an error if the permissions to view this users submission are missing.

return: none

require_view_grades()   X-Ref
Throw an error if the permissions to view grades in this assignment are missing.

return: none

can_view_grades()   X-Ref
Does this user have view grade or grade permission for this assignment?

return: bool

can_grade()   X-Ref
Does this user have grade permission for this assignment?

return: bool

download_submissions()   X-Ref
Download a zip file of all assignment submissions.

return: string - If an error occurs, this will contain the error page.

add_to_log($action = '', $info = '', $url='', $return = false)   X-Ref
Util function to add a message to the log.

param: string $action The current action
param: string $info A detailed description of the change. But no more than 255 characters.
param: string $url The url to the assign module instance.
param: bool $return If true, returns the arguments, else adds to log. The purpose of this is to
return: void|array

get_renderer()   X-Ref
Lazy load the page renderer and expose the renderer to plugins.

return: assign_renderer

get_user_submission($userid, $create, $attemptnumber=-1)   X-Ref
Load the submission object for a particular user, optionally creating it if required.

For team assignments there are 2 submissions - the student submission and the team submission
All files are associated with the team submission but the status of the students contribution is
recorded separately.

param: int $userid The id of the user whose submission we want or 0 in which case USER->id is used
param: bool $create optional - defaults to false. If set to true a new submission object
param: int $attemptnumber - -1 means the latest attempt
return: stdClass The submission

get_submission($submissionid)   X-Ref
Load the submission object from it's id.

param: int $submissionid The id of the submission we want
return: stdClass The submission

get_user_flags($userid, $create)   X-Ref
This will retrieve a user flags object from the db optionally creating it if required.
The user flags was split from the user_grades table in 2.5.

param: int $userid The user we are getting the flags for.
param: bool $create If true the flags record will be created if it does not exist
return: stdClass The flags record

get_user_grade($userid, $create, $attemptnumber=-1)   X-Ref
This will retrieve a grade object from the db, optionally creating it if required.

param: int $userid The user we are grading
param: bool $create If true the grade will be created if it does not exist
param: int $attemptnumber The attempt number to retrieve the grade for. -1 means the latest submission.
return: stdClass The grade record

get_grade($gradeid)   X-Ref
This will retrieve a grade object from the db.

param: int $gradeid The id of the grade
return: stdClass The grade record

view_single_grade_page($mform)   X-Ref
Print the grading page for a single user submission.

param: moodleform $mform
return: string

view_reveal_identities_confirm()   X-Ref
Show a confirmation page to make sure they want to release student identities.

return: string

view_return_links()   X-Ref
View a link to go back to the previous page. Uses url parameters returnaction and returnparams.

return: string

view_grading_table()   X-Ref
View the grading table of all submissions for this assignment.

return: string

view_grading_page()   X-Ref
View entire grading page.

return: string

plagiarism_print_disclosure()   X-Ref
Capture the output of the plagiarism plugins disclosures and return it as a string.

return: string

view_notices($title, $notices)   X-Ref
Message for students when assignment submissions have been closed.

param: string $title The page title
param: array $notices The array of notices to show.
return: string

fullname($user)   X-Ref
Get the name for a user - hiding their real name if blind marking is on.

param: stdClass $user The user record as required by fullname()
return: string The name.

view_edit_submission_page($mform, $notices)   X-Ref
View edit submissions page.

param: moodleform $mform
param: array $notices A list of notices to display at the top of the
return: string The page output.

is_graded($userid)   X-Ref
See if this assignment has a grade yet.

param: int $userid
return: bool

can_view_group_submission($groupid)   X-Ref
Perform an access check to see if the current $USER can view this group submission.

param: int $groupid
return: bool

can_view_submission($userid)   X-Ref
Perform an access check to see if the current $USER can view this users submission.

param: int $userid
return: bool

view_plugin_grading_batch_operation($mform)   X-Ref
Allows the plugin to show a batch grading operation page.

param: moodleform $mform
return: none

process_grading_batch_operation(& $mform)   X-Ref
Ask the user to confirm they want to perform this batch operation

param: moodleform $mform Set to a grading batch operations form
return: string - the page to view after processing these actions

view_batch_set_workflow_state($mform)   X-Ref
Shows a form that allows the workflow state for selected submissions to be changed.

param: moodleform $mform Set to a grading batch operations form
return: string - the page to view after processing these actions

view_batch_markingallocation($mform)   X-Ref
Shows a form that allows the allocated marker for selected submissions to be changed.

param: moodleform $mform Set to a grading batch operations form
return: string - the page to view after processing these actions

check_submit_for_grading($mform)   X-Ref
Ask the user to confirm they want to submit their work for grading.

param: moodleform $mform - null unless form validation has failed
return: string

view_student_summary($user, $showlinks)   X-Ref
Print 2 tables of information with no action links -
the submission summary and the grading summary.

param: stdClass $user the user to print the report for
param: bool $showlinks - Return plain text or links to the profile
return: string - the html summary

show_submit_button($submission = null, $teamsubmission = null)   X-Ref
Returns true if the submit subsission button should be shown to the user.

param: stdClass $submission The users own submission record.
param: stdClass $teamsubmission The users team submission record if there is one
return: bool

get_all_grades($userid)   X-Ref
Get the grades for all previous attempts.
For each grade - the grader is a full user record,
and gradefordisplay is added (rendered from grading manager).

param: int $userid If not set, $USER->id will be used.
return: array $grades All grade records for this user.

get_all_submissions($userid)   X-Ref
Get the submissions for all previous attempts.

param: int $userid If not set, $USER->id will be used.
return: array $submissions All submission records for this user (or group).

view_submission_page()   X-Ref
View submissions page (contains details of current submission).

return: string

convert_grade_for_gradebook(stdClass $grade)   X-Ref
Convert the final raw grade(s) in the grading table for the gradebook.

param: stdClass $grade
return: array

convert_submission_for_gradebook(stdClass $submission)   X-Ref
Convert submission details for the gradebook.

param: stdClass $submission
return: array

gradebook_item_update($submission=null, $grade=null)   X-Ref
Update grades in the gradebook.

param: mixed $submission stdClass|null
param: mixed $grade stdClass|null
return: bool

update_team_submission(stdClass $submission, $userid, $updatetime)   X-Ref
Update team submission.

param: stdClass $submission
param: int $userid
param: bool $updatetime
return: bool

update_submission(stdClass $submission, $userid, $updatetime, $teamsubmission)   X-Ref
Update grades in the gradebook based on submission time.

param: stdClass $submission
param: int $userid
param: bool $updatetime
param: bool $teamsubmission
return: bool

submissions_open($userid = 0,$skipenrolled = false,$submission = false,$flags = false,$gradinginfo = false)   X-Ref
Is this assignment open for submissions?

Check the due date,
prevent late submissions,
has this person already submitted,
is the assignment locked?

param: int $userid - Optional userid so we can see if a different user can submit
param: bool $skipenrolled - Skip enrollment checks (because they have been done already)
param: stdClass $submission - Pre-fetched submission record (or false to fetch it)
param: stdClass $flags - Pre-fetched user flags record (or false to fetch it)
param: stdClass $gradinginfo - Pre-fetched user gradinginfo record (or false to fetch it)
return: bool

render_area_files($component, $area, $submissionid)   X-Ref
Render the files in file area.

param: string $component
param: string $area
param: int $submissionid
return: string

can_edit_submission($userid, $graderid = 0)   X-Ref
Capability check to make sure this grader can edit this submission.

param: int $userid - The user whose submission is to be edited
param: int $graderid (optional) - The user who will do the editing (default to $USER->id).
return: bool

get_graders($userid)   X-Ref
Returns a list of teachers that should be grading given submission.

param: int $userid The submission to grade
return: array

get_notifiable_users($userid)   X-Ref
Returns a list of users that should receive notification about given submission.

param: int $userid The submission to grade
return: array

format_notification_message_text($messagetype,$info,$course,$context,$modulename,$assignmentname)   X-Ref
Format a notification for plain text.

param: string $messagetype
param: stdClass $info
param: stdClass $course
param: stdClass $context
param: string $modulename
param: string $assignmentname

format_notification_message_html($messagetype,$info,$course,$context,$modulename,$coursemodule,$assignmentname)   X-Ref
Format a notification for HTML.

param: string $messagetype
param: stdClass $info
param: stdClass $course
param: stdClass $context
param: string $modulename
param: stdClass $coursemodule
param: string $assignmentname

send_assignment_notification($userfrom,$userto,$messagetype,$eventtype,$updatetime,$coursemodule,$context,$course,$modulename,$assignmentname,$blindmarking,$uniqueidforuser)   X-Ref
Message someone about something (static so it can be called from cron).

param: stdClass $userfrom
param: stdClass $userto
param: string $messagetype
param: string $eventtype
param: int $updatetime
param: stdClass $coursemodule
param: stdClass $context
param: stdClass $course
param: string $modulename
param: string $assignmentname
param: bool $blindmarking
param: int $uniqueidforuser
return: void

send_notification($userfrom,$userto,$messagetype,$eventtype,$updatetime)   X-Ref
Message someone about something.

param: stdClass $userfrom
param: stdClass $userto
param: string $messagetype
param: string $eventtype
param: int $updatetime
return: void

notify_student_submission_copied(stdClass $submission)   X-Ref
Notify student upon successful submission copy.

param: stdClass $submission
return: void

notify_student_submission_receipt(stdClass $submission)   X-Ref
Notify student upon successful submission.

param: stdClass $submission
return: void

notify_graders(stdClass $submission)   X-Ref
Send notifications to graders upon student submissions.

param: stdClass $submission
return: void

submit_for_grading($data, $notices)   X-Ref
Submit a submission for grading.

param: stdClass $data - The form data
param: array $notices - List of error messages to display on an error condition.
return: bool Return false if the submission was not submitted.

process_submit_other_for_grading($mform, $notices)   X-Ref
A students submission is submitted for grading by a teacher.

return: bool

process_submit_for_grading($mform, $notices)   X-Ref
Assignment submission is processed before grading.

param: moodleform|null $mform If validation failed when submitting this form - this is the moodleform.
return: bool Return false if the validation fails. This affects which page is displayed next.

save_user_extension($userid, $extensionduedate)   X-Ref
Save the extension date for a single user.

param: int $userid The user id
param: mixed $extensionduedate Either an integer date or null
return: boolean

process_save_extension(& $mform)   X-Ref
Save extension date.

param: moodleform $mform The submitted form
return: boolean

process_save_quick_grades()   X-Ref
Save quick grades.

return: string The result of the save operation

reveal_identities()   X-Ref
Reveal student identities to markers (and the gradebook).

return: void

process_reveal_identities()   X-Ref
Reveal student identities to markers (and the gradebook).

return: void

process_save_grading_options()   X-Ref
Save grading options.

return: void

format_grade_for_log(stdClass $grade)   X-Ref
Take a grade object and print a short summary for the log file.
The size limit for the log file is 255 characters, so be careful not
to include too much information.

param: stdClass $grade
return: string

format_submission_for_log(stdClass $submission)   X-Ref
Take a submission object and print a short summary for the log file.
The size limit for the log file is 255 characters, so be careful not
to include too much information.

param: stdClass $submission
return: string

process_copy_previous_attempt(&$notices)   X-Ref
Require a valid sess key and then call copy_previous_attempt.

param: array $notices Any error messages that should be shown
return: bool

copy_previous_attempt(&$notices)   X-Ref
Copy the current assignment submission from the last submitted attempt.

param: array $notices Any error messages that should be shown
return: bool

submission_empty($submission)   X-Ref
Determine if the current submission is empty or not.

param: submission $submission the students submission record to check.
return: bool

save_submission(stdClass $data, & $notices)   X-Ref
Save assignment submission for the current user.

param: stdClass $data
param: array $notices Any error messages that should be shown
return: bool

process_save_submission(&$mform, &$notices)   X-Ref
Save assignment submission.

param: moodleform $mform
param: array $notices Any error messages that should be shown
return: bool

grading_disabled($userid, $checkworkflow=true)   X-Ref
Determine if this users grade can be edited.

param: int $userid - The student userid
param: bool $checkworkflow - whether to include a check for the workflow state.
return: bool $gradingdisabled

get_grading_instance($userid, $grade, $gradingdisabled)   X-Ref
Get an instance of a grading form if advanced grading is enabled.
This is specific to the assignment, marker and student.

param: int $userid - The student userid
param: stdClass|false $grade - The grade record
param: bool $gradingdisabled
return: mixed gradingform_instance|null $gradinginstance

add_grade_form_elements(MoodleQuickForm $mform, stdClass $data, $params)   X-Ref
Add elements to grade form.

param: MoodleQuickForm $mform
param: stdClass $data
param: array $params
return: void

add_plugin_submission_elements($submission,MoodleQuickForm $mform,stdClass $data,$userid)   X-Ref
Add elements in submission plugin form.

param: mixed $submission stdClass|null
param: MoodleQuickForm $mform
param: stdClass $data
param: int $userid The current userid (same as $USER->id)
return: void

is_any_feedback_plugin_enabled()   X-Ref
Check if feedback plugins installed are enabled.

return: bool

is_any_submission_plugin_enabled()   X-Ref
Check if submission plugins installed are enabled.

return: bool

add_submission_form_elements(MoodleQuickForm $mform, stdClass $data)   X-Ref
Add elements to submission form.

param: MoodleQuickForm $mform
param: stdClass $data
return: void

revert_to_draft($userid)   X-Ref
Revert to draft.

param: int $userid
return: boolean

process_revert_to_draft($userid = 0)   X-Ref
Revert to draft.
Uses url parameter userid if userid not supplied as a parameter.

param: int $userid
return: boolean

lock_submission($userid)   X-Ref
Prevent student updates to this submission

param: int $userid
return: bool

process_set_batch_marking_workflow_state()   X-Ref
Set the workflow state for multiple users

return: void

process_set_batch_marking_allocation()   X-Ref
Set the marking allocation for multiple users

return: void

process_lock_submission($userid = 0)   X-Ref
Prevent student updates to this submission.
Uses url parameter userid.

param: int $userid
return: void

unlock_submission($userid)   X-Ref
Unlock the student submission.

param: int $userid
return: bool

process_unlock_submission($userid = 0)   X-Ref
Unlock the student submission.
Uses url parameter userid.

param: int $userid
return: bool

apply_grade_to_user($formdata, $userid, $attemptnumber)   X-Ref
Apply a grade from a grading form to a user (may be called multiple times for a group submission).

param: stdClass $formdata - the data from the form
param: int $userid - the user to apply the grade to
param: int $attemptnumber - The attempt number to apply the grade to.
return: void

process_outcomes($userid, $formdata, $sourceuserid = null)   X-Ref
Save outcomes submitted from grading form.

param: int $userid
param: stdClass $formdata
param: int $sourceuserid The user ID under which the outcome data is accessible. This is relevant

reopen_submission_if_required($userid, $submission, $addattempt)   X-Ref
If the requirements are met - reopen the submission for another attempt.
Only call this function when grading the latest attempt.

param: int $userid The userid.
param: stdClass $submission The submission (may be a group submission).
param: bool $addattempt - True if the "allow another attempt" checkbox was checked.
return: bool - true if another attempt was added.

save_grade($userid, $data)   X-Ref
Save grade update.

param: int $userid
param: stdClass $data
return: bool - was the grade saved

process_save_grade(&$mform)   X-Ref
Save grade.

param: moodleform $mform
return: bool - was the grade saved

can_upgrade_assignment($type, $version)   X-Ref
This function is a static wrapper around can_upgrade.

param: string $type The plugin type
param: int $version The plugin version
return: bool

can_upgrade($type, $version)   X-Ref
This function returns true if it can upgrade an assignment from the 2.2 module.

param: string $type The plugin type
param: int $version The plugin version
return: bool

copy_area_files_for_upgrade($oldcontextid,$oldcomponent,$oldfilearea,$olditemid,$newcontextid,$newcomponent,$newfilearea,$newitemid)   X-Ref
Copy all the files from the old assignment files area to the new one.
This is used by the plugin upgrade code.

param: int $oldcontextid The old assignment context id
param: int $oldcomponent The old assignment component ('assignment')
param: int $oldfilearea The old assignment filearea ('submissions')
param: int $olditemid The old submissionid (can be null e.g. intro)
param: int $newcontextid The new assignment context id
param: int $newcomponent The new assignment component ('assignment')
param: int $newfilearea The new assignment filearea ('submissions')
param: int $newitemid The new submissionid (can be null e.g. intro)
return: int The number of files copied

process_add_attempt_group($useridlist)   X-Ref
Add a new attempt for each user in the list - but reopen each group assignment
at most 1 time.

param: array $useridlist Array of userids to reopen.
return: bool

process_add_attempt($userid)   X-Ref
Check for a sess key and then call add_attempt.

param: int $userid int The user to add the attempt for
return: bool - true if successful.

add_attempt($userid)   X-Ref
Add a new attempt for a user.

param: int $userid int The user to add the attempt for
return: bool - true if successful.

get_user_grades_for_gradebook($userid)   X-Ref
Get an upto date list of user grades and feedback for the gradebook.

param: int $userid int or 0 for all users
return: array of grade data formated for the gradebook api

get_uniqueid_for_user($userid)   X-Ref
Call the static version of this function

param: int $userid The userid to lookup
return: int The unique id

allocate_unique_ids($assignid)   X-Ref
Foreach participant in the course - assign them a random id.

param: int $assignid The assignid to lookup

get_uniqueid_for_user_static($assignid, $userid)   X-Ref
Lookup this user id and return the unique id for this assignment.

param: int $assignid The assignment id
param: int $userid The userid to lookup
return: int The unique id

get_user_id_for_uniqueid($uniqueid)   X-Ref
Call the static version of this function.

param: int $uniqueid The uniqueid to lookup
return: int The user id or false if they don't exist

get_user_id_for_uniqueid_static($assignid, $uniqueid)   X-Ref
Lookup this unique id and return the user id for this assignment.

param: int $assignid The id of the assignment this user mapping is in
param: int $uniqueid The uniqueid to lookup
return: int The user id or false if they don't exist

get_marking_workflow_states_for_current_user()   X-Ref
Get the list of marking_workflow states the current user has permission to transition a grade to.

return: array of state => description

show_only_active_users()   X-Ref
Check is only active users in course should be shown.

return: bool true if only active users should be shown.

is_active_user($userid)   X-Ref
Return true is user is active user in course else false

param: int $userid
return: bool true is user is active in course.

is_gradebook_feedback_enabled()   X-Ref
Returns true if gradebook feedback plugin is enabled

return: bool true if gradebook feedback plugin is enabled and visible else false.

get_grading_status($userid)   X-Ref
Returns the grading status.

param: int $userid the user id
return: string returns the grading status

Class: assign_portfolio_caller  - X-Ref

Portfolio caller class for mod_assign.

expected_callbackargs()   X-Ref
Callback arg for a single file export.


__construct($callbackargs)   X-Ref
The constructor.

param: array $callbackargs

load_data()   X-Ref
Load data needed for the portfolio export.

If the assignment type implements portfolio_load_data(), the processing is delegated
to it. Otherwise, the caller must provide either fileid (to export single file) or
submissionid and filearea (to export all data attached to the given submission file area)
via callback arguments.


prepare_package()   X-Ref
Prepares the package up before control is passed to the portfolio plugin.

return: mixed

get_submission_plugin()   X-Ref
Fetch the plugin by its type.

return: assign_submission_plugin

get_sha1()   X-Ref
Calculate a sha1 has of either a single file or a list
of files based on the data set by load_data.

return: string

expected_time()   X-Ref
Calculate the time to transfer either a single file or a list
of files based on the data set by load_data.

return: int

check_permissions()   X-Ref
Checking the permissions.

return: bool

display_name()   X-Ref
Display a module name.

return: string

base_supported_formats()   X-Ref
Return array of formats supported by this portfolio call back.

return: array

Search This Site: