MDL-11282 Using notice_yesno(), but not sure how to provide a backlink with the cancel action...

This commit is contained in:
nicolasconnault 2007-09-14 19:32:50 +00:00
parent e171963b3e
commit b159da787a
3 changed files with 26 additions and 18 deletions

View file

@ -163,6 +163,7 @@ $string['gradeexceptions'] = 'Grade Exceptions';
$string['gradeexceptionshelp'] = 'Grade Exceptions Help';
$string['gradehelp'] = 'Grade Help';
$string['gradeitem'] = 'Grade item';
$string['gradeitemislocked'] = 'This activity is locked in the gradebook. If you regrade it, the grades held internally by this activity will be different from the ones in the gradebook, the latter which will remain unchanged. Are you sure you want to proceed with the regrading?';
$string['gradeitemlocked'] = 'Grading locked';
$string['gradeitemsinc'] = 'Grade items to be included';
$string['gradeitemaddusers'] = 'Exclude from Grading';

View file

@ -98,6 +98,7 @@ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance,
}
/// Create or update the grade_item if needed
if (!$grade_item) {
if ($itemdetails) {
$itemdetails = (array)$itemdetails;
@ -127,9 +128,15 @@ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance,
} else {
if ($grade_item->is_locked()) {
debugging('Grading item is locked!');
$confirm_regrade = optional_param('confirm_regrade', 0, PARAM_INT);
if (!$confirm_regrade) {
$message = get_string('gradeitemislocked', 'grades', $grade_item->itemname);
$back_link = '';
$regrade_link = qualified_me() . '&confirm_regrade=1';
notice_yesno($message, $regrade_link, $back_link);
return GRADE_UPDATE_ITEM_LOCKED;
}
}
if ($itemdetails) {
$itemdetails = (array)$itemdetails;