Replacing function get_statistic_table() with get_main_table() see BT#6220

skala
Julio Montoya 12 years ago
parent d9d92e9f4d
commit 5aa76ef211
  1. 4
      main/admin/user_list.php
  2. 10
      main/admin/user_move_stats.php
  3. 124
      main/course_description/course_description.class.php
  4. 4
      main/dropbox/dropbox_functions.inc.php
  5. 2
      main/exercice/exercice.php
  6. 20
      main/exercice/exercise.class.php
  7. 4
      main/exercice/exercise_history.php
  8. 8
      main/exercice/exercise_report.php
  9. 10
      main/exercice/exercise_result.class.php
  10. 2
      main/exercice/exercise_result.php
  11. 4
      main/exercice/exercise_show.php
  12. 6
      main/exercice/hotpotatoes_exercise_report.php
  13. 8
      main/exercice/hotpotatoes_exercise_result.class.php
  14. 2
      main/exercice/hotspot_answers.as.php
  15. 2
      main/exercice/hotspot_savescore.inc.php
  16. 2
      main/exercice/hotspot_updatescore.inc.php
  17. 2
      main/exercice/mark_free_answer.php
  18. 4
      main/exercice/savescores.php
  19. 2
      main/exercice/testcategory.class.php
  20. 2
      main/forum/forumfunction.inc.php
  21. 6
      main/gradebook/gradebook_result.class.php
  22. 4
      main/gradebook/lib/be/exerciselink.class.php
  23. 4
      main/inc/ajax/exercise.ajax.php
  24. 4
      main/inc/ajax/message.ajax.php
  25. 24
      main/inc/lib/course.lib.php
  26. 92
      main/inc/lib/course_description.lib.php
  27. 2
      main/inc/lib/display.lib.php
  28. 100
      main/inc/lib/events.lib.inc.php
  29. 32
      main/inc/lib/exercise.lib.php
  30. 4
      main/inc/lib/login.lib.php
  31. 7
      main/inc/lib/nanogong.lib.php
  32. 16
      main/inc/lib/online.inc.php
  33. 14
      main/inc/lib/statistics.lib.php
  34. 14
      main/inc/lib/stats.lib.inc.php
  35. 50
      main/inc/lib/tracking.lib.php
  36. 2
      main/inc/lib/usermanager.lib.php
  37. 40
      main/inc/lib/zombie/zombie_manager.class.php
  38. 4
      main/inc/local.inc.php
  39. 4
      main/mySpace/coaches.php
  40. 2
      main/mySpace/index.php
  41. 2
      main/mySpace/myStudents.php
  42. 10
      main/mySpace/myspace.lib.php
  43. 2
      main/mySpace/progression.php
  44. 2
      main/mySpace/reussite.php
  45. 17
      main/newscorm/learnpath.class.php
  46. 6
      main/newscorm/learnpathItem.class.php
  47. 4
      main/newscorm/lp_ajax_save_item.php
  48. 2
      main/newscorm/lp_comm.server.php
  49. 6
      main/newscorm/lp_stats.php
  50. 4
      main/newscorm/lp_view.php
  51. 6
      main/tracking/courseLog.php
  52. 8
      main/tracking/courseLogCSV.php
  53. 2
      main/tracking/course_access_details.php
  54. 2
      main/tracking/exams.php
  55. 4
      main/tracking/logins_details.php
  56. 6
      main/tracking/personnalLog.php
  57. 4
      main/tracking/toolaccess_details.php
  58. 2
      src/ChamiloLMS/Controller/UserPortalController.php
  59. 12
      tests/datafiller/fill_whoisonline.php
  60. 4
      whoisonlinesession.php

@ -167,7 +167,7 @@ function login_user($user_id) {
$main_user_table = Database::get_main_table(TABLE_MAIN_USER); $main_user_table = Database::get_main_table(TABLE_MAIN_USER);
$main_admin_table = Database::get_main_table(TABLE_MAIN_ADMIN); $main_admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$track_e_login_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $track_e_login_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
unset($_user['user_id']); // uid not in session ? prevent any hacking unset($_user['user_id']); // uid not in session ? prevent any hacking
@ -906,4 +906,4 @@ $tpl = $app['template'];
$tpl->assign('actions', $actions); $tpl->assign('actions', $actions);
$tpl->assign('message', $message); $tpl->assign('message', $message);
$tpl->assign('content', $form.$table_result.$extra_search_options); $tpl->assign('content', $form.$table_result.$extra_search_options);
$tpl->display_one_col_template(); $tpl->display_one_col_template();

@ -118,10 +118,10 @@ if (isset($_REQUEST['load_ajax'])) {
//Begin with the import process //Begin with the import process
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$TBL_TRACK_E_COURSE_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $TBL_TRACK_E_COURSE_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$TBL_TRACK_E_LAST_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $TBL_TRACK_E_LAST_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW); $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
$TBL_NOTEBOOK = Database::get_course_table(TABLE_NOTEBOOK); $TBL_NOTEBOOK = Database::get_course_table(TABLE_NOTEBOOK);
@ -588,7 +588,7 @@ $htmlHeadXtra[] = '<script type="text/javascript">
</script>'; </script>';
function get_courses_list_by_user_id_based_in_exercises($user_id) { function get_courses_list_by_user_id_based_in_exercises($user_id) {
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$user_id = intval($user_id); $user_id = intval($user_id);
$sql = "SELECT DISTINCT exe_user_id, c_id, session_id as id_session $sql = "SELECT DISTINCT exe_user_id, c_id, session_id as id_session
FROM $TABLETRACK_EXERCICES WHERE exe_user_id = $user_id FROM $TABLETRACK_EXERCICES WHERE exe_user_id = $user_id

@ -3,42 +3,42 @@
namespace CourseDescription; namespace CourseDescription;
/** /**
* Object Model for the "Course Description" database table. Allows to * Object Model for the "Course Description" database table. Allows to
* *
* - query database * - query database
* - create/insert new course descriptions * - create/insert new course descriptions
* - update/edit course descriptions * - update/edit course descriptions
* - delete course descriptions * - delete course descriptions
* *
* Course descriptions used to provide descriptions for course/sessions. * Course descriptions used to provide descriptions for course/sessions.
* A course/session can have several descriptions associated to it from various types. * A course/session can have several descriptions associated to it from various types.
* Course descriptions are primarily made primarily of * Course descriptions are primarily made primarily of
* *
* - a title * - a title
* - some content * - some content
* - a type (for ex: info, objectives, etc) * - a type (for ex: info, objectives, etc)
* *
* Usage: * Usage:
* *
* Create * Create
* *
* $des = new CourseDescription(); * $des = new CourseDescription();
* $des->set_title('...'); * $des->set_title('...');
* $des->set_content('...'); * $des->set_content('...');
* $des->set_description_type(...); * $des->set_description_type(...);
* $des->insert(); * $des->insert();
* *
* Update * Update
* *
* $des = CourseDescription::get_by_id(..., ...); * $des = CourseDescription::get_by_id(..., ...);
* $des->set_title('...'); * $des->set_title('...');
* $des->update(); * $des->update();
* *
* Delete * Delete
* *
* $des = CourseDescription::get_by_id(..., ...); * $des = CourseDescription::get_by_id(..., ...);
* $des->delete(); * $des->delete();
* *
* @package chamilo.course_description * @package chamilo.course_description
* @author Christian Fasanando <christian1827@gmail.com> * @author Christian Fasanando <christian1827@gmail.com>
* @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva * @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva
@ -49,8 +49,8 @@ class CourseDescription
/** /**
* Return the repository. * Return the repository.
* *
* @return \CourseDescription\CourseDescriptionRepository * @return \CourseDescription\CourseDescriptionRepository
*/ */
public static function repository() public static function repository()
{ {
@ -59,7 +59,7 @@ class CourseDescription
/** /**
* Returns the list of all available types * Returns the list of all available types
* *
* @return array * @return array
*/ */
public static function get_types() public static function get_types()
@ -69,7 +69,7 @@ class CourseDescription
// /** // /**
// * Deprecated (still used by web services) // * Deprecated (still used by web services)
// * // *
// * @param int Course id // * @param int Course id
// * @deprecated use get_descriptions_by_course // * @deprecated use get_descriptions_by_course
// * @return array Array of CourseDescriptions // * @return array Array of CourseDescriptions
@ -153,7 +153,7 @@ class CourseDescription
// /** // /**
// * Insert the course description object into the course_description table. // * Insert the course description object into the course_description table.
// * // *
// * @return bool True on success, false on failure // * @return bool True on success, false on failure
// */ // */
// public function insert() // public function insert()
@ -168,11 +168,11 @@ class CourseDescription
// //
// $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION); // $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
// $sql = "INSERT IGNORE INTO $table SET // $sql = "INSERT IGNORE INTO $table SET
// c_id = $course_id, // c_id = $course_id,
// description_type = $description_type, // description_type = $description_type,
// title = '$title', // title = '$title',
// content = '$content', // content = '$content',
// progress = $progress, // progress = $progress,
// session_id = $session_id"; // session_id = $session_id";
// //
// Database::query($sql); // Database::query($sql);
@ -184,7 +184,7 @@ class CourseDescription
// $this->id = $id; // $this->id = $id;
// //
// /** // /**
// * @todo: course info should come from c_id // * @todo: course info should come from c_id
// */ // */
// api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $id, 'CourseDescriptionAdded', api_get_user_id()); // api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $id, 'CourseDescriptionAdded', api_get_user_id());
// //
@ -192,13 +192,13 @@ class CourseDescription
// } // }
// /** // /**
// * Insert a row like history inside track_e_item_property table // * Insert a row like history inside track_e_item_property table
// * // *
// * @param int description type // * @param int description type
// * @return int affected rows // * @return int affected rows
// */ // */
// public function insert_stats($description_type) // public function insert_stats($description_type)
// { // {
// $tbl_stats_item_property = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); // $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
// $description_id = $this->get_id_by_description_type($description_type); // $description_id = $this->get_id_by_description_type($description_type);
// $course_id = api_get_real_course_id(); // $course_id = api_get_real_course_id();
// $course_code = api_get_course_id(); // $course_code = api_get_course_id();
@ -219,7 +219,7 @@ class CourseDescription
// } // }
// /** // /**
// * Update a course description object to the database. // * Update a course description object to the database.
// * // *
// * @return bool True on success, false on failure. // * @return bool True on success, false on failure.
// */ // */
// public function update() // public function update()
@ -234,11 +234,11 @@ class CourseDescription
// $session_id = $this->get_session_id(); // $session_id = $this->get_session_id();
// //
// $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION); // $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
// $sql = "UPDATE $table SET // $sql = "UPDATE $table SET
// title = '$title', // title = '$title',
// content = '$content', // content = '$content',
// progress = $progress // progress = $progress
// WHERE id = $id AND // WHERE id = $id AND
// c_id = $course_id "; // c_id = $course_id ";
// //
// Database::query($sql); // Database::query($sql);
@ -247,7 +247,7 @@ class CourseDescription
// if ($result) { // if ($result) {
// //insert into item_property // //insert into item_property
// /** // /**
// * @todo: course info should come from c_id // * @todo: course info should come from c_id
// */ // */
// api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionUpdated', api_get_user_id()); // api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionUpdated', api_get_user_id());
// } // }
@ -255,7 +255,7 @@ class CourseDescription
// } // }
// /** // /**
// * Delete a course description object from the database. // * Delete a course description object from the database.
// * // *
// * @return bool True on success false on failure // * @return bool True on success false on failure
// */ // */
// public function delete() // public function delete()
@ -269,7 +269,7 @@ class CourseDescription
// $result = (bool) Database::affected_rows(); // $result = (bool) Database::affected_rows();
// if ($result) { // if ($result) {
// /** // /**
// * @todo: should get course info from $this->c_id // * @todo: should get course info from $this->c_id
// */ // */
// api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionDeleted', api_get_user_id()); // api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionDeleted', api_get_user_id());
// } // }
@ -341,8 +341,8 @@ class CourseDescription
// } // }
/** /**
* The course id. * The course id.
* *
* @see get_course() property to get access to the course object * @see get_course() property to get access to the course object
* @return int * @return int
*/ */
@ -361,7 +361,7 @@ class CourseDescription
/** /**
* The id of the object. * The id of the object.
* *
* @return int * @return int
*/ */
public function get_id() public function get_id()
@ -370,7 +370,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_id($value) public function set_id($value)
@ -380,7 +380,7 @@ class CourseDescription
/** /**
* The title of the course description. * The title of the course description.
* *
* @return string * @return string
*/ */
public function get_title() public function get_title()
@ -389,7 +389,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_title($title) public function set_title($title)
@ -407,7 +407,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_content($content) public function set_content($content)
@ -417,7 +417,7 @@ class CourseDescription
/** /**
* The session id the object is associated with. * The session id the object is associated with.
* *
* @return int * @return int
*/ */
public function get_session_id() public function get_session_id()
@ -426,7 +426,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_session_id($value) public function set_session_id($value)
@ -437,7 +437,7 @@ class CourseDescription
/** /**
* The type of the course description. Should match one of the id returns * The type of the course description. Should match one of the id returns
* by CourseDescription::get_types(). * by CourseDescription::get_types().
* *
* @return int * @return int
*/ */
public function get_description_type() public function get_description_type()
@ -446,7 +446,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_description_type($value) public function set_description_type($value)
@ -464,7 +464,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_progress($value) public function set_progress($value)
@ -474,8 +474,8 @@ class CourseDescription
/** /**
* Return one type from its id * Return one type from its id
* *
* @return \CourseDescription\CourseDescriptionType * @return \CourseDescription\CourseDescriptionType
*/ */
public function get_type() public function get_type()
{ {
@ -504,7 +504,7 @@ class CourseDescription
/** /**
* The item property this object is associated with. * The item property this object is associated with.
* *
* @return \Model\ItemProperty * @return \Model\ItemProperty
*/ */
public function get_item_property() public function get_item_property()
@ -521,12 +521,12 @@ class CourseDescription
// //
///** ///**
// * The common routes (urls) for course description objects: // * The common routes (urls) for course description objects:
// * // *
// * - create new course description // * - create new course description
// * - edit course description // * - edit course description
// * - delete course description // * - delete course description
// * // *
// * @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva // * @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva
// * @licence /license.txt // * @licence /license.txt
// */ // */
@ -535,7 +535,7 @@ class CourseDescription
// //
// /** // /**
// * // *
// * @return CourseDescriptionRoutes // * @return CourseDescriptionRoutes
// */ // */
// public static function instance() // public static function instance()
// { // {
@ -553,7 +553,7 @@ class CourseDescription
// //
// /** // /**
// * Returns the url used to create a new course description from a specific type. // * Returns the url used to create a new course description from a specific type.
// * // *
// * @param CourseDescriptionType $type // * @param CourseDescriptionType $type
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return string // * @return string
@ -573,10 +573,10 @@ class CourseDescription
// //
// /** // /**
// * The url to edit a course description object // * The url to edit a course description object
// * // *
// * @param CourseDescription $description // * @param CourseDescription $description
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return string // * @return string
// */ // */
// function edit($description, $html = true) // function edit($description, $html = true)
// { // {
@ -592,9 +592,9 @@ class CourseDescription
// //
// /** // /**
// * The index route to list all course descriptions for the current course/session // * The index route to list all course descriptions for the current course/session
// * // *
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return type // * @return type
// */ // */
// function index($html = true) // function index($html = true)
// { // {
@ -605,10 +605,10 @@ class CourseDescription
// //
// /** // /**
// * Url to delete a course description object. // * Url to delete a course description object.
// * // *
// * @param CourseDescription $description // * @param CourseDescription $description
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return string // * @return string
// */ // */
// function delete($description, $html = true) // function delete($description, $html = true)
// { // {

@ -1363,7 +1363,7 @@ function get_last_tool_access($tool, $courseId = '', $user_id = '')
} }
// the table where the last tool access is stored (=track_e_lastaccess) // the table where the last tool access is stored (=track_e_lastaccess)
$table_last_access = Database::get_statistic_table('track_e_lastaccess'); $table_last_access = Database::get_main_table('track_e_lastaccess');
$sql = "SELECT access_date FROM $table_last_access WHERE access_user_id='".Database::escape_string($user_id)."' $sql = "SELECT access_date FROM $table_last_access WHERE access_user_id='".Database::escape_string($user_id)."'
AND c_id ='".Database::escape_string($courseId)."' AND c_id ='".Database::escape_string($courseId)."'
@ -1374,4 +1374,4 @@ function get_last_tool_access($tool, $courseId = '', $user_id = '')
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
return $row['access_date']; return $row['access_date'];
} }

@ -48,7 +48,7 @@ $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY); $TBL_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$TBL_EXERCICE_QUESTION = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION); $TBL_EXERCICE_QUESTION = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST);
$TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
// document path // document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document"; $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";

