Mass Exam Marker Plugin
A Moodle plugin to help mark massive exams.
 All Data Structures Namespaces Files Functions Variables
assign Class Reference

Public Member Functions

 __construct ($coursemodulecontext, $coursemodule, $course)
 
 register_return_link ($action, $params)
 
 get_return_action ()
 
 get_return_params ()
 
 set_instance (stdClass $data)
 
 set_context (context $context)
 
 set_course (stdClass $course)
 
 get_feedback_plugins ()
 
 get_submission_plugins ()
 
 is_blind_marking ()
 
 has_submissions_or_grades ()
 
 get_plugin_by_type ($subtype, $type)
 
 get_feedback_plugin_by_type ($type)
 
 get_submission_plugin_by_type ($type)
 
 view ($action='')
 
 add_instance (stdClass $formdata, $callplugins)
 
 delete_instance ()
 
 reset_userdata ($data)
 
 update_gradebook ($reset, $coursemoduleid)
 
 get_admin_config ()
 
 update_calendar ($coursemoduleid)
 
 update_instance ($formdata)
 
 add_all_plugin_settings (MoodleQuickForm $mform)
 
 plugin_data_preprocessing (&$defaultvalues)
 
 has_instance ()
 
 get_instance ()
 
 get_grade_item ()
 
 get_course_context ()
 
 get_course_module ()
 
 get_context ()
 
 get_course ()
 
 display_grade ($grade, $editing, $userid=0, $modified=0)
 
 list_participants ($currentgroup, $idsonly)
 
 count_teams ()
 
 count_participants ($currentgroup)
 
 count_submissions_need_grading ()
 
 count_grades ()
 
 count_submissions ()
 
 count_submissions_with_status ($status)
 
 notify_grade_modified ($grade)
 
 update_user_flags ($flags)
 
 update_grade ($grade)
 
 get_submission_group_members ($groupid, $onlyids)
 
 get_submission_group_members_who_have_not_submitted ($groupid, $onlyids)
 
 get_group_submission ($userid, $groupid, $create, $attemptnumber=-1)
 
 get_submission_group ($userid)
 
 download_rewrite_pluginfile_urls ($text, $user, $plugin)
 
 render_editor_content ($filearea, $submissionid, $plugintype, $editor, $component)
 
 can_grade ()
 
 add_to_log ($action= '', $info= '', $url='', $return=false)
 
 get_renderer ()
 
 get_user_submission ($userid, $create, $attemptnumber=-1)
 
 get_user_flags ($userid, $create)
 
 get_user_grade ($userid, $create, $attemptnumber=-1)
 
 can_view_group_submission ($groupid)
 
 can_view_submission ($userid)
 
 view_student_summary ($user, $showlinks)
 
 submissions_open ($userid=0)
 
 render_area_files ($component, $area, $submissionid)
 
 send_notification ($userfrom, $userto, $messagetype, $eventtype, $updatetime)
 
 submit_for_grading ($data)
 
 save_user_extension ($userid, $extensionduedate)
 
 reveal_identities ()
 
 format_grade_for_log (stdClass $grade)
 
 copy_previous_attempt (&$notices)
 
 submission_empty ($submission)
 
 save_submission (stdClass $data, &$notices)
 
 grading_disabled ($userid, $checkworkflow=true)
 
 add_grade_form_elements (MoodleQuickForm $mform, stdClass $data, $params)
 
 is_any_feedback_plugin_enabled ()
 
 is_any_submission_plugin_enabled ()
 
 add_submission_form_elements (MoodleQuickForm $mform, stdClass $data)
 
 revert_to_draft ($userid)
 
 lock_submission ($userid)
 
 unlock_submission ($userid)
 
 save_grade ($userid, $data)
 
 can_upgrade ($type, $version)
 
 copy_area_files_for_upgrade ($oldcontextid, $oldcomponent, $oldfilearea, $olditemid, $newcontextid, $newcomponent, $newfilearea, $newitemid)
 
 get_user_grades_for_gradebook ($userid)
 
 get_uniqueid_for_user ($userid)
 
 get_user_id_for_uniqueid ($uniqueid)
 
 get_marking_workflow_states_for_current_user ()
 
 show_only_active_users ()
 
 is_active_user ($userid)
 

Static Public Member Functions

static cron ()
 
static send_assignment_notification ($userfrom, $userto, $messagetype, $eventtype, $updatetime, $coursemodule, $context, $course, $modulename, $assignmentname, $blindmarking, $uniqueidforuser)
 
