MDL-18058 glossary rates - secured
This commit is contained in:
@@ -131,6 +131,7 @@ $string['importedcategories'] = 'Imported categories';
|
||||
$string['importedentries'] = 'Imported entries';
|
||||
$string['importentries'] = 'Import entries';
|
||||
$string['importentriesfromxml'] = 'Import entries from XML file';
|
||||
$string['invalidrate'] = 'Invalid glossary rate ($a)';
|
||||
$string['isglobal'] = 'Is this glossary global?';
|
||||
$string['linkcategory'] = 'Automatically link this category';
|
||||
$string['linking'] = 'Auto-linking';
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
}
|
||||
|
||||
if ($data = data_submitted()) { // form submitted
|
||||
|
||||
/// Calculate scale values
|
||||
$scale_values = make_grades_menu($glossary->scale);
|
||||
|
||||
foreach ((array)$data as $entryid => $rating) {
|
||||
if (!is_numeric($entryid)) {
|
||||
continue;
|
||||
@@ -69,6 +73,11 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
/// Check rate is valid for that glossary scale values
|
||||
if (!array_key_exists($rating, $scale_values) && $rating != -999) {
|
||||
print_error('invalidrate', 'glossary', '', $rating);
|
||||
}
|
||||
|
||||
if ($oldrating = get_record("glossary_ratings", "userid", $USER->id, "entryid", $entry->id)) {
|
||||
//Check if we must delete the rate
|
||||
if ($rating == -999) {
|
||||
|
||||
Reference in New Issue
Block a user