Fixing OU report issues

This commit is contained in:
nicolasconnault 2007-09-25 19:32:29 +00:00
parent f22bc9dbcb
commit d32100a522
3 changed files with 13 additions and 2 deletions

View File

@ -806,6 +806,8 @@ class grade_report_grader extends grade_report {
$meanselection = $this->get_pref('meanselection');
$shownumberofgrades = $this->get_pref('shownumberofgrades');
$canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->course->id));
$avghtml = '';
$avgcssclass = 'avg';
@ -857,6 +859,12 @@ class grade_report_grader extends grade_report {
$columncount=1;
foreach ($this->items as $item) {
// If the user shouldn't see this grade_item, hide the average as well
if ($item->is_hidden() && !$canviewhidden) {
$avghtml .= '<td class="cell c' . $columncount++.'"> - </td>';
continue;
}
if (empty($sum_array[$item->id])) {
$sum_array[$item->id] = 0;
}
@ -992,6 +1000,9 @@ class grade_report_grader extends grade_report {
$decimalpoints = $rangesdecimalpoints;
}
$grademin = 0;
$grademax = 100;
if ($displaytype == GRADE_DISPLAY_TYPE_REAL) {
$grademin = format_float($item->grademin, $decimalpoints);
$grademax = format_float($item->grademax, $decimalpoints);

View File

@ -117,7 +117,7 @@ class grader_report_preferences_form extends moodleform {
$help_string = get_string("config$lang_string", 'grades');
// Replace the 'default' value with the site default language string
if (!is_null($options) AND $options[GRADE_REPORT_PREFERENCE_DEFAULT] == 'default') {
if (!is_null($options) AND isset($options[GRADE_REPORT_PREFERENCE_DEFAULT]) && $options[GRADE_REPORT_PREFERENCE_DEFAULT] == 'default') {
$options[GRADE_REPORT_PREFERENCE_DEFAULT] = get_string('sitedefault', 'grades', $default);
} elseif ($type == 'text') {
$help_string = get_string("config{$lang_string}default", 'grades', $default);

View File

@ -533,7 +533,7 @@ class grade_item extends grade_object {
* Returns the hidden state of this grade_item
* @return boolean hidden state
*/
function is_hidden($userid=NULL) {
function is_hidden() {
return ($this->hidden == 1 or ($this->hidden != 0 and $this->hidden > time()));
}