static can_upgrade_assignment ($type, $version)
 
static allocate_unique_ids ($assignid)
 
static get_uniqueid_for_user_static ($assignid, $userid)
 
static get_user_id_for_uniqueid_static ($assignid, $uniqueid)
 

Data Fields

 $susers = null
 

Protected Member Functions

 show_intro ()
 
 load_plugins ($subtype)
 
 delete_grades ()
 
 update_plugin_instance (assign_plugin $plugin, stdClass $formdata)
 
 add_plugin_grade_elements ($grade, MoodleQuickForm $mform, stdClass $data, $userid)
 
 add_plugin_settings (assign_plugin $plugin, MoodleQuickForm $mform, &$pluginsenabled)
 
 get_module_name ()
 
 get_module_name_plural ()
 
 get_grading_userid_list ()
 
 pack_files ($filesforzipping)
 
 view_grant_extension ($mform)
 
 view_plugin_page ()
 
 view_plugin_content ($pluginsubtype)
 
 view_savegrading_result ($message)
 
 view_quickgrading_result ($message)
 
 view_footer ()
 
 download_submissions ()
 
 get_submission ($submissionid)
 
 get_grade ($gradeid)
 
 view_single_grade_page ($mform)
 
 view_reveal_identities_confirm ()
 
 view_return_links ()
 
 view_grading_table ()
 
 view_grading_page ()
 
 plagiarism_print_disclosure ()
 
 view_student_error_message ()
 
 view_edit_submission_page ($mform, $notices)
 
 is_graded ($userid)
 
 view_plugin_grading_batch_operation ($mform)
 
 process_grading_batch_operation (&$mform)
 
 check_submit_for_grading ($mform)
 
 show_submit_button ($submission=null, $teamsubmission=null)
 
 get_all_grades ($userid)
 
 get_all_submissions ($userid)
 
 view_submission_page ()
 
 convert_grade_for_gradebook (stdClass $grade)
 
 convert_submission_for_gradebook (stdClass $submission)
 
 gradebook_item_update ($submission=null, $grade=null)
 
 update_team_submission (stdClass $submission, $userid, $updatetime)
 
 update_submission (stdClass $submission, $userid, $updatetime, $teamsubmission)
 
 get_graders ($userid)
 
 notify_student_submission_copied (stdClass $submission)
 
 notify_student_submission_receipt (stdClass $submission)
 
 notify_graders (stdClass $submission)
 
 process_submit_for_grading ($mform)
 
 process_save_extension (&$mform)
 
 process_save_quick_grades ()
 
 process_reveal_identities ()
 
 process_save_grading_options ()
 
 format_submission_for_log (stdClass $submission)
 
 process_copy_previous_attempt (&$notices)
 
 process_save_submission (&$mform, &$notices)
 
 get_grading_instance ($userid, $grade, $gradingdisabled)
 
 add_plugin_submission_elements ($submission, MoodleQuickForm $mform, stdClass $data, $userid)
 
 process_revert_to_draft ($userid=0)
 
 process_set_batch_marking_workflow_state ()
 
 process_set_batch_marking_allocation ()
 
 process_lock_submission ($userid=0)
 
 process_unlock_submission ($userid=0)
 
 apply_grade_to_user ($formdata, $userid, $attemptnumber)
 
 process_outcomes ($userid, $formdata)
 
 process_save_grade (&$mform)
 
 process_add_attempt_group ($useridlist)
 
 process_add_attempt ($userid)
 
 add_attempt ($userid)
 

Static Protected Member Functions

static format_notification_message_text ($messagetype, $info, $course, $context, $modulename, $assignmentname)
 
static format_notification_message_html ($messagetype, $info, $course, $context, $modulename, $coursemodule, $assignmentname)
 

Constructor & Destructor Documentation

__construct (   $coursemodulecontext,
  $coursemodule,
  $course 
)

Constructor for the base assign class.

Parameters
mixed$coursemodulecontextcontext|null the course module context (or the course context if the coursemodule has not been created yet).
mixed$coursemodulethe current course module if it was already loaded, otherwise this class will load one from the context as required.
mixed$coursethe current course if it was already loaded, otherwise this class will load one from the context as required.

Member Function Documentation

add_all_plugin_settings ( MoodleQuickForm  $mform)

Add settings to edit plugin form.

Parameters
MoodleQuickForm$mformThe form to add the configuration settings to. This form is modified directly (not returned).
Returns
void
add_attempt (   $userid)
protected

