diff --git a/classes/page_with_filter_controls.php b/classes/page_with_filter_controls.php index b88ff57..22f7ab5 100644 --- a/classes/page_with_filter_controls.php +++ b/classes/page_with_filter_controls.php @@ -154,6 +154,7 @@ class mod_attendance_page_with_filter_controls { $this->enddate = time(); break; case ATT_VIEW_ALL: + case ATT_VIEW_NOTPRESENT: $this->startdate = 0; $this->enddate = 0; break; diff --git a/classes/structure.php b/classes/structure.php index 7a29187..2863bf6 100644 --- a/classes/structure.php +++ b/classes/structure.php @@ -96,6 +96,10 @@ class mod_attendance_structure { /** @var array of sessionid. */ private $sessioninfo = array(); + /** @var float number [0..1], the threshold for student to be shown at low grade report */ + private $lowgradethreshold; + + /** * Initializes the attendance API instance using the data from DB * @@ -1271,4 +1275,24 @@ class mod_attendance_structure { } return; } + + /** + * Gets the lowgrade threshold to use. + * + */ + public function get_lowgrade_threshold() { + if (!isset($this->lowgradethreshold)) { + $this->lowgradethreshold = 1; + + if ($this->grade > 0) { + $gradeitem = grade_item::fetch(array('courseid' => $this->course->id, 'itemtype' => 'mod', + 'itemmodule' => 'attendance', 'iteminstance' => $this->id)); + if ($gradeitem->gradepass > 0 && $gradeitem->grademax != $gradeitem->grademin) { + $this->lowgradethreshold = ($gradeitem->gradepass - $gradeitem->grademin) / ($gradeitem->grademax - $gradeitem->grademin); + } + } + } + + return $this->lowgradethreshold; + } } diff --git a/lang/en/attendance.php b/lang/en/attendance.php index 7d85379..a1243f0 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -247,7 +247,7 @@ $string['invalidsessionendtime'] = 'The end time must be greater than start time $string['invalidstatus'] = 'You have selected an invalid status, please try again'; $string['iptimemissing'] = 'Invalid minutes to release'; $string['jumpto'] = 'Jump to'; -$string['lowgrade'] = 'Low grade'; +$string['below'] = 'Below {$a}%'; $string['maxpossible'] = 'Maximum possible'; $string['maxpossible_help'] = 'Shows the score each user can reach if they receive the maximum points in each session not yet taken (past and future):