Browse Source

Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

Yannick Warnier 11 years ago
parent
commit
272cc51490
27 changed files with 328 additions and 53 deletions
  1. 0 1
      license.txt
  2. 1 6
      main/admin/course_request_accepted.php
  3. 1 1
      main/dropbox/dropbox_functions.inc.php
  4. 1 1
      main/dropbox/dropbox_init.inc.php
  5. 37 2
      main/inc/ajax/model.ajax.php
  6. 6 0
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php
  7. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php
  8. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_load_folders.php
  9. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_create_folder.php
  10. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_delete_file.php
  11. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php
  12. 3 6
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_copy.php
  13. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_paste.php
  14. 6 0
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_upload.php
  15. 6 0
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php
  16. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_folder_listing.php
  17. 3 7
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php
  18. 4 6
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php
  19. 6 0
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_login.php
  20. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_preview.php
  21. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_as_form.php
  22. 6 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_name.php
  23. 7 0
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_text.php
  24. 8 0
      main/inc/lib/main_api.lib.php
  25. 112 8
      main/inc/lib/sessionmanager.lib.php
  26. 12 5
      main/mySpace/index.php
  27. 55 0
      main/mySpace/myspace.lib.php

+ 0 - 1
license.txt

@@ -11,7 +11,6 @@ Copyright (c) 2003-2007 Ghent University (UGent)
 Copyright (c) 2001-2004 Universite catholique de Louvain (UCL)
 Copyright (c) 2003-2008 Vrije Universiteit Brussel (VUB)
 Copyright (c) 2004-2008 Hoogeschool Gent (HoGent)
-Copyright (c) Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
 
 For a full list of contributors detaining copyrights over parts of
 the Chamilo software, see "documentation/credits.html".

+ 1 - 6
main/admin/course_request_accepted.php

@@ -41,7 +41,6 @@ $course_validation_feature = api_get_setting('course_validation') == 'true';
 $delete_course_request = intval($_GET['delete_course_request']);
 $message = trim(Security::remove_XSS(stripslashes(urldecode($_GET['message']))));
 $is_error_message = !empty($_GET['is_error_message']);