Add a new attempt for a user.

Parameters
int$useridint The user to add the attempt for
Returns
bool - true if successful.
add_grade_form_elements ( MoodleQuickForm  $mform,
stdClass  $data,
  $params 
)

Add elements to grade form.

Parameters
MoodleQuickForm$mform
stdClass$data
array$params
Returns
void
add_instance ( stdClass  $formdata,
  $callplugins 
)

Add this instance to the database.

Parameters
stdClass$formdataThe data submitted from the form
bool$callpluginsThis is used to skip the plugin code when upgrading an old assignment to a new one (the plugins get called manually)
Returns
mixed false if an error occurs or the int id of the new instance
add_plugin_grade_elements (   $grade,
MoodleQuickForm  $mform,
stdClass  $data,
  $userid 
)
protected

Add elements in grading plugin form.

Parameters
mixed$gradestdClass|null
MoodleQuickForm$mform
stdClass$data
int$userid- The userid we are grading
Returns
void
add_plugin_settings ( assign_plugin  $plugin,
MoodleQuickForm  $mform,
$pluginsenabled 
)
protected

Add one plugins settings to edit plugin form.

Parameters
assign_plugin$pluginThe plugin to add the settings from
MoodleQuickForm$mformThe form to add the configuration settings to. This form is modified directly (not returned).
array$pluginsenabledA list of form elements to be added to a group. The new element is added to this array by this function.
Returns
void
add_plugin_submission_elements (   $submission,
MoodleQuickForm  $mform,
stdClass  $data,
  $userid 
)
protected

Add elements in submission plugin form.

Parameters
mixed$submissionstdClass|null
MoodleQuickForm$mform
stdClass$data
int$useridThe current userid (same as $USER->id)
Returns
void
add_submission_form_elements ( MoodleQuickForm  $mform,
stdClass  $data 
)

Add elements to submission form.

Parameters
MoodleQuickForm$mform
stdClass$data
Returns
void
add_to_log (   $action = '',
  $info = '',
  $url = '',
  $return = false 
)

Util function to add a message to the log.

Parameters
string$actionThe current action
string$infoA detailed description of the change. But no more than 255 characters.
string$urlThe url to the assign module instance.
bool$returnIf true, returns the arguments, else adds to log. The purpose of this is to retrieve the arguments to use them with the new event system (Event 2).
Returns
void|array
static allocate_unique_ids (   $assignid)
static

Foreach participant in the course - assign them a random id.

Parameters
int$assignidThe assignid to lookup
apply_grade_to_user (   $formdata,
  $userid,
  $attemptnumber 
)
protected

Apply a grade from a grading form to a user (may be called multiple times for a group submission).

Parameters
stdClass$formdata- the data from the form
int$userid- the user to apply the grade to
int$attemptnumber- The attempt number to apply the grade to.
Returns
void
can_grade ( )

Does this user have grade permission for this assignment?

Returns
bool
can_upgrade (   $type,
  $version 
)

This function returns true if it can upgrade an assignment from the 2.2 module.

Parameters
string$typeThe plugin type
int$versionThe plugin version
Returns
bool
static can_upgrade_assignment (   $type,
  $version 
)
static

This function is a static wrapper around can_upgrade.

Parameters
string$typeThe plugin type
int$versionThe plugin version
Returns
bool
can_view_group_submission (   $groupid)

Perform an access check to see if the current $USER can view this group submission.

Parameters
int$groupid
Returns
bool
can_view_submission (   $userid)

Perform an access check to see if the current $USER can view this users submission.

Parameters
int$userid
Returns
bool
check_submit_for_grading (   $mform)
protected

Ask the user to confirm they want to submit their work for grading.

Parameters
moodleform$mform- null unless form validation has failed
Returns
string
convert_grade_for_gradebook ( stdClass  $grade)
protected

Convert the final raw grade(s) in the grading table for the gradebook.

Parameters
stdClass$grade
Returns
array
convert_submission_for_gradebook ( stdClass  $submission)
protected

Convert submission details for the gradebook.

Parameters
stdClass$submission
Returns
array
copy_area_files_for_upgrade (   $oldcontextid,
  $oldcomponent,
  $oldfilearea,
  $olditemid,
  $newcontextid,
  $newcomponent,
  $newfilearea,
  $newitemid 
)

Copy all the files from the old assignment files area to the new one. This is used by the plugin upgrade code.

