MDL-13787 Updated get_pref() so that it looks up a short version of the config variable (grade_ instead of grade_report_) in case the first isn't set. It also returns null if no variable is found. Merging from MOODLE_19_STABLE

This commit is contained in:
nicolasconnault 2008-03-05 07:10:16 +00:00
parent 037a40f7dd
commit 54294d3b09

View File

@ -170,14 +170,19 @@ class grade_report {
function get_pref($pref, $objectid=null) {
global $CFG;
$fullprefname = 'grade_report_' . $pref;
$shortprefname = 'grade_' . $pref;
$retval = null;
if (!isset($this) OR get_class($this) != 'grade_report') {
if (!empty($objectid)) {
$retval = get_user_preferences($fullprefname . $objectid, grade_report::get_pref($pref));
} else {
} elseif (isset($CFG->$fullprefname)) {
$retval = get_user_preferences($fullprefname, $CFG->$fullprefname);
} elseif (isset($CFG->$shortprefname)) {
$retval = get_user_preferences($fullprefname, $CFG->$shortprefname);
} else {
$retval = null;
}
} else {
if (empty($this->prefs[$pref.$objectid])) {