ソースを参照

Fix functions add session is see BT#13000

jmontoyaa 7 年 前
コミット
c87ae051ca
1 ファイル変更20 行追加12 行削除
  1. 20 12
      main/inc/ajax/myspace.ajax.php

+ 20 - 12
main/inc/ajax/myspace.ajax.php

@@ -14,23 +14,24 @@ switch ($action) {
         $course_code = Security::remove_XSS($_REQUEST['course']);
         $type = Security::remove_XSS($_REQUEST['type']);
         $range = Security::remove_XSS($_REQUEST['range']);
-
+        $sessionId = isset($_REQUEST['session_id']) ? $_REQUEST['session_id'] : 0;
         $courseInfo = api_get_course_info($course_code);
-        $courseId = $courseInfo['real_id'];
 
         if ($range == 1) {
             $start_date = Security::remove_XSS($_REQUEST['sd']);
             $end_date = Security::remove_XSS($_REQUEST['ed']);
             $sql_result = MySpace::get_connections_to_course_by_date(
                 $user_id,
-                $courseId,
+                $courseInfo,
+                $sessionId,
                 $start_date,
                 $end_date
             );
         } else {
             $sql_result = MySpace::get_connections_to_course(
                 $user_id,
-                $courseId
+                $courseInfo,
+                $sessionId
             );
         }
         $foo_print = grapher($sql_result, $start_date, $end_date, $type);
@@ -39,17 +40,18 @@ switch ($action) {
         break;
     case 'access_detail_by_date':
         $db = array('is_empty' => true);
-        $start_date = isset($_REQUEST['startDate']) ? $_REQUEST['startDate'] : "";
-        $end_date = isset($_REQUEST['endDate']) ? $_REQUEST['endDate'] : "";
-        $user_id = isset($_REQUEST['student']) ? $_REQUEST['student'] : "";
-        $course_code = isset($_REQUEST['course']) ? $_REQUEST['course'] : "";
-        $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : "";
+        $start_date = isset($_REQUEST['startDate']) ? $_REQUEST['startDate'] : '';
+        $end_date = isset($_REQUEST['endDate']) ? $_REQUEST['endDate'] : '';
+        $user_id = isset($_REQUEST['student']) ? $_REQUEST['student'] : '';
+        $course_code = isset($_REQUEST['course']) ? $_REQUEST['course'] : '';
+        $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : '';
+        $sessionId = isset($_REQUEST['session_id']) ? $_REQUEST['session_id'] : 0;
         $courseInfo = api_get_course_info($course_code);
-        $courseId = $courseInfo['real_id'];
 
         $sql_result = MySpace::get_connections_to_course_by_date(
             $user_id,
-            $courseId,
+            $courseInfo,
+            $sessionId,
             $start_date,
             $end_date
         );
@@ -57,7 +59,13 @@ switch ($action) {
         if (is_array($sql_result) && count($sql_result) > 0) {
             $db['is_empty'] = false;
             $db['result'] = convert_to_string($sql_result);
-            $rst = get_stats($user_id, $courseId, $start_date, $end_date);
+            $rst = get_stats(
+                $user_id,
+                $courseInfo,
+                $sessionId,
+                $start_date,
+                $end_date
+            );
             $foo_stats = '<strong>'.get_lang('Total').': </strong>'.$rst['total'].'<br />';
             $foo_stats .= '<strong>'.get_lang('Average').': </strong>'.$rst['avg'].'<br />';
             $foo_stats .= '<strong>'.get_lang('Quantity').' : </strong>'.$rst['times'].'<br />';