Parameters
int$oldcontextidThe old assignment context id
int$oldcomponentThe old assignment component ('assignment')
int$oldfileareaThe old assignment filearea ('submissions')
int$olditemidThe old submissionid (can be null e.g. intro)
int$newcontextidThe new assignment context id
int$newcomponentThe new assignment component ('assignment')
int$newfileareaThe new assignment filearea ('submissions')
int$newitemidThe new submissionid (can be null e.g. intro)
Returns
int The number of files copied
copy_previous_attempt ( $notices)

Copy the current assignment submission from the last submitted attempt.

Parameters
array$noticesAny error messages that should be shown to the user at the top of the edit submission form.
Returns
bool
count_grades ( )

Load a count of grades.

Returns
int number of grades
count_participants (   $currentgroup)

Load a count of active users enrolled in the current course with the specified permission and group. 0 for no group.

Parameters
int$currentgroup
Returns
int number of matching users
count_submissions ( )

Load a count of submissions.

Returns
int number of submissions
count_submissions_need_grading ( )

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.

Returns
int number of matching submissions
count_submissions_with_status (   $status)

Load a count of submissions with a specified status.

Parameters
string$statusThe submission status - should match one of the constants
Returns
int number of matching submissions
count_teams ( )

Load a count of valid teams for this assignment.

Returns
int number of valid teams
static cron ( )
static

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.

Returns
bool
delete_grades ( )
protected

Delete all grades from the gradebook for this assignment.

Returns
bool
delete_instance ( )

Delete this instance from the database.

Returns
bool false if an error occurs
display_grade (   $grade,
  $editing,
  $userid = 0,
  $modified = 0 
)

Return a grade in user-friendly form, whether it's a scale or not.

Parameters
mixed$gradeint|null
boolean$editingAre we allowing changes to this grade?
int$useridThe user id the grade belongs to
int$modifiedTimestamp from when the grade was last modified
Returns
string User-friendly representation of grade
download_rewrite_pluginfile_urls (   $text,
  $user,
  $plugin 
)

Rewrite plugin file urls so they resolve correctly in an exported zip.

Parameters
string$text- The replacement text
stdClass$user- The user record
assign_plugin$plugin- The assignment plugin
download_submissions ( )
protected

Download a zip file of all assignment submissions.

Returns
string - If an error occurs, this will contain the error page.
format_grade_for_log ( stdClass  $grade)

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.

Parameters
stdClass$grade
Returns
string
static format_notification_message_html (   $messagetype,
  $info,
  $course,
  $context,
  $modulename,
  $coursemodule,
  $assignmentname 
)
staticprotected

Format a notification for HTML.

Parameters
string$messagetype
stdClass$info
stdClass$course
stdClass$context
string$modulename
stdClass$coursemodule
string$assignmentname
static format_notification_message_text (   $messagetype,
  $info,
  $course,
  $context,
  $modulename,
  $assignmentname 
)
staticprotected

Format a notification for plain text.

Parameters
string$messagetype
stdClass$info
stdClass$course
stdClass$context
string$modulename
string$assignmentname
format_submission_for_log ( stdClass  $submission)
protected

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.

Parameters
stdClass$submission
Returns
string
get_admin_config ( )

Load and cache the admin config for this module.

Returns
stdClass the plugin config
get_all_grades (   $userid)
protected

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).

Parameters
int$useridIf not set, $USER->id will be used.
Returns
array $grades All grade records for this user.
get_all_submissions (   $userid)
protected

Get the submissions for all previous attempts.

Parameters
int$useridIf not set, $USER->id will be used.
Returns
array $submissions All submission records for this user (or group).
get_context ( )

Get context module.

Returns
context
get_course ( )

Get the current course.

Returns
mixed stdClass|null The course
get_course_context ( )

Get the context of the current course.

Returns
mixed context|null The course context
get_course_module ( )

Get the current course module.

Returns
mixed stdClass|null The course module
get_feedback_plugin_by_type (   $type)

Get a feedback plugin by type.

Parameters
string$type- The type of plugin e.g comments
Returns
mixed assign_feedback_plugin|null
get_feedback_plugins ( )

Get list of feedback plugins installed.

Returns
array
get_grade (   $gradeid)
protected

This will retrieve a grade object from the db.

Parameters
int$gradeidThe id of the grade
Returns
stdClass The grade record
get_grade_item ( )

Get the primary grade item for this assign instance.

Returns
stdClass The grade_item record
get_graders (   $userid)
protected

Returns a list of teachers that should be grading given submission.

Parameters
int$useridThe submission to grade
Returns
array
get_grading_instance (   $userid,
  $grade,
  $gradingdisabled 
)
protected

