Permalink
Browse files

MDL-19596 Added browser check and refactored fixed student column che…

…ck into its own method.
  • Loading branch information...
1 parent 8e641dd commit 26b85b50086d7ea5b5f8a0d118c704e549b52186 nicolasconnault committed Jun 24, 2009
Showing with 25 additions and 8 deletions.
  1. +25 −8 grade/report/grader/lib.php
@@ -516,9 +516,9 @@ function print_toggle($type, $return=false) {
*/
function get_headerhtml() {
global $CFG, $USER;
-
+
$this->rowcount = 0;
- $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+ $fixedstudents = $this->is_fixed_students();
if (!$fixedstudents) {
$strsortasc = $this->get_lang_string('sortasc', 'grades');
@@ -691,7 +691,7 @@ function get_studentshtml() {
$numusers = count($this->users);
$showuserimage = $this->get_pref('showuserimage');
$showuseridnumber = $this->get_pref('showuseridnumber');
- $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+ $fixedstudents = $this->is_fixed_students();
// Preload scale objects for items with a scaleid
$scales_list = '';
@@ -932,7 +932,7 @@ function get_studentnameshtml() {
$showuserimage = $this->get_pref('showuserimage');
$showuseridnumber = $this->get_pref('showuseridnumber');
- $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+ $fixedstudents = $this->is_fixed_students();
$strsortasc = $this->get_lang_string('sortasc', 'grades');
$strsortdesc = $this->get_lang_string('sortdesc', 'grades');
@@ -1064,7 +1064,7 @@ function get_studentnameshtml() {
function get_endhtml() {
global $CFG, $USER;
- $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+ $fixedstudents = $this->is_fixed_students();
if ($fixedstudents) {
return "</tbody></table></div>";
@@ -1157,7 +1157,7 @@ function get_avghtml($grouponly=false) {
$ungraded_counts = get_records_sql($SQL);
- $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+ $fixedstudents = $this->is_fixed_students();
if (!$fixedstudents) {
$colspan='';
if ($this->get_pref('showuseridnumber')) {
@@ -1247,7 +1247,7 @@ function get_rangehtml() {
$columncount=0;
$rangehtml = '<tr class="range r'.$this->rowcount++.' heading">';
- $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+ $fixedstudents = $this->is_fixed_students();
if (!$fixedstudents) {
$colspan='';
if ($this->get_pref('showuseridnumber')) {
@@ -1287,7 +1287,7 @@ function get_iconshtml() {
$iconshtml = '<tr class="controls">';
- $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+ $fixedstudents = $this->is_fixed_students();
$showuseridnumber = $this->get_pref('showuseridnumber');
$colspan = '';
@@ -1438,5 +1438,22 @@ function process_action($target, $action) {
return true;
}
+
+ /**
+ * Returns whether or not to display fixed students column.
+ * Includes a browser check, because IE6 doesn't support the scrollbar.
+ *
+ * @return bool
+ */
+ function is_fixed_students() {
+ global $USER, $CFG;
+ return empty($USER->screenreader) && $CFG->grade_report_fixedstudents &&
+ (check_browser_version('MSIE', '7.0') ||
+ check_browser_version('Firefox', '2.0') ||
+ check_browser_version('Gecko', '2006010100') ||
+ check_browser_version('Camino', '1.0') ||
+ check_browser_version('Opera', '6.0') ||
+ check_browser_version('Safari', '2.0'));
+ }
}
?>

0 comments on commit 26b85b5

Please sign in to comment.