mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-78333 mod_assign: final removal of deprecated log format methods.
This commit is contained in:
parent
2e1c6fd43e
commit
ca95bee259
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 ' .
|
||||
'<modname>_scale_used_anywhere, all implementations of <modname>_scale_used are now ignored');
|
||||
}
|
||||
|
@ -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 '</td></tr></table>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 3.8
|
||||
*/
|
||||
function assign_scale_used() {
|
||||
throw new coding_exception('assign_scale_used() can not be used anymore. Plugins can implement ' .
|
||||
'<modname>_scale_used_anywhere, all implementations of <modname>_scale_used are now ignored');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if scale is being used by any instance of assignment
|
||||
*
|
||||
|
@ -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) . ' <br>';
|
||||
|
||||
foreach ($this->submissionplugins as $plugin) {
|
||||
if ($plugin->is_enabled() && $plugin->is_visible()) {
|
||||
$info .= '<br>' . $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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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).';
|
||||
|
1
mod/assign/submission/file/lang/en/deprecated.txt
Normal file
1
mod/assign/submission/file/lang/en/deprecated.txt
Normal file
@ -0,0 +1 @@
|
||||
numfilesforlog,assignsubmission_file
|
@ -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
|
||||
|
@ -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';
|
||||
|
1
mod/assign/submission/onlinetext/lang/en/deprecated.txt
Normal file
1
mod/assign/submission/onlinetext/lang/en/deprecated.txt
Normal file
@ -0,0 +1 @@
|
||||
numwordsforlog,assignsubmission_onlinetext
|
@ -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
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user