@ -2183,8 +2183,8 @@ class Exercise
*/ */
public function clean_results() public function clean_results()
{ {
$table_track_e_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_e_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_e_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT exe_id FROM $table_track_e_exercises $sql = "SELECT exe_id FROM $table_track_e_exercises
WHERE c_id = '".api_get_course_int_id()."' AND WHERE c_id = '".api_get_course_int_id()."' AND
@ -2464,7 +2464,7 @@ class Exercise
$lp_item_view_id = 0, $lp_item_view_id = 0,
$status = 'incomplete' $status = 'incomplete'
) { ) {
$track_exercises = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if (empty($lp_id)) { if (empty($lp_id)) {
$lp_id = 0; $lp_id = 0;
} }
@ -2511,7 +2511,7 @@ class Exercise
$questionList = array(), $questionList = array(),
$weight = 0 $weight = 0
) { ) {
$track_exercises = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$safe_lp_id = intval($safe_lp_id); $safe_lp_id = intval($safe_lp_id);
$safe_lp_item_id = intval($safe_lp_item_id); $safe_lp_item_id = intval($safe_lp_item_id);
$safe_lp_item_view_id = intval($safe_lp_item_view_id); $safe_lp_item_view_id = intval($safe_lp_item_view_id);
@ -2890,7 +2890,7 @@ class Exercise
$questionId = intval($questionId); $questionId = intval($questionId);
$exeId = intval($exeId); $exeId = intval($exeId);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_ans = Database::get_course_table(TABLE_QUIZ_ANSWER); $table_ans = Database::get_course_table(TABLE_QUIZ_ANSWER);
// Creates a temporary Question object // Creates a temporary Question object
@ -3502,7 +3502,7 @@ class Exercise
case HOT_SPOT : case HOT_SPOT :
if ($from_database) { if ($from_database) {
if ($show_result) { if ($show_result) {
$TBL_TRACK_HOTSPOT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$query = "SELECT hotspot_correct $query = "SELECT hotspot_correct
FROM ".$TBL_TRACK_HOTSPOT." FROM ".$TBL_TRACK_HOTSPOT."
WHERE hotspot_exe_id = '".$exeId."' and WHERE hotspot_exe_id = '".$exeId."' and
@ -3544,7 +3544,7 @@ class Exercise
case HOT_SPOT_DELINEATION : case HOT_SPOT_DELINEATION :
if ($from_database) { if ($from_database) {
// getting the user answer // getting the user answer
$TBL_TRACK_HOTSPOT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$query = "SELECT hotspot_correct, hotspot_coordinate $query = "SELECT hotspot_correct, hotspot_coordinate
FROM ".$TBL_TRACK_HOTSPOT." FROM ".$TBL_TRACK_HOTSPOT."
WHERE hotspot_exe_id = '".$exeId."' AND WHERE hotspot_exe_id = '".$exeId."' AND
@ -4406,7 +4406,7 @@ class Exercise
} }
if ($saved_results) { if ($saved_results) {
$stat_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$sql_update = 'UPDATE '.$stat_table.' SET exe_result = exe_result + '.floatval($questionScore).' WHERE exe_id = '.$exeId; $sql_update = 'UPDATE '.$stat_table.' SET exe_result = exe_result + '.floatval($questionScore).' WHERE exe_id = '.$exeId;
if ($debug) { if ($debug) {
error_log($sql_update); error_log($sql_update);
@ -5104,7 +5104,7 @@ class Exercise
*/ */
public function getStatTrackExerciseInfoByExeId($exe_id) public function getStatTrackExerciseInfoByExeId($exe_id)
{ {
$track_exercises = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id "; $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id ";
$result = Database::query($sql_track); $result = Database::query($sql_track);
@ -5144,7 +5144,7 @@ class Exercise
$exercise_info = self::getStatTrackExerciseInfoByExeId($exe_id); $exercise_info = self::getStatTrackExerciseInfoByExeId($exe_id);
$question_id = intval($question_id); $question_id = intval($question_id);
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$track_exercises = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if ($exercise_info) { if ($exercise_info) {
if (empty($exercise_info['questions_to_check'])) { if (empty($exercise_info['questions_to_check'])) {

@ -41,8 +41,8 @@ $interbreadcrumb[]= array ('url' => 'exercise_history.php'.'?exe_id='.intval($_G
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_EXERCICES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_EXERCICES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT_RECORDING= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING= Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
Display::display_header($nameTools,get_lang('Exercise')); Display::display_header($nameTools,get_lang('Exercise'));
if (isset($_GET['message'])) { if (isset($_GET['message'])) {

@ -44,9 +44,9 @@ $is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_drh();
$is_tutor = api_is_allowed_to_edit(true); $is_tutor = api_is_allowed_to_edit(true);
$TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION); $TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$TBL_TRACK_ATTEMPT_RECORDING = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -592,4 +592,4 @@ jQuery("#results").jqGrid('navButtonAdd','#results_pager',{
<?php <?php
echo Display::grid_html('results'); echo Display::grid_html('results');
Display :: display_footer(); Display :: display_footer();

@ -87,9 +87,9 @@ class ExerciseResult
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT_RECORDING = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$cid = api_get_course_id(); $cid = api_get_course_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -438,7 +438,7 @@ class ExerciseResult
foreach ($this->results as $row) { foreach ($this->results as $row) {
$column = 0; $column = 0;
if ($with_column_user) { if ($with_column_user) {
if (api_is_western_name_order()) { if (api_is_western_name_order()) {
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); $worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
@ -486,4 +486,4 @@ class ExerciseResult
$workbook->close(); $workbook->close();
return true; return true;
} }
} }

@ -144,7 +144,7 @@ $objExercise->displayQuestionListByAttempt($exe_id, true);
// If is not valid. // If is not valid.
$session_control_key = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id); $session_control_key = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if (isset($session_control_key) && !ExerciseLib::exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) { if (isset($session_control_key) && !ExerciseLib::exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) {
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql_fraud = "UPDATE $TBL_TRACK_ATTEMPT SET answer = 0, marks = 0, position = 0 WHERE exe_id = $exe_id "; $sql_fraud = "UPDATE $TBL_TRACK_ATTEMPT SET answer = 0, marks = 0, position = 0 WHERE exe_id = $exe_id ";
Database::query($sql_fraud); Database::query($sql_fraud);
} }

@ -39,8 +39,8 @@ if ($origin == 'learnpath') {
// Database table definitions // Database table definitions
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
// General parameters passed via POST/GET // General parameters passed via POST/GET
if ($debug) { error_log('Entered exercise_show.php: '.print_r($_POST,1)); } if ($debug) { error_log('Entered exercise_show.php: '.print_r($_POST,1)); }

@ -42,8 +42,8 @@ $is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_drh();
$is_tutor = api_is_allowed_to_edit(true); $is_tutor = api_is_allowed_to_edit(true);
$TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION); $TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES_EXERCICES = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -488,4 +488,4 @@ $extra_params['height'] = 'auto';
<?php <?php
echo Display::grid_html('results'); echo Display::grid_html('results');
Display :: display_footer(); Display :: display_footer();

@ -66,9 +66,9 @@ class HotpotatoesExerciseResult
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT_RECORDING = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$cid = api_get_course_id(); $cid = api_get_course_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -376,4 +376,4 @@ class HotpotatoesExerciseResult
$workbook->close(); $workbook->close();
return true; return true;
} }
} }

@ -95,7 +95,7 @@ if(isset($_SESSION['exerciseResultCoordinates']) && $from_db==0) {
} }
} else { } else {
// get it from db // get it from db
$tbl_track_e_hotspot = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $tbl_track_e_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$sql = "SELECT hotspot_coordinate $sql = "SELECT hotspot_coordinate
FROM $tbl_track_e_hotspot FROM $tbl_track_e_hotspot
WHERE hotspot_question_id = $questionId AND WHERE hotspot_question_id = $questionId AND

@ -42,7 +42,7 @@ foreach ($coords as $coord) {
} }
$coordinates = substr($coordinates,0,-1); $coordinates = substr($coordinates,0,-1);
$TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS); $TBL_TRACK_E_HOTSPOT = Database::get_main_table(STATISTIC_TRACK_E_HOTSPOTS);
// Save into db // Save into db
$sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (user_id , course_id , quiz_id , question_id , answer_id , correct , coordinate ) VALUES ( $sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (user_id , course_id , quiz_id , question_id , answer_id , correct , coordinate ) VALUES (
'".Database::escape_string($_user['user_id'])."', '".Database::escape_string($_user['user_id'])."',

@ -52,7 +52,7 @@ foreach ($coords as $coord) {
} }
$coordinates = substr($coordinates,0,-1); $coordinates = substr($coordinates,0,-1);
$TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS); $TBL_TRACK_E_HOTSPOT = Database::get_main_table(STATISTIC_TRACK_E_HOTSPOTS);
// update db // update db
$update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId]; $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];

@ -87,7 +87,7 @@ if ($action == 'mark') {
if (!empty($_POST['score']) AND $_POST['score'] < $obj_question->selectWeighting() AND $_POST['score'] >= 0) { if (!empty($_POST['score']) AND $_POST['score'] < $obj_question->selectWeighting() AND $_POST['score'] >= 0) {
//mark the user mark into the database using something similar to the following function: //mark the user mark into the database using something similar to the following function:
$exercise_table = Database::get_statistic_table('track_e_exercices'); $exercise_table = Database::get_main_table('track_e_exercices');
#global $origin, $tbl_learnpath_user, $learnpath_id, $learnpath_item_id; #global $origin, $tbl_learnpath_user, $learnpath_id, $learnpath_item_id;
$sql = "SELECT * FROM $exercise_table $sql = "SELECT * FROM $exercise_table
WHERE exe_user_id = '".Database::escape_string($my_usr)."' AND WHERE exe_user_id = '".Database::escape_string($my_usr)."' AND

@ -35,7 +35,7 @@ $full_file_path = $documentPath.$test;
FileManager::my_delete($full_file_path.$_user['user_id'].".t.html"); FileManager::my_delete($full_file_path.$_user['user_id'].".t.html");
$TABLETRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TABLETRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$tbl_learnpath_user = Database::get_course_table(TABLE_LEARNPATH_USER); $tbl_learnpath_user = Database::get_course_table(TABLE_LEARNPATH_USER);
$TABLE_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); $TABLE_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
@ -102,4 +102,4 @@ if ($origin != 'learnpath') {
Display::display_reduced_header(); Display::display_reduced_header();
Display::display_confirmation_message(get_lang('HotPotatoesFinished')); Display::display_confirmation_message(get_lang('HotPotatoesFinished'));
Display::display_footer(); Display::display_footer();
} }

@ -762,7 +762,7 @@ class Testcategory
* If no question for this category, return "" * If no question for this category, return ""
*/ */
public static function getCatScoreForExeidForUserid($in_cat_id, $in_exe_id, $in_user_id) { public static function getCatScoreForExeidForUserid($in_cat_id, $in_exe_id, $in_user_id) {
$tbl_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $tbl_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$tbl_question_rel_category = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY); $tbl_question_rel_category = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
$in_cat_id = intval($in_cat_id); $in_cat_id = intval($in_cat_id);
$in_exe_id = intval($in_exe_id); $in_exe_id = intval($in_exe_id);

@ -3274,7 +3274,7 @@ function get_whats_new()
$_course = api_get_course_info(); $_course = api_get_course_info();
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$tracking_last_tool_access = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $tracking_last_tool_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
// Note: This has to be replaced by the tool constant later. But temporarily bb_forum is used since this is the only thing that is in the tracking currently. // Note: This has to be replaced by the tool constant later. But temporarily bb_forum is used since this is the only thing that is in the tracking currently.
//$tool = TOOL_FORUM; //$tool = TOOL_FORUM;

@ -92,8 +92,8 @@ class GradeBookResult
$return = array(); $return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$cid = api_get_course_id(); $cid = api_get_course_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -328,4 +328,4 @@ class GradeBookResult
echo $data; echo $data;
return true; return true;
} }
} }

@ -85,7 +85,7 @@ class ExerciseLink extends AbstractLink
* Has anyone done this exercise yet ? * Has anyone done this exercise yet ?
*/ */
public function has_results() { public function has_results() {
$tbl_stats = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$sql = 'SELECT count(exe_id) AS number FROM '.$tbl_stats." $sql = 'SELECT count(exe_id) AS number FROM '.$tbl_stats."
WHERE session_id = $session_id AND WHERE session_id = $session_id AND
@ -105,7 +105,7 @@ class ExerciseLink extends AbstractLink
*/ */
public function calc_score($stud_id = null) public function calc_score($stud_id = null)
{ {
$tbl_stats = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
// The following query should be similar (in conditions) // The following query should be similar (in conditions)
// to the one used in exercice/exercice.php, look for note-query-exe-results marker // to the one used in exercice/exercice.php, look for note-query-exe-results marker
$session_id = api_get_session_id(); $session_id = api_get_session_id();

@ -149,9 +149,9 @@ switch ($action) {
$sidx = 1; $sidx = 1;
} }
$track_exercise = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$minutes = intval($_REQUEST['minutes']); $minutes = intval($_REQUEST['minutes']);
$now = time() - 60*$minutes; //1 hour $now = time() - 60*$minutes; //1 hour

@ -27,7 +27,7 @@ switch ($action) {
echo ''; echo '';
break; break;
} }
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$tbl_my_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_my_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_my_user_friend = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $tbl_my_user_friend = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@ -77,4 +77,4 @@ switch ($action) {
default: default:
echo ''; echo '';
} }
exit; exit;

@ -1532,17 +1532,17 @@ class CourseManager
$table_course_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); $table_course_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
$table_course_survey_question_option= Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); $table_course_survey_question_option= Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION);
$table_stats_hotpots = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $table_stats_hotpots = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$table_stats_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_stats_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_stats_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_stats_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_stats_access = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $table_stats_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$table_stats_lastaccess = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $table_stats_lastaccess = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$table_stats_course_access = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $table_stats_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$table_stats_online = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $table_stats_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$table_stats_default = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $table_stats_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_stats_downloads = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); $table_stats_downloads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$table_stats_links = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS); $table_stats_links = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$table_stats_uploads = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_UPLOADS); $table_stats_uploads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS);
$courseInfo = api_get_course_info($code); $courseInfo = api_get_course_info($code);
@ -4733,7 +4733,7 @@ class CourseManager
unsubscribe = '".intval($unsubscribe) . "', unsubscribe = '".intval($unsubscribe) . "',
visual_code = '".Database :: escape_string($visual_code) . "'"; visual_code = '".Database :: escape_string($visual_code) . "'";
Database::query($sql); Database::query($sql);
$course_id = Database::insert_id(); $course_id = Database::insert_id();
if ($course_id) { if ($course_id) {

@ -1,8 +1,8 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This file contains a class used like library provides functions for * This file contains a class used like library provides functions for
* course description tool. It's also used like model to * course description tool. It's also used like model to
* course_description_controller (MVC pattern) * course_description_controller (MVC pattern)
* @author Christian Fasanando <christian1827@gmail.com> * @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description * @package chamilo.course_description
@ -27,10 +27,10 @@ class CourseDescription
* Constructor * Constructor
*/ */
public function __construct() {} public function __construct() {}
/** /**
* Returns an array of objects of type CourseDescription corresponding to a specific course, without session ids (session id = 0) * Returns an array of objects of type CourseDescription corresponding to a specific course, without session ids (session id = 0)
* *
* @param int Course id * @param int Course id
* @return array Array of CourseDescriptions * @return array Array of CourseDescriptions
*/ */
@ -41,7 +41,7 @@ class CourseDescription
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
} else { } else {
return array(); return array();
} }
$t_course_desc = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $t_course_desc = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$sql = "SELECT * FROM $t_course_desc WHERE c_id = $course_id AND session_id = '0';"; $sql = "SELECT * FROM $t_course_desc WHERE c_id = $course_id AND session_id = '0';";
$sql_result = Database::query($sql); $sql_result = Database::query($sql);
@ -58,7 +58,7 @@ class CourseDescription
} }
return $results; return $results;
} }
/** /**
* Get all data of course description by session id, * Get all data of course description by session id,
@ -72,7 +72,7 @@ class CourseDescription
$sql = "SELECT * FROM $tbl_course_description WHERE c_id = $course_id $condition_session ORDER BY id "; $sql = "SELECT * FROM $tbl_course_description WHERE c_id = $course_id $condition_session ORDER BY id ";
$rs = Database::query($sql); $rs = Database::query($sql);
$data = array(); $data = array();
while ($description = Database::fetch_array($rs)) { while ($description = Database::fetch_array($rs)) {
$data['descriptions'][$description['id']] = Security::remove_XSS($description, STUDENT); $data['descriptions'][$description['id']] = Security::remove_XSS($description, STUDENT);
//reload titles to ensure we have the last version (after edition) //reload titles to ensure we have the last version (after edition)
//$data['default_description_titles'][$description['id']] = Security::remove_XSS($description['title'], STUDENT); //$data['default_description_titles'][$description['id']] = Security::remove_XSS($description['title'], STUDENT);
@ -86,18 +86,18 @@ class CourseDescription
* @return array * @return array
*/ */
public function get_description_history($description_type) { public function get_description_history($description_type) {
$tbl_stats_item_property = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
$tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$description_id = $this->get_id_by_description_type($description_type); $description_id = $this->get_id_by_description_type($description_type);
$item_property_id = api_get_item_property_id($course_id, TOOL_COURSE_DESCRIPTION, $description_id); $item_property_id = api_get_item_property_id($course_id, TOOL_COURSE_DESCRIPTION, $description_id);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT tip.id, tip.course_id, tip.item_property_id, tip.title, tip.content, tip.progress, tip.lastedit_date, tip.session_id $sql = "SELECT tip.id, tip.course_id, tip.item_property_id, tip.title, tip.content, tip.progress, tip.lastedit_date, tip.session_id
FROM $tbl_stats_item_property tip INNER JOIN $tbl_item_property ip FROM $tbl_stats_item_property tip INNER JOIN $tbl_item_property ip
ON ip.tool = '".TOOL_COURSE_DESCRIPTION."' AND ip.id = tip.item_property_id ON ip.tool = '".TOOL_COURSE_DESCRIPTION."' AND ip.id = tip.item_property_id
WHERE ip.c_id = $course_id AND tip.course_id = '$course_id' AND tip.session_id = '".intval($this->session_id)."' WHERE ip.c_id = $course_id AND tip.course_id = '$course_id' AND tip.session_id = '".intval($this->session_id)."'
ORDER BY tip.lastedit_date DESC"; ORDER BY tip.lastedit_date DESC";
$rs = Database::query($sql); $rs = Database::query($sql);
@ -119,13 +119,13 @@ class CourseDescription
public function get_data_by_description_type($description_type, $course_code = '', $session_id = null) { public function get_data_by_description_type($description_type, $course_code = '', $session_id = null) {
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (!isset($session_id)) { if (!isset($session_id)) {
$session_id = $this->session_id; $session_id = $this->session_id;
} }
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
if (!empty($course_code)) { if (!empty($course_code)) {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
} }
$description_type = intval($description_type); $description_type = intval($description_type);
@ -139,18 +139,18 @@ class CourseDescription
} }
return $data; return $data;
} }
public function get_data_by_id($id, $course_code = '', $session_id = null) { public function get_data_by_id($id, $course_code = '', $session_id = null) {
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (!isset($session_id)) { if (!isset($session_id)) {
$session_id = $this->session_id; $session_id = $this->session_id;
} }
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
if (!empty($course_code)) { if (!empty($course_code)) {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
} }
$id = intval($id); $id = intval($id);
@ -165,7 +165,7 @@ class CourseDescription
} }
return $data; return $data;
} }
/** /**
* Get maximum description type by session id, first you must set session_id properties with the object CourseDescription * Get maximum description type by session id, first you must set session_id properties with the object CourseDescription
@ -174,7 +174,7 @@ class CourseDescription
public function get_max_description_type() { public function get_max_description_type() {
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT MAX(description_type) as MAX FROM $tbl_course_description WHERE c_id = $course_id AND session_id='".$this->session_id."'"; $sql = "SELECT MAX(description_type) as MAX FROM $tbl_course_description WHERE c_id = $course_id AND session_id='".$this->session_id."'";
$rs = Database::query($sql); $rs = Database::query($sql);
$max = Database::fetch_array($rs); $max = Database::fetch_array($rs);
@ -190,15 +190,15 @@ class CourseDescription
* first you must set description_type, title, content, progress and session_id properties with the object CourseDescription * first you must set description_type, title, content, progress and session_id properties with the object CourseDescription
* @return int affected rows * @return int affected rows
*/ */
public function insert() { public function insert() {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$sql = "INSERT IGNORE INTO $tbl_course_description SET $sql = "INSERT IGNORE INTO $tbl_course_description SET
c_id = $course_id, c_id = $course_id,
description_type = '".intval($this->description_type)."', description_type = '".intval($this->description_type)."',
title = '".Database::escape_string($this->title)."', title = '".Database::escape_string($this->title)."',
content = '".Database::escape_string($this->content)."', content = '".Database::escape_string($this->content)."',
progress = '".intval($this->progress)."', progress = '".intval($this->progress)."',
session_id = '".intval($this->session_id)."' "; session_id = '".intval($this->session_id)."' ";
Database::query($sql); Database::query($sql);
$last_id = Database::insert_id(); $last_id = Database::insert_id();
@ -218,7 +218,7 @@ class CourseDescription
* @return int affected rows * @return int affected rows
*/ */
public function insert_stats($description_type) { public function insert_stats($description_type) {
$tbl_stats_item_property = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
$description_id = $this->get_id_by_description_type($description_type); $description_id = $this->get_id_by_description_type($description_type);
$course_id = api_get_real_course_id(); $course_id = api_get_real_course_id();
$course_code = api_get_course_id(); $course_code = api_get_course_id();
@ -243,19 +243,19 @@ class CourseDescription
* and session_id properties with the object CourseDescription * and session_id properties with the object CourseDescription
* @return int affected rows * @return int affected rows
*/ */
public function update() { public function update() {
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$sql = "UPDATE $tbl_course_description SET $sql = "UPDATE $tbl_course_description SET
title = '".Database::escape_string($this->title)."', title = '".Database::escape_string($this->title)."',
content = '".Database::escape_string($this->content)."', content = '".Database::escape_string($this->content)."',
progress = '".$this->progress."' progress = '".$this->progress."'
WHERE id = '".intval($this->id)."' AND WHERE id = '".intval($this->id)."' AND
session_id = '".$this->session_id."' AND session_id = '".$this->session_id."' AND
c_id = ".api_get_course_int_id()." c_id = ".api_get_course_int_id()."
"; ";
Database::query($sql); Database::query($sql);
$affected_rows = Database::affected_rows(); $affected_rows = Database::affected_rows();
if ($this->id > 0) { if ($this->id > 0) {
//insert into item_property //insert into item_property
api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionUpdated', api_get_user_id()); api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionUpdated', api_get_user_id());
@ -268,7 +268,7 @@ class CourseDescription
* @return int affected rows * @return int affected rows
*/ */
public function delete() { public function delete() {
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "DELETE FROM $tbl_course_description WHERE c_id = $course_id AND id = '".intval($this->id)."' AND session_id = '".intval($this->session_id)."'"; $sql = "DELETE FROM $tbl_course_description WHERE c_id = $course_id AND id = '".intval($this->id)."' AND session_id = '".intval($this->session_id)."'";
Database::query($sql); Database::query($sql);
@ -288,7 +288,7 @@ class CourseDescription
public function get_id_by_description_type($description_type) { public function get_id_by_description_type($description_type) {
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT id FROM $tbl_course_description WHERE c_id = $course_id AND description_type = '".intval($description_type)."'"; $sql = "SELECT id FROM $tbl_course_description WHERE c_id = $course_id AND description_type = '".intval($description_type)."'";
$rs = Database::query($sql); $rs = Database::query($sql);
$row = Database::fetch_array($rs); $row = Database::fetch_array($rs);
@ -307,7 +307,7 @@ class CourseDescription
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$session_id = intval($session_id); $session_id = intval($session_id);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT progress FROM $tbl_course_description WHERE c_id = $course_id AND description_type = '".intval($description_type)."' AND session_id = '".intval($this->session_id)."' "; $sql = "SELECT progress FROM $tbl_course_description WHERE c_id = $course_id AND description_type = '".intval($description_type)."' AND session_id = '".intval($this->session_id)."' ";
$rs = Database::query($sql); $rs = Database::query($sql);
$progress = ''; $progress = '';
@ -339,7 +339,7 @@ class CourseDescription
$default_description_titles[5]= get_lang('CourseMaterial'); $default_description_titles[5]= get_lang('CourseMaterial');
$default_description_titles[6]= get_lang('HumanAndTechnicalResources'); $default_description_titles[6]= get_lang('HumanAndTechnicalResources');
$default_description_titles[7]= get_lang('Assessment'); $default_description_titles[7]= get_lang('Assessment');
$default_description_titles[8]= get_lang('Other'); $default_description_titles[8]= get_lang('Other');
return $default_description_titles; return $default_description_titles;
} }
@ -508,4 +508,4 @@ class CourseDescription
public function get_progress() { public function get_progress() {
return $this->progress; return $this->progress;
} }
} }

@ -1310,7 +1310,7 @@ class Display
*/ */
public static function show_notification($course_info) public static function show_notification($course_info)
{ {
$t_track_e_access = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $t_track_e_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST); $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);

@ -19,7 +19,7 @@
function event_open() function event_open()
{ {
global $_configuration; global $_configuration;
$TABLETRACK_OPEN = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_OPEN); $TABLETRACK_OPEN = Database::get_main_table(TABLE_STATISTIC_TRACK_E_OPEN);
// @getHostByAddr($_SERVER['REMOTE_ADDR']) : will provide host and country information // @getHostByAddr($_SERVER['REMOTE_ADDR']) : will provide host and country information
// $_SERVER['HTTP_USER_AGENT'] : will provide browser and os information // $_SERVER['HTTP_USER_AGENT'] : will provide browser and os information
@ -58,7 +58,7 @@ function event_open()
*/ */
function event_login() function event_login()
{ {
$TABLETRACK_LOGIN = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $TABLETRACK_LOGIN = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$_user = api_get_user_info(); $_user = api_get_user_info();
$reallyNow = api_get_utc_datetime(); $reallyNow = api_get_utc_datetime();
@ -92,8 +92,8 @@ function event_login()
*/ */
function event_access_course() function event_access_course()
{ {
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_LASTACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); //for "what's new" notification $TABLETRACK_LASTACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); //for "what's new" notification
$id_session = api_get_session_id(); $id_session = api_get_session_id();
$now = api_get_utc_datetime(); $now = api_get_utc_datetime();
@ -140,8 +140,8 @@ function event_access_course()
function event_access_tool($tool, $id_session = 0) function event_access_tool($tool, $id_session = 0)
{ {
global $_configuration; global $_configuration;
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_LASTACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); //for "what's new" notification $TABLETRACK_LASTACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); //for "what's new" notification
$_course = api_get_course_info(); $_course = api_get_course_info();
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
@ -203,7 +203,7 @@ function event_access_tool($tool, $id_session = 0)
*/ */
function event_download($doc_url) function event_download($doc_url)
{ {
$tbl_stats_downloads = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); $tbl_stats_downloads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$doc_url = Database::escape_string($doc_url); $doc_url = Database::escape_string($doc_url);
$reallyNow = api_get_utc_datetime(); $reallyNow = api_get_utc_datetime();
@ -237,7 +237,7 @@ function event_download($doc_url)
*/ */
function event_upload($doc_id) function event_upload($doc_id)
{ {
$TABLETRACK_UPLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_UPLOADS); $TABLETRACK_UPLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS);
$courseCode = api_get_course_id(); $courseCode = api_get_course_id();
$reallyNow = api_get_utc_datetime(); $reallyNow = api_get_utc_datetime();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
@ -268,7 +268,7 @@ function event_upload($doc_id)
*/ */
function event_link($link_id) function event_link($link_id)
{ {
$TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS); $TABLETRACK_LINKS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$reallyNow = api_get_utc_datetime(); $reallyNow = api_get_utc_datetime();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$sql = "INSERT INTO ".$TABLETRACK_LINKS." $sql = "INSERT INTO ".$TABLETRACK_LINKS."
@ -306,7 +306,7 @@ function event_link($link_id)
*/ */
function update_event_exercise($exeid, $exo_id, $score, $weight, $session_id, $learnpath_id = 0, $learnpath_item_id = 0, $learnpath_item_view_id = 0, $duration = 0, $status = '', $remind_list = array() , $end_date = null) { function update_event_exercise($exeid, $exo_id, $score, $weight, $session_id, $learnpath_id = 0, $learnpath_item_id = 0, $learnpath_item_view_id = 0, $duration = 0, $status = '', $remind_list = array() , $end_date = null) {
global $debug; global $debug;
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if ($debug) { if ($debug) {
error_log('Called to update_event_exercise'); error_log('Called to update_event_exercise');
@ -377,7 +377,7 @@ function createEventExercise($exo_id)
if (empty($exo_id) or (intval($exo_id) != $exo_id)) { if (empty($exo_id) or (intval($exo_id) != $exo_id)) {
return false; return false;
} }
$tbl_track_exe = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_track_exe = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_exe = Database::get_course_table(TABLE_QUIZ_TEST); $tbl_exe = Database::get_course_table(TABLE_QUIZ_TEST);
$uid = api_get_user_id(); $uid = api_get_user_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -443,7 +443,7 @@ function saveExerciseAttempt($score, $answer, $question_id, $exe_id, $position,
$now = api_get_utc_datetime(); $now = api_get_utc_datetime();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
if ($debug) { if ($debug) {
error_log("----- entering saveExerciseAttempt() function ------"); error_log("----- entering saveExerciseAttempt() function ------");
@ -517,7 +517,7 @@ function saveExerciseAttempt($score, $answer, $question_id, $exe_id, $position,
$res = Database::query($sql); $res = Database::query($sql);
if (defined('ENABLED_LIVE_EXERCISE_TRACKING')) { if (defined('ENABLED_LIVE_EXERCISE_TRACKING')) {
$recording_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $recording_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
if ($debug) { if ($debug) {
error_log("Saving e attempt recording "); error_log("Saving e attempt recording ");
} }
@ -549,7 +549,7 @@ function saveExerciseAttemptHotspot($exe_id, $question_id, $answer_id, $correct,
$correct = 0; $correct = 0;
} }
$tbl_track_e_hotspot = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $tbl_track_e_hotspot = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$sql = "INSERT INTO $tbl_track_e_hotspot (hotspot_user_id, c_id, hotspot_exe_id, hotspot_question_id, hotspot_answer_id, hotspot_correct, hotspot_coordinate)". $sql = "INSERT INTO $tbl_track_e_hotspot (hotspot_user_id, c_id, hotspot_exe_id, hotspot_question_id, hotspot_answer_id, hotspot_correct, hotspot_coordinate)".
" VALUES ('".api_get_user_id()."',". " VALUES ('".api_get_user_id()."',".
" '".api_get_course_int_id()."', ". " '".api_get_course_int_id()."', ".
@ -574,7 +574,7 @@ function saveExerciseAttemptHotspot($exe_id, $question_id, $answer_id, $correct,
*/ */
function event_system($event_type, $event_value_type, $event_value, $datetime = null, $user_id = null, $course_code = null) function event_system($event_type, $event_value_type, $event_value, $datetime = null, $user_id = null, $course_code = null)
{ {
$TABLETRACK_DEFAULT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $TABLETRACK_DEFAULT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
if (empty($event_type)) { if (empty($event_type)) {
return false; return false;
@ -710,7 +710,7 @@ function get_event_users($event_name)
function get_events_by_user_and_type($user_id, $event_type) function get_events_by_user_and_type($user_id, $event_type)
{ {
$TABLETRACK_DEFAULT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $TABLETRACK_DEFAULT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$user_id = intval($user_id); $user_id = intval($user_id);
$event_type = Database::escape_string($event_type); $event_type = Database::escape_string($event_type);
@ -822,7 +822,7 @@ function eventType_mod($etId, $users, $message, $subject)
function getLastAttemptDateOfExercise($exe_id) function getLastAttemptDateOfExercise($exe_id)
{ {
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$track_attempts = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql_track_attempt = 'SELECT max(tms) as last_attempt_date FROM '.$track_attempts.' WHERE exe_id='.$exe_id; $sql_track_attempt = 'SELECT max(tms) as last_attempt_date FROM '.$track_attempts.' WHERE exe_id='.$exe_id;
$rs_last_attempt = Database::query($sql_track_attempt); $rs_last_attempt = Database::query($sql_track_attempt);
$row_last_attempt = Database::fetch_array($rs_last_attempt); $row_last_attempt = Database::fetch_array($rs_last_attempt);
@ -838,7 +838,7 @@ function getLastAttemptDateOfExercise($exe_id)
function getLatestQuestionIdFromAttempt($exe_id) function getLatestQuestionIdFromAttempt($exe_id)
{ {
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$track_attempts = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = 'SELECT question_id FROM '.$track_attempts.' WHERE exe_id='.$exe_id.' ORDER BY tms DESC LIMIT 1'; $sql = 'SELECT question_id FROM '.$track_attempts.' WHERE exe_id='.$exe_id.' ORDER BY tms DESC LIMIT 1';
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result)) { if (Database::num_rows($result)) {
@ -859,7 +859,7 @@ function getLatestQuestionIdFromAttempt($exe_id)
*/ */
function get_attempt_count($user_id, $exerciseId, $lp_id, $lp_item_id, $lp_item_view_id) function get_attempt_count($user_id, $exerciseId, $lp_id, $lp_item_id, $lp_item_view_id)
{ {
$stat_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$user_id = intval($user_id); $user_id = intval($user_id);
$exerciseId = intval($exerciseId); $exerciseId = intval($exerciseId);
$lp_id = intval($lp_id); $lp_id = intval($lp_id);
@ -887,7 +887,7 @@ function get_attempt_count($user_id, $exerciseId, $lp_id, $lp_item_id, $lp_item_
function get_attempt_count_not_finished($user_id, $exerciseId, $lp_id, $lp_item_id) function get_attempt_count_not_finished($user_id, $exerciseId, $lp_id, $lp_item_id)
{ {
$stat_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$user_id = intval($user_id); $user_id = intval($user_id);
$exerciseId = intval($exerciseId); $exerciseId = intval($exerciseId);
$lp_id = intval($lp_id); $lp_id = intval($lp_id);
@ -928,9 +928,9 @@ function delete_student_lp_events($user_id, $lp_id, $course, $session_id)
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
} }
$track_e_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$track_attempts = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$recording_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $recording_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$user_id = intval($user_id); $user_id = intval($user_id);
$lp_id = intval($lp_id); $lp_id = intval($lp_id);
@ -984,7 +984,7 @@ function delete_student_lp_events($user_id, $lp_id, $course, $session_id)
*/ */
function delete_all_incomplete_attempts($user_id, $exercise_id, $course_id, $session_id = 0) function delete_all_incomplete_attempts($user_id, $exercise_id, $course_id, $session_id = 0)
{ {
$track_e_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$user_id = intval($user_id); $user_id = intval($user_id);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$course_id = intval($course_id); $course_id = intval($course_id);
@ -1010,8 +1010,8 @@ function delete_all_incomplete_attempts($user_id, $exercise_id, $course_id, $ses
*/ */
function get_all_exercise_results($exercise_id, $courseId, $session_id = 0, $load_question_list = true, $user_id = null) function get_all_exercise_results($exercise_id, $courseId, $session_id = 0, $load_question_list = true, $user_id = null)
{ {
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$courseId = intval($courseId); $courseId = intval($courseId);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1054,8 +1054,8 @@ function get_all_exercise_results($exercise_id, $courseId, $session_id = 0, $loa
*/ */
function get_all_exercise_results_by_course($courseId, $session_id = 0, $get_count = true) function get_all_exercise_results_by_course($courseId, $session_id = 0, $get_count = true)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$courseId = intval($courseId); $courseId = intval($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1098,8 +1098,8 @@ function get_all_exercise_results_by_course($courseId, $session_id = 0, $get_cou
*/ */
function get_all_exercise_results_by_user($user_id, $courseId, $session_id = 0) function get_all_exercise_results_by_user($user_id, $courseId, $session_id = 0)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$courseId = intval($courseId); $courseId = intval($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$user_id = intval($user_id); $user_id = intval($user_id);
@ -1137,9 +1137,9 @@ function get_all_exercise_results_by_user($user_id, $courseId, $session_id = 0)
*/ */
function get_exercise_results_by_attempt($exe_id) function get_exercise_results_by_attempt($exe_id)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_attempt_recording = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $table_track_attempt_recording = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$sql = "SELECT * FROM $table_track_exercises WHERE status = '' AND exe_id = $exe_id"; $sql = "SELECT * FROM $table_track_exercises WHERE status = '' AND exe_id = $exe_id";
@ -1180,9 +1180,9 @@ function get_exercise_results_by_attempt($exe_id)
*/ */
function getExerciseResultsByUser($user_id, $exercise_id, $courseId, $session_id = 0, $lp_id = 0, $lp_item_id = 0, $order = null) function getExerciseResultsByUser($user_id, $exercise_id, $courseId, $session_id = 0, $lp_id = 0, $lp_item_id = 0, $order = null)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_attempt_recording = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $table_track_attempt_recording = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$courseId = intval($courseId); $courseId = intval($courseId);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1234,7 +1234,7 @@ function getExerciseResultsByUser($user_id, $exercise_id, $courseId, $session_id
*/ */
function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $session_id = 0) function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $session_id = 0)
{ {
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$courseId = intval($courseId); $courseId = intval($courseId);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1269,8 +1269,8 @@ function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $ses
*/ */
function get_best_exercise_results_by_user($exercise_id, $courseId, $session_id = 0) function get_best_exercise_results_by_user($exercise_id, $courseId, $session_id = 0)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$courseId = intval($courseId); $courseId = intval($courseId);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1318,7 +1318,7 @@ function get_best_exercise_results_by_user($exercise_id, $courseId, $session_id
*/ */
function get_best_attempt_exercise_results_per_user($user_id, $exercise_id, $courseId, $session_id = 0) function get_best_attempt_exercise_results_per_user($user_id, $exercise_id, $courseId, $session_id = 0)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$courseId = intval($courseId); $courseId = intval($courseId);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1368,8 +1368,8 @@ function get_best_attempt_exercise_results_per_user($user_id, $exercise_id, $cou
*/ */
function count_exercise_result_not_validated($exercise_id, $courseId, $session_id = 0) function count_exercise_result_not_validated($exercise_id, $courseId, $session_id = 0)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$courseId = intval($courseId); $courseId = intval($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
@ -1399,7 +1399,7 @@ function count_exercise_result_not_validated($exercise_id, $courseId, $session_i
*/ */
function get_count_exercises_attempted_by_course($courseId, $session_id = 0) function get_count_exercises_attempted_by_course($courseId, $session_id = 0)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$courseId = intval($courseId); $courseId = intval($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1428,8 +1428,8 @@ function get_count_exercises_attempted_by_course($courseId, $session_id = 0)
*/ */
function get_all_exercise_event_from_lp($exercise_id, $courseId, $session_id = 0) function get_all_exercise_event_from_lp($exercise_id, $courseId, $session_id = 0)
{ {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$courseId = intval($courseId); $courseId = intval($courseId);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1480,7 +1480,7 @@ function get_all_exercises_from_lp($lp_id, $course_id)
*/ */
function get_comments($exe_id, $question_id) function get_comments($exe_id, $question_id)
{ {
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT teacher_comment FROM ".$table_track_attempt." $sql = "SELECT teacher_comment FROM ".$table_track_attempt."
WHERE exe_id='".Database::escape_string($exe_id)."' AND question_id = '".Database::escape_string($question_id)."' WHERE exe_id='".Database::escape_string($exe_id)."' AND question_id = '".Database::escape_string($question_id)."'
ORDER by question_id"; ORDER by question_id";
@ -1495,7 +1495,7 @@ function get_comments($exe_id, $question_id)
*/ */
function getAllExerciseEventByExeId($exe_id) function getAllExerciseEventByExeId($exe_id)
{ {
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$list = array(); $list = array();
@ -1519,7 +1519,7 @@ function getAllExerciseEventByExeId($exe_id)
*/ */
function delete_attempt($exe_id, $user_id, $courseId, $session_id, $question_id) function delete_attempt($exe_id, $user_id, $courseId, $session_id, $question_id)
{ {
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$user_id = intval($user_id); $user_id = intval($user_id);
@ -1544,7 +1544,7 @@ function delete_attempt($exe_id, $user_id, $courseId, $session_id, $question_id)
*/ */
function delete_attempt_hotspot($exe_id, $user_id, $courseId, $question_id) function delete_attempt_hotspot($exe_id, $user_id, $courseId, $question_id)
{ {
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$user_id = intval($user_id); $user_id = intval($user_id);
@ -1594,7 +1594,7 @@ function getAnsweredQuestionsFromAttempt($exe_id, $objExercise)
*/ */
function event_course_login($courseId, $user_id, $session_id) function event_course_login($courseId, $user_id, $session_id)
{ {
$course_tracking_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $course_tracking_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$time = api_get_datetime(); $time = api_get_datetime();
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);

@ -879,7 +879,7 @@ class ExerciseLib
public static function get_exercise_track_exercise_info($exe_id) public static function get_exercise_track_exercise_info($exe_id)
{ {
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_COURSE = Database::get_main_table(TABLE_MAIN_COURSE); $TBL_COURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$exe_id = intval($exe_id); $exe_id = intval($exe_id);
$result_array = array(); $result_array = array();
@ -989,7 +989,7 @@ class ExerciseLib
$in_column = 'firstname'; $in_column = 'firstname';
} }
$TBL_TRACK_HOTPOTATOES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_USER = Database :: get_main_table(TABLE_MAIN_USER); $TBL_USER = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $TBL_TRACK_HOTPOTATOES thp $sql = "SELECT * FROM $TBL_TRACK_HOTPOTATOES thp
@ -1042,9 +1042,9 @@ class ExerciseLib
$TBL_GROUP_REL_USER = Database :: get_course_table(TABLE_GROUP_USER); $TBL_GROUP_REL_USER = Database :: get_course_table(TABLE_GROUP_USER);
$TBL_GROUP = Database :: get_course_table(TABLE_GROUP); $TBL_GROUP = Database :: get_course_table(TABLE_GROUP);
$TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT_RECORDING = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$session_id_and = ' AND te.session_id = '.api_get_session_id().' '; $session_id_and = ' AND te.session_id = '.api_get_session_id().' ';
@ -1903,8 +1903,8 @@ class ExerciseLib
* */ * */
public static function get_student_stats_by_question($question_id, $exercise_id, $courseId, $session_id) public static function get_student_stats_by_question($question_id, $exercise_id, $courseId, $session_id)
{ {
$track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$question_id = intval($question_id); $question_id = intval($question_id);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
@ -1935,8 +1935,8 @@ class ExerciseLib
*/ */
public static function get_number_students_question_with_answer_count($question_id, $exercise_id, $courseId, $session_id) public static function get_number_students_question_with_answer_count($question_id, $exercise_id, $courseId, $session_id)
{ {
$track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$question_id = intval($question_id); $question_id = intval($question_id);
@ -1973,8 +1973,8 @@ class ExerciseLib
*/ */
public static function get_number_students_answer_hotspot_count($answer_id, $question_id, $exercise_id, $courseId, $session_id) public static function get_number_students_answer_hotspot_count($answer_id, $question_id, $exercise_id, $courseId, $session_id)
{ {
$track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$track_hotspot = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $track_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$question_id = intval($question_id); $question_id = intval($question_id);
@ -2020,8 +2020,8 @@ class ExerciseLib
*/ */
public static function get_number_students_answer_count($answer_id, $question_id, $exercise_id, $courseId, $session_id, $question_type = null, $correct_answer = null, $current_answer = null) public static function get_number_students_answer_count($answer_id, $question_id, $exercise_id, $courseId, $session_id, $question_type = null, $correct_answer = null, $current_answer = null)
{ {
$track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$question_id = intval($question_id); $question_id = intval($question_id);
@ -2200,8 +2200,8 @@ class ExerciseLib
*/ */
public static function get_number_students_finish_exercise($exercise_id, $courseId, $session_id) public static function get_number_students_finish_exercise($exercise_id, $courseId, $session_id)
{ {
$track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$courseId = intval($courseId); $courseId = intval($courseId);
@ -2287,7 +2287,7 @@ class ExerciseLib
*/ */
public static function update_attempt_date($exeId, $last_attempt_date) public static function update_attempt_date($exeId, $last_attempt_date)
{ {
$exercice_attemp_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $exercice_attemp_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$exeId = intval($exeId); $exeId = intval($exeId);
$last_attempt_date = Database::escape_string($last_attempt_date); $last_attempt_date = Database::escape_string($last_attempt_date);
$sql = "UPDATE $exercice_attemp_table SET tms = '".api_get_utc_datetime()."' $sql = "UPDATE $exercice_attemp_table SET tms = '".api_get_utc_datetime()."'

@ -228,7 +228,7 @@ class Login
// a uid is given (log in succeeded) // a uid is given (log in succeeded)
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN); $admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$track_e_login = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $track_e_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = "SELECT user.*, a.user_id is_admin, UNIX_TIMESTAMP(login.login_date) login_date $sql = "SELECT user.*, a.user_id is_admin, UNIX_TIMESTAMP(login.login_date) login_date
FROM $user_table FROM $user_table
@ -458,7 +458,7 @@ class Login
} }
if ($save_course_access) { if ($save_course_access) {
$course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $course_tracking_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
/* /*
* When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems) * When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems)

@ -233,8 +233,9 @@ class Nanogong
if ($load_from_database) { if ($load_from_database) {
//Load the real filename just if exists //Load the real filename just if exists
if (isset($this->params['exe_id']) && isset($this->params['user_id']) && isset($this->params['question_id']) && isset($this->params['session_id']) && isset($this->params['course_id'])) { if (isset($this->params['exe_id']) && isset($this->params['user_id']) &&
$attempt_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); isset($this->params['question_id']) && isset($this->params['session_id']) && isset($this->params['course_id'])) {
$attempt_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT filename FROM $attempt_table $sql = "SELECT filename FROM $attempt_table
WHERE exe_id = ".$this->params['exe_id']." AND WHERE exe_id = ".$this->params['exe_id']." AND
user_id = ".$this->params['user_id']." AND user_id = ".$this->params['user_id']." AND
@ -692,4 +693,4 @@ class Nanogong
return $html; return $html;
} }
} }

@ -29,7 +29,7 @@ class Online {
{ {
$_course = api_get_course_info(); $_course = api_get_course_info();
$uid = (int) $uid; $uid = (int) $uid;
$online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
if (!empty($uid)) { if (!empty($uid)) {
$login_ip = ''; $login_ip = '';
if(!empty($_SERVER['REMOTE_ADDR'])) { if(!empty($_SERVER['REMOTE_ADDR'])) {
@ -62,7 +62,7 @@ class Online {
global $extAuthSource; global $extAuthSource;
// Database table definition // Database table definition
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
if (empty($user_id)) { if (empty($user_id)) {
$user_id = api_get_user_id(); $user_id = api_get_user_id();
@ -125,7 +125,7 @@ class Online {
* @return bool * @return bool
*/ */
static function loginDelete($user_id) { static function loginDelete($user_id) {
$online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$user_id = intval($user_id); $user_id = intval($user_id);
if (empty($user_id)) { if (empty($user_id)) {
return false; return false;
@ -136,7 +136,7 @@ class Online {
} }
static function user_is_online($user_id) { static function user_is_online($user_id) {
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
@ -193,7 +193,7 @@ class Online {
$online_time = time() - $time_limit*60; $online_time = time() - $time_limit*60;
$current_date = api_get_utc_datetime($online_time); $current_date = api_get_utc_datetime($online_time);
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$query = ''; $query = '';
@ -267,7 +267,7 @@ class Online {
} else { } else {
$time_limit = intval($time_limit); $time_limit = intval($time_limit);
} }
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$query = ''; $query = '';
@ -339,7 +339,7 @@ class Online {
$online_time = time() - $time_limit*60; $online_time = time() - $time_limit*60;
$current_date = api_get_utc_datetime($online_time); $current_date = api_get_utc_datetime($online_time);
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$course_code = Database::escape_string($course_code); $course_code = Database::escape_string($course_code);
$from = intval($from); $from = intval($from);
@ -369,7 +369,7 @@ class Online {
static function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null) { static function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null) {
if(empty($coursecode)) return false; if(empty($coursecode)) return false;
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$coursecode = Database::escape_string($coursecode); $coursecode = Database::escape_string($coursecode);
$time_limit = Database::escape_string($time_limit); $time_limit = Database::escape_string($time_limit);

@ -129,7 +129,7 @@ class Statistics {
static function get_number_of_activities() { static function get_number_of_activities() {
// Database table definitions // Database table definitions
global $_configuration; global $_configuration;
$track_e_default = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
@ -154,7 +154,7 @@ class Statistics {
*/ */
static function get_activities_data($from, $number_of_items, $column, $direction) { static function get_activities_data($from, $number_of_items, $column, $direction) {
global $dateTimeFormatLong, $_configuration; global $dateTimeFormatLong, $_configuration;
$track_e_default = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $track_e_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
@ -320,7 +320,7 @@ class Statistics {
*/ */
static function print_login_stats($type) static function print_login_stats($type)
{ {
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
@ -395,7 +395,7 @@ class Statistics {
static function print_recent_login_stats() static function print_recent_login_stats()
{ {
$total_logins = array(); $total_logins = array();
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
@ -422,7 +422,7 @@ class Statistics {
static function print_tool_stats() static function print_tool_stats()
{ {
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE); $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
@ -572,7 +572,7 @@ class Statistics {
$form->display(); $form->display();
$values = $form->exportValues(); $values = $form->exportValues();
$date_diff = $values['date_diff']; $date_diff = $values['date_diff'];
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE); $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$sql = "SELECT access_date, c.code FROM $table s , $access_url_rel_course_table u, $tableCourse c $sql = "SELECT access_date, c.code FROM $table s , $access_url_rel_course_table u, $tableCourse c
@ -696,7 +696,7 @@ class Statistics {
*/ */
static function print_users_not_logged_in_stats() { static function print_users_not_logged_in_stats() {
$total_logins = array(); $total_logins = array();
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
$total = self::count_users(); $total = self::count_users();

@ -1,4 +1,4 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
@ -44,12 +44,12 @@
// regroup table names for maintenance purpose // regroup table names for maintenance purpose
//we can use the database class: this file is only called in the /index.php file before the global.inc.php //we can use the database class: this file is only called in the /index.php file before the global.inc.php
$TABLETRACK_OPEN = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_OPEN); $TABLETRACK_OPEN = Database::get_main_table(TABLE_STATISTIC_TRACK_E_OPEN);
$TABLESTATS_PROVIDERS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_C_PROVIDERS); $TABLESTATS_PROVIDERS = Database::get_main_table(TABLE_STATISTIC_TRACK_C_PROVIDERS);
$TABLESTATS_COUNTRIES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_C_COUNTRIES); $TABLESTATS_COUNTRIES = Database::get_main_table(TABLE_STATISTIC_TRACK_C_COUNTRIES);
$TABLESTATS_BROWSERS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_C_BROWSERS); $TABLESTATS_BROWSERS = Database::get_main_table(TABLE_STATISTIC_TRACK_C_BROWSERS);
$TABLESTATS_OS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_C_OS); $TABLESTATS_OS = Database::get_main_table(TABLE_STATISTIC_TRACK_C_OS);
$TABLESTATS_REFERERS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_C_REFERERS); $TABLESTATS_REFERERS = Database::get_main_table(TABLE_STATISTIC_TRACK_C_REFERERS);
/* /*
Main : decodeOpenInfos launch all processes Main : decodeOpenInfos launch all processes

@ -87,7 +87,7 @@ class Tracking
*/ */
public static function get_time_spent_on_the_platform($user_id, $time_filter = 'last_7_days', $start_date = null, $end_date = null) public static function get_time_spent_on_the_platform($user_id, $time_filter = 'last_7_days', $start_date = null, $end_date = null)
{ {
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$condition_time = null; $condition_time = null;
if (empty($time_filter)) { if (empty($time_filter)) {
$time_filter = 'last_7_days'; $time_filter = 'last_7_days';
@ -173,7 +173,7 @@ class Tracking
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
if (is_array($user_id)) { if (is_array($user_id)) {
$user_id = array_map('intval', $user_id); $user_id = array_map('intval', $user_id);
@ -199,7 +199,7 @@ class Tracking
*/ */
public static function get_first_connection_date($student_id) public static function get_first_connection_date($student_id)
{ {
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = 'SELECT login_date FROM '.$tbl_track_login.' $sql = 'SELECT login_date FROM '.$tbl_track_login.'
WHERE login_user_id = '.intval($student_id).' WHERE login_user_id = '.intval($student_id).'
ORDER BY login_date ASC LIMIT 0,1'; ORDER BY login_date ASC LIMIT 0,1';
@ -222,7 +222,7 @@ class Tracking
*/ */
public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false)
{ {
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = 'SELECT login_date FROM '.$tbl_track_login.' $sql = 'SELECT login_date FROM '.$tbl_track_login.'
WHERE login_user_id = '.intval($student_id).' WHERE login_user_id = '.intval($student_id).'
ORDER BY login_date DESC LIMIT 0,1'; ORDER BY login_date DESC LIMIT 0,1';
@ -266,7 +266,7 @@ class Tracking
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = 'SELECT login_course_date FROM '.$tbl_track_login.' $sql = 'SELECT login_course_date FROM '.$tbl_track_login.'
WHERE user_id = '.$student_id.' WHERE user_id = '.$student_id.'
AND c_id = "'.$courseId.'" AND c_id = "'.$courseId.'"
@ -299,7 +299,7 @@ class Tracking
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$tbl_track_e_course_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = 'SELECT login_course_date $sql = 'SELECT login_course_date
FROM '.$tbl_track_e_course_access.' FROM '.$tbl_track_e_course_access.'
WHERE user_id = '.$student_id.' AND WHERE user_id = '.$student_id.' AND
@ -363,7 +363,7 @@ class Tracking
$session_id = intval($session_id); $session_id = intval($session_id);
$count = 0; $count = 0;
$tbl_track_e_course_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = "SELECT count(*) as count_connections $sql = "SELECT count(*) as count_connections
FROM $tbl_track_e_course_access FROM $tbl_track_e_course_access
WHERE c_id = '$courseId' AND session_id = $session_id $month_filter"; WHERE c_id = '$courseId' AND session_id = $session_id $month_filter";
@ -418,7 +418,7 @@ class Tracking
{ {
// table definition // table definition
$tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
$tbl_stats_exercise = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
// Compose a filter based on optional exercise given // Compose a filter based on optional exercise given
$condition_quiz = ""; $condition_quiz = "";
@ -514,7 +514,7 @@ class Tracking
if (!empty($lp_item_id)) if (!empty($lp_item_id))
$lp_id = intval($lp_item_id); $lp_id = intval($lp_item_id);
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercices AS ex $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercices AS ex
WHERE ex.c_id = '$courseId' AND WHERE ex.c_id = '$courseId' AND
@ -548,7 +548,7 @@ class Tracking
if (empty($exercise_list)) { if (empty($exercise_list)) {
return '0%'; return '0%';
} }
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$exercise_list = array_keys($exercise_list); $exercise_list = array_keys($exercise_list);
$exercise_list = array_map('intval', $exercise_list); $exercise_list = array_map('intval', $exercise_list);
@ -707,8 +707,8 @@ class Tracking
if ($debug) if ($debug)
echo '<h1>Tracking::get_avg_student_score</h1>'; echo '<h1>Tracking::get_avg_student_score</h1>';
// get global tables names // get global tables names
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_stats_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
// get course tables names // get course tables names
$tbl_quiz_questions = Database :: get_course_table(TABLE_QUIZ_QUESTION); $tbl_quiz_questions = Database :: get_course_table(TABLE_QUIZ_QUESTION);
@ -1785,7 +1785,7 @@ class Tracking
$user_condition = "AND access_user_id IN ('".implode("', '", $user_list)."')"; $user_condition = "AND access_user_id IN ('".implode("', '", $user_list)."')";
} }
$tbl_stats_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $tbl_stats_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$sql = "SELECT count(*) FROM $tbl_stats_access WHERE DATE_SUB(NOW(),INTERVAL $last_days DAY) <= access_date $sql = "SELECT count(*) FROM $tbl_stats_access WHERE DATE_SUB(NOW(),INTERVAL $last_days DAY) <= access_date
AND c_id = '$courseId' AND access_tool='".TOOL_CHAT."' AND access_session_id='$session_id' $user_condition "; AND c_id = '$courseId' AND access_tool='".TOOL_CHAT."' AND access_session_id='$session_id' $user_condition ";
@ -1814,7 +1814,7 @@ class Tracking
$date_time = ''; $date_time = '';
// table definition // table definition
$tbl_stats_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $tbl_stats_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$sql = "SELECT access_date FROM $tbl_stats_access $sql = "SELECT access_date FROM $tbl_stats_access
WHERE access_tool='".TOOL_CHAT."' AND access_user_id='$student_id' AND c_id = '$courseId' AND access_session_id = '$session_id' WHERE access_tool='".TOOL_CHAT."' AND access_user_id='$student_id' AND c_id = '$courseId' AND access_session_id = '$session_id'
ORDER BY access_date DESC limit 1"; ORDER BY access_date DESC limit 1";
@ -1840,7 +1840,7 @@ class Tracking
$session_id = intval($session_id); $session_id = intval($session_id);
// table definition // table definition
$tbl_stats_links = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS); $tbl_stats_links = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$sql = 'SELECT 1 $sql = 'SELECT 1
FROM '.$tbl_stats_links.' FROM '.$tbl_stats_links.'
@ -1867,7 +1867,7 @@ class Tracking
$session_id = intval($session_id); $session_id = intval($session_id);
// table definition // table definition
$tbl_stats_documents = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); $tbl_stats_documents = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$sql = 'SELECT 1 $sql = 'SELECT 1
FROM '.$tbl_stats_documents.' FROM '.$tbl_stats_documents.'
@ -1907,7 +1907,7 @@ class Tracking
*/ */
public static function get_inactives_students_in_course($courseId, $since = 'never', $session_id = 0) public static function get_inactives_students_in_course($courseId, $since = 'never', $session_id = 0)
{ {
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$table_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $table_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$inner = ''; $inner = '';
@ -1951,7 +1951,7 @@ class Tracking
$student_id = intval($student_id); $student_id = intval($student_id);
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$tbl_course_rel_user = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $tbl_course_rel_user = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$sql = 'SELECT '.$student_id.' $sql = 'SELECT '.$student_id.'
FROM '.$tbl_course_rel_user.' FROM '.$tbl_course_rel_user.'
@ -2110,7 +2110,7 @@ class Tracking
//protect data //protect data
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$data = array(); $data = array();
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$condition_session = ''; $condition_session = '';
if (isset($session_id)) { if (isset($session_id)) {
$session_id = intval($session_id); $session_id = intval($session_id);
@ -2150,7 +2150,7 @@ class Tracking
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$data = array(); $data = array();
$TABLETRACK_DOWNLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$condition_session = ''; $condition_session = '';
if (isset($session_id)) { if (isset($session_id)) {
$session_id = intval($session_id); $session_id = intval($session_id);
@ -2189,7 +2189,7 @@ class Tracking
{ {
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$data = array(); $data = array();
$TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS); $TABLETRACK_LINKS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$TABLECOURSE_LINKS = Database::get_course_table(TABLE_LINK); $TABLECOURSE_LINKS = Database::get_course_table(TABLE_LINK);
$condition_session = ''; $condition_session = '';
@ -3872,7 +3872,7 @@ class TrackingUserLog
$session_id = intval($session_id); $session_id = intval($session_id);
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$track_access_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$tempView = $view; $tempView = $view;
if (substr($view, 0, 1) == '1') { if (substr($view, 0, 1) == '1') {
$new_view = substr_replace($view, '0', 0, 1); $new_view = substr_replace($view, '0', 0, 1);
@ -4182,7 +4182,7 @@ class TrackingUserLog
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$downloads_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
if (substr($view, 4, 1) == '1') { if (substr($view, 4, 1) == '1') {
$new_view = substr_replace($view, '0', 4, 1); $new_view = substr_replace($view, '0', 4, 1);
echo " echo "
@ -4279,7 +4279,7 @@ class TrackingUserLogCSV
function display_login_tracking_info($view, $user_id, $courseId, $session_id = 0) function display_login_tracking_info($view, $user_id, $courseId, $session_id = 0)
{ {
$MonthsLong = $GLOBALS['MonthsLong']; $MonthsLong = $GLOBALS['MonthsLong'];
$track_access_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
// protected data // protected data
$user_id = intval($user_id); $user_id = intval($user_id);
@ -4477,7 +4477,7 @@ class TrackingUserLogCSV
$courseId = Database::escape_string($courseId); $courseId = Database::escape_string($courseId);
$session_id = intval($session_id); $session_id = intval($session_id);
$downloads_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
if (substr($view, 4, 1) == '1') { if (substr($view, 4, 1) == '1') {
$new_view = substr_replace($view, '0', 4, 1); $new_view = substr_replace($view, '0', 4, 1);

@ -4005,7 +4005,7 @@ class UserManager
*/ */
public static function delete_inactive_student($student_id, $years = 2, $warning_message = false, $return_timestamp = false) { public static function delete_inactive_student($student_id, $years = 2, $warning_message = false, $return_timestamp = false) {
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = 'SELECT login_date FROM ' . $tbl_track_login . ' WHERE login_user_id = ' . intval($student_id) . ' ORDER BY login_date DESC LIMIT 0,1'; $sql = 'SELECT login_date FROM ' . $tbl_track_login . ' WHERE login_user_id = ' . intval($student_id) . ' ORDER BY login_date DESC LIMIT 0,1';
if (empty($years)) { if (empty($years)) {
$years = 1; $years = 1;

@ -21,7 +21,7 @@ class ZombieManager
/** /**
* Returns users whose last login is prior from $ceiling * Returns users whose last login is prior from $ceiling
* *
* @param int|string $ceiling last login date * @param int|string $ceiling last login date
* @param bool $active_only if true returns only active users. Otherwise returns all users. * @param bool $active_only if true returns only active users. Otherwise returns all users.
* @return ResultSet * @return ResultSet
@ -32,18 +32,18 @@ class ZombieManager
$ceiling = date('Y-m-d H:i:s', $ceiling); $ceiling = date('Y-m-d H:i:s', $ceiling);
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$login_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $login_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = 'SELECT $sql = 'SELECT
user.user_id, user.user_id,
user.firstname, user.firstname,
user.lastname, user.lastname,
user.username, user.username,
user.auth_source, user.auth_source,
user.email, user.email,
user.status, user.status,
user.registration_date, user.registration_date,
user.active, user.active,
access.login_date'; access.login_date';
global $_configuration; global $_configuration;
@ -53,19 +53,19 @@ class ZombieManager
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
$sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url $sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url
WHERE WHERE
access.login_date = (SELECT MAX(a.login_date) access.login_date = (SELECT MAX(a.login_date)
FROM $login_table as a FROM $login_table as a
WHERE a.login_user_id = user.user_id WHERE a.login_user_id = user.user_id
) AND ) AND
access.login_date <= '$ceiling' AND access.login_date <= '$ceiling' AND
user.user_id = access.login_user_id AND user.user_id = access.login_user_id AND
url.login_user_id = user.user_id AND url.access_url_id=$current_url_id"; url.login_user_id = user.user_id AND url.access_url_id=$current_url_id";
} else { } else {
$sql .= " FROM $user_table as user, $login_table as access $sql .= " FROM $user_table as user, $login_table as access
WHERE WHERE
access.login_date = (SELECT MAX(a.login_date) access.login_date = (SELECT MAX(a.login_date)
FROM $login_table as a FROM $login_table as a
WHERE a.login_user_id = user.user_id WHERE a.login_user_id = user.user_id
) AND ) AND
access.login_date <= '$ceiling' AND access.login_date <= '$ceiling' AND
@ -91,4 +91,4 @@ class ZombieManager
} }
} }

@ -470,7 +470,7 @@ if (isset($uidReset) && $uidReset) { // session data refresh requested
// a uid is given (log in succeeded) // a uid is given (log in succeeded)
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN); $admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$track_e_login = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $track_e_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = "SELECT user.*, a.user_id is_admin, login.login_date $sql = "SELECT user.*, a.user_id is_admin, login.login_date
FROM $user_table FROM $user_table
@ -525,7 +525,7 @@ if (!isset($_SESSION['login_as'])) {
} }
if ($save_course_access) { if ($save_course_access) {
$course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $course_tracking_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
/* /*
* When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems) * When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems)

@ -39,7 +39,7 @@ $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_rel_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_rel_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
if (isset($_POST['export'])) { if (isset($_POST['export'])) {
$order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; $order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
@ -157,4 +157,4 @@ if (isset($_POST['export'])){
echo "<br /><br />"; echo "<br /><br />";
echo "<form method='post' action='coaches.php'><button type='submit' class='save' name='export' value='".get_lang('exportExcel')."'>".get_lang('exportExcel')."</button><form>"; echo "<form method='post' action='coaches.php'><button type='submit' class='save' name='export' value='".get_lang('exportExcel')."'>".get_lang('exportExcel')."</button><form>";
Display::display_footer(); Display::display_footer();

@ -619,7 +619,7 @@ if ($is_platform_admin && $view == 'admin' && $display != 'yourstudents') {
); );
} }
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sqlCoachs = "SELECT DISTINCT scu.id_user as id_coach, user_id, lastname, firstname, MAX(login_date) as login_date $sqlCoachs = "SELECT DISTINCT scu.id_user as id_coach, user_id, lastname, firstname, MAX(login_date) as login_date
FROM $tbl_user, $tbl_session_course_user scu, $tbl_track_login FROM $tbl_user, $tbl_session_course_user scu, $tbl_track_login

@ -164,7 +164,7 @@ if (isset($_GET['details'])) {
// Database Table Definitions // Database Table Definitions
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if (isset($_GET['user_id']) && $_GET['user_id'] != "") { if (isset($_GET['user_id']) && $_GET['user_id'] != "") {
$user_id = intval($_GET['user_id']); $user_id = intval($_GET['user_id']);

@ -61,7 +61,7 @@ class MySpace {
static function get_connections_to_course($user_id, $courseId, $session_id = 0) { static function get_connections_to_course($user_id, $courseId, $session_id = 0) {
// Database table definitions // Database table definitions
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
// protect data // protect data
$user_id = intval($user_id); $user_id = intval($user_id);
@ -86,7 +86,7 @@ class MySpace {
static function get_connections_from_course_list($user_id, $course_list, $session_id = 0) { static function get_connections_from_course_list($user_id, $course_list, $session_id = 0) {
// Database table definitions // Database table definitions
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
if (empty($course_list)) { if (empty($course_list)) {
return false; return false;
} }
@ -1051,7 +1051,7 @@ class MySpace {
*/ */
function exercises_results($user_id, $courseId, $session_id = false) { function exercises_results($user_id, $courseId, $session_id = false) {
$sql = 'SELECT exe_result , exe_weighting $sql = 'SELECT exe_result , exe_weighting
FROM '.Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES)." FROM '.Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES)."
WHERE c_id = '".Database::escape_string($courseId)."' WHERE c_id = '".Database::escape_string($courseId)."'
AND exe_user_id = '".Database::escape_string($user_id)."'"; AND exe_user_id = '".Database::escape_string($user_id)."'";
if ($session_id !== false) { if ($session_id !== false) {
@ -1812,7 +1812,7 @@ class MySpace {
function get_stats($user_id, $courseId, $start_date = null, $end_date = null) { function get_stats($user_id, $courseId, $start_date = null, $end_date = null) {
// Database table definitions // Database table definitions
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$strg_sd = ""; $strg_sd = "";
$strg_ed = ""; $strg_ed = "";
@ -1864,7 +1864,7 @@ function add_day_to($end_date) {
*/ */
function get_connections_to_course_by_date($user_id, $courseId, $start_date, $end_date) { function get_connections_to_course_by_date($user_id, $courseId, $start_date, $end_date) {
// Database table definitions // Database table definitions
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$user_id = intval($user_id); $user_id = intval($user_id);
if (!empty($course_info)) { if (!empty($course_info)) {

@ -29,7 +29,7 @@ Display :: display_header($nameTools);
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_track_exercice = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_track_exercice = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
/* /*
MAIN CODE MAIN CODE

@ -27,7 +27,7 @@ $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_track_exercice = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_track_exercice = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if (!empty($_GET['session'])) { if (!empty($_GET['session'])) {
$sql_session = "SELECT name,id $sql_session = "SELECT name,id

@ -3231,22 +3231,9 @@ class learnpath
$html .= stripslashes($title); $html .= stripslashes($title);
} }
/*$tbl_track_e_exercises = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
$user_id = api_get_user_id();
$sql = "SELECT path FROM $tbl_track_e_exercises, $tbl_lp_item
WHERE c_id = $courseId AND
path = '" . $item['path'] . "' AND
exe_user_id = '$user_id' AND
c_id = '$course_code' AND
path = exe_exo_id AND
status <> 'incomplete'";
$result = Database::query($sql);
$count = Database :: num_rows($result);*/
if ($item['type'] == 'quiz') { if ($item['type'] == 'quiz') {
error_log("1-->>>>>>>>>>>>>>>>"); // error_log("1-->>>>>>>>>>>>>>>>");
error_log($item['status']); // error_log($item['status']);
if ($item['status'] == 'completed') { if ($item['status'] == 'completed') {
$html .= "&nbsp;<img id='toc_img_".$item['id']."' src='".$icon_name[$item['status']]."' alt='".substr( $html .= "&nbsp;<img id='toc_img_".$item['id']."' src='".$icon_name[$item['status']]."' alt='".substr(
$item['status'], $item['status'],

@ -1877,7 +1877,7 @@ class learnpathItem
if ($returnstatus) { if ($returnstatus) {
//AND origin_lp_item_id = '.$user_id.' //AND origin_lp_item_id = '.$user_id.'
$sql = 'SELECT exe_result, exe_weighting $sql = 'SELECT exe_result, exe_weighting
FROM '.Database :: get_statistic_table( FROM '.Database :: get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCICES TABLE_STATISTIC_TRACK_E_EXERCICES
).' ).'
WHERE exe_exo_id = '.$items[$refs_list[$prereqs_string]]->path.' WHERE exe_exo_id = '.$items[$refs_list[$prereqs_string]]->path.'
@ -1907,7 +1907,7 @@ class learnpathItem
// 3. for multiple attempts we check that there are minimun 1 item completed. // 3. for multiple attempts we check that there are minimun 1 item completed.
// Checking in the database. // Checking in the database.
$sql = 'SELECT exe_result, exe_weighting $sql = 'SELECT exe_result, exe_weighting
FROM '.Database :: get_statistic_table( FROM '.Database :: get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCICES TABLE_STATISTIC_TRACK_E_EXERCICES
).' ).'
WHERE exe_exo_id = '.$items[$refs_list[$prereqs_string]]->path.' WHERE exe_exo_id = '.$items[$refs_list[$prereqs_string]]->path.'
@ -3082,7 +3082,7 @@ class learnpathItem
$my_status = ' '; $my_status = ' ';
$total_time = ' '; $total_time = ' ';
if (!empty($_REQUEST['exeId'])) { if (!empty($_REQUEST['exeId'])) {
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$safe_exe_id = Database::escape_string($_REQUEST['exeId']); $safe_exe_id = Database::escape_string($_REQUEST['exeId']);
$sql = 'SELECT start_date,exe_date FROM '.$TBL_TRACK_EXERCICES.' WHERE exe_id = '.(int)$safe_exe_id; $sql = 'SELECT start_date,exe_date FROM '.$TBL_TRACK_EXERCICES.' WHERE exe_id = '.(int)$safe_exe_id;

@ -251,7 +251,7 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
if (!isset($_SESSION['login_as'])) { if (!isset($_SESSION['login_as'])) {
// If $_SESSION['login_as'] is set, then the user is an admin logged as the user. // If $_SESSION['login_as'] is set, then the user is an admin logged as the user.
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql_last_connection = "SELECT login_id, login_date $sql_last_connection = "SELECT login_id, login_date
FROM $tbl_track_login FROM $tbl_track_login
@ -305,4 +305,4 @@ echo save_item(
(!empty($_REQUEST['suspend'])?$_REQUEST['suspend']:null), (!empty($_REQUEST['suspend'])?$_REQUEST['suspend']:null),
(!empty($_REQUEST['loc'])?$_REQUEST['loc']:null), (!empty($_REQUEST['loc'])?$_REQUEST['loc']:null),
$interactions, $interactions,
(!empty($_REQUEST['core_exit'])?$_REQUEST['core_exit']:'')); (!empty($_REQUEST['core_exit'])?$_REQUEST['core_exit']:''));

@ -168,7 +168,7 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
if (!isset($_SESSION['login_as'])) { if (!isset($_SESSION['login_as'])) {
// If $_SESSION['login_as'] is set, then the user is an admin logged as the user. // If $_SESSION['login_as'] is set, then the user is an admin logged as the user.
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql_last_connection = "SELECT login_id, login_date FROM $tbl_track_login $sql_last_connection = "SELECT login_id, login_date FROM $tbl_track_login
WHERE login_user_id='".api_get_user_id()."' ORDER BY login_date DESC LIMIT 0,1"; WHERE login_user_id='".api_get_user_id()."' ORDER BY login_date DESC LIMIT 0,1";

@ -110,8 +110,8 @@ $TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_VIEW = Database :: get_course_table(TABLE_LP_VIEW); $TBL_LP_VIEW = Database :: get_course_table(TABLE_LP_VIEW);
$tbl_quiz_questions = Database :: get_course_table(TABLE_QUIZ_QUESTION); $tbl_quiz_questions = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST); $TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST);
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_stats_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT max(view_count) FROM $TBL_LP_VIEW WHERE c_id = $course_id AND lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition"; $sql = "SELECT max(view_count) FROM $TBL_LP_VIEW WHERE c_id = $course_id AND lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition";
$res = Database::query($sql); $res = Database::query($sql);
@ -945,4 +945,4 @@ if (empty($export_csv)) {
echo $output; echo $output;
} }
Display::display_footer(); Display::display_footer();

@ -211,7 +211,7 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp
$_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db(); $_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db();
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$safe_item_id = intval($_GET['lp_item_id']); $safe_item_id = intval($_GET['lp_item_id']);
@ -542,4 +542,4 @@ $_setting['show_navigation_menu'] = $save_setting;
if ($debug) { if ($debug) {
error_log(' ------- end lp_view.php ------'); error_log(' ------- end lp_view.php ------');
} }
Display::display_footer(); Display::display_footer();

@ -115,9 +115,9 @@ $htmlHeadXtra[] .= $js;
// Database table definitions. // Database table definitions.
//@todo remove this calls //@todo remove this calls
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TABLETRACK_ACCESS_2 = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_ACCESS_2 = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TABLETRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE); $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);

@ -32,10 +32,10 @@ require_once '../newscorm/scormItem.class.php';
/* Constants and variables */ /* Constants and variables */
// regroup table names for maintenance purpose // regroup table names for maintenance purpose
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS); $TABLETRACK_LINKS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$TABLETRACK_DOWNLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$TABLETRACK_ACCESS_2 = Database::get_statistic_table("track_e_access"); $TABLETRACK_ACCESS_2 = Database::get_main_table("track_e_access");
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE); $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);

@ -41,7 +41,7 @@ td {border-bottom: thin dashed gray;}
/*]]>*/ /*]]>*/
</style>"; </style>";
//@todo use Database library //@todo use Database library
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
Display::display_header($nameTools,"Tracking"); Display::display_header($nameTools,"Tracking");
require_once api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php"; require_once api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php";

@ -25,7 +25,7 @@ if (isset($_GET['export'])) {
$export_to_xls = true; $export_to_xls = true;
} }
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if (api_is_platform_admin() && empty($_GET['cidReq'])) { if (api_is_platform_admin() && empty($_GET['cidReq'])) {
$global = true; $global = true;

@ -52,7 +52,7 @@ td {border-bottom: thin dashed gray;}
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER); $TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
$TABLEUSER = Database::get_main_table(TABLE_MAIN_USER); $TABLEUSER = Database::get_main_table(TABLE_MAIN_USER);
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
Display::display_header($nameTools, "Tracking"); Display::display_header($nameTools, "Tracking");
include(api_get_path(LIBRARY_PATH) . "statsUtils.lib.inc.php"); include(api_get_path(LIBRARY_PATH) . "statsUtils.lib.inc.php");
@ -227,4 +227,4 @@ $is_allowedToTrackEverybodyInCourse = api_is_course_admin(); // allowed to track
?> ?>
</table> </table>
<?php <?php
Display::display_footer(); Display::display_footer();

@ -42,9 +42,9 @@ td {border-bottom: thin dashed gray;}
$view = preg_replace('/[^01]/','',$_REQUEST['view']); $view = preg_replace('/[^01]/','',$_REQUEST['view']);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_LOGIN = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $TABLETRACK_LOGIN = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$limitOfDisplayedLogins = 25; // number of logins to display $limitOfDisplayedLogins = 25; // number of logins to display
include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php"); include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");

@ -71,7 +71,7 @@ $reqdate = $_REQUEST['reqdate'];
<table width="100%" cellpadding="2" cellspacing="0" border="0"> <table width="100%" cellpadding="2" cellspacing="0" border="0">
<?php <?php
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
if (isset($courseId)) //stats for the current course if (isset($courseId)) //stats for the current course
{ {
@ -264,4 +264,4 @@ $reqdate = $_REQUEST['reqdate'];
echo get_lang('NotAllowed'); echo get_lang('NotAllowed');
} }
echo '</table>'; echo '</table>';
Display::display_footer(); Display::display_footer();

@ -153,7 +153,7 @@ class UserPortalController extends CommonController
if (!empty($_POST['submitAuth'])) { if (!empty($_POST['submitAuth'])) {
// The user has been already authenticated, we are now to find the last login of the user. // The user has been already authenticated, we are now to find the last login of the user.
if (!empty($this->user_id)) { if (!empty($this->user_id)) {
$track_login_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $track_login_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql_last_login = "SELECT login_date $sql_last_login = "SELECT login_date
FROM $track_login_table FROM $track_login_table
WHERE login_user_id = '".$this->user_id."' WHERE login_user_id = '".$this->user_id."'

@ -4,7 +4,7 @@
* @author Julio Montoya <gugli100@gmail.com> * @author Julio Montoya <gugli100@gmail.com>
* *
*/ */
/** /**
* Initialisation section * Initialisation section
*/ */
@ -16,11 +16,11 @@ require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
* @return array List of user IDs for the users that have just been inserted * @return array List of user IDs for the users that have just been inserted
*/ */
function fill_whoisonline() { function fill_whoisonline() {
$table_e_online = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $table_e_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$max = 100; $max = 100;
//Cleaning the table //Cleaning the table
$sql = "TRUNCATE $table_e_online"; $sql = "TRUNCATE $table_e_online";
$rs = Database::query($sql); $rs = Database::query($sql);
//filling the table //filling the table
for ($i=1;$i <=$max;$i++) { for ($i=1;$i <=$max;$i++) {
@ -28,5 +28,5 @@ function fill_whoisonline() {
$sql = "INSERT INTO $table_e_online (login_id, login_user_id, login_date, login_ip, course, session_id, access_url_id) $sql = "INSERT INTO $table_e_online (login_id, login_user_id, login_date, login_ip, course, session_id, access_url_id)
VALUES ('$i', '$i', '$date', '127.0.0.1', '', '0','1')"; VALUES ('$i', '$i', '$date', '127.0.0.1', '', '0','1')";
$rs = Database::query($sql); $rs = Database::query($sql);
} }
} }

@ -64,7 +64,7 @@ echo Display::page_header(get_lang('UserOnlineListSession'));
course.code, course.code,
".(api_is_western_name_order() ? "CONCAT(user.firstname,' ',user.lastname)" : "CONCAT(user.lastname,' ',user.firstname)")." as name, ".(api_is_western_name_order() ? "CONCAT(user.firstname,' ',user.lastname)" : "CONCAT(user.lastname,' ',user.firstname)")." as name,
user.email user.email
FROM ".Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS)." AS last_access FROM ".Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS)." AS last_access
INNER JOIN ".Database::get_main_table(TABLE_MAIN_USER)." AS user INNER JOIN ".Database::get_main_table(TABLE_MAIN_USER)." AS user
ON user.user_id = last_access.access_user_id ON user.user_id = last_access.access_user_id
INNER JOIN ".Database::get_main_table(TABLE_MAIN_COURSE)." AS course INNER JOIN ".Database::get_main_table(TABLE_MAIN_COURSE)." AS course
@ -115,4 +115,4 @@ echo Display::page_header(get_lang('UserOnlineListSession'));
?> ?>
</table> </table>
<?php <?php
Display::display_footer(); Display::display_footer();

Loading…
Cancel
Save