Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Standard base class for mod_assign (assignment types). More...
Public Member Functions | |
__construct ($coursemodulecontext, $coursemodule, $course) | |
Constructor for the base assign class. | |
add_all_plugin_settings (MoodleQuickForm $mform) | |
Add settings to edit plugin form. | |
add_grade_form_elements (MoodleQuickForm $mform, stdClass $data, $params) | |
Add elements to grade form. | |
add_instance (stdClass $formdata, $callplugins) | |
Add this instance to the database. | |
add_submission_form_elements (MoodleQuickForm $mform, stdClass $data) | |
Add elements to submission form. | |
add_to_log ($action='', $info='', $url='', $return=false) | |
Util function to add a message to the log. | |
can_edit_group_submission ($groupid) | |
Perform an access check to see if the current $USER can edit this group submission. | |
can_edit_submission ($userid, $graderid=0) | |
Capability check to make sure this grader can edit this submission. | |
can_grade ($user=null) | |
Does this user have grade permission for this assignment? | |
can_upgrade ($type, $version) | |
This function returns true if it can upgrade an assignment from the 2.2 module. | |
can_view_grades ($groupid=null) | |
Does this user have view grade or grade permission for this assignment? | |
can_view_group_submission ($groupid) | |
Perform an access check to see if the current $USER can view this group submission. | |
can_view_submission ($userid) | |
Perform an access check to see if the current $USER can view this users submission. | |
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. | |
copy_previous_attempt (&$notices) | |
Copy the current assignment submission from the last submitted attempt. | |
count_grades () | |
Load a count of grades. | |
count_participants ($currentgroup) | |
Load a count of active users enrolled in the current course with the specified permission and group. | |
count_submissions ($includenew=false) | |
Load a count of submissions. | |
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. | |
count_submissions_with_status ($status, $currentgroup=null) | |
Load a count of submissions with a specified status. | |
count_teams ($activitygroup=0) | |
Load a count of valid teams for this assignment. | |
delete_all_overrides () | |
Deletes all assign overrides from the database and clears any corresponding calendar events. | |
delete_instance () | |
Delete this instance from the database. | |
delete_override ($overrideid) | |
Deletes a assign override from the database and clears any corresponding calendar events. | |
display_grade ($grade, $editing, $userid=0, $modified=0) | |
Return a grade in user-friendly form, whether it's a scale or not. | |
download_rewrite_pluginfile_urls ($text, $user, $plugin) | |
Rewrite plugin file urls so they resolve correctly in an exported zip. | |
format_grade_for_log (stdClass $grade) | |
Take a grade object and print a short summary for the log file. | |
format_submission_for_log (stdClass $submission) | |
Take a submission object and print a short summary for the log file. | |
fullname ($user) | |
Get the name for a user - hiding their real name if blind marking is on. | |
get_admin_config () | |
Load and cache the admin config for this module. | |
get_all_groups ($userid) | |
Gets all groups the user is a member of. | |
get_all_submissions ($userid) | |
Get the submissions for all previous attempts. | |
get_assign_attempt_history_renderable ($user) | |
Creates an assign_attempt_history renderable. | |
get_assign_feedback_status_renderable ($user) | |
Creates an assign_feedback_status renderable. | |
get_assign_grading_summary_renderable ($activitygroup=null) | |
Creates an assign_grading_summary renderable. | |
get_assign_perpage () | |
Get the marking table page size. | |
get_assign_submission_status_renderable ($user, $showlinks) | |
Creates an assign_submission_status renderable. | |
get_context () | |
Get context module. | |
get_course () | |
Get the current course. | |
get_course_context () | |
Get the context of the current course. | |
get_course_module () | |
Get the current course module. | |
get_default_instance () | |
Get the settings for the current instance of this assignment. | |
get_feedback_plugin_by_type ($type) | |
Get a feedback plugin by type. | |
get_feedback_plugins () | |
Get list of feedback plugins installed. | |
get_filters () | |
Return array of valid search filters for the grading interface. | |
get_grade_item () | |
Get the primary grade item for this assign instance. | |
get_grading_status ($userid) | |
Returns the grading status. | |
get_group_submission ($userid, $groupid, $create, $attemptnumber=-1) | |
Load the group submission object for a particular user, optionally creating it if required. | |
get_instance (int $userid=null) | |
Get the settings for the current instance of this assignment. | |
get_marking_allocation_filters ($export=false) | |
Return array of valid grading allocation filters for the grading interface. | |
get_marking_workflow_filters ($export=false) | |
Return array of valid grading workflow filters for the grading interface. | |
get_marking_workflow_states_for_current_user () | |
Get the list of marking_workflow states the current user has permission to transition a grade to. | |
get_participant ($userid) | |
Load a user if they are enrolled in the current course. | |
get_plugin_by_type ($subtype, $type) | |
Get a specific submission plugin by its type. | |
get_renderer () | |
Lazy load the page renderer and expose the renderer to plugins. | |
get_return_action () | |
Return an action that can be used to get back to the current page. | |
get_return_params () | |
Return a list of parameters that can be used to get back to the current page. | |
get_shared_group_members ($cm, $userid) | |
Returns IDs of the users who share group membership with the specified user. | |
get_submission_group ($userid) | |
This is used for team assignments to get the group for the specified user. | |
get_submission_group_members ($groupid, $onlyids, $excludesuspended=false) | |
Get a list of the users in the same group as this user. | |
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. | |
get_submission_plugin_by_type ($type) | |
Get a submission plugin by type. | |
get_submission_plugins () | |
Get list of submission plugins installed. | |
get_timelimit_panel (stdClass $submission) | |
Get the time limit panel object for this submission attempt. | |
get_uniqueid_for_user ($userid) | |
Call the static version of this function. | |
get_user_flags ($userid, $create) | |
This will retrieve a user flags object from the db optionally creating it if required. | |
get_user_grade ($userid, $create, $attemptnumber=-1) | |
This will retrieve a grade object from the db, optionally creating it if required. | |
get_user_grades_for_gradebook ($userid) | |
Get an upto date list of user grades and feedback for the gradebook. | |
get_user_id_for_uniqueid ($uniqueid) | |
Call the static version of this function. | |
get_user_submission ($userid, $create, $attemptnumber=-1) | |
Load the submission object for a particular user, optionally creating it if required. | |
get_useridlist_key ($id=null) | |
Generates the key that should be used for an entry in the useridlist cache. | |
get_useridlist_key_id () | |
The id used to uniquily identify the cache for this instance of the assign object. | |
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. | |
grading_disabled ($userid, $checkworkflow=true, $gradinginfo=null) | |
Determine if this users grade can be edited. | |
has_instance () | |
Has this assignment been constructed from an instance? | |
has_overrides () | |
Returns whether an assign has any overrides. | |
has_submissions_or_grades () | |
Does an assignment have submission(s) or grade(s) already? | |
is_active_user ($userid) | |
Return true is user is active user in course else false. | |
is_any_feedback_plugin_enabled () | |
Check if feedback plugins installed are enabled. | |
is_any_submission_plugin_enabled () | |
Check if submission plugins installed are enabled. | |
is_attempt_in_progress (?int $userid=null, int $groupid=0, int $attemptnumber=-1) | |
Check if an assignment submission is already started and not yet submitted. | |
is_blind_marking () | |
Is blind marking enabled and reveal identities not set yet? | |
is_gradebook_feedback_enabled () | |
Returns true if gradebook feedback plugin is enabled. | |
is_hidden_grader () | |
Is hidden grading enabled? | |
is_override_calendar_event (\calendar_event $event) | |
Check if the given calendar_event is either a user or group override event. | |
is_time_limit_enabled (?int $userid=null) | |
Check if time limit for assignment enabled and set up. | |
is_userid_filtered ($userid) | |
Is user id filtered by user filters and table preferences. | |
list_participants ($currentgroup, $idsonly, $tablesort=false) | |
Load a list of users enrolled in the current course with the specified permission and group. | |
list_participants_with_filter_status_and_group ($currentgroup, $tablesort=false) | |
Get the submission status/grading status for all submissions in this assignment. | |
load_plugins ($subtype) | |
Load the plugins from the sub folders under subtype. | |
lock_submission ($userid) | |
Prevent student updates to this submission. | |
new_submission_empty ($data) | |
Determine if a new submission is empty or not. | |
notify_grade_modified ($grade, $mailedoverride=false) | |
Mark in the database that this grade record should have an update notification sent by cron. | |
override_exists ($userid) | |
Returns user override. | |
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) | |
register_return_link ($action, $params) | |
Set the action and parameters that can be used to return to the current page. | |
remove_submission ($userid) | |
Remove any data from the current submission. | |
render_area_files ($component, $area, $submissionid) | |
Render the files in file area. | |
render_editor_content ($filearea, $submissionid, $plugintype, $editor, $component, $shortentext=false) | |
Render the content in editor that is often used by plugin. | |
require_view_grades () | |
Throw an error if the permissions to view grades in this assignment are missing. | |
require_view_group_submission ($groupid) | |
Throw an error if the permissions to view this users' group submission are missing. | |
require_view_submission ($userid) | |
Throw an error if the permissions to view this users submission are missing. | |
reset_userdata ($data) | |
Actual implementation of the reset course functionality, delete all the assignment submissions for course $data->courseid. | |
reveal_identities () | |
Reveal student identities to markers (and the gradebook). | |
revert_to_draft ($userid) | |
Revert to draft. | |
save_grade ($userid, $data) | |
Save grade update. | |
save_submission (stdClass $data, & $notices) | |
Save assignment submission for the current user. | |
save_user_extension ($userid, $extensionduedate) | |
Save the extension date for a single user. | |
send_notification ($userfrom, $userto, $messagetype, $eventtype, $updatetime) | |
Message someone about something. | |
set_context (context $context) | |
Set the context. | |
set_course (stdClass $course) | |
Set the course data. | |
set_instance (stdClass $data) | |
Set the submitted form data. | |
set_module_viewed () | |
Update the module completion status (set it viewed) and trigger module viewed event. | |
set_most_recent_team_submission ($submission) | |
Set the most recent submission for the team. | |
should_provide_intro_attachments (int $userid) | |
Check if the intro attachments should be provided to the user. | |
show_intro () | |
Based on the current assignment settings should we display the intro. | |
show_only_active_users () | |
Check is only active users in course should be shown. | |
submission_empty ($submission) | |
Determine if the current submission is empty or not. | |
submissions_open ($userid=0, $skipenrolled=false, $submission=false, $flags=false, $gradinginfo=false) | |
Is this assignment open for submissions? | |
submit_for_grading ($data, $notices) | |
Submit a submission for grading. | |
unlock_submission ($userid) | |
Unlock the student submission. | |
update_calendar ($coursemoduleid) | |
Update the calendar entries for this assignment. | |
update_effective_access ($userid) | |
Updates the assign properties with override information for a user. | |
update_grade ($grade, $reopenattempt=false) | |
Update a grade in the grade table for the assignment and in the gradebook. | |
update_gradebook ($reset, $coursemoduleid) | |
Update the gradebook information for this assignment. | |
update_instance ($formdata) | |
Update this instance in the database. | |
update_user_flags ($flags) | |
Update user flags for this user in this assignment. | |
view ($action='', $args=array()) | |
Display the assignment, used by view.php. | |
view_batch_markingallocation ($mform) | |
Shows a form that allows the allocated marker for selected submissions to be changed. | |
view_student_summary ($user, $showlinks) | |
Print 2 tables of information with no action links - the submission summary and the grading summary. | |
view_submission_action_bar (stdClass $instance, stdClass $user) | |
The action bar displayed in the submissions page. | |
Static Public Member Functions | |
static | allocate_unique_ids ($assignid) |
Foreach participant in the course - assign them a random id. | |
static | can_upgrade_assignment ($type, $version) |
This function is a static wrapper around can_upgrade. | |
static | cron () |
Finds all assignment notifications that have yet to be mailed out, and mails them. | |
static | get_uniqueid_for_user_static ($assignid, $userid) |
Lookup this user id and return the unique id for this assignment. | |
static | get_user_id_for_uniqueid_static ($assignid, $uniqueid) |
Lookup this unique id and return the user id for this assignment. | |
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). | |
Public Attributes | |
float | $grade |
grade value. | |
Protected Member Functions | |
add_attempt ($userid) | |
Add a new attempt for a user. | |
add_grade_notices () | |
Checks for any grade notices, and adds notifications. | |
add_plugin_grade_elements ($grade, MoodleQuickForm $mform, stdClass $data, $userid) | |
Add elements in grading plugin form. | |
add_plugin_settings (assign_plugin $plugin, MoodleQuickForm $mform, & $pluginsenabled) | |
Add one plugins settings to edit plugin form. | |
add_plugin_submission_elements ($submission, MoodleQuickForm $mform, stdClass $data, $userid) | |
Add elements in submission plugin form. | |
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). | |
check_submit_for_grading ($mform) | |
Ask the user to confirm they want to submit their work for grading. | |
convert_grade_for_gradebook (stdClass $grade) | |
Convert the final raw grade(s) in the grading table for the gradebook. | |
convert_submission_for_gradebook (stdClass $submission) | |
Convert submission details for the gradebook. | |
count_attachments () | |
Count the number of intro attachments. | |
delete_grades () | |
Delete all grades from the gradebook for this assignment. | |
download_submissions ($userids=null) | |
Download a zip file of all assignment submissions. | |
fix_null_grades () | |
View fix rescaled null grades. | |
get_all_grades ($userid) | |
Get the grades for all previous attempts. | |
get_error_messages () | |
Get error messages. | |
get_grade ($gradeid) | |
This will retrieve a grade object from the db. | |
get_graders ($userid) | |
Returns a list of teachers that should be grading given submission. | |
get_grading_instance ($userid, $grade, $gradingdisabled) | |
Get an instance of a grading form if advanced grading is enabled. | |
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. | |
get_module_name () | |
Get the name of the current module. | |
get_module_name_plural () | |
Get the plural name of the current module. | |
get_notifiable_users ($userid) | |
Returns a list of users that should receive notification about given submission. | |
get_submission ($submissionid) | |
Load the submission object from it's id. | |
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. | |
get_submitted_sql ($group=0) | |
Returns array with sql code and parameters returning all ids of users who have submitted an assignment. | |
gradebook_item_update ($submission=null, $grade=null) | |
Update grades in the gradebook. | |
has_visible_attachments () | |
Are there any intro attachments to display? | |
is_graded ($userid) | |
See if this assignment has a grade yet. | |
notify_graders (stdClass $submission) | |
Send notifications to graders upon student submissions. | |
notify_student_submission_copied (stdClass $submission) | |
Notify student upon successful submission copy. | |
notify_student_submission_receipt (stdClass $submission) | |
Notify student upon successful submission. | |
plagiarism_print_disclosure () | |
Capture the output of the plagiarism plugins disclosures and return it as a string. | |
process_add_attempt ($userid) | |
Check for a sess key and then call add_attempt. | |
process_add_attempt_group ($useridlist) | |
Add a new attempt for each user in the list - but reopen each group assignment at most 1 time. | |
process_copy_previous_attempt (&$notices) | |
Require a valid sess key and then call copy_previous_attempt. | |
process_grading_batch_operation (& $mform) | |
Ask the user to confirm they want to perform this batch operation. | |
process_lock_submission ($userid=0) | |
Prevent student updates to this submission. | |
process_outcomes ($userid, $formdata, $sourceuserid=null) | |
Save outcomes submitted from grading form. | |
process_remove_submission ($userid=0) | |
Remove the current submission. | |
process_reveal_identities () | |
Reveal student identities to markers (and the gradebook). | |
process_revert_to_draft ($userid=0) | |
Revert to draft. | |
process_save_extension (& $mform) | |
Save extension date. | |
process_save_grade (&$mform) | |
Save grade. | |
process_save_grading_options () | |
Save grading options. | |
process_save_quick_grades () | |
Save quick grades. | |
process_save_submission (&$mform, &$notices) | |
Save assignment submission. | |
process_set_batch_marking_allocation () | |
Set the marking allocation for multiple users. | |
process_set_batch_marking_workflow_state () | |
Set the workflow state for multiple users. | |
process_submit_for_grading ($mform, $notices) | |
Assignment submission is processed before grading. | |
process_submit_other_for_grading ($mform, $notices) | |
A students submission is submitted for grading by a teacher. | |
process_unlock_submission ($userid=0) | |
Unlock the student submission. | |
reopen_submission_if_required ($userid, $submission, $addattempt) | |
If the requirements are met - reopen the submission for another attempt. | |
save_editor_draft_files ($formdata) | |
Save the attachments in the editor description. | |
save_intro_draft_files ($formdata) | |
Save the attachments in the intro description. | |
set_error_message (string $message) | |
Set error message. | |
show_submit_button ($submission=null, $teamsubmission=null, $userid=null) | |
Returns true if the submit subsission button should be shown to the user. | |
update_activity_completion_records ($teamsubmission, $requireallteammemberssubmit, $submission, $userid, $complete, $completion) | |
Updates and creates the completion records in mdl_course_modules_completion. | |
update_plugin_instance (assign_plugin $plugin, stdClass $formdata) | |
Update the settings for a single plugin. | |
update_submission (stdClass $submission, $userid, $updatetime, $teamsubmission) | |
Update grades in the gradebook based on submission time. | |
update_team_submission (stdClass $submission, $userid, $updatetime) | |
Update team submission. | |
view_batch_set_workflow_state ($mform) | |
Shows a form that allows the workflow state for selected submissions to be changed. | |
view_edit_submission_page ($mform, $notices) | |
View edit submissions page. | |
view_fix_rescaled_null_grades () | |
View fix rescaled null grades. | |
view_footer () | |
Display the page footer. | |
view_grader () | |
View entire grader app. | |
view_grading_page () | |
View entire grading page. | |
view_grading_table () | |
View the grading table of all submissions for this assignment. | |
view_grant_extension ($mform) | |
View the grant extension date page. | |
view_notices ($title, $notices) | |
Message for students when assignment submissions have been closed. | |
view_plugin_content ($pluginsubtype) | |
Display the submission that is used by a plugin. | |
view_plugin_grading_batch_operation ($mform) | |
Allows the plugin to show a batch grading operation page. | |
view_plugin_page () | |
View a page rendered by a plugin. | |
view_quickgrading_result ($message) | |
Display a continue page after quickgrading. | |
view_remove_submission_confirm () | |
Show a confirmation page to make sure they want to remove submission data. | |
view_return_links () | |
View a link to go back to the previous page. | |
view_reveal_identities_confirm () | |
Show a confirmation page to make sure they want to release student identities. | |
view_savegrading_result ($message) | |
Display a continue page after grading. | |
view_single_grade_page ($mform) | |
Print the grading page for a single user submission. | |
view_single_grading_panel ($args) | |
Print the grading page for a single user submission. | |
view_submission_page () | |
View submissions page (contains details of current submission). | |
Static Protected Member Functions | |
static | format_notification_message_html ($messagetype, $info, $course, $context, $modulename, $coursemodule, $assignmentname) |
Format a notification for HTML. | |
static | format_notification_message_text ($messagetype, $info, $course, $context, $modulename, $assignmentname) |
Format a notification for plain text. | |
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 | null | $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|false | 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.
stdClass | $adminconfig | |
stdClass | $instance | |
context | $context |
string |
|
protected |
Returns array with sql code and parameters returning all ids of users who have submitted an assignment.
int | $group | The group that the query is for. |
array | list($sql, $params) |
assign::get_timelimit_panel | ( | stdClass | $submission | ) |
Get the time limit panel object for this submission attempt.
stdClass | $submission | assign submission. |
string | the panel output. |
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|false | 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, | |||
$gradinginfo = null ) |
Determine if this users grade can be edited.
int | $userid | - The student userid |
bool | $checkworkflow | - whether to include a check for the workflow state. |
stdClass | $gradinginfo | - optional, allow gradinginfo to be passed for performance. |
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_attempt_in_progress | ( | ?int | $userid = null, |
int | $groupid = 0, | ||
int | $attemptnumber = -1 ) |
Check if an assignment submission is already started and not yet submitted.
int | null | $userid | User ID. If null, use global user. |
int | $groupid | Group ID. If 0, use user id to determine group. |
int | $attemptnumber | Attempt number. If -1, check latest submission. |
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::is_time_limit_enabled | ( | ?int | $userid = null | ) |
Check if time limit for assignment enabled and set up.
int | null | $userid | User ID. If null, use global user. |
bool |
assign::is_userid_filtered | ( | $userid | ) |
Is user id filtered by user filters and table preferences.
int | $userid | User id that needs to be checked. |
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 | |
bool | $tablesort |
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 |
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 |
coding_exception |
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 |
|
protected |
Save the attachments in the editor description.
stdClass | $formdata |
assign::save_grade | ( | $userid, | |
$data ) |
Save grade update.
int | $userid | |
stdClass | $data |
bool | - was the grade saved |
|
protected |
Save the attachments in the intro description.
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::should_provide_intro_attachments | ( | int | $userid | ) |
Check if the intro attachments should be provided to the user.
int | $userid | User id. |
bool |
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 |
assign::view_submission_action_bar | ( | stdClass | $instance, |
stdClass | $user ) |
The action bar displayed in the submissions page.
stdClass | $instance | The settings for the current instance of this assignment |
stdClass | $user | The user to print the action bar for |
string |
|
protected |
View submissions page (contains details of current submission).
string |