global $CFG;
parent::grade_report($courseid, $gpr, $context);
- $this->showrank = grade_get_setting($this->courseid, 'report_user_showrank', !empty($CFG->grade_report_user_showrank));
- $this->showhiddenitems = grade_get_setting($this->courseid, 'report_user_showhiddenitems', !empty($CFG->grade_report_user_showhiddenitems));
+ $this->showrank = grade_get_setting($this->courseid, 'report_user_showrank', $CFG->grade_report_user_showrank);
+ $this->showhiddenitems = grade_get_setting($this->courseid, 'report_user_showhiddenitems', $CFG->grade_report_user_showhiddenitems);
$switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition);
$grade_item =& $items[$itemid];
$grade_grade =& $grades[$itemid];
- if (!$this->showhiddenitems and !$canviewhidden and $grade_item->is_hidden()) {
- continue;
+ if (!$canviewhidden and $grade_item->is_hidden()) {
+ if ($this->showhiddenitems == 0) {
+ // no hidden items at all
+ continue;
+ } else if ($this->showhiddenitems == 1 and !$grade_item->is_hiddenuntil()) {
+ // hidden until that are still hidden are visible
+ continue;
+ }
}
$class = 'gradeitem';
$options = array(-1 => get_string('default', 'grades'),
0 => get_string('hide'),
- 1 => get_string('show'));
+ 1 => get_string('showhiddenuntilonly', 'grades'),
+ 2 => get_string('show'));
if (empty($CFG->grade_report_user_showhiddenitems)) {
$options[-1] = get_string('defaultprev', 'grades', $options[0]);
$settings->add(new admin_setting_configcheckbox('grade_report_user_showrank', get_string('showrank', 'grades'), get_string('configshowrank', 'grades'), 0, PARAM_INT));
-$settings->add(new admin_setting_configcheckbox('grade_report_user_showhiddenitems', get_string('showhiddenitems', 'grades'), get_string('configshowhiddenitems', 'grades'), 0, PARAM_INT));
+$options = array(0 => get_string('shownohidden', 'grades'),
+ 1 => get_string('showhiddenuntilonly', 'grades'),
+ 2 => get_string('showallhidden', 'grades'));
+$settings->add(new admin_setting_configselect('grade_report_user_showhiddenitems', get_string('showhiddenitems', 'grades'), get_string('configshowhiddenitems', 'grades'), 1, $options));
?>
$string['setting'] = 'Setting';
$string['settings'] = 'Settings';
$string['setweights'] = 'Set Weights';
+$string['showallhidden'] = 'All hidden';
$string['showallstudents'] = 'Show All Students';
$string['showactivityicons'] = 'Show activity icons';
$string['showaverages'] = 'Show column averages';
$string['showfeedback'] = 'Show feedback';
$string['showgroups'] = 'Show groups';
$string['showhiddenitems'] = 'Show hidden items';
+$string['showhiddenuntilonly'] = 'Only hidden until';
$string['showlocks'] = 'Show locks';
+$string['shownohidden'] = 'No hidden';
$string['shownooutcomes'] = 'Hide outcomes';
$string['shownumberofgrades'] = 'Show number of grades in averages';
$string['showranges'] = 'Show ranges';
return $this->grade_item->is_hidden();
}
+ /**
+ * Check grade hidden status. Uses data from both grade item and grade.
+ * @return boolean true if hiddenuntil, false if not
+ */
+ function is_hiddenuntil() {
+ $this->load_grade_item();
+ return $this->grade_item->is_hiddenuntil();
+ }
+
/**
* Sets the grade_item's hidden variable and updates the grade_item.
* Method named after grade_item::set_hidden().
return $this->hidden == 1 or ($this->hidden != 0 and $this->hidden > time()) or $this->grade_item->is_hidden();
}
+ /**
+ * Check grade hidden status. Uses data from both grade item and grade.
+ * @return boolean true if hiddenuntil, false if not
+ */
+ function is_hiddenuntil() {
+ $this->load_grade_item();
+
+ if ($this->hidden == 1 or $this->grade_item->hidden == 1) {
+ return false; //always hidden
+ }
+
+ if ($this->hidden > 1 or $this->grade_item->hidden > 1) {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Check grade hidden status. Uses data from both grade item and grade.
* @return int 0 means visible, 1 hidden always, timestamp hidden until
return ($this->hidden == 1 or ($this->hidden != 0 and $this->hidden > time()));
}
+ /**
+ * Check grade hidden status. Uses data from both grade item and grade.
+ * @return boolean true if hiddenuntil, false if not
+ */
+ function is_hiddenuntil() {
+ return $this->hidden > 1;
+ }
+
/**
* Check grade item hidden status.
* @return int 0 means visible, 1 hidden always, timestamp hidden until