|
|
|
|
@ -3601,8 +3601,6 @@ class learnpathItem |
|
|
|
|
{ |
|
|
|
|
if (self::debug > 0) { |
|
|
|
|
error_log('Funcion called: scorm_update_time'); |
|
|
|
|
} |
|
|
|
|
if (self::debug > 0) { |
|
|
|
|
error_log("total_sec: $total_sec"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -3610,12 +3608,13 @@ class learnpathItem |
|
|
|
|
$item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
|
|
|
|
|
$get_view_sql = 'SELECT total_time, status FROM ' . $item_view_table . ' |
|
|
|
|
WHERE c_id = ' . $course_id . ' |
|
|
|
|
AND lp_item_id="' . $this->db_id . '" |
|
|
|
|
AND lp_view_id="' . $this->view_id . '" |
|
|
|
|
AND view_count="' . $this->get_attempt_id() . '"'; |
|
|
|
|
$result = Database::query($get_view_sql); |
|
|
|
|
$sql = 'SELECT total_time, status FROM ' . $item_view_table . ' |
|
|
|
|
WHERE |
|
|
|
|
c_id = ' . $course_id . ' AND |
|
|
|
|
lp_item_id="' . $this->db_id . '" AND |
|
|
|
|
lp_view_id="' . $this->view_id . '" AND |
|
|
|
|
view_count="' . $this->get_attempt_id() . '"'; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$row = Database::fetch_array($result); |
|
|
|
|
|
|
|
|
|
if (!isset($row['total_time'])) { |
|
|
|
|
@ -3630,7 +3629,7 @@ class learnpathItem |
|
|
|
|
$lp_table = Database::get_course_table(TABLE_LP_MAIN); |
|
|
|
|
$lp_id = intval($this->lp_id); |
|
|
|
|
$sql = "SELECT * FROM $lp_table |
|
|
|
|
WHERE id = $lp_id AND c_id = $course_id"; |
|
|
|
|
WHERE id = $lp_id AND c_id = $course_id"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
$accumulateScormTime = 'false'; |
|
|
|
|
if (Database::num_rows($res) > 0) { |
|
|
|
|
@ -3638,15 +3637,15 @@ class learnpathItem |
|
|
|
|
$accumulateScormTime = $row['accumulate_scorm_time']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Step 2.1 : if normal mode total_time = total_time + total_sec |
|
|
|
|
// Step 2.1 : if normal mode total_time = total_time + total_sec |
|
|
|
|
if ($accumulateScormTime != 0) { |
|
|
|
|
$total_time += $total_sec; |
|
|
|
|
//$this->last_scorm_session_time = $total_sec; |
|
|
|
|
} else { |
|
|
|
|
//Step 2.2 : if not cumulative mode total_time = total_time - last_update + total_sec |
|
|
|
|
// Step 2.2 : if not cumulative mode total_time = total_time - last_update + total_sec |
|
|
|
|
$total_time = $total_time - $this->last_scorm_session_time + $total_sec; |
|
|
|
|
$this->last_scorm_session_time = $total_sec; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Step 3 update db only if status != completed, passed, browsed or seriousgamemode not activated |
|
|
|
|
$case_completed = array( |
|
|
|
|
'completed', |
|
|
|
|
@ -3660,10 +3659,11 @@ class learnpathItem |
|
|
|
|
) { |
|
|
|
|
$sql = "UPDATE $item_view_table |
|
|
|
|
SET total_time = '$total_time' |
|
|
|
|
WHERE c_id = $course_id |
|
|
|
|
AND lp_item_id = {$this->db_id} |
|
|
|
|
AND lp_view_id = {$this->view_id} |
|
|
|
|
AND view_count = {$this->get_attempt_id()}"; |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
lp_item_id = {$this->db_id} AND |
|
|
|
|
lp_view_id = {$this->view_id} AND |
|
|
|
|
view_count = {$this->get_attempt_id()}"; |
|
|
|
|
if (self::debug > 0) { |
|
|
|
|
error_log($sql); |
|
|
|
|
} |
|
|
|
|
@ -3679,7 +3679,8 @@ class learnpathItem |
|
|
|
|
$item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$sql = 'UPDATE ' . $item_view_table . ' |
|
|
|
|
SET total_time = 0, start_time=' . time() . ' |
|
|
|
|
SET total_time = 0, |
|
|
|
|
start_time=' . time() . ' |
|
|
|
|
WHERE c_id = ' . $course_id . ' |
|
|
|
|
AND lp_item_id="' . $this->db_id . '" |
|
|
|
|
AND lp_view_id="' . $this->view_id . '" |
|
|
|
|
@ -3737,21 +3738,11 @@ class learnpathItem |
|
|
|
|
$iva_row = Database::fetch_array($iva_res); |
|
|
|
|
$iva_id = $iva_row[0]; |
|
|
|
|
$ivau_sql = "UPDATE $iva_table " . |
|
|
|
|
"SET objective_id = '" . Database::escape_string( |
|
|
|
|
$objective[0] |
|
|
|
|
) . "'," . |
|
|
|
|
"status = '" . Database::escape_string( |
|
|
|
|
$objective[1] |
|
|
|
|
) . "'," . |
|
|
|
|
"score_raw = '" . Database::escape_string( |
|
|
|
|
$objective[2] |
|
|
|
|
) . "'," . |
|
|
|
|
"score_min = '" . Database::escape_string( |
|
|
|
|
$objective[4] |
|
|
|
|
) . "'," . |
|
|
|
|
"score_max = '" . Database::escape_string( |
|
|
|
|
$objective[3] |
|
|
|
|
) . "' " . |
|
|
|
|
"SET objective_id = '" . Database::escape_string($objective[0]) . "'," . |
|
|
|
|
"status = '" . Database::escape_string($objective[1]) . "'," . |
|
|
|
|
"score_raw = '" . Database::escape_string($objective[2]) . "'," . |
|
|
|
|
"score_min = '" . Database::escape_string($objective[4]) . "'," . |
|
|
|
|
"score_max = '" . Database::escape_string($objective[3]) . "' " . |
|
|
|
|
"WHERE c_id = $course_id AND id = $iva_id"; |
|
|
|
|
Database::query($ivau_sql); |
|
|
|
|
} else { |
|
|
|
|
|