Skip to content

Commit

Permalink
MDL-13787 Updated get_pref() so that it looks up a short version of t…
Browse files Browse the repository at this point in the history
…he 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
  • Loading branch information
nicolasconnault committed Mar 5, 2008
1 parent 037a40f commit 54294d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion grade/report/lib.php
Expand Up @@ -170,14 +170,19 @@ function grade_report($courseid, $gpr, $context, $page=null) {
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])) {
Expand Down

0 comments on commit 54294d3

Please sign in to comment.