Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Standard base class for mod_assign (assignment types). More...
Public Member Functions | |
__construct ($coursemodulecontext, $coursemodule, $course) | |
Constructor for the base assign class. More... | |
add_all_plugin_settings (MoodleQuickForm $mform) | |
Add settings to edit plugin form. More... | |
add_grade_form_elements (MoodleQuickForm $mform, stdClass $data, $params) | |
Add elements to grade form. More... | |
add_instance (stdClass $formdata, $callplugins) | |
Add this instance to the database. More... | |
add_submission_form_elements (MoodleQuickForm $mform, stdClass $data) | |
Add elements to submission form. More... | |
add_to_log ($action='', $info='', $url='', $return=false) | |
Util function to add a message to the log. More... | |
can_edit_group_submission ($groupid) | |
Perform an access check to see if the current $USER can edit this group submission. More... | |
can_edit_submission ($userid, $graderid=0) | |
Capability check to make sure this grader can edit this submission. More... | |
can_grade ($user=null) | |
Does this user have grade permission for this assignment? More... | |
can_upgrade ($type, $version) | |
This function returns true if it can upgrade an assignment from the 2.2 module. More... | |
can_view_grades ($groupid=null) | |
Does this user have view grade or grade permission for this assignment? More... | |
can_view_group_submission ($groupid) | |
Perform an access check to see if the current $USER can view this group submission. More... | |
can_view_submission ($userid) | |
Perform an access check to see if the current $USER can view this users submission. More... | |
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. More... | |
copy_previous_attempt (&$notices) | |
Copy the current assignment submission from the last submitted attempt. More... | |
count_grades () | |
Load a count of grades. More... | |
count_participants ($currentgroup) | |
Load a count of active users enrolled in the current course with the specified permission and group. More... | |
count_submissions ($includenew=false) | |
Load a count of submissions. More... | |
count_submissions_need_grading ($currentgroup=null) | |
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. More... | |
count_submissions_with_status ($status, $currentgroup=null) | |
Load a count of submissions with a specified status. More... | |
count_teams ($activitygroup=0) | |
Load a count of valid teams for this assignment. More... | |
delete_all_overrides () | |
Deletes all assign overrides from the database and clears any corresponding calendar events. | |
delete_instance () | |
Delete this instance from the database. More... | |
delete_override ($overrideid) | |
Deletes a assign override from the database and clears any corresponding calendar events. More... | |
display_grade ($grade, $editing, $userid=0, $modified=0) | |
Return a grade in user-friendly form, whether it's a scale or not. More... | |
download_rewrite_pluginfile_urls ($text, $user, $plugin) | |
Rewrite plugin file urls so they resolve correctly in an exported zip. More... | |
format_grade_for_log (stdClass $grade) | |
Take a grade object and print a short summary for the log file. More... | |
format_submission_for_log (stdClass $submission) | |
Take a submission object and print a short summary for the log file. More... | |
fullname ($user) | |
Get the name for a user - hiding their real name if blind marking is on. More... | |
get_admin_config () | |
Load and cache the admin config for this module. More... | |
get_all_groups ($userid) | |
Gets all groups the user is a member of. More... | |
get_all_submissions ($userid) | |
Get the submissions for all previous attempts. More... | |
get_assign_attempt_history_renderable ($user) | |
Creates an assign_attempt_history renderable. More... | |
get_assign_feedback_status_renderable ($user) | |
Creates an assign_feedback_status renderable. More... | |
get_assign_grading_summary_renderable ($activitygroup=null) | |
Creates an assign_grading_summary renderable. More... | |
get_assign_perpage () | |
Get the marking table page size. More... | |
get_assign_submission_status_renderable ($user, $showlinks) | |
Creates an assign_submission_status renderable. More... | |
get_context () | |
Get context module. More... | |
get_course () | |
Get the current course. More... | |
get_course_context () | |
Get the context of the current course. More... | |
get_course_module () | |
Get the current course module. More... | |
get_default_instance () | |
Get the settings for the current instance of this assignment. More... | |
get_feedback_plugin_by_type ($type) | |
Get a feedback plugin by type. More... | |
get_feedback_plugins () | |
Get list of feedback plugins installed. More... | |
get_filters () | |
Return array of valid search filters for the grading interface. More... | |
get_grade_item () | |
Get the primary grade item for this assign instance. More... | |
get_grading_status ($userid) | |
Returns the grading status. More... | |
get_group_submission ($userid, $groupid, $create, $attemptnumber=-1) | |
Load the group submission object for a particular user, optionally creating it if required. More... | |
get_instance (int $userid=null) | |
Get the settings for the current instance of this assignment. More... | |
get_marking_allocation_filters ($export=false) | |
Return array of valid grading allocation filters for the grading interface. More... | |
get_marking_workflow_filters ($export=false) | |
Return array of valid grading workflow filters for the grading interface. More... | |
get_marking_workflow_states_for_current_user () | |
Get the list of marking_workflow states the current user has permission to transition a grade to. More... | |
get_participant ($userid) | |
Load a user if they are enrolled in the current course. More... | |
get_plugin_by_type ($subtype, $type) | |
Get a specific submission plugin by its type. More... | |
get_renderer () | |
Lazy load the page renderer and expose the renderer to plugins. More... | |
get_return_action () | |
Return an action that can be used to get back to the current page. More... | |
get_return_params () | |
Return a list of parameters that can be used to get back to the current page. More... | |
get_shared_group_members ($cm, $userid) | |
Returns IDs of the users who share group membership with the specified user. More... | |
get_submission_group ($userid) | |
This is used for team assignments to get the group for the specified user. More... | |
get_submission_group_members ($groupid, $onlyids, $excludesuspended=false) | |
Get a list of the users in the same group as this user. More... | |
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. More... | |
get_submission_plugin_by_type ($type) | |
Get a submission plugin by type. More... | |
get_submission_plugins () | |
Get list of submission plugins installed. More... | |
get_uniqueid_for_user ($userid) | |
Call the static version of this function. More... | |
get_user_flags ($userid, $create) | |
This will retrieve a user flags object from the db optionally creating it if required. More... | |
get_user_grade ($userid, $create, $attemptnumber=-1) | |
This will retrieve a grade object from the db, optionally creating it if required. More... | |
get_user_grades_for_gradebook ($userid) | |
Get an upto date list of user grades and feedback for the gradebook. More... | |
get_user_id_for_uniqueid ($uniqueid) | |
Call the static version of this function. More... | |
get_user_submission ($userid, $create, $attemptnumber=-1) | |
Load the submission object for a particular user, optionally creating it if required. More... | |
get_useridlist_key ($id=null) | |
Generates the key that should be used for an entry in the useridlist cache. More... | |
get_useridlist_key_id () | |
The id used to uniquily identify the cache for this instance of the assign object. More... | |
get_valid_calendar_event_timestart_range (\calendar_event $event) | |
This function calculates the minimum and maximum cutoff values for the timestart of the given event. More... | |
grading_disabled ($userid, $checkworkflow=true) | |
Determine if this users grade can be edited. More... | |
has_instance () | |
Has this assignment been constructed from an instance? More... | |
has_overrides () | |
Returns whether an assign has any overrides. More... | |
has_submissions_or_grades () | |
Does an assignment have submission(s) or grade(s) already? More... | |
is_active_user ($userid) | |
Return true is user is active user in course else false. More... | |
is_any_feedback_plugin_enabled () | |
Check if feedback plugins installed are enabled. More... | |
is_any_submission_plugin_enabled () | |
Check if submission plugins installed are enabled. More... | |
is_blind_marking () | |
Is blind marking enabled and reveal identities not set yet? More... | |
is_gradebook_feedback_enabled () | |
Returns true if gradebook feedback plugin is enabled. More... | |
is_hidden_grader () | |
Is hidden grading enabled? More... | |
is_override_calendar_event (\calendar_event $event) | |
Check if the given calendar_event is either a user or group override event. More... | |
list_participants ($currentgroup, $idsonly, $tablesort=false) | |
Load a list of users enrolled in the current course with the specified permission and group. More... | |
list_participants_with_filter_status_and_group ($currentgroup, $tablesort=false) | |
Get the submission status/grading status for all submissions in this assignment. More... | |
load_plugins ($subtype) | |
Load the plugins from the sub folders under subtype. More... | |
lock_submission ($userid) | |
Prevent student updates to this submission. More... | |
new_submission_empty ($data) | |
Determine if a new submission is empty or not. More... | |
notify_grade_modified ($grade, $mailedoverride=false) | |
Mark in the database that this grade record should have an update notification sent by cron. More... | |
override_exists ($userid) | |
Returns user override. More... | |
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) More... | |
register_return_link ($action, $params) | |
Set the action and parameters that can be used to return to the current page. More... | |
remove_submission ($userid) | |
Remove any data from the current submission. More... | |
render_area_files ($component, $area, $submissionid) | |
Render the files in file area. More... | |
render_editor_content ($filearea, $submissionid, $plugintype, $editor, $component, $shortentext=false) | |
Render the content in editor that is often used by plugin. More... | |
require_view_grades () | |
Throw an error if the permissions to view grades in this assignment are missing. More... | |
require_view_group_submission ($groupid) | |
Throw an error if the permissions to view this users' group submission are missing. More... | |
require_view_submission ($userid) | |
Throw an error if the permissions to view this users submission are missing. More... | |
reset_userdata ($data) | |
Actual implementation of the reset course functionality, delete all the assignment submissions for course $data->courseid. More... | |
reveal_identities () | |
Reveal student identities to markers (and the gradebook). More... | |
revert_to_draft ($userid) | |
Revert to draft. More... | |
save_grade ($userid, $data) | |
Save grade update. More... | |
save_submission (stdClass $data, & $notices) | |
Save assignment submission for the current user. More... | |
save_user_extension ($userid, $extensionduedate) | |
Save the extension date for a single user. More... | |
send_notification ($userfrom, $userto, $messagetype, $eventtype, $updatetime) | |
Message someone about something. More... | |
set_context (context $context) | |
Set the context. More... | |
set_course (stdClass $course) | |
Set the course data. More... | |
set_instance (stdClass $data) | |
Set the submitted form data. More... | |
set_module_viewed () | |
Update the module completion status (set it viewed) and trigger module viewed event. More... | |
set_most_recent_team_submission ($submission) | |
Set the most recent submission for the team. More... | |
show_intro () | |
Based on the current assignment settings should we display the intro. More... | |
show_only_active_users () | |
Check is only active users in course should be shown. More... | |
submission_empty ($submission) | |
Determine if the current submission is empty or not. More... | |
submissions_open ($userid=0, $skipenrolled=false, $submission=false, $flags=false, $gradinginfo=false) | |
Is this assignment open for submissions? More... | |
submit_for_grading ($data, $notices) | |
Submit a submission for grading. More... | |
unlock_submission ($userid) | |
Unlock the student submission. More... | |
update_calendar ($coursemoduleid) | |
Update the calendar entries for this assignment. More... | |
update_effective_access ($userid) | |
Updates the assign properties with override information for a user. More... | |
update_grade ($grade, $reopenattempt=false) | |
Update a grade in the grade table for the assignment and in the gradebook. More... | |
update_gradebook ($reset, $coursemoduleid) | |
Update the gradebook information for this assignment. More... | |
update_instance ($formdata) | |
Update this instance in the database. More... | |
update_user_flags ($flags) | |
Update user flags for this user in this assignment. More... | |
view ($action='', $args=array()) | |
Display the assignment, used by view.php. More... | |
view_batch_markingallocation ($mform) | |
Shows a form that allows the allocated marker for selected submissions to be changed. More... | |
view_student_summary ($user, $showlinks) | |
Print 2 tables of information with no action links - the submission summary and the grading summary. More... | |
Static Public Member Functions | |
static | allocate_unique_ids ($assignid) |
Foreach participant in the course - assign them a random id. More... | |
static | can_upgrade_assignment ($type, $version) |
This function is a static wrapper around can_upgrade. More... | |
static | cron () |
Finds all assignment notifications that have yet to be mailed out, and mails them. More... | |
static | get_uniqueid_for_user_static ($assignid, $userid) |
Lookup this user id and return the unique id for this assignment. More... | |
static | get_user_id_for_uniqueid_static ($assignid, $uniqueid) |
Lookup this unique id and return the user id for this assignment. More... | |
static | send_assignment_notification ($userfrom, $userto, $messagetype, $eventtype, $updatetime, $coursemodule, $context, $course, $modulename, $assignmentname, $blindmarking, $uniqueidforuser) |
Message someone about something (static so it can be called from cron). More... | |
Protected Member Functions | |
add_attempt ($userid) | |
Add a new attempt for a user. More... | |
add_grade_notices () | |
Checks for any grade notices, and adds notifications. More... | |
add_plugin_grade_elements ($grade, MoodleQuickForm $mform, stdClass $data, $userid) | |
Add elements in grading plugin form. More... | |
add_plugin_settings (assign_plugin $plugin, MoodleQuickForm $mform, & $pluginsenabled) | |
Add one plugins settings to edit plugin form. More... | |
add_plugin_submission_elements ($submission, MoodleQuickForm $mform, stdClass $data, $userid) | |
Add elements in submission plugin form. More... | |
apply_grade_to_user ($formdata, $userid, $attemptnumber) | |
Apply a grade from a grading form to a user (may be called multiple times for a group submission). More... | |
check_submit_for_grading ($mform) | |
Ask the user to confirm they want to submit their work for grading. More... | |
convert_grade_for_gradebook (stdClass $grade) | |
Convert the final raw grade(s) in the grading table for the gradebook. More... | |
convert_submission_for_gradebook (stdClass $submission) | |
Convert submission details for the gradebook. More... | |
count_attachments () | |
Count the number of intro attachments. More... | |
delete_grades () | |
Delete all grades from the gradebook for this assignment. More... | |
download_submissions ($userids=false) | |
Download a zip file of all assignment submissions. More... | |
fix_null_grades () | |
View fix rescaled null grades. More... | |
get_all_grades ($userid) | |
Get the grades for all previous attempts. More... | |
get_error_messages () | |
Get error messages. More... | |
get_grade ($gradeid) | |
This will retrieve a grade object from the db. More... | |
get_graders ($userid) | |
Returns a list of teachers that should be grading given submission. More... | |
get_grading_instance ($userid, $grade, $gradingdisabled) | |
Get an instance of a grading form if advanced grading is enabled. More... | |
get_grading_userid_list ($cached=false, $useridlistid='') | |
Utility function to get the userid for every row in the grading table so the order can be frozen while we iterate it. More... | |
get_module_name () | |
Get the name of the current module. More... | |
get_module_name_plural () | |
Get the plural name of the current module. More... | |
get_notifiable_users ($userid) | |
Returns a list of users that should receive notification about given submission. More... | |
get_submission ($submissionid) | |
Load the submission object from it's id. More... | |
get_submissionstatement ($adminconfig, $instance, $context) | |
Get the correct submission statement depending on single submisison, team submission or team submission where all team memebers must submit. More... | |
gradebook_item_update ($submission=null, $grade=null) | |
Update grades in the gradebook. More... | |
has_visible_attachments () | |
Are there any intro attachments to display? More... | |
is_graded ($userid) | |
See if this assignment has a grade yet. More... | |
notify_graders (stdClass $submission) | |
Send notifications to graders upon student submissions. More... | |
notify_student_submission_copied (stdClass $submission) | |
Notify student upon successful submission copy. More... | |
notify_student_submission_receipt (stdClass $submission) | |
Notify student upon successful submission. More... | |
pack_files ($filesforzipping) | |
Generate zip file from array of given files. More... | |
plagiarism_print_disclosure () | |
Capture the output of the plagiarism plugins disclosures and return it as a string. More... | |
process_add_attempt ($userid) | |
Check for a sess key and then call add_attempt. More... | |
process_add_attempt_group ($useridlist) | |
Add a new attempt for each user in the list - but reopen each group assignment at most 1 time. More... | |
process_copy_previous_attempt (&$notices) | |
Require a valid sess key and then call copy_previous_attempt. More... | |
process_grading_batch_operation (& $mform) | |
Ask the user to confirm they want to perform this batch operation. More... | |
process_lock_submission ($userid=0) | |
Prevent student updates to this submission. More... | |
process_outcomes ($userid, $formdata, $sourceuserid=null) | |
Save outcomes submitted from grading form. More... | |
process_remove_submission ($userid=0) | |
Remove the current submission. More... | |
process_reveal_identities () | |
Reveal student identities to markers (and the gradebook). More... | |
process_revert_to_draft ($userid=0) | |
Revert to draft. More... | |
process_save_extension (& $mform) | |
Save extension date. More... | |
process_save_grade (&$mform) | |
Save grade. More... | |
process_save_grading_options () | |
Save grading options. More... | |
process_save_quick_grades () | |
Save quick grades. More... | |
process_save_submission (&$mform, &$notices) | |
Save assignment submission. More... | |
process_set_batch_marking_allocation () | |
Set the marking allocation for multiple users. More... | |
process_set_batch_marking_workflow_state () | |
Set the workflow state for multiple users. More... | |
process_submit_for_grading ($mform, $notices) | |
Assignment submission is processed before grading. More... | |
process_submit_other_for_grading ($mform, $notices) | |
A students submission is submitted for grading by a teacher. More... | |
process_unlock_submission ($userid=0) | |
Unlock the student submission. More... | |
reopen_submission_if_required ($userid, $submission, $addattempt) | |
If the requirements are met - reopen the submission for another attempt. More... | |
save_intro_draft_files ($formdata) | |
Save the attachments in the draft areas. More... | |
set_error_message (string $message) | |
Set error message. More... | |
show_submit_button ($submission=null, $teamsubmission=null, $userid=null) | |
Returns true if the submit subsission button should be shown to the user. More... | |
update_activity_completion_records ($teamsubmission, $requireallteammemberssubmit, $submission, $userid, $complete, $completion) | |
Updates and creates the completion records in mdl_course_modules_completion. More... | |
update_plugin_instance (assign_plugin $plugin, stdClass $formdata) | |
Update the settings for a single plugin. More... | |
update_submission (stdClass $submission, $userid, $updatetime, $teamsubmission) | |
Update grades in the gradebook based on submission time. More... | |
update_team_submission (stdClass $submission, $userid, $updatetime) | |
Update team submission. More... | |
view_batch_set_workflow_state ($mform) | |
Shows a form that allows the workflow state for selected submissions to be changed. More... | |
view_edit_submission_page ($mform, $notices) | |
View edit submissions page. More... | |
view_fix_rescaled_null_grades () | |
View fix rescaled null grades. More... | |
view_footer () | |
Display the page footer. More... | |
view_grader () | |
View entire grader app. More... | |
view_grading_page () | |
View entire grading page. More... | |
view_grading_table () | |
View the grading table of all submissions for this assignment. More... | |
view_grant_extension ($mform) | |
View the grant extension date page. More... | |
view_notices ($title, $notices) | |
Message for students when assignment submissions have been closed. More... | |
view_plugin_content ($pluginsubtype) | |
Display the submission that is used by a plugin. More... | |
view_plugin_grading_batch_operation ($mform) | |
Allows the plugin to show a batch grading operation page. More... | |
view_plugin_page () | |
View a page rendered by a plugin. More... | |
view_quickgrading_result ($message) | |
Display a continue page after quickgrading. More... | |
view_remove_submission_confirm () | |
Show a confirmation page to make sure they want to remove submission data. More... | |
view_return_links () | |
View a link to go back to the previous page. More... | |
view_reveal_identities_confirm () | |
Show a confirmation page to make sure they want to release student identities. More... | |
view_savegrading_result ($message) | |
Display a continue page after grading. More... | |
view_single_grade_page ($mform) | |
Print the grading page for a single user submission. More... | |
view_single_grading_panel ($args) | |
Print the grading page for a single user submission. More... | |
view_submission_page () | |
View submissions page (contains details of current submission). More... | |
Static Protected Member Functions | |
static | format_notification_message_html ($messagetype, $info, $course, $context, $modulename, $coursemodule, $assignmentname) |
Format a notification for HTML. More... | |
static | format_notification_message_text ($messagetype, $info, $course, $context, $modulename, $assignmentname) |
Format a notification for plain text. More... | |
Standard base class for mod_assign (assignment types).
assign::__construct | ( | $coursemodulecontext, | |
$coursemodule, | |||
$course | |||
) |
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.
mixed | $coursemodulecontext | context|null the course module context (or the course context if the coursemodule has not been created yet). |
mixed | $coursemodule | the current course module if it was already loaded, otherwise this class will load one from the context as required. |
mixed | $course | the current course if it was already loaded, otherwise this class will load one from the context as required. |
assign::add_all_plugin_settings | ( | MoodleQuickForm | $mform | ) |
Add settings to edit plugin form.
MoodleQuickForm | $mform | The form to add the configuration settings to. This form is modified directly (not returned). |
void |
|
protected |
Add a new attempt for a user.
int | $userid | int The user to add the attempt for |
bool | - true if successful. |
assign::add_grade_form_elements | ( | MoodleQuickForm | $mform, |
stdClass | $data, | ||
$params | |||
) |
Add elements to grade form.
MoodleQuickForm | $mform | |
stdClass | $data | |
array | $params |
void |
|
protected |
Checks for any grade notices, and adds notifications.
Will display on assignment main page and grading table.
void | The notifications API will render the notifications at the appropriate part of the page. |
assign::add_instance | ( | stdClass | $formdata, |
$callplugins | |||
) |
Add this instance to the database.
stdClass | $formdata | The data submitted from the form |
bool | $callplugins | This is used to skip the plugin code when upgrading an old assignment to a new one (the plugins get called manually) |
mixed | false if an error occurs or the int id of the new instance |
|
protected |
Add elements in grading plugin form.
mixed | $grade | stdClass|null |
MoodleQuickForm | $mform | |
stdClass | $data | |
int | $userid | - The userid we are grading |
void |
|
protected |
Add one plugins settings to edit plugin form.
assign_plugin | $plugin | The plugin to add the settings from |
MoodleQuickForm | $mform | The form to add the configuration settings to. This form is modified directly (not returned). |
array | $pluginsenabled | A list of form elements to be added to a group. The new element is added to this array by this function. |
void |
|
protected |
Add elements in submission plugin form.
mixed | $submission | stdClass|null |
MoodleQuickForm | $mform | |
stdClass | $data | |
int | $userid | The current userid (same as $USER->id) |
void |
assign::add_submission_form_elements | ( | MoodleQuickForm | $mform, |
stdClass | $data | ||
) |
assign::add_to_log | ( | $action = '' , |
|
$info = '' , |
|||
$url = '' , |
|||
$return = false |
|||
) |
Util function to add a message to the log.
string | $action | The current action |
string | $info | A detailed description of the change. But no more than 255 characters. |
string | $url | The url to the assign module instance. |
bool | $return | If 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). |
void|array |
|
static |
Foreach participant in the course - assign them a random id.
int | $assignid | The assignid to lookup |
|
protected |
Apply a grade from a grading form to a user (may be called multiple times for a group submission).
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. |
void |
assign::can_edit_group_submission | ( | $groupid | ) |
Perform an access check to see if the current $USER can edit this group submission.
int | $groupid |
bool |
assign::can_edit_submission | ( | $userid, | |
$graderid = 0 |
|||
) |
Capability check to make sure this grader can edit this submission.
int | $userid | - The user whose submission is to be edited |
int | $graderid | (optional) - The user who will do the editing (default to $USER->id). |
bool |
assign::can_grade | ( | $user = null | ) |
Does this user have grade permission for this assignment?
int | stdClass | $user | The object or id of the user who will do the editing (default to current user). |
bool |
assign::can_upgrade | ( | $type, | |
$version | |||
) |
This function returns true if it can upgrade an assignment from the 2.2 module.
string | $type | The plugin type |
int | $version | The plugin version |
bool |
|
static |
This function is a static wrapper around can_upgrade.
string | $type | The plugin type |
int | $version | The plugin version |
bool |
assign::can_view_grades | ( | $groupid = null | ) |
Does this user have view grade or grade permission for this assignment?
mixed | $groupid | int|null when is set to a value, use this group instead calculating it |
bool |
assign::can_view_group_submission | ( | $groupid | ) |
Perform an access check to see if the current $USER can view this group submission.
int | $groupid |
bool |
assign::can_view_submission | ( | $userid | ) |
Perform an access check to see if the current $USER can view this users submission.
int | $userid |
bool |
|
protected |
Ask the user to confirm they want to submit their work for grading.
moodleform | $mform | - null unless form validation has failed |
string |
|
protected |
Convert the final raw grade(s) in the grading table for the gradebook.
stdClass | $grade |
array |
|
protected |
Convert submission details for the gradebook.
stdClass | $submission |
array |
assign::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.
int | $oldcontextid | The old assignment context id |
int | $oldcomponent | The old assignment component ('assignment') |
int | $oldfilearea | The old assignment filearea ('submissions') |
int | $olditemid | The old submissionid (can be null e.g. intro) |
int | $newcontextid | The new assignment context id |
int | $newcomponent | The new assignment component ('assignment') |
int | $newfilearea | The new assignment filearea ('submissions') |
int | $newitemid | The new submissionid (can be null e.g. intro) |
int | The number of files copied |
assign::copy_previous_attempt | ( | & | $notices | ) |
Copy the current assignment submission from the last submitted attempt.
array | $notices | Any error messages that should be shown to the user at the top of the edit submission form. |
bool |
|
protected |
Count the number of intro attachments.
int |
assign::count_grades | ( | ) |
Load a count of grades.
int | number of grades |
assign::count_participants | ( | $currentgroup | ) |
Load a count of active users enrolled in the current course with the specified permission and group.
0 for no group.
int | $currentgroup |
int | number of matching users |
assign::count_submissions | ( | $includenew = false | ) |
Load a count of submissions.
bool | $includenew | When true, also counts the submissions with status 'new'. |
int | number of submissions |
assign::count_submissions_need_grading | ( | $currentgroup = null | ) |
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.
mixed | $currentgroup | int|null the group for counting (if null the function will determine it) |
int | number of matching submissions |
assign::count_submissions_with_status | ( | $status, | |
$currentgroup = null |
|||
) |
Load a count of submissions with a specified status.
string | $status | The submission status - should match one of the constants |
mixed | $currentgroup | int|null the group for counting (if null the function will determine it) |
int | number of matching submissions |
assign::count_teams | ( | $activitygroup = 0 | ) |
Load a count of valid teams for this assignment.
int | $activitygroup | Activity active group |
int | number of valid teams |
|
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.
bool |
|
protected |
Delete all grades from the gradebook for this assignment.
bool |
assign::delete_instance | ( | ) |
Delete this instance from the database.
bool | false if an error occurs |
assign::delete_override | ( | $overrideid | ) |
Deletes a assign override from the database and clears any corresponding calendar events.
int | $overrideid | The id of the override being deleted |
bool | true on success |
assign::display_grade | ( | $grade, | |
$editing, | |||
$userid = 0 , |
|||
$modified = 0 |
|||
) |
Return a grade in user-friendly form, whether it's a scale or not.
mixed | $grade | int|null |
boolean | $editing | Are we allowing changes to this grade? |
int | $userid | The user id the grade belongs to |
int | $modified | Timestamp from when the grade was last modified |
string | User-friendly representation of grade |
assign::download_rewrite_pluginfile_urls | ( | $text, | |
$user, | |||
$plugin | |||
) |
Rewrite plugin file urls so they resolve correctly in an exported zip.
string | $text | - The replacement text |
stdClass | $user | - The user record |
assign_plugin | $plugin | - The assignment plugin |
|
protected |
Download a zip file of all assignment submissions.
array | $userids | Array of user ids to download assignment submissions in a zip file |
string | - If an error occurs, this will contain the error page. |
|
protected |
View fix rescaled null grades.
bool | True if null all grades are now fixed. |
assign::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.
stdClass | $grade |
string |
|
staticprotected |
Format a notification for HTML.
string | $messagetype | |
stdClass | $info | |
stdClass | $course | |
stdClass | $context | |
string | $modulename | |
stdClass | $coursemodule | |
string | $assignmentname |
|
staticprotected |
Format a notification for plain text.
string | $messagetype | |
stdClass | $info | |
stdClass | $course | |
stdClass | $context | |
string | $modulename | |
string | $assignmentname |
assign::format_submission_for_log | ( | stdClass | $submission | ) |
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.
stdClass | $submission |
string |
assign::fullname | ( | $user | ) |
Get the name for a user - hiding their real name if blind marking is on.
stdClass | $user | The user record as required by fullname() |
string | The name. |
assign::get_admin_config | ( | ) |
Load and cache the admin config for this module.
stdClass | the plugin config |
|
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).
int | $userid | If not set, $USER->id will be used. |
array::$grades | All grade records for this user. |
assign::get_all_groups | ( | $userid | ) |
Gets all groups the user is a member of.
int | $userid | Teh id of the user who's groups we are checking |
array | The group objects |
assign::get_all_submissions | ( | $userid | ) |
Get the submissions for all previous attempts.
int | $userid | If not set, $USER->id will be used. |
array::$submissions | All submission records for this user (or group). |
assign::get_assign_attempt_history_renderable | ( | $user | ) |
Creates an assign_attempt_history renderable.
stdClass | $user | the user to get the report for |
assign_attempt_history | renderable object |
assign::get_assign_feedback_status_renderable | ( | $user | ) |
Creates an assign_feedback_status renderable.
stdClass | $user | the user to get the report for |
assign_feedback_status | renderable object |
assign::get_assign_grading_summary_renderable | ( | $activitygroup = null | ) |
Creates an assign_grading_summary renderable.
mixed | $activitygroup | int|null the group for calculating the grading summary (if null the function will determine it) |
assign_grading_summary | renderable object |
assign::get_assign_perpage | ( | ) |
Get the marking table page size.
integer |
assign::get_assign_submission_status_renderable | ( | $user, | |
$showlinks | |||
) |
Creates an assign_submission_status renderable.
stdClass | $user | the user to get the report for |
bool | $showlinks | return plain text or links to the profile |
assign_submission_status | renderable object |
assign::get_context | ( | ) |
Get context module.
context |
assign::get_course | ( | ) |
Get the current course.
mixed | stdClass|null The course |
assign::get_course_context | ( | ) |
Get the context of the current course.
mixed | context|null The course context |
assign::get_course_module | ( | ) |
Get the current course module.
cm_info|null | The course module or null if not known |
assign::get_default_instance | ( | ) |
Get the settings for the current instance of this assignment.
stdClass | The settings |
dml_exception |
|
protected |
Get error messages.
array | The array of error messages |
assign::get_feedback_plugin_by_type | ( | $type | ) |
Get a feedback plugin by type.
string | $type | - The type of plugin e.g comments |
mixed | assign_feedback_plugin|null |
assign::get_feedback_plugins | ( | ) |
Get list of feedback plugins installed.
array |
assign::get_filters | ( | ) |
Return array of valid search filters for the grading interface.
array |
|
protected |
This will retrieve a grade object from the db.
int | $gradeid | The id of the grade |
stdClass | The grade record |
assign::get_grade_item | ( | ) |
Get the primary grade item for this assign instance.
grade_item | The grade_item record |
|
protected |
Returns a list of teachers that should be grading given submission.
int | $userid | The submission to grade |
array |
|
protected |
Get an instance of a grading form if advanced grading is enabled.
This is specific to the assignment, marker and student.
int | $userid | - The student userid |
stdClass | false | $grade | - The grade record |
bool | $gradingdisabled |
mixed | gradingform_instance|null $gradinginstance |
assign::get_grading_status | ( | $userid | ) |
Returns the grading status.
int | $userid | the user id |
string | returns the grading status |
|
protected |
Utility function to get the userid for every row in the grading table so the order can be frozen while we iterate it.
boolean | $cached | If true, the cached list from the session could be returned. |
string | $useridlistid | String value used for caching the participant list. |
array | An array of userids |
assign::get_group_submission | ( | $userid, | |
$groupid, | |||
$create, | |||
$attemptnumber = -1 |
|||
) |
Load the group submission object for a particular user, optionally creating it if required.
int | $userid | The id of the user whose submission we want |
int | $groupid | The id of the group for this user - may be 0 in which case it is determined from the userid. |
bool | $create | If set to true a new submission object will be created in the database with the status set to "new". |
int | $attemptnumber | - -1 means the latest attempt |
stdClass | The submission |
assign::get_instance | ( | int | $userid = null | ) |
Get the settings for the current instance of this assignment.
int | null | $userid | the id of the user to load the assign instance for. |
stdClass | The settings |
assign::get_marking_allocation_filters | ( | $export = false | ) |
Return array of valid grading allocation filters for the grading interface.
boolean | $export | Export the list of filters for a template. |
array |
assign::get_marking_workflow_filters | ( | $export = false | ) |
Return array of valid grading workflow filters for the grading interface.
boolean | $export | Export the list of filters for a template. |
array |
assign::get_marking_workflow_states_for_current_user | ( | ) |
Get the list of marking_workflow states the current user has permission to transition a grade to.
array | of state => description |
|
protected |
Get the name of the current module.
string | the module name (Assignment) |
|
protected |
Get the plural name of the current module.
string | the module name plural (Assignments) |
|
protected |
Returns a list of users that should receive notification about given submission.
int | $userid | The submission to grade |
array |
assign::get_participant | ( | $userid | ) |
Load a user if they are enrolled in the current course.
Populated with submission status for this assignment.
int | $userid |
null|stdClass | user record |
assign::get_plugin_by_type | ( | $subtype, | |
$type | |||
) |
Get a specific submission plugin by its type.
string | $subtype | assignsubmission | assignfeedback |
string | $type |
mixed | assign_plugin|null |
assign::get_renderer | ( | ) |
Lazy load the page renderer and expose the renderer to plugins.
assign_renderer |
assign::get_return_action | ( | ) |
Return an action that can be used to get back to the current page.
string | action |
assign::get_return_params | ( | ) |
Return a list of parameters that can be used to get back to the current page.
array | params |
assign::get_shared_group_members | ( | $cm, | |
$userid | |||
) |
Returns IDs of the users who share group membership with the specified user.
stdClass | cm_info | $cm | Course-module |
int | $userid | User ID |
array | An array of ID of users. |
|
protected |
Load the submission object from it's id.
int | $submissionid | The id of the submission we want |
stdClass | The submission |
assign::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
int | $userid | The id of the user whose submission we want |
mixed | The group or false |
assign::get_submission_group_members | ( | $groupid, | |
$onlyids, | |||
$excludesuspended = false |
|||
) |
Get a list of the users in the same group as this user.
int | $groupid | The id of the group whose members we want or 0 for the default group |
bool | $onlyids | Whether to retrieve only the user id's |
bool | $excludesuspended | Whether to exclude suspended users |
array | The users (possibly id's only) |
assign::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.
int | $groupid | The id of the group whose members we want or 0 for the default group |
bool | $onlyids | Whether to retrieve only the user id's |
array | The users (possibly id's only) |
assign::get_submission_plugin_by_type | ( | $type | ) |
Get a submission plugin by type.
string | $type | - The type of plugin e.g comments |
mixed | assign_submission_plugin|null |
assign::get_submission_plugins | ( | ) |
Get list of submission plugins installed.
array |
|
protected |
Get the correct submission statement depending on single submisison, team submission or team submission where all team memebers must submit.
array | $adminconfig | |
assign | $instance | |
context | $context |
string |
assign::get_uniqueid_for_user | ( | $userid | ) |
Call the static version of this function.
int | $userid | The userid to lookup |
int | The unique id |
|
static |
Lookup this user id and return the unique id for this assignment.
int | $assignid | The assignment id |
int | $userid | The userid to lookup |
int | The unique id |
assign::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.
int | $userid | The user we are getting the flags for. |
bool | $create | If true the flags record will be created if it does not exist |
stdClass | The flags record |
assign::get_user_grade | ( | $userid, | |
$create, | |||
$attemptnumber = -1 |
|||
) |
This will retrieve a grade object from the db, optionally creating it if required.
int | $userid | The user we are grading |
bool | $create | If true the grade will be created if it does not exist |
int | $attemptnumber | The attempt number to retrieve the grade for. -1 means the latest submission. |
stdClass | The grade record |
assign::get_user_grades_for_gradebook | ( | $userid | ) |
Get an upto date list of user grades and feedback for the gradebook.
int | $userid | int or 0 for all users |
array | of grade data formated for the gradebook api The data required by the gradebook api is userid, rawgrade, feedback, feedbackformat, usermodified, dategraded, datesubmitted |
assign::get_user_id_for_uniqueid | ( | $uniqueid | ) |
Call the static version of this function.
int | $uniqueid | The uniqueid to lookup |
int | The user id or false if they don't exist |
|
static |
Lookup this unique id and return the user id for this assignment.
int | $assignid | The id of the assignment this user mapping is in |
int | $uniqueid | The uniqueid to lookup |
int | The user id or false if they don't exist |
assign::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.
int | $userid | The id of the user whose submission we want or 0 in which case USER->id is used |
bool | $create | If set to true a new submission object will be created in the database with the status set to "new". |
int | $attemptnumber | - -1 means the latest attempt |
stdClass | The submission |
assign::get_useridlist_key | ( | $id = null | ) |
Generates the key that should be used for an entry in the useridlist cache.
string | $id | Generate a key for this instance (optional) |
string | The key for the id, or new entry if no $id is passed. |
assign::get_useridlist_key_id | ( | ) |
The id used to uniquily identify the cache for this instance of the assign object.
string |
assign::get_valid_calendar_event_timestart_range | ( | \calendar_event | $event | ) |
This function calculates the minimum and maximum cutoff values for the timestart of the given event.
It will return an array with two values, the first being the minimum cutoff value and the second being the maximum cutoff value. Either or both values can be null, which indicates there is no minimum or maximum, respectively.
If a cutoff is required then the function must return an array containing the cutoff timestamp and error string to display to the user if the cutoff value is violated.
A minimum and maximum cutoff return value will look like: [ [1505704373, 'The due date must be after the sbumission start date'], [1506741172, 'The due date must be before the cutoff date'] ]
If the event does not have a valid timestart range then [false, false] will be returned.
calendar_event | $event | The calendar event to get the time range for |
array |
|
protected |
Update grades in the gradebook.
mixed | $submission | stdClass|null |
mixed | $grade | stdClass|null |
bool |
assign::grading_disabled | ( | $userid, | |
$checkworkflow = true |
|||
) |
Determine if this users grade can be edited.
int | $userid | - The student userid |
bool | $checkworkflow | - whether to include a check for the workflow state. |
bool::$gradingdisabled |
assign::has_instance | ( | ) |
Has this assignment been constructed from an instance?
bool |
assign::has_overrides | ( | ) |
Returns whether an assign has any overrides.
true | if any, false if not |
assign::has_submissions_or_grades | ( | ) |
Does an assignment have submission(s) or grade(s) already?
bool |
|
protected |
Are there any intro attachments to display?
boolean |
assign::is_active_user | ( | $userid | ) |
Return true is user is active user in course else false.
int | $userid |
bool | true is user is active in course. |
assign::is_any_feedback_plugin_enabled | ( | ) |
Check if feedback plugins installed are enabled.
bool |
assign::is_any_submission_plugin_enabled | ( | ) |
Check if submission plugins installed are enabled.
bool |
assign::is_blind_marking | ( | ) |
Is blind marking enabled and reveal identities not set yet?
bool |
assign::is_gradebook_feedback_enabled | ( | ) |
Returns true if gradebook feedback plugin is enabled.
bool | true if gradebook feedback plugin is enabled and visible else false. |
|
protected |
See if this assignment has a grade yet.
int | $userid |
bool |
assign::is_hidden_grader | ( | ) |
Is hidden grading enabled?
This just checks the assignment settings. Remember to check the user has the 'showhiddengrader' capability too
bool |
assign::is_override_calendar_event | ( | \calendar_event | $event | ) |
Check if the given calendar_event is either a user or group override event.
bool |
assign::list_participants | ( | $currentgroup, | |
$idsonly, | |||
$tablesort = false |
|||
) |
Load a list of users enrolled in the current course with the specified permission and group.
0 for no group. Apply any current sort filters from the grading table.
int | $currentgroup | |
bool | $idsonly |
array | List of user records |
assign::list_participants_with_filter_status_and_group | ( | $currentgroup, | |
$tablesort = false |
|||
) |
Get the submission status/grading status for all submissions in this assignment.
These statuses match the available filters (requiregrading, submitted, notsubmitted, grantedextension). If this is a group assignment, group info is also returned.
int | $currentgroup | |
boolean | $tablesort | Apply current user table sorting preferences. |
array | List of user records with extra fields 'submitted', 'notsubmitted', 'requiregrading', 'grantedextension', 'groupid', 'groupname' |
assign::load_plugins | ( | $subtype | ) |
Load the plugins from the sub folders under subtype.
string | $subtype | - either submission or feedback |
array | - The sorted list of plugins |
assign::lock_submission | ( | $userid | ) |
Prevent student updates to this submission.
int | $userid |
bool |
assign::new_submission_empty | ( | $data | ) |
Determine if a new submission is empty or not.
stdClass | $data | Submission data |
bool |
assign::notify_grade_modified | ( | $grade, | |
$mailedoverride = false |
|||
) |
Mark in the database that this grade record should have an update notification sent by cron.
stdClass | $grade | a grade record keyed on id |
bool | $mailedoverride | when true, flag notification to be sent again. |
bool | true for success |
|
protected |
Send notifications to graders upon student submissions.
stdClass | $submission |
void |
|
protected |
Notify student upon successful submission copy.
stdClass | $submission |
void |
|
protected |
Notify student upon successful submission.
stdClass | $submission |
void |
assign::override_exists | ( | $userid | ) |
Returns user override.
Algorithm: For each assign setting, if there is a matching user-specific override, then use that otherwise, if there are group-specific overrides, use the one with the lowest sort order. If neither applies, leave the assign setting unchanged.
int | $userid | The userid. |
stdClass | The override |
|
protected |
Generate zip file from array of given files.
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. |
path | of temp file - note this returned file does not have a .zip extension - it is a temp file. |
|
protected |
Capture the output of the plagiarism plugins disclosures and return it as a string.
string |
assign::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)
array | $defaultvalues |
|
protected |
Check for a sess key and then call add_attempt.
int | $userid | int The user to add the attempt for |
bool | - true if successful. |
|
protected |
Add a new attempt for each user in the list - but reopen each group assignment at most 1 time.
array | $useridlist | Array of userids to reopen. |
bool |
|
protected |
Require a valid sess key and then call copy_previous_attempt.
array | $notices | Any error messages that should be shown to the user at the top of the edit submission form. |
bool |
|
protected |
Ask the user to confirm they want to perform this batch operation.
moodleform | $mform | Set to a grading batch operations form |
string | - the page to view after processing these actions |
|
protected |
Prevent student updates to this submission.
Uses url parameter userid.
int | $userid |
void |
|
protected |
Save outcomes submitted from grading form.
int | $userid | |
stdClass | $formdata | |
int | $sourceuserid | The user ID under which the outcome data is accessible. This is relevant for an outcome set to a user but applied to an entire group. |
|
protected |
Remove the current submission.
int | $userid |
boolean |
|
protected |
Reveal student identities to markers (and the gradebook).
void |
|
protected |
Revert to draft.
Uses url parameter userid if userid not supplied as a parameter.
int | $userid |
boolean |
|
protected |
Save extension date.
moodleform | $mform | The submitted form |
boolean |
|
protected |
Save grade.
moodleform | $mform |
bool | - was the grade saved |
|
protected |
Save grading options.
void |
|
protected |
Save quick grades.
string | The result of the save operation |
|
protected |
Save assignment submission.
moodleform | $mform | |
array | $notices | Any error messages that should be shown to the user at the top of the edit submission form. |
bool |
|
protected |
Set the marking allocation for multiple users.
void |
|
protected |
Set the workflow state for multiple users.
void |
|
protected |
Assignment submission is processed before grading.
moodleform | null | $mform | If validation failed when submitting this form - this is the moodleform. It can be null. |
bool | Return false if the validation fails. This affects which page is displayed next. |
|
protected |
A students submission is submitted for grading by a teacher.
bool |
|
protected |
Unlock the student submission.
Uses url parameter userid.
int | $userid |
bool |
assign::register_return_link | ( | $action, | |
$params | |||
) |
Set the action and parameters that can be used to return to the current page.
string | $action | The action for the current page |
array | $params | An array of name value pairs which form the parameters to return to the current page. |
void |
assign::remove_submission | ( | $userid | ) |
Remove any data from the current submission.
int | $userid |
boolean |
assign::render_area_files | ( | $component, | |
$area, | |||
$submissionid | |||
) |
Render the files in file area.
string | $component | |
string | $area | |
int | $submissionid |
string |
assign::render_editor_content | ( | $filearea, | |
$submissionid, | |||
$plugintype, | |||
$editor, | |||
$component, | |||
$shortentext = false |
|||
) |
Render the content in editor that is often used by plugin.
string | $filearea | |
int | $submissionid | |
string | $plugintype | |
string | $editor | |
string | $component | |
bool | $shortentext | Whether to shorten the text content. |
string |
|
protected |
If the requirements are met - reopen the submission for another attempt.
Only call this function when grading the latest attempt.
int | $userid | The userid. |
stdClass | $submission | The submission (may be a group submission). |
bool | $addattempt | - True if the "allow another attempt" checkbox was checked. |
bool | - true if another attempt was added. |
assign::require_view_grades | ( | ) |
Throw an error if the permissions to view grades in this assignment are missing.
required_capability_exception |
none |
assign::require_view_group_submission | ( | $groupid | ) |
Throw an error if the permissions to view this users' group submission are missing.
int | $groupid | Group id. |
required_capability_exception |
assign::require_view_submission | ( | $userid | ) |
Throw an error if the permissions to view this users submission are missing.
required_capability_exception |
none |
assign::reset_userdata | ( | $data | ) |
Actual implementation of the reset course functionality, delete all the assignment submissions for course $data->courseid.
stdClass | $data | the data submitted from the reset course. |
array | status array |
assign::reveal_identities | ( | ) |
Reveal student identities to markers (and the gradebook).
void |
assign::revert_to_draft | ( | $userid | ) |
Revert to draft.
int | $userid |
boolean |
assign::save_grade | ( | $userid, | |
$data | |||
) |
Save grade update.
int | $userid | |
stdClass | $data |
bool | - was the grade saved |
|
protected |
Save the attachments in the draft areas.
stdClass | $formdata |
assign::save_submission | ( | stdClass | $data, |
& | $notices | ||
) |
Save assignment submission for the current user.
stdClass | $data | |
array | $notices | Any error messages that should be shown to the user. |
bool |
assign::save_user_extension | ( | $userid, | |
$extensionduedate | |||
) |
Save the extension date for a single user.
int | $userid | The user id |
mixed | $extensionduedate | Either an integer date or null |
boolean |
|
static |
Message someone about something (static so it can be called from cron).
stdClass | $userfrom | |
stdClass | $userto | |
string | $messagetype | |
string | $eventtype | |
int | $updatetime | |
stdClass | $coursemodule | |
stdClass | $context | |
stdClass | $course | |
string | $modulename | |
string | $assignmentname | |
bool | $blindmarking | |
int | $uniqueidforuser |
void |
assign::send_notification | ( | $userfrom, | |
$userto, | |||
$messagetype, | |||
$eventtype, | |||
$updatetime | |||
) |
Message someone about something.
stdClass | $userfrom | |
stdClass | $userto | |
string | $messagetype | |
string | $eventtype | |
int | $updatetime |
void |
assign::set_context | ( | context | $context | ) |
Set the context.
context | $context | The new context |
assign::set_course | ( | stdClass | $course | ) |
Set the course data.
stdClass | $course | The course data |
|
protected |
Set error message.
string | $message | The error message |
assign::set_instance | ( | stdClass | $data | ) |
Set the submitted form data.
stdClass | $data | The form data (instance) |
assign::set_module_viewed | ( | ) |
Update the module completion status (set it viewed) and trigger module viewed event.
assign::set_most_recent_team_submission | ( | $submission | ) |
Set the most recent submission for the team.
The most recent team submission is used to determine if another attempt should be created when allowing another attempt on a group assignment, and whether the gradebook should be updated.
stdClass | $submission | The most recent submission of the group. |
assign::show_intro | ( | ) |
Based on the current assignment settings should we display the intro.
bool | showintro |
assign::show_only_active_users | ( | ) |
Check is only active users in course should be shown.
bool | true if only active users should be shown. |
|
protected |
Returns true if the submit subsission button should be shown to the user.
stdClass | $submission | The users own submission record. |
stdClass | $teamsubmission | The users team submission record if there is one |
int | $userid | The user |
bool |
assign::submission_empty | ( | $submission | ) |
Determine if the current submission is empty or not.
submission | $submission | the students submission record to check. |
bool |
assign::submissions_open | ( | $userid = 0 , |
|
$skipenrolled = false , |
|||
$submission = false , |
|||
$flags = false , |
|||
$gradinginfo = false |
|||
) |
Is this assignment open for submissions?
Check the due date, prevent late submissions, has this person already submitted, is the assignment locked?
int | $userid | - Optional userid so we can see if a different user can submit |
bool | $skipenrolled | - Skip enrollment checks (because they have been done already) |
stdClass | $submission | - Pre-fetched submission record (or false to fetch it) |
stdClass | $flags | - Pre-fetched user flags record (or false to fetch it) |
stdClass | $gradinginfo | - Pre-fetched user gradinginfo record (or false to fetch it) |
bool |
assign::submit_for_grading | ( | $data, | |
$notices | |||
) |
Submit a submission for grading.
stdClass | $data | - The form data |
array | $notices | - List of error messages to display on an error condition. |
bool | Return false if the submission was not submitted. |
assign::unlock_submission | ( | $userid | ) |
Unlock the student submission.
int | $userid |
bool |
|
protected |
Updates and creates the completion records in mdl_course_modules_completion.
int | $teamsubmission | value of 0 or 1 to indicate whether this is a group activity |
int | $requireallteammemberssubmit | value of 0 or 1 to indicate whether all group members must click Submit |
obj | $submission | the submission |
int | $userid | the user id |
int | $complete | |
obj | $completion |
null |
assign::update_calendar | ( | $coursemoduleid | ) |
Update the calendar entries for this assignment.
int | $coursemoduleid | - Required to pass this in because it might not exist in the database yet. |
bool |
assign::update_effective_access | ( | $userid | ) |
Updates the assign properties with override information for a user.
Algorithm: For each assign setting, if there is a matching user-specific override, then use that otherwise, if there are group-specific overrides, return the most lenient combination of them. If neither applies, leave the assign setting unchanged.
int | $userid | The userid. |
assign::update_grade | ( | $grade, | |
$reopenattempt = false |
|||
) |
Update a grade in the grade table for the assignment and in the gradebook.
stdClass | $grade | a grade record keyed on id |
bool | $reopenattempt | If the attempt reopen method is manual, allow another attempt at this assignment. |
bool | true for success |
assign::update_gradebook | ( | $reset, | |
$coursemoduleid | |||
) |
Update the gradebook information for this assignment.
bool | $reset | If true, will reset all grades in the gradbook for this assignment |
int | $coursemoduleid | This is required because it might not exist in the database yet |
bool |
assign::update_instance | ( | $formdata | ) |
Update this instance in the database.
stdClass | $formdata | - the data submitted from the form |
bool | false if an error occurs |
|
protected |
Update the settings for a single plugin.
assign_plugin | $plugin | The plugin to update |
stdClass | $formdata | The form data |
bool | false if an error occurs |
|
protected |
Update grades in the gradebook based on submission time.
stdClass | $submission | |
int | $userid | |
bool | $updatetime | |
bool | $teamsubmission |
bool |
|
protected |
Update team submission.
stdClass | $submission | |
int | $userid | |
bool | $updatetime |
bool |
assign::update_user_flags | ( | $flags | ) |
Update user flags for this user in this assignment.
stdClass | $flags | a flags record keyed on id |
bool | true for success |
assign::view | ( | $action = '' , |
|
$args = array() |
|||
) |
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.
string | $action | The current action if any. |
array | $args | Optional arguments to pass to the view (instead of getting them from GET and POST). |
string | - The page output. |
assign::view_batch_markingallocation | ( | $mform | ) |
Shows a form that allows the allocated marker for selected submissions to be changed.
moodleform | $mform | Set to a grading batch operations form |
string | - the page to view after processing these actions |
|
protected |
Shows a form that allows the workflow state for selected submissions to be changed.
moodleform | $mform | Set to a grading batch operations form |
string | - the page to view after processing these actions |
|
protected |
View edit submissions page.
moodleform | $mform | |
array | $notices | A list of notices to display at the top of the edit submission form (e.g. from plugins). |
string | The page output. |
|
protected |
View fix rescaled null grades.
void | The notifications API will render the notifications at the appropriate part of the page. |
|
protected |
Display the page footer.
string |
|
protected |
View entire grader app.
string |
|
protected |
View entire grading page.
string |
|
protected |
View the grading table of all submissions for this assignment.
string |
|
protected |
View the grant extension date page.
Uses url parameters 'userid' or from parameter 'selectedusers'
moodleform | $mform | - Used for validation of the submitted data |
string |
|
protected |
Message for students when assignment submissions have been closed.
string | $title | The page title |
array | $notices | The array of notices to show. |
string |
|
protected |
Display the submission that is used by a plugin.
Uses url parameters 'sid', 'gid' and 'plugin'.
string | $pluginsubtype |
string |
|
protected |
Allows the plugin to show a batch grading operation page.
moodleform | $mform |
none |
|
protected |
View a page rendered by a plugin.
Uses url parameters 'pluginaction', 'pluginsubtype', 'plugin', and 'id'.
string |
|
protected |
Display a continue page after quickgrading.
string | $message | - The message to display. |
string |
|
protected |
Show a confirmation page to make sure they want to remove submission data.
string |
|
protected |
View a link to go back to the previous page.
Uses url parameters returnaction and returnparams.
string |
|
protected |
Show a confirmation page to make sure they want to release student identities.
string |
|
protected |
Display a continue page after grading.
string | $message | - The message to display. |
string |
|
protected |
Print the grading page for a single user submission.
moodleform | $mform |
string |
|
protected |
Print the grading page for a single user submission.
array | $args | Optional args array (better than pulling args from _GET and _POST) |
string |
assign::view_student_summary | ( | $user, | |
$showlinks | |||
) |
Print 2 tables of information with no action links - the submission summary and the grading summary.
stdClass | $user | the user to print the report for |
bool | $showlinks | - Return plain text or links to the profile |
string | - the html summary |
|
protected |
View submissions page (contains details of current submission).
string |