-$keyword = Database::escape_string(trim($_GET['keyword']));
 
 if ($course_validation_feature) {
 
@@ -99,12 +98,8 @@ function get_number_of_requests() {
  * Get course data to display
  */
 function get_request_data($from, $number_of_items, $column, $direction) {
-    global $keyword;
-
+    $keyword = Database::escape_string(trim($_GET['keyword']));
     $course_request_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST);
-    $users_table = Database :: get_main_table(TABLE_MAIN_USER);
-    $course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
-
     $sql = "SELECT id AS col0,
                    code AS col1,
                    title AS col2,

+ 1 - 1
main/dropbox/dropbox_functions.inc.php

@@ -40,7 +40,7 @@ function handle_multiple_actions()
     }
 
     // STEP 2: at least one file has to be selected. If not we return an error message
-    $ids = issset($_GET['id']) ? $_GET['id'] : array();
+    $ids = isset($_GET['id']) ? $_GET['id'] : array();
     if (count($ids)>0) {
         $checked_file_ids = $_POST['id'];
     } else {

+ 1 - 1
main/dropbox/dropbox_init.inc.php

@@ -125,7 +125,7 @@ $language_file = array('dropbox', 'document');
 
 // including the basic Chamilo initialisation file
 require_once '../inc/global.inc.php';
-$is_allowed_in_course = api_is_allowed_to_edit(false, true);
+$is_allowed_in_course = api_is_allowed_in_course();
 $is_courseTutor = api_is_course_tutor();
 $is_courseAdmin = api_is_course_admin();
 $current_course_tool  = TOOL_DROPBOX;

+ 37 - 2
main/inc/ajax/model.ajax.php

@@ -239,14 +239,16 @@ switch ($action) {
         break;
     case 'get_session_lp_progress':
     case 'get_session_progress':
-        #$count = SessionManager::get_count_session_lp_progress(intval($_GET['session_id']));
-        #break;
         $courses = SessionManager::get_course_list_by_session_id(intval($_GET['session_id']));
         //TODO let select course
         $course = current($courses);
         $users = CourseManager::get_student_list_from_course_code($course['code'], true, intval($_GET['session_id']));
         $count = count($users);
         break;
+    case 'get_exercise_progress':
+        $records = SessionManager::get_exercise_progress(intval($_GET['session_id']));
+        $count = count($records);
+        break;
     /*case 'get_extra_fields':
         $type = $_REQUEST['type'];
         $obj = new ExtraField($type);
@@ -563,6 +565,38 @@ switch ($action) {
             )
         );
         break;
+    case 'get_exercise_progress':
+        $sessionId = 0;
+        if (isset($_GET['session_id']) && !empty($_GET['session_id']))
+        {
+            $sessionId = intval($_GET['session_id']);
+            $courses = SessionManager::get_course_list_by_session_id($sessionId);
+            //TODO let select course
+            $course = current($courses);
+        }
+
+        $columns = array(
+            'session', 
+            'exercise_id', 
+            'quiz_title', 
+            'username', 
+            'lastname', 
+            'firstname', 
+            'time', 
+            'question_id', 
+            'question', 
+            'answer', 
+            'correct'
+        );
+
+        $result = SessionManager::get_exercise_progress($sessionId,
+            array(
+                'where' => $where_condition,
+                'order' => "$sidx $sord",
+                'limit'=> "$start , $limit"
+            )
+        );
+        break;
     case 'get_session_lp_progress':
         $sessionId = 0;
         if (isset($_GET['session_id']) && !empty($_GET['session_id']))
@@ -861,6 +895,7 @@ $allowed_actions = array(
     'get_sessions_tracking',
     'get_session_lp_progress',
     'get_session_progress',
+    'get_exercise_progress',
     'get_exercise_results',
     'get_hotpotatoes_exercise_results',
     'get_work_teacher',

+ 6 - 0
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php

@@ -1,5 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_load_folders.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_create_folder.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_delete_file.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 3 - 6
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_copy.php

@@ -1,16 +1,13 @@
 <?php
 /* For licensing terms, see /license.txt */
-
-require_once '../../../../../../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
-
 /**
- * copy file
  * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
  * @link www.phpletter.com
- * @since 22/May/2007
+ * @since 22/April/2007
  *
  */
+require_once '../../../../../../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 
 $error = "";
 $info  = '';

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_paste.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 6 - 0
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_upload.php

@@ -1,5 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';

+ 6 - 0
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php

@@ -1,5 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_folder_listing.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 3 - 7
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php

@@ -1,17 +1,13 @@
 <?php
 /* For licensing terms, see /license.txt */
-
-require_once '../../../../../../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
-
 /**
- * image save function
  * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
  * @link www.phpletter.com
- * @since 22/May/2007
+ * @since 22/April/2007
  *
  */
-
+require_once '../../../../../../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 
 $error = "";
 $info  = "";

+ 4 - 6
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php

@@ -1,18 +1,16 @@
 <?php
-
 /* For licensing terms, see /license.txt */
 
-require_once '../../../../../../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
-
 /**
- * ajax image undo function
  * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
  * @link www.phpletter.com
- * @since 22/May/2007
+ * @since 22/April/2007
  *
  */
 
+require_once '../../../../../../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
+
 require_once(CLASS_HISTORY);
 $history                 = new History($_POST['file_path'], $session);
 $lastestSessionImageInfo = $history->getLastestRestorable();

+ 6 - 0
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_login.php

@@ -1,5 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_preview.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_as_form.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 6 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_name.php

@@ -1,6 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 7 - 0
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_text.php

@@ -1,5 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
+/**
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
+
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
 

+ 8 - 0
main/inc/lib/main_api.lib.php

@@ -6782,3 +6782,11 @@ function api_can_login_as($loginAsUserId, $userId = null)
 
     return (api_is_platform_admin() OR (api_is_session_admin() && $user_info['status'] == 5) OR $isDrh());
 }
+
+/**
+ * @return bool
+ */
+function api_is_allowed_in_course()
+{
+    return Session::read('is_allowed_in_course');
+}

+ 112 - 8
main/inc/lib/sessionmanager.lib.php

@@ -501,6 +501,75 @@ class SessionManager
         $num = $row['total_rows'];
         return $num;
     }
+    /**
+     *  Get the progress of a exercise
+     *  @param int session id
+     *  @return array 
+     */
+    public static function get_exercise_progress($sessionId = 0, $options = array())
+    {
+        $session                = Database::get_main_table(TABLE_MAIN_SESSION);
+        $user                   = Database::get_main_table(TABLE_MAIN_USER);
+        $quiz                   = Database::get_course_table(TABLE_QUIZ_TEST);
+        $quiz_answer            = Database::get_course_table(TABLE_QUIZ_ANSWER);
+        $quiz_question          = Database::get_course_table(TABLE_QUIZ_QUESTION);
+        $table_stats_exercises  = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
+        $table_stats_attempt    = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
+ 
+        $courses = SessionManager::get_course_list_by_session_id($sessionId);
+        //TODO let select course
+        $course = current($courses);
+        //TODO fix this
+        $course_info = array('real_id' => $course['id']);
+
+        $where = " WHERE a.session_id = %d
+        AND a.course_code = '%s'";
+
+        $limit = null;
+        if (!empty($options['limit'])) {
+            $limit = " LIMIT ".$options['limit'];
+        }
+
+        if (!empty($options['where'])) {
+           $where .= ' AND '.$options['where'];
+        }
+
+        $order = null;
+        if (!empty($options['order'])) {
+            $order = " ORDER BY ".$options['order'];
+        }
+
+        $sql = "SELECT 
+            s.name as session, 
+            CONCAT (q.c_id, q.id) as exercise_id, 
+            q.title as quiz_title, 
+            u.username, 
+            u.lastname, 
+            u.firstname, 
+            a.tms as time, 
+            qa.question_id, 
+            qq.question, 
+            qa.answer, 
+            qa.correct
+        FROM $table_stats_attempt a
+        LEFT JOIN $quiz_answer qa ON a.answer = qa.id_auto
+        LEFT JOIN  $quiz_question qq ON qq.id = qa.question_id
+        INNER JOIN $table_stats_exercises e ON e.exe_id = a.exe_id
+        INNER JOIN $session s ON s.id = a.session_id
+        INNER JOIN $quiz q ON q.id = e.exe_exo_id
+        INNER JOIN $user u ON u.user_id = a.user_id
+        $where $order $limit";
+
+
+        $sql_query = sprintf($sql, $sessionId, $course['code']);
+
+        $rs = Database::query($sql_query);
+        while ($row = Database::fetch_array($rs))
+        {
+            $data[] = $row; 
+        }
+        return $data;
+    }
     /**
      * Gets the progress of learning paths in the given session
      * @param int   session id
@@ -520,6 +589,7 @@ class SessionManager
         //TODO fix this
         $course_info = array('real_id' => $course['id']);
 
+
         //getting all the students of the course
         //we are not using this because it only returns user ids
         /*if (empty($sessionId)
@@ -530,11 +600,28 @@ class SessionManager
             // Registered students in session.
             $users = CourseManager :: get_student_list_from_course_code($course_code, true, $sessionId);
         }*/
-        $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.course_code FROM $session_course_user s
-        INNER JOIN $user u ON u.user_id = s.id_user
-        WHERE course_code = '%s'
+        $where = " WHERE course_code = '%s'
         AND s.status <> 2 and id_session = %s";
 
+        $limit = null;
+        if (!empty($options['limit'])) {
+            $limit = " LIMIT ".$options['limit'];
+        }
+
+        if (!empty($options['where'])) {
+           $where .= ' AND '.$options['where'];
+        }
+
+        $order = null;
+        if (!empty($options['order'])) {
+            $order = " ORDER BY ".$options['order'];
+        }      
+
+        $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.course_code 
+        FROM $session_course_user s
+        INNER JOIN $user u ON u.user_id = s.id_user
+        $where $order $limit";
+
         $sql_query = sprintf($sql, $course['code'], $sessionId);
 
         $rs = Database::query($sql_query);
@@ -607,8 +694,8 @@ class SessionManager
         $forum_post             = Database::get_course_table(TABLE_FORUM_POST);
         $tbl_course_lp          = Database::get_course_table(TABLE_LP_MAIN);
         $wiki                   = Database::get_course_table(TABLE_WIKI);
-        $table_stats_default        = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
-        $table_stats_access        = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
+        $table_stats_default    = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
+        $table_stats_access     = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
 
         $courses = SessionManager::get_course_list_by_session_id($sessionId);
         //TODO let select course
@@ -626,11 +713,28 @@ class SessionManager
             // Registered students in session.
             $users = CourseManager :: get_student_list_from_course_code($course_code, true, $sessionId);
         }*/
-        $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.course_code FROM $session_course_user s
-        INNER JOIN $user u ON u.user_id = s.id_user
-        WHERE course_code = '%s'
+        $where = " WHERE course_code = '%s'
         AND s.status <> 2 and id_session = %s";
 
+        $limit = null;
+        if (!empty($options['limit'])) {
+            $limit = " LIMIT ".$options['limit'];
+        }
+
+        if (!empty($options['where'])) {
+           $where .= ' AND '.$options['where'];
+        }
+
+        $order = null;
+        if (!empty($options['order'])) {
+            $order = " ORDER BY ".$options['order'];
+        }      
+        
+        $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.course_code 
+        FROM $session_course_user s
+        INNER JOIN $user u ON u.user_id = s.id_user
+        $where $order $limit";
+
         $sql_query = sprintf($sql, $course['code'], $sessionId);
 
         $rs = Database::query($sql_query);

+ 12 - 5
main/mySpace/index.php

@@ -160,7 +160,7 @@ echo '<a href="javascript: void(0);" onclick="javascript: window.print()">'.
     Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
 echo '</span>';
 
-if (!empty($session_id) && !in_array($display, array('accessoverview','lpprogressoverview','progressoverview'))) {
+if (!empty($session_id) && !in_array($display, array('accessoverview','lpprogressoverview','progressoverview','exerciseprogress'))) {
     echo '<a href="index.php">'.Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
     if (!api_is_platform_admin()) {
         if (api_get_setting('add_users_by_coach') == 'true') {
@@ -183,7 +183,7 @@ if (!empty($session_id) && !in_array($display, array('accessoverview','lpprogres
 
 // Actions menu
 $nb_menu_items = count($menu_items);
-if (empty($session_id) || in_array($display, array('accessoverview','lpprogressoverview', 'progressoverview'))) {
+if (empty($session_id) || in_array($display, array('accessoverview','lpprogressoverview', 'progressoverview', 'exerciseprogress'))) {
     if ($nb_menu_items > 1) {
         foreach ($menu_items as $key => $item) {
             echo $item;
@@ -204,7 +204,7 @@ $sessionFilter->addElement('select_ajax', 'session_name', get_lang('SearchCourse
 $courseListUrl = api_get_self();
 
 #show filter by session
-if ($is_platform_admin && $view == 'admin' && in_array($display, array('accessoverview','lpprogressoverview', 'progressoverview'))) {
+if ($is_platform_admin && $view == 'admin' && in_array($display, array('accessoverview','lpprogressoverview', 'progressoverview', 'exerciseprogress'))) {
     echo '<div class="pull-right">';
     echo $sessionFilter->return_form();
     echo '</div>';
@@ -608,6 +608,7 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
 	echo ' | <a href="'.api_get_self().'?view=admin&amp;display=accessoverview">'.get_lang('DisplayAccessOverview').'</a>';
     echo ' | <a href="'.api_get_self().'?view=admin&amp;display=lpprogressoverview">'.get_lang('DisplayLpProgressOverview').'</a>';
     echo ' | <a href="'.api_get_self().'?view=admin&amp;display=progressoverview">'.get_lang('DisplayProgressOverview').'</a>';
+    echo ' | <a href="'.api_get_self().'?view=admin&amp;display=exerciseprogress">'.get_lang('DisplayExerciseProgress').'</a>';
 	echo ' | <a href="'.api_get_self().'?view=admin&amp;display=courseoverview">'.get_lang('DisplayCourseOverview').'</a>';
     echo ' | <a href="'.api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin">'.get_lang('LPQuestionListResults').'</a>';
     echo ' | <a href="'.api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin">'.get_lang('LPExerciseResultsBySession').'</a>';
@@ -625,13 +626,19 @@ if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourst
         }
     } else if($display == 'lpprogressoverview') {
         if (!empty($_GET['session_id'])) {
-            echo MySpace::display_tracking_lp_progress_overview($_GET['session_id']);
+            echo MySpace::display_tracking_lp_progress_overview(intval($_GET['session_id']));
         } else {
             Display::display_warning_message(get_lang('ChooseSession'));
         }
     } else if($display == 'progressoverview') {
         if (!empty($_GET['session_id'])) {
-            echo MySpace::display_tracking_progress_overview($_GET['session_id']);
+            echo MySpace::display_tracking_progress_overview(intval($_GET['session_id']));
+        } else {
+            Display::display_warning_message(get_lang('ChooseSession'));
+        }
+    } else if($display == 'exerciseprogress') {
+        if (!empty($_GET['session_id'])) {
+            echo MySpace::display_tracking_exercise_progress_overview(intval($_GET['session_id']));
         } else {
             Display::display_warning_message(get_lang('ChooseSession'));
         }

+ 55 - 0
main/mySpace/myspace.lib.php

@@ -320,6 +320,61 @@ class MySpace {
         $table = Display::grid_js('lps', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
 
 
+        $return = '<script>$(function() {'. $table . '});</script>';
+        $return .= Display::grid_html('lps');
+        return $return;
+    }
+    /**
+     * 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
+     */
+    function display_tracking_exercise_progress_overview($sessionId = 0) {
+
+        $courses = SessionManager::get_course_list_by_session_id($sessionId);
+        //TODO let select course
+        $course = current($courses); 
+        /**
+         * Column name
+         * The order is important you need to check the $column variable in the model.ajax.php file
+         */
+        $columns = array(
+            get_lang('Session'), 
+            get_lang('ExerciseId'), 
+            get_lang('QuizTitle'), 
+            get_lang('Username'), 
+            get_lang('Lastname'), 
+            get_lang('Firstname'), 
+            get_lang('Time'), 
+            get_lang('Question_id'), 
+            get_lang('Question'), 
+            get_lang('Answer'), 
+            get_lang('Correct'),
+        );
+
+        /**
+         * Column config
+         */
+        $column_model   = array(
+            array('name'=>'session',        'index'=>'session',     'width'=>'160',   'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
+            array('name'=>'exercise_id',    'index'=>'exercise_id', 'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'quiz_title',     'index'=>'quiz_title',  'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'username',       'index'=>'username',    'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'lastname',       'index'=>'lastname',    'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'firstname',      'index'=>'firstname',   'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'time',           'index'=>'time',        'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'question_id',    'index'=>'question_id', 'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'question',       'index'=>'question',    'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'answer',         'index'=>'answer',      'width'=>'100',   'align'=>'left', 'search' => 'true'),
+            array('name'=>'correct',        'index'=>'correct',     'width'=>'100',   'align'=>'left', 'search' => 'true'),
+        );
+        //get dinamic column names
+
+        $action_links = '';
+        // jqgrid will use this URL to do the selects
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id=' . intval($sessionId);
+        $table = Display::grid_js('lps', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
+
+
         $return = '<script>$(function() {'. $table . '});</script>';
         $return .= Display::grid_html('lps');
         return $return;