diff --git a/mod/assign/assignmentplugin.php b/mod/assign/assignmentplugin.php index 22c43f82cf2..73445d93f48 100644 --- a/mod/assign/assignmentplugin.php +++ b/mod/assign/assignmentplugin.php @@ -522,14 +522,10 @@ abstract class assign_plugin { } /** - * Formatting for log info - * - * @param stdClass $submissionorgrade assign_submission or assign_grade The new submission or grade - * @return string + * @deprecated since 2.7 */ - public function format_for_log(stdClass $submissionorgrade) { - // Format the info for each submission plugin add_to_log. - return ''; + public function format_for_log() { + throw new coding_exception(__FUNCTION__ . ' has been deprecated, please do not use it any more'); } /** diff --git a/mod/assign/deprecatedlib.php b/mod/assign/deprecatedlib.php index d550bf23996..87b3ad2a76b 100644 --- a/mod/assign/deprecatedlib.php +++ b/mod/assign/deprecatedlib.php @@ -57,3 +57,32 @@ function assign_get_completion_state($course, $cm, $userid, $type) { return $type; } } + +/** + * @deprecated since Moodle 3.3, when the block_course_overview block was removed. + */ +function assign_print_overview() { + throw new coding_exception('assign_print_overview() can not be used any more and is obsolete.'); +} + +/** + * @deprecated since Moodle 3.3, when the block_course_overview block was removed. + */ +function assign_get_mysubmission_details_for_print_overview() { + throw new coding_exception('assign_get_mysubmission_details_for_print_overview() can not be used any more and is obsolete.'); +} + +/** + * @deprecated since Moodle 3.3, when the block_course_overview block was removed. + */ +function assign_get_grade_details_for_print_overview() { + throw new coding_exception('assign_get_grade_details_for_print_overview() can not be used any more and is obsolete.'); +} + +/** + * @deprecated since Moodle 3.8 + */ +function assign_scale_used() { + throw new coding_exception('assign_scale_used() can not be used anymore. Plugins can implement ' . + '_scale_used_anywhere, all implementations of _scale_used are now ignored'); +} diff --git a/mod/assign/lib.php b/mod/assign/lib.php index 9158e763dcc..0a85b0847d8 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -618,27 +618,6 @@ function assign_page_type_list($pagetype, $parentcontext, $currentcontext) { return $modulepagetype; } -/** - * @deprecated since Moodle 3.3, when the block_course_overview block was removed. - */ -function assign_print_overview() { - throw new coding_exception('assign_print_overview() can not be used any more and is obsolete.'); -} - -/** - * @deprecated since Moodle 3.3, when the block_course_overview block was removed. - */ -function assign_get_mysubmission_details_for_print_overview() { - throw new coding_exception('assign_get_mysubmission_details_for_print_overview() can not be used any more and is obsolete.'); -} - -/** - * @deprecated since Moodle 3.3, when the block_course_overview block was removed. - */ -function assign_get_grade_details_for_print_overview() { - throw new coding_exception('assign_get_grade_details_for_print_overview() can not be used any more and is obsolete.'); -} - /** * Print recent activity from all assignments in a given course * @@ -961,14 +940,6 @@ function assign_print_recent_mod_activity($activity, $courseid, $detail, $modnam echo ''; } -/** - * @deprecated since Moodle 3.8 - */ -function assign_scale_used() { - throw new coding_exception('assign_scale_used() can not be used anymore. Plugins can implement ' . - '_scale_used_anywhere, all implementations of _scale_used are now ignored'); -} - /** * Checks if scale is being used by any instance of assignment * diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 8d96c838147..7b5c0878fa4 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3700,42 +3700,10 @@ class assign { } /** - * Util function to add a message to the log. - * * @deprecated since 2.7 - Use new events system instead. - * (see http://docs.moodle.org/dev/Migrating_logging_calls_in_plugins). - * - * @param string $action The current action - * @param string $info A detailed description of the change. But no more than 255 characters. - * @param string $url The url to the assign module instance. - * @param bool $return If true, returns the arguments, else adds to log. The purpose of this is to - * retrieve the arguments to use them with the new event system (Event 2). - * @return void|array */ - 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, - $this->get_course_module()->id - ); - - if ($return) { - // We only need to call debugging when returning a value. This is because the call to - // call_user_func_array('add_to_log', $args) will trigger a debugging message of it's own. - debugging('The mod_assign add_to_log() function is now deprecated.', DEBUG_DEVELOPER); - return $args; - } - call_user_func_array('add_to_log', $args); + public function add_to_log() { + throw new coding_exception(__FUNCTION__ . ' has been deprecated, please do not use it any more'); } /** @@ -7386,65 +7354,17 @@ class assign { } /** - * 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. - * * @deprecated since 2.7 - * - * @param stdClass $grade - * @return string */ - 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 != '') { - $info .= get_string('gradenoun') . ': ' . $this->display_grade($grade->grade, false) . '. '; - } else { - $info .= get_string('nograde', 'assign'); - } - return $info; + public function format_grade_for_log() { + throw new coding_exception(__FUNCTION__ . ' has been deprecated, please do not use it any more'); } /** - * 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. - * * @deprecated since 2.7 - * - * @param stdClass $submission - * @return string */ - 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($submission->userid); - if ($group) { - $name = $group->name; - } else { - $name = get_string('defaultteam', 'assign'); - } - } - $status = get_string('submissionstatus_' . $submission->status, 'assign'); - $params = array('id'=>$submission->userid, 'fullname'=>$name, 'status'=>$status); - $info .= get_string('submissionlog', 'assign', $params) . '
'; - - foreach ($this->submissionplugins as $plugin) { - if ($plugin->is_enabled() && $plugin->is_visible()) { - $info .= '
' . $plugin->format_for_log($submission); - } - } - - return $info; + public function format_submission_for_log() { + throw new coding_exception(__FUNCTION__ . ' has been deprecated, please do not use it any more'); } /** diff --git a/mod/assign/submission/file/lang/en/assignsubmission_file.php b/mod/assign/submission/file/lang/en/assignsubmission_file.php index 30d4a299d99..ecd41ad13b0 100644 --- a/mod/assign/submission/file/lang/en/assignsubmission_file.php +++ b/mod/assign/submission/file/lang/en/assignsubmission_file.php @@ -41,8 +41,10 @@ $string['maxfilessubmission'] = 'Maximum number of uploaded files'; $string['maxfilessubmission_help'] = 'If file submissions are enabled, each student will be able to upload up to this number of files for their submission.'; $string['maximumsubmissionsize'] = 'Maximum submission size'; $string['maximumsubmissionsize_help'] = 'Files uploaded by students may be up to this size.'; -$string['numfilesforlog'] = 'The number of file(s) : {$a} file(s).'; $string['pluginname'] = 'File submissions'; $string['privacy:metadata:filepurpose'] = 'The files loaded for this assignment submission'; $string['siteuploadlimit'] = 'Site upload limit'; $string['submissionfilearea'] = 'Uploaded submission files'; + +// Deprecated since Moodle 4.3. +$string['numfilesforlog'] = 'The number of file(s) : {$a} file(s).'; diff --git a/mod/assign/submission/file/lang/en/deprecated.txt b/mod/assign/submission/file/lang/en/deprecated.txt new file mode 100644 index 00000000000..e6dea5c87ac --- /dev/null +++ b/mod/assign/submission/file/lang/en/deprecated.txt @@ -0,0 +1 @@ +numfilesforlog,assignsubmission_file diff --git a/mod/assign/submission/file/locallib.php b/mod/assign/submission/file/locallib.php index 804ec66205f..a5cd790882b 100644 --- a/mod/assign/submission/file/locallib.php +++ b/mod/assign/submission/file/locallib.php @@ -509,19 +509,6 @@ class assign_submission_file extends assign_submission_plugin { return true; } - /** - * Formatting for log info - * - * @param stdClass $submission The submission - * @return string - */ - public function format_for_log(stdClass $submission) { - // Format the info for each submission plugin (will be added to log). - $filecount = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA); - - return get_string('numfilesforlog', 'assignsubmission_file', $filecount); - } - /** * Return true if there are no submission files * @param stdClass $submission diff --git a/mod/assign/submission/onlinetext/lang/en/assignsubmission_onlinetext.php b/mod/assign/submission/onlinetext/lang/en/assignsubmission_onlinetext.php index eb91ba51c28..4d21aa083f5 100644 --- a/mod/assign/submission/onlinetext/lang/en/assignsubmission_onlinetext.php +++ b/mod/assign/submission/onlinetext/lang/en/assignsubmission_onlinetext.php @@ -33,7 +33,6 @@ $string['onlinetext'] = 'Online text'; $string['onlinetextfilename'] = 'onlinetext.html'; $string['onlinetextsubmission'] = 'Allow online text submission'; $string['numwords'] = '({$a} words)'; -$string['numwordsforlog'] = 'Submission word count: {$a} words'; $string['pluginname'] = 'Online text submissions'; $string['privacy:metadata:assignmentid'] = 'Assignment ID'; $string['privacy:metadata:filepurpose'] = 'Files that are embedded in the text submission.'; @@ -46,3 +45,6 @@ $string['wordlimit_help'] = 'If online text submissions are enabled, this is the 'of words that each student will be allowed to submit.'; $string['wordlimitexceeded'] = 'The word limit for this assignment is {$a->limit} words and you ' . 'are attempting to submit {$a->count} words. Please review your submission and try again.'; + +// Deprecated since Moodle 4.3. +$string['numwordsforlog'] = 'Submission word count: {$a} words'; diff --git a/mod/assign/submission/onlinetext/lang/en/deprecated.txt b/mod/assign/submission/onlinetext/lang/en/deprecated.txt new file mode 100644 index 00000000000..3bb45b2f6ec --- /dev/null +++ b/mod/assign/submission/onlinetext/lang/en/deprecated.txt @@ -0,0 +1 @@ +numwordsforlog,assignsubmission_onlinetext diff --git a/mod/assign/submission/onlinetext/locallib.php b/mod/assign/submission/onlinetext/locallib.php index 30fd3d26faa..0fd17b07ac1 100644 --- a/mod/assign/submission/onlinetext/locallib.php +++ b/mod/assign/submission/onlinetext/locallib.php @@ -562,23 +562,6 @@ class assign_submission_onlinetext extends assign_submission_plugin { return true; } - /** - * Formatting for log info - * - * @param stdClass $submission The new submission - * @return string - */ - public function format_for_log(stdClass $submission) { - // Format the info for each submission plugin (will be logged). - $onlinetextsubmission = $this->get_onlinetext_submission($submission->id); - $onlinetextloginfo = ''; - $onlinetextloginfo .= get_string('numwordsforlog', - 'assignsubmission_onlinetext', - count_words($onlinetextsubmission->onlinetext)); - - return $onlinetextloginfo; - } - /** * The assignment has been deleted - cleanup * diff --git a/mod/assign/tests/fixtures/testable_assign.php b/mod/assign/tests/fixtures/testable_assign.php index e9adbab766d..573944aead3 100644 --- a/mod/assign/tests/fixtures/testable_assign.php +++ b/mod/assign/tests/fixtures/testable_assign.php @@ -44,10 +44,6 @@ class mod_assign_testable_assign extends assign { return parent::apply_grade_to_user($formdata, $userid, $attemptnumber); } - public function testable_format_submission_for_log(stdClass $submission) { - return parent::format_submission_for_log($submission); - } - public function testable_get_grading_userid_list() { return parent::get_grading_userid_list(); } diff --git a/mod/assign/upgrade.txt b/mod/assign/upgrade.txt index 656b94d386d..68c4818957d 100644 --- a/mod/assign/upgrade.txt +++ b/mod/assign/upgrade.txt @@ -1,5 +1,12 @@ This files describes API changes in the assign code. +=== 4.3 === +* The following deprecated methods have been removed and should not be used any more: + - `assign::add_to_log` + - `assign::format_grade_for_log` + - `assign::format_submission_for_log` + - `assign_plugin::format_for_log` + === 4.2 === * The upgradelib.php file has been removed from mod_assign as it was only being used by mod_assignment and mod_assignment has been removed from core.