Fix #72 - Exporting 'Common' Session type Sessions filtered by Group
authorBarry Oosthuizen <barry.oosthuizen@nottingham.ac.uk>
Fri, 13 Feb 2015 14:19:00 +0000 (14:19 +0000)
committerBarry Oosthuizen <barry.oosthuizen@nottingham.ac.uk>
Fri, 13 Feb 2015 14:19:00 +0000 (14:19 +0000)
locallib.php
renderables.php

index c0bef5c..5df4484 100644 (file)
@@ -697,7 +697,7 @@ class attendance {
         return $DB->count_records_select('attendance_sessions', $where, $params);
     }
 
-    public function get_filtered_sessions() {
+    public function get_filtered_sessions($filtergroups = true) {
         global $DB;
 
         if ($this->pageparams->startdate && $this->pageparams->enddate) {
@@ -707,7 +707,7 @@ class attendance {
         } else {
             $where = "attendanceid = :aid AND sessdate >= :csdate";
         }
-        if ($this->pageparams->get_current_sesstype() > att_page_with_filter_controls::SESSTYPE_ALL) {
+        if ($filtergroups && $this->pageparams->get_current_sesstype() > att_page_with_filter_controls::SESSTYPE_ALL) {
             $where .= " AND groupid=:cgroup";
         }
         $params = array(
@@ -806,7 +806,7 @@ class attendance {
                 $info_array[] = construct_session_full_date_time($lastsession->sessdate, $lastsession->duration);
                 break;
             } else {
-                $info_array[] = construct_session_full_date_time($sess->sessdate, $sess->duration);
+            $info_array[] = construct_session_full_date_time($sess->sessdate, $sess->duration);
             }
             $i++;
         }
index 5dd2223..7502859 100644 (file)
@@ -475,7 +475,7 @@ class attendance_report_data implements renderable {
 
         $this->groups = groups_get_all_groups($att->course->id);
 
-        $this->sessions = $att->get_filtered_sessions();
+        $this->sessions = $att->get_filtered_sessions(false);
 
         $this->statuses = $att->get_statuses();
         $this->allstatuses = $att->get_statuses(false);