|
|
@ -792,7 +792,15 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!isset($_SESSION['login_as'])) { |
|
|
|
if (!isset($_SESSION['login_as'])) { |
|
|
|
|
|
|
|
$save_course_access = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//The value $_dont_save_user_course_access should be added before the call of global.inc.php see the main/inc/chat.ajax.php file |
|
|
|
|
|
|
|
//Disables the updates in the TRACK_E_COURSE_ACCESS table |
|
|
|
|
|
|
|
if (isset($_dont_save_user_course_access) && $_dont_save_user_course_access == true) { |
|
|
|
|
|
|
|
$save_course_access = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($save_course_access) { |
|
|
|
$course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
|
|
$course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
@ -814,8 +822,7 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or |
|
|
|
$time = api_get_datetime(); |
|
|
|
$time = api_get_datetime(); |
|
|
|
|
|
|
|
|
|
|
|
//We select the last record for the current course in the course tracking table |
|
|
|
//We select the last record for the current course in the course tracking table |
|
|
|
// But only if the login date is < than now + max_life_time |
|
|
|
//But only if the login date is < than now + max_life_time |
|
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT course_access_id FROM $course_tracking_table |
|
|
|
$sql = "SELECT course_access_id FROM $course_tracking_table |
|
|
|
WHERE user_id = ".intval($_user ['user_id'])." AND |
|
|
|
WHERE user_id = ".intval($_user ['user_id'])." AND |
|
|
|
course_code = '$course_code' AND |
|
|
|
course_code = '$course_code' AND |
|
|
@ -823,9 +830,8 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or |
|
|
|
login_course_date > now() - INTERVAL $session_lifetime SECOND |
|
|
|
login_course_date > now() - INTERVAL $session_lifetime SECOND |
|
|
|
ORDER BY login_course_date DESC LIMIT 0,1"; |
|
|
|
ORDER BY login_course_date DESC LIMIT 0,1"; |
|
|
|
$result = Database::query($sql); |
|
|
|
$result = Database::query($sql); |
|
|
|
//error_log($sql); |
|
|
|
|
|
|
|
if (Database::num_rows($result)>0) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Database::num_rows($result) > 0) { |
|
|
|
$i_course_access_id = Database::result($result,0,0); |
|
|
|
$i_course_access_id = Database::result($result,0,0); |
|
|
|
//We update the course tracking table |
|
|
|
//We update the course tracking table |
|
|
|
$sql="UPDATE $course_tracking_table SET logout_course_date = '$time', counter = counter+1 ". |
|
|
|
$sql="UPDATE $course_tracking_table SET logout_course_date = '$time', counter = counter+1 ". |
|
|
@ -839,6 +845,8 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or |
|
|
|
Database::query($sql); |
|
|
|
Database::query($sql); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|