Forráskód Böngészése

Change the order of filters - refs BT#7674 BT#7673 BT#7675

Francis Gonzales 11 éve
szülő
commit
470c1be5d2

+ 2 - 1
main/inc/ajax/session.ajax.php

@@ -88,9 +88,10 @@ switch ($action) {
                     }
                     $results2[] = $item2;
                 }
+                $results2[] = array('T', 'text' => 'TODOS', 'id' => 'T');
                 echo json_encode($results2);
             } else {
-                echo json_encode(array());
+                echo json_encode(array(array('T', 'text' => 'TODOS', 'id' => 'T')));
             }
         }
         break;

+ 6 - 5
main/inc/lib/sessionmanager.lib.php

@@ -615,9 +615,11 @@ class SessionManager
                 $data[$lesson['id']]  = $data[$lesson['id']] . '%';
                 $count++;
             }
-
-            $data['total'] = round($progress / $count, 2) . '%';
-
+            if ($count == 0) {
+                $data['total'] = 0;
+            } else {
+                $data['total'] = round($progress / $count, 2) . '%';
+            }
             $table[] = $data;
         }
         return $table;
@@ -1107,7 +1109,7 @@ class SessionManager
      * @author César Perales <cesar.perales@beeznest.com>, Beeznest Team
      * @version Chamilo 1.9.6
      */