Get an instance of a grading form if advanced grading is enabled. This is specific to the assignment, marker and student.

Parameters
int$userid- The student userid
stdClass | false$grade- The grade record
bool$gradingdisabled
Returns
mixed gradingform_instance|null $gradinginstance
get_grading_userid_list ( )
protected

Utility function to get the userid for every row in the grading table so the order can be frozen while we iterate it.

Returns
array An array of userids
get_group_submission (   $userid,
  $groupid,
  $create,
  $attemptnumber = -1 
)

Load the group submission object for a particular user, optionally creating it if required.

Parameters
int$useridThe id of the user whose submission we want
int$groupidThe id of the group for this user - may be 0 in which case it is determined from the userid.
bool$createIf set to true a new submission object will be created in the database
int$attemptnumber- -1 means the latest attempt
Returns
stdClass The submission
get_instance ( )

Get the settings for the current instance of this assignment

Returns
stdClass The settings
get_marking_workflow_states_for_current_user ( )

Get the list of marking_workflow states the current user has permission to transition a grade to.

Returns
array of state => description
get_module_name ( )
protected

Get the name of the current module.

Returns
string the module name (Assignment)
get_module_name_plural ( )
protected

Get the plural name of the current module.

Returns
string the module name plural (Assignments)
get_plugin_by_type (   $subtype,
  $type 
)

Get a specific submission plugin by its type.

Parameters
string$subtypeassignsubmission | assignfeedback
string$type
Returns
mixed assign_plugin|null
get_renderer ( )

Lazy load the page renderer and expose the renderer to plugins.

Returns
assign_renderer
get_return_action ( )

Return an action that can be used to get back to the current page.

Returns
string action
get_return_params ( )

Return a list of parameters that can be used to get back to the current page.

Returns
array params
get_submission (   $submissionid)
protected

Load the submission object from it's id.

Parameters
int$submissionidThe id of the submission we want
Returns
stdClass The submission
get_submission_group (   $userid)

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

Parameters
int$useridThe id of the user whose submission we want
Returns
mixed The group or false
get_submission_group_members (   $groupid,
  $onlyids 
)

Get a list of the users in the same group as this user.

