Browse Source

Fix statistics errors and warnings - 1.10.x

Imanol Losada 10 years ago
parent
commit
b34ca336f5

+ 6 - 6
main/admin/statistics/index.php

@@ -81,19 +81,19 @@ switch ($_REQUEST['report']) {
         break;
     case 'users':
         // total amount of users
+        $teachers = $students = array();
+        $countInvisible = isset($_GET['count_invisible_courses']) ? $_GET['count_invisible_courses'] : null;
         Statistics::printStats(
             get_lang('NumberOfUsers'),
             array(
-                get_lang('Teachers') => Statistics::countUsers(1, null, $_GET['count_invisible_courses']),
-                get_lang('Students') => Statistics::countUsers(5, null, $_GET['count_invisible_courses'])
+                get_lang('Teachers') => Statistics::countUsers(COURSEMANAGER, null, $countInvisible),
+                get_lang('Students') => Statistics::countUsers(STUDENT, null, $countInvisible)
             )
         );
-        $teachers = $students = array();
-        $countInvisible = isset($_GET['count_invisible_courses']) ? $_GET['count_invisible_courses'] : null;
         foreach ($course_categories as $code => $name) {
             $name = str_replace(get_lang('Department'), "", $name);
-            $teachers[$name] = Statistics::countUsers(1, $code, $countInvisible);
-            $students[$name] = Statistics::countUsers(5, $code, $countInvisible);
+            $teachers[$name] = Statistics::countUsers(COURSEMANAGER, $code, $countInvisible);
+            $students[$name] = Statistics::countUsers(STUDENT, $code, $countInvisible);
         }
         // docents for each course category
         Statistics::printStats(get_lang('Teachers'), $teachers);

+ 2 - 2
main/inc/lib/statistics.lib.php

@@ -596,8 +596,8 @@ class Statistics
 
         $table = new SortableTable(
             'activities',
-            array('Statistics', 'get_number_of_activities'),
-            array('Statistics','get_activities_data'),
+            array('Statistics', 'getNumberOfActivities'),
+            array('Statistics','getActivitiesData'),
             5,
             50,
             'DESC'

+ 6 - 3
main/inc/lib/zombie/zombie_report.class.php

@@ -40,8 +40,8 @@ class ZombieReport implements Countable
                 array(
                     'name' => 'ceiling',
                     'label' => get_lang('LastAccess'),
-                    'type' => 'datepickerdate',
-                    'default' => $this->get_ceiling(),
+                    'type' => 'date_picker',
+                    'default' => $this->get_ceiling('Y-m-d'),
                     'rules' => array(
 //                        array(
 //                            'type' => 'required',
@@ -121,7 +121,7 @@ class ZombieReport implements Countable
         return $form->isSubmitted() == false || $form->validate();
     }
 
-    function get_ceiling()
+    function get_ceiling($format = null)
     {
         $result = Request::get('ceiling');
         $result = $result ? $result : ZombieManager::last_year();
@@ -130,6 +130,9 @@ class ZombieReport implements Countable
         $result = is_array($result) ? mktime(0, 0, 0, $result['F'], $result['d'], $result['Y']) : $result;
         $result = is_numeric($result) ? (int) $result : $result;
         $result = is_string($result) ? strtotime($result) : $result;
+        if ($format) {
+            $result = date($format, $result);
+        }
         return $result;
     }