-    function get_user_data_access_tracking_overview(
+    static function get_user_data_access_tracking_overview(
         $sessionId,
         $courseId,
         $studentId = 0,
@@ -2229,7 +2231,6 @@ class SessionManager
 		if (count($order_by)>0) {
 			$sql_query .= ' ORDER BY '.Database::escape_string(implode(',',$order_by));
 		}
-        //echo $sql_query;
         if (self::$_debug) {
             error_log(preg_replace('/\s+/', ' ', $sql_query));
         }

+ 43 - 31
main/mySpace/index.php

@@ -9,6 +9,8 @@
  */
 $language_file = array('registration', 'index', 'tracking', 'admin', 'exercice');
 
+$isSessionFirst = false;
+
 // resetting the course id
 $cidReset = true;
 
@@ -634,18 +636,18 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
                 break;
             case 'accessoverview':
                $tool_name = get_lang('DisplayAccessOverview');
-               $a = $an = 'search_session_all';
+               $a = $an = 'search_course_by_session_all';
                 break;
             case 'surveyoverview':
                $tool_name = get_lang('DisplaySurveyOverview');
                 break;
             case 'lpprogressoverview':
                $tool_name = get_lang('DisplayLpProgressOverview');
-               $a = $an = 'search_session_all';
+               $a = $an = 'search_course_by_session_all';
                 break;
             case 'progressoverview':
                $tool_name = get_lang('DisplayProgressOverview');
-               $a = $an = 'search_session_all';
+               $a = $an = 'search_course_by_session_all';
                 break;
             case 'exerciseprogress':
                $tool_name = get_lang('DisplayExerciseProgress');
@@ -659,7 +661,7 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
 
         $sessionList = array();
         $courseList = array();
-        $sessionId = isset($_GET['session_id']) ? intval(Security::remove_XSS($_GET['session_id'])) : null;
+        $sessionId = isset($_GET['session_id']) ? Security::remove_XSS($_GET['session_id']) : null;
         $courseId = isset($_GET['course_id']) ? intval(Security::remove_XSS($_GET['course_id'])) : null;
 
         if (!empty($sessionId)) {
@@ -675,6 +677,11 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
             $a = 'search_course_by_session';
         }
 
+        
+        if (empty($sessionId) && !$isSessionFirst) {
+            $sessionId = 'T';
+        }
+        
         if (!empty($courseId)) {
             $courseList = array();
             $courseInfo = api_get_course_info_by_id($courseId);
@@ -867,29 +874,49 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
             $( "#date_from, #date_to").datepicker({
                 dateFormat:  "yy-mm-dd"
             });
-                        
-             $("#session_name").on("change", function() {
-                var sessionId = $(this).val();
-                //window.location = "'.$self.'?view=admin&display='.$display.'&session_id="+sessionId;
-                select2("#course_name", "' .  $ajax_path . 'course.ajax.php?a=' . $a . '&session_id=" + sessionId);
-            });
 
-            if (display == "lpprogressoverview" || display == "progressoverview" || display == "surveyoverview") {
-                if (isEmpty($("#session_name").val())) {
-                    $("#course_name").select2("readonly", true);
-                }}
+            ' . ( ($isSessionFirst) ? '
+                    $("#session_name").on("change", function() {
+                        var sessionId = $(this).val();
+                        //window.location = "'.$self.'?view=admin&display='.$display.'&session_id="+sessionId;
+                        select2("#course_name", "' .  $ajax_path . 'course.ajax.php?a=' . $a . '&session_id=" + sessionId);
+                    });
+                    ' :  '  
+                    $("#course_name").on("change", function() {
+                        if ($(this).val() == "") {
+                            $("#session_name").val("");
+                            $("#session_name").select2("readonly", true);
+                        } else {
+                            $("#session_name").select2("readonly", false);
+                        }
+                    });
+                       '
+                   ) . '
+
+                //if (display == "lpprogressoverview" || display == "progressoverview" || display == "surveyoverview") {
+                ' . ( ($isSessionFirst) ? '
+                   if (isEmpty($("#session_name").val())) {
+                      $("#course_name").select2("readonly", true);
+                   }' :  'if (isEmpty($("#course_name").val())) {
+                              $("#session_name").select2("readonly", true);
+                          }'
+                   ) . '
+                //}     
             });
 
             $("#course_name").on("change", function() {
+                if ($(this).val() == "") {
+                    $("#session_name").val("");
+                } 
                 var sessionId = $("#session_name").val();
                 var courseId = $("#course_name").val();
                 var display = "' . $display . '";
                 if (isEmpty(courseId)) {
                     select2("#session_name", "' .  $ajax_path . 'session.ajax.php?a=search_session");
                     if (isEmpty(sessionId)) {
-                        select2("#course_name", "' .  $ajax_path . 'course.ajax.php?a=search_course");
+                        select2("#course_name", "' .  $ajax_path . 'course.ajax.php?a=search_course_by_session_all&session_id=T");
                     } else {
-                        select2("#course_name", "' .  $ajax_path . 'course.ajax.php?a=search_course_by_session&session_id=" + sessionId);
+                        select2("#course_name", "' .  $ajax_path . 'course.ajax.php?a=search_course_by_session_all&session_id=" + sessionId);
                     }
                 } else {
                     select2("#session_name", "' .  $ajax_path . 'session.ajax.php?a=search_session_by_course&course_id=" + courseId);
@@ -897,11 +924,6 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
                 if (display == "accessoverview" || display == "exerciseprogress") {
                     window.location = "'.$self.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId;
                 }
-                /*
-                if (isEmpty(sessionId)) {
-                    select2("#session_name", "' .  $ajax_path . 'session.ajax.php?a=search_session_by_course&course_id=" + courseId);
-                }
-                */
                 if (typeof $("#survey_name") == "object") {
                     var surveyId = $("#survey_name").val();
                     select2("#survey_name", "' . $ajax_path . 'course.ajax.php?a=search_survey_by_course&session_id=" + sessionId + "&course_id=" + courseId + "&survey_id=" + surveyId);
@@ -910,16 +932,6 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
                     var exerciseId = $("#exercise_name").val();
                     select2("#exercise_name", "' . $ajax_path . 'course.ajax.php?a=search_exercise_by_course&session_id=" + sessionId + "&course_id=" + courseId + "&exercise_id=" + exerciseId);
                 }
-                /*if (typeof $("#student_name") == "object") {
-                    var studentId = $("#student_name").val();
-                    urlajax = "' . $ajax_path . 'course.ajax.php?a=search_user_by_course&course_id=" + courseId + "&student_id=" + studentId
-                    if (!isEmpty(sessionId)) {
-                        urlajax = urlajax + "&session_id=" + sessionId;
-                        select2("#course_name", "' .  $ajax_path . 'course.ajax.php?a=search_course_by_session&session_id=" + sessionId);
-                    }
-                    select2("#student_name", urlajax);
-                }
-            });*/
             ' . $script . '
         });
         function areBothFilled() {

+ 3 - 3
main/mySpace/myspace.lib.php

@@ -274,7 +274,7 @@ class MySpace {
      * Display a sortable table that contains an overview off all the progress of the user in a session
      * @author César Perales <cesar.perales@beeznest.com>, Beeznest Team
      */
-    public function display_tracking_lp_progress_overview($sessionId = '', $courseId = '', $date_from, $date_to) {
+    public static function display_tracking_lp_progress_overview($sessionId = '', $courseId = '', $date_from, $date_to) {
 
         $course = api_get_course_info_by_id($courseId);
         /**
@@ -351,7 +351,7 @@ class MySpace {
      * @return  string  HTML array of results formatted for gridJS
      * @author César Perales <cesar.perales@beeznest.com>, Beeznest Team
      */
-    function display_tracking_exercise_progress_overview($sessionId = 0, $courseId = 0, $exerciseId = 0, $date_from, $date_to) {
+    static function display_tracking_exercise_progress_overview($sessionId = 0, $courseId = 0, $exerciseId = 0, $date_from, $date_to) {
         /**
          * Column names
          * The column order is important. Check $column variable in the main/inc/ajax/model.ajax.php file
@@ -654,7 +654,7 @@ class MySpace {
      * @author César Perales <cesar.perales@beeznest.com>, Beeznest Team
      * @version Chamilo 1.9.6
      */
-    function display_tracking_access_overview($sessionId = 0, $courseId = 0, $studentId = '', $profile = '', $date_from, $date_to) {
+    static function display_tracking_access_overview($sessionId = 0, $courseId = 0, $studentId = '', $profile = '', $date_from, $date_to) {
         //The order is important you need to check the the $column variable in the model.ajax.php file
         $columns = array(
             get_lang('LoginDate'),

+ 1 - 1
main/newscorm/learnpathList.class.php

@@ -170,7 +170,7 @@ class learnpathList {
      *  @param int  Id of session
      *  @return array List of lessons with lessons id as keys
      */
-    function get_course_lessons($course_code, $session_id) {
+    static function  get_course_lessons($course_code, $session_id) {
         $tbl_course_lp          = Database::get_course_table(TABLE_LP_MAIN);
 
         $course = api_get_course_info($course_code);