mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-54751 core_grades: Gradebook highlights modules pending deletion
Added warning to all gradebook pages if any modules are pending deletion. Modified the return values for get_name, and is_locked for affected grade items to indicate their pending deletion.
This commit is contained in:
parent
3869d77411
commit
45bd824e59
@ -970,6 +970,13 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
|
||||
$user = null) {
|
||||
global $CFG, $OUTPUT, $PAGE;
|
||||
|
||||
// Put a warning on all gradebook pages if the course has modules currently scheduled for background deletion.
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
if (course_modules_pending_deletion($courseid)) {
|
||||
\core\notification::add(get_string('gradesmoduledeletionpendingwarning', 'grades'),
|
||||
\core\output\notification::NOTIFY_WARNING);
|
||||
}
|
||||
|
||||
if ($active_type === 'preferences') {
|
||||
// In Moodle 2.8 report preferences were moved under 'settings'. Allow backward compatibility for 3rd party grade reports.
|
||||
$active_type = 'settings';
|
||||
|
@ -326,6 +326,8 @@ $string['grades'] = 'Grades';
|
||||
$string['gradesforuser'] = 'Grades for {$a->user}';
|
||||
$string['singleview'] = 'Single view for {$a}';
|
||||
$string['gradesonly'] = 'Change to grades only';
|
||||
$string['gradesmoduledeletionpendingwarning'] = 'Warning: Activity deletion in progress! Some grades are about to be removed.';
|
||||
$string['gradesmoduledeletionprefix'] = '[Deletion in progress]';
|
||||
$string['gradessettings'] = 'Grade settings';
|
||||
$string['gradetype'] = 'Grade type';
|
||||
$string['gradetype_help'] = 'There are 4 grade types:
|
||||
|
@ -524,6 +524,14 @@ class grade_item extends grade_object {
|
||||
* @return bool Locked state
|
||||
*/
|
||||
public function is_locked($userid=NULL) {
|
||||
global $CFG;
|
||||
|
||||
// Override for any grade items belonging to activities which are in the process of being deleted.
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
if (course_module_instance_pending_deletion($this->courseid, $this->itemmodule, $this->iteminstance)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!empty($this->locked)) {
|
||||
return true;
|
||||
}
|
||||
@ -1393,7 +1401,12 @@ class grade_item extends grade_object {
|
||||
public function get_name($fulltotal=false) {
|
||||
if (strval($this->itemname) !== '') {
|
||||
// MDL-10557
|
||||
return format_string($this->itemname);
|
||||
|
||||
// Make it obvious to users if the course module to which this grade item relates, is currently being removed.
|
||||
$deletionpending = course_module_instance_pending_deletion($this->courseid, $this->itemmodule, $this->iteminstance);
|
||||
$deletionnotice = get_string('gradesmoduledeletionprefix', 'grades');
|
||||
|
||||
return $deletionpending ? format_string($deletionnotice . ' ' . $this->itemname) : format_string($this->itemname);
|
||||
|
||||
} else if ($this->is_course_item()) {
|
||||
return get_string('coursetotal', 'grades');
|
||||
|
Loading…
x
Reference in New Issue
Block a user