idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
29,800
public function get_return_action ( ) { global $ PAGE ; if ( ! WS_SERVER ) { $ params = $ PAGE -> url -> params ( ) ; } if ( ! empty ( $ params [ 'action' ] ) ) { return $ params [ 'action' ] ; } return '' ; }
Return an action that can be used to get back to the current page .
29,801
public function show_intro ( ) { if ( $ this -> get_instance ( ) -> alwaysshowdescription || time ( ) > $ this -> get_instance ( ) -> allowsubmissionsfromdate ) { return true ; } return false ; }
Based on the current assignment settings should we display the intro .
29,802
public function get_return_params ( ) { global $ PAGE ; $ params = array ( ) ; if ( ! WS_SERVER ) { $ params = $ PAGE -> url -> params ( ) ; } unset ( $ params [ 'id' ] ) ; unset ( $ params [ 'action' ] ) ; return $ params ; }
Return a list of parameters that can be used to get back to the current page .
29,803
public function get_plugin_by_type ( $ subtype , $ type ) { $ shortsubtype = substr ( $ subtype , strlen ( 'assign' ) ) ; $ name = $ shortsubtype . 'plugins' ; if ( $ name != 'feedbackplugins' && $ name != 'submissionplugins' ) { return null ; } $ pluginlist = $ this -> $ name ; foreach ( $ pluginlist as $ plugin ) { i...
Get a specific submission plugin by its type .
29,804
public function load_plugins ( $ subtype ) { global $ CFG ; $ result = array ( ) ; $ names = core_component :: get_plugin_list ( $ subtype ) ; foreach ( $ names as $ name => $ path ) { if ( file_exists ( $ path . '/locallib.php' ) ) { require_once ( $ path . '/locallib.php' ) ; $ shortsubtype = substr ( $ subtype , str...
Load the plugins from the sub folders under subtype .
29,805
protected function delete_grades ( ) { global $ CFG ; $ result = grade_update ( 'mod/assign' , $ this -> get_course ( ) -> id , 'mod' , 'assign' , $ this -> get_instance ( ) -> id , 0 , null , array ( 'deleted' => 1 ) ) ; return $ result == GRADE_UPDATE_OK ; }
Delete all grades from the gradebook for this assignment .
29,806
public function update_effective_access ( $ userid ) { $ override = $ this -> override_exists ( $ userid ) ; $ keys = array ( 'duedate' , 'cutoffdate' , 'allowsubmissionsfromdate' ) ; foreach ( $ keys as $ key ) { if ( isset ( $ override -> { $ key } ) ) { $ this -> get_instance ( ) -> { $ key } = $ override -> { $ key...
Updates the assign properties with override information for a user .
29,807
public function has_overrides ( ) { global $ DB ; $ override = $ DB -> record_exists ( 'assign_overrides' , array ( 'assignid' => $ this -> get_instance ( ) -> id ) ) ; if ( $ override ) { return true ; } return false ; }
Returns whether an assign has any overrides .
29,808
public function override_exists ( $ userid ) { global $ DB ; $ getuseroverride = function ( $ userid ) use ( $ DB ) { $ useroverride = $ DB -> get_record ( 'assign_overrides' , [ 'assignid' => $ this -> get_instance ( ) -> id , 'userid' => $ userid ] ) ; return $ useroverride ? get_object_vars ( $ useroverride ) : [ ] ...
Returns user override
29,809
public function is_override_calendar_event ( \ calendar_event $ event ) { global $ DB ; if ( ! isset ( $ event -> modulename ) ) { return false ; } if ( $ event -> modulename != 'assign' ) { return false ; } if ( ! isset ( $ event -> instance ) ) { return false ; } if ( ! isset ( $ event -> userid ) && ! isset ( $ even...
Check if the given calendar_event is either a user or group override event .
29,810
function get_valid_calendar_event_timestart_range ( \ calendar_event $ event ) { $ instance = $ this -> get_instance ( ) ; $ submissionsfromdate = $ instance -> allowsubmissionsfromdate ; $ cutoffdate = $ instance -> cutoffdate ; $ duedate = $ instance -> duedate ; $ gradingduedate = $ instance -> gradingduedate ; $ mi...
This function calculates the minimum and maximum cutoff values for the timestart of the given event .
29,811
protected function update_plugin_instance ( assign_plugin $ plugin , stdClass $ formdata ) { if ( $ plugin -> is_visible ( ) ) { $ enabledname = $ plugin -> get_subtype ( ) . '_' . $ plugin -> get_type ( ) . '_enabled' ; if ( ! empty ( $ formdata -> $ enabledname ) ) { $ plugin -> enable ( ) ; if ( ! $ plugin -> save_s...
Update the settings for a single plugin .
29,812
public function update_gradebook ( $ reset , $ coursemoduleid ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/lib.php' ) ; $ assign = clone $ this -> get_instance ( ) ; $ assign -> cmidnumber = $ coursemoduleid ; $ assign -> gradefeedbackenabled = $ this -> is_gradebook_feedback_enabled ( ) ; $ param ...
Update the gradebook information for this assignment .
29,813
public function get_assign_perpage ( ) { $ perpage = ( int ) get_user_preferences ( 'assign_perpage' , 10 ) ; $ adminconfig = $ this -> get_admin_config ( ) ; $ maxperpage = - 1 ; if ( isset ( $ adminconfig -> maxperpage ) ) { $ maxperpage = $ adminconfig -> maxperpage ; } if ( isset ( $ maxperpage ) && $ maxperpage !=...
Get the marking table page size
29,814
public function get_admin_config ( ) { if ( $ this -> adminconfig ) { return $ this -> adminconfig ; } $ this -> adminconfig = get_config ( 'assign' ) ; return $ this -> adminconfig ; }
Load and cache the admin config for this module .
29,815
protected function save_intro_draft_files ( $ formdata ) { if ( isset ( $ formdata -> introattachments ) ) { file_save_draft_area_files ( $ formdata -> introattachments , $ this -> get_context ( ) -> id , 'mod_assign' , ASSIGN_INTROATTACHMENT_FILEAREA , 0 ) ; } }
Save the attachments in the draft areas .
29,816
protected function add_plugin_grade_elements ( $ grade , MoodleQuickForm $ mform , stdClass $ data , $ userid ) { foreach ( $ this -> feedbackplugins as $ plugin ) { if ( $ plugin -> is_enabled ( ) && $ plugin -> is_visible ( ) ) { $ plugin -> get_form_elements_for_user ( $ grade , $ mform , $ data , $ userid ) ; } } }
Add elements in grading plugin form .
29,817
protected function add_plugin_settings ( assign_plugin $ plugin , MoodleQuickForm $ mform , & $ pluginsenabled ) { global $ CFG ; if ( $ plugin -> is_visible ( ) && ! $ plugin -> is_configurable ( ) && $ plugin -> is_enabled ( ) ) { $ name = $ plugin -> get_subtype ( ) . '_' . $ plugin -> get_type ( ) . '_enabled' ; $ ...
Add one plugins settings to edit plugin form .
29,818
public function add_all_plugin_settings ( MoodleQuickForm $ mform ) { $ mform -> addElement ( 'header' , 'submissiontypes' , get_string ( 'submissiontypes' , 'assign' ) ) ; $ submissionpluginsenabled = array ( ) ; $ group = $ mform -> addGroup ( array ( ) , 'submissionplugins' , get_string ( 'submissiontypes' , 'assign...
Add settings to edit plugin form .
29,819
protected function get_module_name ( ) { if ( isset ( self :: $ modulename ) ) { return self :: $ modulename ; } self :: $ modulename = get_string ( 'modulename' , 'assign' ) ; return self :: $ modulename ; }
Get the name of the current module .
29,820
protected function get_module_name_plural ( ) { if ( isset ( self :: $ modulenameplural ) ) { return self :: $ modulenameplural ; } self :: $ modulenameplural = get_string ( 'modulenameplural' , 'assign' ) ; return self :: $ modulenameplural ; }
Get the plural name of the current module .
29,821
public function get_instance ( ) { global $ DB ; if ( $ this -> instance ) { return $ this -> instance ; } if ( $ this -> get_course_module ( ) ) { $ params = array ( 'id' => $ this -> get_course_module ( ) -> instance ) ; $ this -> instance = $ DB -> get_record ( 'assign' , $ params , '*' , MUST_EXIST ) ; } if ( ! $ t...
Get the settings for the current instance of this assignment
29,822
public function get_grade_item ( ) { if ( $ this -> gradeitem ) { return $ this -> gradeitem ; } $ instance = $ this -> get_instance ( ) ; $ params = array ( 'itemtype' => 'mod' , 'itemmodule' => 'assign' , 'iteminstance' => $ instance -> id , 'courseid' => $ instance -> course , 'itemnumber' => 0 ) ; $ this -> gradeit...
Get the primary grade item for this assign instance .
29,823
public function get_course_context ( ) { if ( ! $ this -> context && ! $ this -> course ) { throw new coding_exception ( 'Improper use of the assignment class. ' . 'Cannot load the course context.' ) ; } if ( $ this -> context ) { return $ this -> context -> get_course_context ( ) ; } else { return context_course :: in...
Get the context of the current course .
29,824
public function get_course_module ( ) { if ( $ this -> coursemodule ) { return $ this -> coursemodule ; } if ( ! $ this -> context ) { return null ; } if ( $ this -> context -> contextlevel == CONTEXT_MODULE ) { $ modinfo = get_fast_modinfo ( $ this -> get_course ( ) ) ; $ this -> coursemodule = $ modinfo -> get_cm ( $...
Get the current course module .
29,825
public function get_course ( ) { global $ DB ; if ( $ this -> course ) { return $ this -> course ; } if ( ! $ this -> context ) { return null ; } $ params = array ( 'id' => $ this -> get_course_context ( ) -> instanceid ) ; $ this -> course = $ DB -> get_record ( 'course' , $ params , '*' , MUST_EXIST ) ; return $ this...
Get the current course .
29,826
protected function count_attachments ( ) { $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( $ this -> get_context ( ) -> id , 'mod_assign' , ASSIGN_INTROATTACHMENT_FILEAREA , 0 , 'id' , false ) ; return count ( $ files ) ; }
Count the number of intro attachments .
29,827
public function get_participant ( $ userid ) { global $ DB , $ USER ; if ( $ userid == $ USER -> id ) { $ participant = clone ( $ USER ) ; } else { $ participant = $ DB -> get_record ( 'user' , array ( 'id' => $ userid ) ) ; } if ( ! $ participant ) { return null ; } if ( ! is_enrolled ( $ this -> context , $ participa...
Load a user if they are enrolled in the current course . Populated with submission status for this assignment .
29,828
public function count_teams ( $ activitygroup = 0 ) { $ count = 0 ; $ participants = $ this -> list_participants ( $ activitygroup , true ) ; if ( $ this -> get_instance ( ) -> teamsubmissiongroupingid ) { $ groups = groups_get_all_groups ( $ this -> get_course ( ) -> id , array_keys ( $ participants ) , $ this -> get_...
Load a count of valid teams for this assignment .
29,829
public function count_submissions_need_grading ( $ currentgroup = null ) { global $ DB ; if ( $ this -> get_instance ( ) -> teamsubmission ) { return 0 ; } if ( $ currentgroup === null ) { $ currentgroup = groups_get_activity_group ( $ this -> get_course_module ( ) , true ) ; } list ( $ esql , $ params ) = get_enrolled...
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 .
29,830
public function count_grades ( ) { global $ DB ; if ( ! $ this -> has_instance ( ) ) { return 0 ; } $ currentgroup = groups_get_activity_group ( $ this -> get_course_module ( ) , true ) ; list ( $ esql , $ params ) = get_enrolled_sql ( $ this -> get_context ( ) , 'mod/assign:submit' , $ currentgroup , true ) ; $ params...
Load a count of grades .
29,831
public function count_submissions ( $ includenew = false ) { global $ DB ; if ( ! $ this -> has_instance ( ) ) { return 0 ; } $ params = array ( ) ; $ sqlnew = '' ; if ( ! $ includenew ) { $ sqlnew = ' AND s.status <> :status ' ; $ params [ 'status' ] = ASSIGN_SUBMISSION_STATUS_NEW ; } if ( $ this -> get_instance ( ) -...
Load a count of submissions .
29,832
public function count_submissions_with_status ( $ status , $ currentgroup = null ) { global $ DB ; if ( $ currentgroup === null ) { $ currentgroup = groups_get_activity_group ( $ this -> get_course_module ( ) , true ) ; } list ( $ esql , $ params ) = get_enrolled_sql ( $ this -> get_context ( ) , 'mod/assign:submit' , ...
Load a count of submissions with a specified status .
29,833
protected function get_grading_userid_list ( $ cached = false , $ useridlistid = '' ) { if ( $ cached ) { if ( empty ( $ useridlistid ) ) { $ useridlistid = $ this -> get_useridlist_key_id ( ) ; } $ useridlistkey = $ this -> get_useridlist_key ( $ useridlistid ) ; if ( empty ( $ SESSION -> mod_assign_useridlist [ $ use...
Utility function to get the userid for every row in the grading table so the order can be frozen while we iterate it .
29,834
protected function pack_files ( $ filesforzipping ) { global $ CFG ; $ tempzip = tempnam ( $ CFG -> tempdir . '/' , 'assignment_' ) ; $ zipper = new zip_packer ( ) ; if ( $ zipper -> archive_to_pathname ( $ filesforzipping , $ tempzip ) ) { return $ tempzip ; } return false ; }
Generate zip file from array of given files .
29,835
public function notify_grade_modified ( $ grade , $ mailedoverride = false ) { global $ DB ; $ flags = $ this -> get_user_flags ( $ grade -> userid , true ) ; if ( $ flags -> mailed != 1 || $ mailedoverride ) { $ flags -> mailed = 0 ; } return $ this -> update_user_flags ( $ flags ) ; }
Mark in the database that this grade record should have an update notification sent by cron .
29,836
public function update_user_flags ( $ flags ) { global $ DB ; if ( $ flags -> userid <= 0 || $ flags -> assignment <= 0 || $ flags -> id <= 0 ) { return false ; } $ result = $ DB -> update_record ( 'assign_user_flags' , $ flags ) ; return $ result ; }
Update user flags for this user in this assignment .
29,837
public function update_grade ( $ grade , $ reopenattempt = false ) { global $ DB ; $ grade -> timemodified = time ( ) ; if ( ! empty ( $ grade -> workflowstate ) ) { $ validstates = $ this -> get_marking_workflow_states_for_current_user ( ) ; if ( ! array_key_exists ( $ grade -> workflowstate , $ validstates ) ) { retu...
Update a grade in the grade table for the assignment and in the gradebook .
29,838
protected function view_grant_extension ( $ mform ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/extensionform.php' ) ; $ o = '' ; $ data = new stdClass ( ) ; $ data -> id = $ this -> get_course_module ( ) -> id ; $ formparams = array ( 'instance' => $ this -> get_instance ( ) , 'assign' => $ this ) ...
View the grant extension date page .
29,839
public function get_submission_group_members ( $ groupid , $ onlyids , $ excludesuspended = false ) { $ members = array ( ) ; if ( $ groupid != 0 ) { $ allusers = $ this -> list_participants ( $ groupid , $ onlyids ) ; foreach ( $ allusers as $ user ) { if ( $ this -> get_submission_group ( $ user -> id ) ) { $ members...
Get a list of the users in the same group as this user .
29,840
public function get_submission_group_members_who_have_not_submitted ( $ groupid , $ onlyids ) { $ instance = $ this -> get_instance ( ) ; if ( ! $ instance -> teamsubmission || ! $ instance -> requireallteammemberssubmit ) { return array ( ) ; } $ members = $ this -> get_submission_group_members ( $ groupid , $ onlyids...
Get a list of the users in the same group as this user that have not submitted the assignment .
29,841
protected function view_plugin_page ( ) { global $ USER ; $ o = '' ; $ pluginsubtype = required_param ( 'pluginsubtype' , PARAM_ALPHA ) ; $ plugintype = required_param ( 'plugin' , PARAM_PLUGIN ) ; $ pluginaction = required_param ( 'pluginaction' , PARAM_ALPHA ) ; $ plugin = $ this -> get_plugin_by_type ( $ pluginsubty...
View a page rendered by a plugin .
29,842
public function get_submission_group ( $ userid ) { if ( isset ( $ this -> usersubmissiongroups [ $ userid ] ) ) { return $ this -> usersubmissiongroups [ $ userid ] ; } $ groups = $ this -> get_all_groups ( $ userid ) ; if ( count ( $ groups ) != 1 ) { $ return = false ; } else { $ return = array_pop ( $ groups ) ; } ...
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
29,843
public function get_all_groups ( $ userid ) { if ( isset ( $ this -> usergroups [ $ userid ] ) ) { return $ this -> usergroups [ $ userid ] ; } $ grouping = $ this -> get_instance ( ) -> teamsubmissiongroupingid ; $ return = groups_get_all_groups ( $ this -> get_course ( ) -> id , $ userid , $ grouping ) ; $ this -> us...
Gets all groups the user is a member of .
29,844
protected function view_plugin_content ( $ pluginsubtype ) { $ o = '' ; $ submissionid = optional_param ( 'sid' , 0 , PARAM_INT ) ; $ gradeid = optional_param ( 'gid' , 0 , PARAM_INT ) ; $ plugintype = required_param ( 'plugin' , PARAM_PLUGIN ) ; $ item = null ; if ( $ pluginsubtype == 'assignsubmission' ) { $ plugin =...
Display the submission that is used by a plugin .
29,845
public function download_rewrite_pluginfile_urls ( $ text , $ user , $ plugin ) { $ groupname = '' ; if ( $ this -> get_instance ( ) -> teamsubmission ) { $ submissiongroup = $ this -> get_submission_group ( $ user -> id ) ; if ( $ submissiongroup ) { $ groupname = $ submissiongroup -> name . '-' ; } else { $ groupname...
Rewrite plugin file urls so they resolve correctly in an exported zip .
29,846
public function render_editor_content ( $ filearea , $ submissionid , $ plugintype , $ editor , $ component , $ shortentext = false ) { global $ CFG ; $ result = '' ; $ plugin = $ this -> get_submission_plugin_by_type ( $ plugintype ) ; $ text = $ plugin -> get_editor_text ( $ editor , $ submissionid ) ; if ( $ shorten...
Render the content in editor that is often used by plugin .
29,847
protected function view_savegrading_result ( $ message ) { $ o = '' ; $ o .= $ this -> get_renderer ( ) -> render ( new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , $ this -> show_intro ( ) , $ this -> get_course_module ( ) -> id , get_string ( 'savegradingresult' , 'assign' ) ) ) ; $ gradin...
Display a continue page after grading .
29,848
protected function view_quickgrading_result ( $ message ) { $ o = '' ; $ o .= $ this -> get_renderer ( ) -> render ( new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , $ this -> show_intro ( ) , $ this -> get_course_module ( ) -> id , get_string ( 'quickgradingresult' , 'assign' ) ) ) ; $ last...
Display a continue page after quickgrading .
29,849
public function can_view_grades ( $ groupid = null ) { if ( ! has_any_capability ( array ( 'mod/assign:viewgrades' , 'mod/assign:grade' ) , $ this -> context ) ) { return false ; } if ( $ this -> get_course_module ( ) -> effectivegroupmode == SEPARATEGROUPS ) { if ( $ groupid === null ) { $ groupid = groups_get_activit...
Does this user have view grade or grade permission for this assignment?
29,850
public function add_to_log ( $ action = '' , $ info = '' , $ url = '' , $ return = false ) { global $ USER ; $ fullurl = 'view.php?id=' . $ this -> get_course_module ( ) -> id ; if ( $ url != '' ) { $ fullurl .= '&' . $ url ; } $ args = array ( $ this -> get_course ( ) -> id , 'assign' , $ action , $ fullurl , $ info ,...
Util function to add a message to the log .
29,851
public function get_renderer ( ) { global $ PAGE ; if ( $ this -> output ) { return $ this -> output ; } $ this -> output = $ PAGE -> get_renderer ( 'mod_assign' , null , RENDERER_TARGET_GENERAL ) ; return $ this -> output ; }
Lazy load the page renderer and expose the renderer to plugins .
29,852
public function get_user_submission ( $ userid , $ create , $ attemptnumber = - 1 ) { global $ DB , $ USER ; if ( ! $ userid ) { $ userid = $ USER -> id ; } $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'userid' => $ userid , 'groupid' => 0 ) ; if ( $ attemptnumber >= 0 ) { $ params [ 'attemptnu...
Load the submission object for a particular user optionally creating it if required .
29,853
protected function get_submission ( $ submissionid ) { global $ DB ; $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'id' => $ submissionid ) ; return $ DB -> get_record ( 'assign_submission' , $ params , '*' , MUST_EXIST ) ; }
Load the submission object from it s id .
29,854
public function get_user_flags ( $ userid , $ create ) { global $ DB , $ USER ; if ( ! $ userid ) { $ userid = $ USER -> id ; } $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'userid' => $ userid ) ; $ flags = $ DB -> get_record ( 'assign_user_flags' , $ params ) ; if ( $ flags ) { return $ flags...
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 .
29,855
public function get_user_grade ( $ userid , $ create , $ attemptnumber = - 1 ) { global $ DB , $ USER ; if ( ! $ userid ) { $ userid = $ USER -> id ; } $ submission = null ; $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'userid' => $ userid ) ; if ( $ attemptnumber < 0 || $ create ) { if ( $ thi...
This will retrieve a grade object from the db optionally creating it if required .
29,856
protected function get_grade ( $ gradeid ) { global $ DB ; $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'id' => $ gradeid ) ; return $ DB -> get_record ( 'assign_grades' , $ params , '*' , MUST_EXIST ) ; }
This will retrieve a grade object from the db .
29,857
protected function view_remove_submission_confirm ( ) { global $ USER , $ DB ; $ userid = optional_param ( 'userid' , $ USER -> id , PARAM_INT ) ; if ( ! $ this -> can_edit_submission ( $ userid , $ USER -> id ) ) { print_error ( 'nopermission' ) ; } $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ userid ) , '...
Show a confirmation page to make sure they want to remove submission data .
29,858
protected function view_reveal_identities_confirm ( ) { require_capability ( 'mod/assign:revealidentities' , $ this -> get_context ( ) ) ; $ o = '' ; $ header = new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , false , $ this -> get_course_module ( ) -> id ) ; $ o .= $ this -> get_renderer ( ...
Show a confirmation page to make sure they want to release student identities .
29,859
protected function view_return_links ( ) { $ returnaction = optional_param ( 'returnaction' , '' , PARAM_ALPHA ) ; $ returnparams = optional_param ( 'returnparams' , '' , PARAM_TEXT ) ; $ params = array ( ) ; $ returnparams = str_replace ( '&amp;' , '&' , $ returnparams ) ; parse_str ( $ returnparams , $ params ) ; $ n...
View a link to go back to the previous page . Uses url parameters returnaction and returnparams .
29,860
protected function view_grader ( ) { global $ USER , $ PAGE ; $ o = '' ; $ this -> require_view_grades ( ) ; $ PAGE -> set_pagelayout ( 'embedded' ) ; $ courseshortname = $ this -> get_context ( ) -> get_course_context ( ) -> get_context_name ( false , true ) ; $ args = [ 'contextname' => $ this -> get_context ( ) -> g...
View entire grader app .
29,861
protected function view_grading_page ( ) { global $ CFG ; $ o = '' ; $ this -> require_view_grades ( ) ; require_once ( $ CFG -> dirroot . '/mod/assign/gradeform.php' ) ; $ this -> add_grade_notices ( ) ; $ o .= $ this -> view_grading_table ( ) ; $ o .= $ this -> view_footer ( ) ; \ mod_assign \ event \ grading_table_v...
View entire grading page .
29,862
protected function plagiarism_print_disclosure ( ) { global $ CFG ; $ o = '' ; if ( ! empty ( $ CFG -> enableplagiarism ) ) { require_once ( $ CFG -> libdir . '/plagiarismlib.php' ) ; $ o .= plagiarism_print_disclosure ( $ this -> get_course_module ( ) -> id ) ; } return $ o ; }
Capture the output of the plagiarism plugins disclosures and return it as a string .
29,863
protected function view_notices ( $ title , $ notices ) { global $ CFG ; $ o = '' ; $ header = new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , $ this -> show_intro ( ) , $ this -> get_course_module ( ) -> id , $ title ) ; $ o .= $ this -> get_renderer ( ) -> render ( $ header ) ; foreach ( ...
Message for students when assignment submissions have been closed .
29,864
public function fullname ( $ user ) { if ( $ this -> is_blind_marking ( ) ) { $ hasviewblind = has_capability ( 'mod/assign:viewblinddetails' , $ this -> get_context ( ) ) ; if ( empty ( $ user -> recordid ) ) { $ uniqueid = $ this -> get_uniqueid_for_user ( $ user -> id ) ; } else { $ uniqueid = $ user -> recordid ; }...
Get the name for a user - hiding their real name if blind marking is on .
29,865
protected function view_edit_submission_page ( $ mform , $ notices ) { global $ CFG , $ USER , $ DB ; $ o = '' ; require_once ( $ CFG -> dirroot . '/mod/assign/submission_form.php' ) ; $ userid = optional_param ( 'userid' , $ USER -> id , PARAM_INT ) ; $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ userid ) ,...
View edit submissions page .
29,866
protected function is_graded ( $ userid ) { $ grade = $ this -> get_user_grade ( $ userid , false ) ; if ( $ grade ) { return ( $ grade -> grade !== null && $ grade -> grade >= 0 ) ; } return false ; }
See if this assignment has a grade yet .
29,867
protected function view_plugin_grading_batch_operation ( $ mform ) { require_capability ( 'mod/assign:grade' , $ this -> context ) ; $ prefix = 'plugingradingbatchoperation_' ; if ( $ data = $ mform -> get_data ( ) ) { $ tail = substr ( $ data -> operation , strlen ( $ prefix ) ) ; list ( $ plugintype , $ action ) = ex...
Allows the plugin to show a batch grading operation page .
29,868
protected function view_batch_set_workflow_state ( $ mform ) { global $ CFG , $ DB ; require_once ( $ CFG -> dirroot . '/mod/assign/batchsetmarkingworkflowstateform.php' ) ; $ o = '' ; $ submitteddata = $ mform -> get_data ( ) ; $ users = $ submitteddata -> selectedusers ; $ userlist = explode ( ',' , $ users ) ; $ for...
Shows a form that allows the workflow state for selected submissions to be changed .
29,869
public function view_batch_markingallocation ( $ mform ) { global $ CFG , $ DB ; require_once ( $ CFG -> dirroot . '/mod/assign/batchsetallocatedmarkerform.php' ) ; $ o = '' ; $ submitteddata = $ mform -> get_data ( ) ; $ users = $ submitteddata -> selectedusers ; $ userlist = explode ( ',' , $ users ) ; $ formdata = a...
Shows a form that allows the allocated marker for selected submissions to be changed .
29,870
protected function check_submit_for_grading ( $ mform ) { global $ USER , $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/submissionconfirmform.php' ) ; $ notifications = array ( ) ; $ submission = $ this -> get_user_submission ( $ USER -> id , false ) ; $ plugins = $ this -> get_submission_plugins ( ) ; foreach...
Ask the user to confirm they want to submit their work for grading .
29,871
public function get_assign_attempt_history_renderable ( $ user ) { $ allsubmissions = $ this -> get_all_submissions ( $ user -> id ) ; $ allgrades = $ this -> get_all_grades ( $ user -> id ) ; $ history = new assign_attempt_history ( $ allsubmissions , $ allgrades , $ this -> get_submission_plugins ( ) , $ this -> get_...
Creates an assign_attempt_history renderable .
29,872
public function view_student_summary ( $ user , $ showlinks ) { $ o = '' ; if ( $ this -> can_view_submission ( $ user -> id ) ) { if ( has_capability ( 'mod/assign:submit' , $ this -> get_context ( ) , $ user , false ) ) { $ submissionstatus = $ this -> get_assign_submission_status_renderable ( $ user , $ showlinks ) ...
Print 2 tables of information with no action links - the submission summary and the grading summary .
29,873
protected function show_submit_button ( $ submission = null , $ teamsubmission = null , $ userid = null ) { if ( $ teamsubmission ) { if ( $ teamsubmission -> status === ASSIGN_SUBMISSION_STATUS_SUBMITTED ) { return false ; } else if ( $ this -> submission_empty ( $ teamsubmission ) ) { return false ; } else if ( $ sub...
Returns true if the submit subsission button should be shown to the user .
29,874
public function get_all_submissions ( $ userid ) { global $ DB , $ USER ; if ( ! $ userid ) { $ userid = $ USER -> id ; } $ params = array ( ) ; if ( $ this -> get_instance ( ) -> teamsubmission ) { $ groupid = 0 ; $ group = $ this -> get_submission_group ( $ userid ) ; if ( $ group ) { $ groupid = $ group -> id ; } $ ...
Get the submissions for all previous attempts .
29,875
public function get_assign_grading_summary_renderable ( $ activitygroup = null ) { $ instance = $ this -> get_instance ( ) ; $ cm = $ this -> get_course_module ( ) ; $ draft = ASSIGN_SUBMISSION_STATUS_DRAFT ; $ submitted = ASSIGN_SUBMISSION_STATUS_SUBMITTED ; $ isvisible = $ cm -> visible ; if ( $ activitygroup === nul...
Creates an assign_grading_summary renderable .
29,876
protected function convert_submission_for_gradebook ( stdClass $ submission ) { $ gradebookgrade = array ( ) ; $ gradebookgrade [ 'userid' ] = $ submission -> userid ; $ gradebookgrade [ 'usermodified' ] = $ submission -> userid ; $ gradebookgrade [ 'datesubmitted' ] = $ submission -> timemodified ; return $ gradebookg...
Convert submission details for the gradebook .
29,877
protected function gradebook_item_update ( $ submission = null , $ grade = null ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/lib.php' ) ; if ( $ this -> is_blind_marking ( ) ) { return false ; } if ( $ this -> get_instance ( ) -> markingworkflow && ! empty ( $ grade ) && $ this -> get_grading_statu...
Update grades in the gradebook .
29,878
protected function update_team_submission ( stdClass $ submission , $ userid , $ updatetime ) { global $ DB ; if ( $ updatetime ) { $ submission -> timemodified = time ( ) ; } $ mysubmission = $ this -> get_user_submission ( $ userid , true , $ submission -> attemptnumber ) ; $ mysubmission -> status = $ submission -> ...
Update team submission .
29,879
protected function update_submission ( stdClass $ submission , $ userid , $ updatetime , $ teamsubmission ) { global $ DB ; if ( $ teamsubmission ) { return $ this -> update_team_submission ( $ submission , $ userid , $ updatetime ) ; } if ( $ updatetime ) { $ submission -> timemodified = time ( ) ; } $ result = $ DB -...
Update grades in the gradebook based on submission time .
29,880
public function submissions_open ( $ userid = 0 , $ skipenrolled = false , $ submission = false , $ flags = false , $ gradinginfo = false ) { global $ USER ; if ( ! $ userid ) { $ userid = $ USER -> id ; } $ time = time ( ) ; $ dateopen = true ; $ finaldate = false ; if ( $ this -> get_instance ( ) -> cutoffdate ) { $ ...
Is this assignment open for submissions?
29,881
public function render_area_files ( $ component , $ area , $ submissionid ) { global $ USER ; return $ this -> get_renderer ( ) -> assign_files ( $ this -> context , $ submissionid , $ area , $ component ) ; }
Render the files in file area .
29,882
public function can_edit_submission ( $ userid , $ graderid = 0 ) { global $ USER ; if ( empty ( $ graderid ) ) { $ graderid = $ USER -> id ; } $ instance = $ this -> get_instance ( ) ; if ( $ userid == $ graderid && $ instance -> teamsubmission && $ instance -> preventsubmissionnotingroup && $ this -> get_submission_g...
Capability check to make sure this grader can edit this submission .
29,883
public function get_shared_group_members ( $ cm , $ userid ) { if ( ! isset ( $ this -> sharedgroupmembers [ $ userid ] ) ) { $ this -> sharedgroupmembers [ $ userid ] = array ( ) ; if ( $ members = groups_get_activity_shared_group_members ( $ cm , $ userid ) ) { $ this -> sharedgroupmembers [ $ userid ] = array_keys (...
Returns IDs of the users who share group membership with the specified user .
29,884
protected function get_graders ( $ userid ) { $ potentialgraders = get_enrolled_users ( $ this -> context , "mod/assign:grade" , null , 'u.*' , null , null , null , true ) ; $ graders = array ( ) ; if ( groups_get_activity_groupmode ( $ this -> get_course_module ( ) ) == SEPARATEGROUPS ) { if ( $ groups = groups_get_al...
Returns a list of teachers that should be grading given submission .
29,885
protected function get_notifiable_users ( $ userid ) { $ potentialusers = get_enrolled_users ( $ this -> context , "mod/assign:receivegradernotifications" , null , 'u.*' , null , null , null , true ) ; $ notifiableusers = array ( ) ; if ( groups_get_activity_groupmode ( $ this -> get_course_module ( ) ) == SEPARATEGROU...
Returns a list of users that should receive notification about given submission .
29,886
protected static function format_notification_message_text ( $ messagetype , $ info , $ course , $ context , $ modulename , $ assignmentname ) { $ formatparams = array ( 'context' => $ context -> get_course_context ( ) ) ; $ posttext = format_string ( $ course -> shortname , true , $ formatparams ) . ' -> ' . $ modulen...
Format a notification for plain text .
29,887
protected static function format_notification_message_html ( $ messagetype , $ info , $ course , $ context , $ modulename , $ coursemodule , $ assignmentname ) { global $ CFG ; $ formatparams = array ( 'context' => $ context -> get_course_context ( ) ) ; $ posthtml = '<p><font face="sans-serif">' . '<a href="' . $ CFG ...
Format a notification for HTML .
29,888
public function send_notification ( $ userfrom , $ userto , $ messagetype , $ eventtype , $ updatetime ) { global $ USER ; $ userid = core_user :: is_real_user ( $ userfrom -> id ) ? $ userfrom -> id : $ USER -> id ; $ uniqueid = $ this -> get_uniqueid_for_user ( $ userid ) ; self :: send_assignment_notification ( $ us...
Message someone about something .
29,889
protected function notify_student_submission_copied ( stdClass $ submission ) { global $ DB , $ USER ; $ adminconfig = $ this -> get_admin_config ( ) ; if ( empty ( $ adminconfig -> submissionreceipts ) ) { return ; } if ( $ submission -> userid ) { $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ submission ->...
Notify student upon successful submission copy .
29,890
protected function notify_student_submission_receipt ( stdClass $ submission ) { global $ DB , $ USER ; $ adminconfig = $ this -> get_admin_config ( ) ; if ( empty ( $ adminconfig -> submissionreceipts ) ) { return ; } if ( $ submission -> userid ) { $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ submission -...
Notify student upon successful submission .
29,891
protected function notify_graders ( stdClass $ submission ) { global $ DB , $ USER ; $ instance = $ this -> get_instance ( ) ; $ late = $ instance -> duedate && ( $ instance -> duedate < time ( ) ) ; if ( ! $ instance -> sendnotifications && ! ( $ late && $ instance -> sendlatenotifications ) ) { return ; } if ( $ subm...
Send notifications to graders upon student submissions .
29,892
public function submit_for_grading ( $ data , $ notices ) { global $ USER ; $ userid = $ USER -> id ; if ( ! empty ( $ data -> userid ) ) { $ userid = $ data -> userid ; } if ( $ userid == $ USER -> id ) { require_capability ( 'mod/assign:submit' , $ this -> context ) ; } else { if ( ! $ this -> can_edit_submission ( $...
Submit a submission for grading .
29,893
protected function process_submit_other_for_grading ( $ mform , $ notices ) { global $ USER , $ CFG ; require_sesskey ( ) ; $ userid = optional_param ( 'userid' , $ USER -> id , PARAM_INT ) ; if ( ! $ this -> submissions_open ( $ userid ) ) { $ notices [ ] = get_string ( 'submissionsclosed' , 'assign' ) ; return false ...
A students submission is submitted for grading by a teacher .
29,894
protected function process_submit_for_grading ( $ mform , $ notices ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/submissionconfirmform.php' ) ; require_sesskey ( ) ; if ( ! $ this -> submissions_open ( ) ) { $ notices [ ] = get_string ( 'submissionsclosed' , 'assign' ) ; return false ; } $ data = n...
Assignment submission is processed before grading .
29,895
public function save_user_extension ( $ userid , $ extensionduedate ) { global $ DB ; require_capability ( 'mod/assign:grantextension' , $ this -> context ) ; if ( ! is_enrolled ( $ this -> get_course_context ( ) , $ userid ) ) { return false ; } if ( ! has_capability ( 'mod/assign:submit' , $ this -> context , $ useri...
Save the extension date for a single user .
29,896
protected function process_save_extension ( & $ mform ) { global $ DB , $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/extensionform.php' ) ; require_sesskey ( ) ; $ users = optional_param ( 'userid' , 0 , PARAM_INT ) ; if ( ! $ users ) { $ users = required_param ( 'selectedusers' , PARAM_SEQUENCE ) ; } $ userl...
Save extension date .
29,897
public function format_grade_for_log ( stdClass $ grade ) { global $ DB ; $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ grade -> userid ) , '*' , MUST_EXIST ) ; $ info = get_string ( 'gradestudent' , 'assign' , array ( 'id' => $ user -> id , 'fullname' => fullname ( $ user ) ) ) ; if ( $ grade -> 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 .
29,898
public function format_submission_for_log ( stdClass $ submission ) { global $ DB ; $ info = '' ; if ( $ submission -> userid ) { $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ submission -> userid ) , '*' , MUST_EXIST ) ; $ name = fullname ( $ user ) ; } else { $ group = $ this -> get_submission_group ( $ su...
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 .
29,899
public function submission_empty ( $ submission ) { $ allempty = true ; foreach ( $ this -> submissionplugins as $ plugin ) { if ( $ plugin -> is_enabled ( ) && $ plugin -> is_visible ( ) ) { if ( ! $ allempty || ! $ plugin -> is_empty ( $ submission ) ) { $ allempty = false ; } } } return $ allempty ; }
Determine if the current submission is empty or not .