Parameters
int$groupidThe id of the group whose members we want or 0 for the default group
bool$onlyidsWhether to retrieve only the user id's
Returns
array The users (possibly id's only)
get_submission_group_members_who_have_not_submitted (   $groupid,
  $onlyids 
)

Get a list of the users in the same group as this user that have not submitted the assignment.

Parameters
int$groupidThe id of the group whose members we want or 0 for the default group
bool$onlyidsWhether to retrieve only the user id's
Returns
array The users (possibly id's only)
get_submission_plugin_by_type (   $type)

Get a submission plugin by type.

Parameters
string$type- The type of plugin e.g comments
Returns
mixed assign_submission_plugin|null
get_submission_plugins ( )

Get list of submission plugins installed.

Returns
array
get_uniqueid_for_user (   $userid)

Call the static version of this function

Parameters
int$useridThe userid to lookup
Returns
int The unique id
static get_uniqueid_for_user_static (   $assignid,
  $userid 
)
static

Lookup this user id and return the unique id for this assignment.

Parameters
int$assignidThe assignment id
int$useridThe userid to lookup
Returns
int The unique id
get_user_flags (   $userid,
  $create 
)

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.

Parameters
int$useridThe user we are getting the flags for.
bool$createIf true the flags record will be created if it does not exist
Returns
stdClass The flags record
get_user_grade (   $userid,
  $create,
  $attemptnumber = -1 
)

This will retrieve a grade object from the db, optionally creating it if required.

Parameters
int$useridThe user we are grading
bool$createIf true the grade will be created if it does not exist
int$attemptnumberThe attempt number to retrieve the grade for. -1 means the latest submission.
Returns
stdClass The grade record
get_user_grades_for_gradebook (   $userid)

Get an upto date list of user grades and feedback for the gradebook.

Parameters
int$useridint or 0 for all users
Returns
array of grade data formated for the gradebook api The data required by the gradebook api is userid, rawgrade, feedback, feedbackformat, usermodified, dategraded, datesubmitted
get_user_id_for_uniqueid (   $uniqueid)

Call the static version of this function.

Parameters
int$uniqueidThe uniqueid to lookup
Returns
int The user id or false if they don't exist
static get_user_id_for_uniqueid_static (   $assignid,
  $uniqueid 
)
static

Lookup this unique id and return the user id for this assignment.

Parameters
int$assignidThe id of the assignment this user mapping is in
int$uniqueidThe uniqueid to lookup
Returns
int The user id or false if they don't exist
get_user_submission (   $userid,
  $create,
  $attemptnumber = -1 
)

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.

Parameters
int$useridThe id of the user whose submission we want or 0 in which case USER->id is used
bool$createoptional - defaults to false. If set to true a new submission object will be created in the database.
int$attemptnumber- -1 means the latest attempt
Returns
stdClass The submission
gradebook_item_update (   $submission = null,
  $grade = null 
)
protected

Update grades in the gradebook.

Parameters
mixed$submissionstdClass|null
mixed$gradestdClass|null
Returns
bool
grading_disabled (   $userid,
  $checkworkflow = true 
)

Determine if this users grade can be edited.

Parameters
int$userid- The student userid
bool$checkworkflow- whether to include a check for the workflow state.
Returns
bool $gradingdisabled
has_instance ( )

Has this assignment been constructed from an instance?

Returns
bool
has_submissions_or_grades ( )

Does an assignment have submission(s) or grade(s) already?

Returns
bool
is_active_user (   $userid)

Return true is user is active user in course else false

Parameters
int$userid
Returns
bool true is user is active in course.
is_any_feedback_plugin_enabled ( )

Check if feedback plugins installed are enabled.

Returns
bool
is_any_submission_plugin_enabled ( )

Check if submission plugins installed are enabled.

Returns
bool
is_blind_marking ( )

Is blind marking enabled and reveal identities not set yet?

Returns
bool
is_graded (   $userid)
protected

See if this assignment has a grade yet.

Parameters
int$userid
Returns
bool
list_participants (   $currentgroup,
  $idsonly 
)

Load a list of users enrolled in the current course with the specified permission and group. 0 for no group.

Parameters
int$currentgroup
bool$idsonly
Returns
array List of user records
load_plugins (   $subtype)
protected

Load the plugins from the sub folders under subtype.

Parameters
string$subtype- either submission or feedback
Returns
array - The sorted list of plugins
lock_submission (   $userid)

Prevent student updates to this submission

Parameters
int$userid
Returns
bool
notify_grade_modified (   $grade)

Mark in the database that this grade record should have an update notification sent by cron.

Parameters
stdClass$gradea grade record keyed on id
Returns
bool true for success
notify_graders ( stdClass  $submission)
protected

Send notifications to graders upon student submissions.

Parameters
stdClass$submission
Returns
void
notify_student_submission_copied ( stdClass  $submission)
protected

Notify student upon successful submission copy.

Parameters
stdClass$submission
Returns
void
notify_student_submission_receipt ( stdClass  $submission)
protected

Notify student upon successful submission.

Parameters
stdClass$submission
Returns
void
pack_files (   $filesforzipping)
protected

Generate zip file from array of given files.

Parameters
array$filesforzipping- array of files to pass into archive_to_pathname. This array is indexed by the final file name and each element in the array is an instance of a stored_file object.
Returns
path of temp file - note this returned file does not have a .zip extension - it is a temp file.
plagiarism_print_disclosure ( )
protected

Capture the output of the plagiarism plugins disclosures and return it as a string.

Returns
void
plugin_data_preprocessing ( $defaultvalues)

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)

Parameters
array$defaultvalues
process_add_attempt (   $userid)
protected

Check for a sess key and then call add_attempt.

Parameters
int$useridint The user to add the attempt for
Returns
bool - true if successful.
process_add_attempt_group (   $useridlist)
protected

Add a new attempt for each user in the list - but reopen each group assignment at most 1 time.

Parameters
array$useridlistArray of userids to reopen.
Returns
bool
process_copy_previous_attempt ( $notices)
protected

Require a valid sess key and then call copy_previous_attempt.

Parameters
array$noticesAny error messages that should be shown to the user at the top of the edit submission form.
Returns
bool
process_grading_batch_operation ( $mform)
protected

Ask the user to confirm they want to perform this batch operation

Parameters
moodleform$mformSet to a grading batch operations form
Returns
string - the page to view after processing these actions
process_lock_submission (   $userid = 0)
protected

Prevent student updates to this submission. Uses url parameter userid.

Parameters
int$userid
Returns
void
process_outcomes (   $userid,
  $formdata 
)
protected

Save outcomes submitted from grading form

Parameters
int$userid
stdClass$formdata
process_reveal_identities ( )
protected

Reveal student identities to markers (and the gradebook).

Returns
void
process_revert_to_draft (   $userid = 0)
protected

Revert to draft. Uses url parameter userid if userid not supplied as a parameter.

Parameters
int$userid
Returns
boolean
process_save_extension ( $mform)
protected

Save extension date.

Parameters
moodleform$mformThe submitted form
Returns
boolean
process_save_grade ( $mform)
protected

Save grade.

Parameters
moodleform$mform
Returns
bool - was the grade saved
process_save_grading_options ( )
protected

Save grading options.

Returns
void
process_save_quick_grades ( )
protected

Save quick grades.

Returns
string The result of the save operation
process_save_submission ( $mform,
$notices 
)
protected

Save assignment submission.

Parameters
moodleform$mform
array$noticesAny error messages that should be shown to the user at the top of the edit submission form.
Returns
bool
process_set_batch_marking_allocation ( )
protected

Set the marking allocation for multiple users

Returns
void
process_set_batch_marking_workflow_state ( )
protected

Set the workflow state for multiple users

Returns
void
process_submit_for_grading (   $mform)
protected

Assignment submission is processed before grading.

Parameters
moodleform | null$mformIf validation failed when submitting this form - this is the moodleform. It can be null.
Returns
bool Return false if the validation fails. This affects which page is displayed next.
process_unlock_submission (   $userid = 0)
protected

Unlock the student submission. Uses url parameter userid.

Parameters
int$userid
Returns
bool
register_return_link (   $action,
  $params 
)

Set the action and parameters that can be used to return to the current page.

Parameters
string$actionThe action for the current page
array$paramsAn array of name value pairs which form the parameters to return to the current page.
Returns
void
render_area_files (   $component,
  $area,
  $submissionid 
)

Render the files in file area.

Parameters
string$component
string$area
int$submissionid
Returns
string
render_editor_content (   $filearea,
  $submissionid,
  $plugintype,
  $editor,
  $component 
)

Render the content in editor that is often used by plugin.

Parameters
string$filearea
int$submissionid
string$plugintype
string$editor
string$component
Returns
string
reset_userdata (   $data)

Actual implementation of the reset course functionality, delete all the assignment submissions for course $data->courseid.

Parameters
stdClass$datathe data submitted from the reset course.
Returns
array status array
reveal_identities ( )

Reveal student identities to markers (and the gradebook).

Returns
void
revert_to_draft (   $userid)

Revert to draft.

Parameters
int$userid
Returns
boolean
save_grade (   $userid,
  $data 
)

Save grade update.

Parameters
int$userid
stdClass$data
Returns
bool - was the grade saved
save_submission ( stdClass  $data,
$notices 
)

Save assignment submission for the current user.

Parameters
stdClass$data
array$noticesAny error messages that should be shown to the user.
Returns
bool
save_user_extension (   $userid,
  $extensionduedate 
)

Save the extension date for a single user.

Parameters
int$useridThe user id
mixed$extensionduedateEither an integer date or null
Returns
boolean
static send_assignment_notification (   $userfrom,
  $userto,
  $messagetype,
  $eventtype,
  $updatetime,
  $coursemodule,
  $context,
  $course,
  $modulename,
  $assignmentname,
  $blindmarking,
  $uniqueidforuser 
)
static

Message someone about something (static so it can be called from cron).

Parameters
stdClass$userfrom
stdClass$userto
string$messagetype
string$eventtype
int$updatetime
stdClass$coursemodule
stdClass$context
stdClass$course
string$modulename
string$assignmentname
bool$blindmarking
int$uniqueidforuser
Returns
void
send_notification (   $userfrom,
  $userto,
  $messagetype,
  $eventtype,
  $updatetime 
)

Message someone about something.

Parameters
stdClass$userfrom
stdClass$userto
string$messagetype
string$eventtype
int$updatetime
Returns
void
set_context ( context  $context)

Set the context.

Parameters
context$contextThe new context
set_course ( stdClass  $course)

Set the course data.

Parameters
stdClass$courseThe course data
set_instance ( stdClass  $data)

Set the submitted form data.

Parameters
stdClass$dataThe form data (instance)
show_intro ( )
protected

Based on the current assignment settings should we display the intro.

Returns
bool showintro
show_only_active_users ( )

Check is only active users in course should be shown.

Returns
bool true if only active users should be shown.
show_submit_button (   $submission = null,
  $teamsubmission = null 
)
protected

Returns true if the submit subsission button should be shown to the user.

Parameters
stdClass$submissionThe users own submission record.
stdClass$teamsubmissionThe users team submission record if there is one
Returns
bool
submission_empty (   $submission)

Determine if the current submission is empty or not.

Parameters
submission$submissionthe students submission record to check.
Returns
bool
submissions_open (   $userid = 0)

Is this assignment open for submissions?

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

Parameters
int$userid- Optional userid so we can see if a different user can submit
Returns
bool
submit_for_grading (   $data)

Submit a submission for grading.

Returns
bool Return false if the submission was not submitted.
unlock_submission (   $userid)

Unlock the student submission.

Parameters
int$userid
Returns
bool
update_calendar (   $coursemoduleid)

Update the calendar entries for this assignment.

Parameters
int$coursemoduleid- Required to pass this in because it might not exist in the database yet.
Returns
bool
update_grade (   $grade)

Update a grade in the grade table for the assignment and in the gradebook.

Parameters
stdClass$gradea grade record keyed on id
Returns
bool true for success
update_gradebook (   $reset,
  $coursemoduleid 
)

Update the gradebook information for this assignment.

Parameters
bool$resetIf true, will reset all grades in the gradbook for this assignment
int$coursemoduleidThis is required because it might not exist in the database yet
Returns
bool
update_instance (   $formdata)

Update this instance in the database.

Parameters
stdClass$formdata- the data submitted from the form
Returns
bool false if an error occurs
update_plugin_instance ( assign_plugin  $plugin,
stdClass  $formdata 
)
protected

Update the settings for a single plugin.

Parameters
assign_plugin$pluginThe plugin to update
stdClass$formdataThe form data
Returns
bool false if an error occurs
update_submission ( stdClass  $submission,
  $userid,
  $updatetime,
  $teamsubmission 
)
protected

Update grades in the gradebook based on submission time.

Parameters
stdClass$submission
int$userid
bool$updatetime
bool$teamsubmission
Returns
bool
update_team_submission ( stdClass  $submission,
  $userid,
  $updatetime 
)
protected

Update team submission.

Parameters
stdClass$submission
int$userid
bool$updatetime
Returns
bool
update_user_flags (   $flags)

Update user flags for this user in this assignment.

Parameters
stdClass$flagsa flags record keyed on id
Returns
bool true for success
view (   $action = '')

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.

Parameters
string$actionThe current action if any.
Returns
string - The page output.
view_edit_submission_page (   $mform,
  $notices 
)
protected

View edit submissions page.

Parameters
moodleform$mform
array$noticesA list of notices to display at the top of the edit submission form (e.g. from plugins).
Returns
string The page output.
view_footer ( )
protected

Display the page footer.

Returns
string
view_grading_page ( )
protected

View entire grading page.

Returns
string
view_grading_table ( )
protected

View the grading table of all submissions for this assignment.

Returns
string
view_grant_extension (   $mform)
protected

View the grant extension date page.

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

Parameters
moodleform$mform- Used for validation of the submitted data
Returns
string
view_plugin_content (   $pluginsubtype)
protected

Display the submission that is used by a plugin.

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

Parameters
string$pluginsubtype
Returns
string
view_plugin_grading_batch_operation (   $mform)
protected

Allows the plugin to show a batch grading operation page.

Parameters
moodleform$mform
Returns
none
view_plugin_page ( )
protected

View a page rendered by a plugin.

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

Returns
string
view_quickgrading_result (   $message)
protected

Display a grading error.

Parameters
string$message- The description of the result
Returns
string
view_return_links ( )
protected

View a link to go back to the previous page. Uses url parameters returnaction and returnparams.

Returns
string
view_reveal_identities_confirm ( )
protected

Show a confirmation page to make sure they want to release student identities.

Returns
string
view_savegrading_result (   $message)
protected

Display a continue page.

Parameters
string$message- The message to display
Returns
string
view_single_grade_page (   $mform)
protected

Print the grading page for a single user submission.

Parameters
moodleform$mform
Returns
string
view_student_error_message ( )
protected

Message for students when assignment submissions have been closed.

Returns
string
view_student_summary (   $user,
  $showlinks 
)

Print 2 tables of information with no action links - the submission summary and the grading summary.

Parameters
stdClass$userthe user to print the report for
bool$showlinks- Return plain text or links to the profile
Returns
string - the html summary
view_submission_page ( )
protected

View submissions page (contains details of current submission).

Returns
string

Field Documentation

$susers = null

The documentation for this class was generated from the following file: