Minor - update php docs, show error_log as recommended by yw

pull/2487/head
jmontoyaa 7 years ago
parent 0a70fe1c5c
commit ab4d2f1d4f
  1. 17
      main/lp/learnpathItem.class.php

@ -1815,7 +1815,7 @@ class learnpathItem
} }
return 0; return 0;
} else { } else {
$time = self::fixAbusiveTime($time); $time = $this->fixAbusiveTime($time);
if (self::DEBUG > 2) { if (self::DEBUG > 2) {
error_log( error_log(
'Current start time = '.$this->current_start_time.', current stop time = '. 'Current start time = '.$this->current_start_time.', current stop time = '.
@ -1827,10 +1827,14 @@ class learnpathItem
} }
/** /**
* Sometimes time recorded for a learning path item is superior to the maximum allowed duration of the session.
* In this case, this session resets the time for that particular learning path item to 5 minutes
* (something more realistic, that is also used when leaving the portal without closing one's session).
*
* @param int $time * @param int $time
* @return int * @return int
*/ */
public static function fixAbusiveTime($time) public function fixAbusiveTime($time)
{ {
// Code based from Event::courseLogout // Code based from Event::courseLogout
$sessionLifetime = api_get_configuration_value('session_lifetime'); $sessionLifetime = api_get_configuration_value('session_lifetime');
@ -1841,9 +1845,8 @@ class learnpathItem
$fixedAddedMinute = 5 * 60; // Add only 5 minutes $fixedAddedMinute = 5 * 60; // Add only 5 minutes
if ($time > $sessionLifetime) { if ($time > $sessionLifetime) {
if (self::DEBUG > 2) { error_log("fixAbusiveTime: Total time is too big: $time replaced with: $fixedAddedMinute");
error_log("Total time is too big: $time replaced with: $fixedAddedMinute"); error_log("item_id : ".$this->db_id." lp_item_view.iid: ".$this->db_item_view_id);
}
$time = $fixedAddedMinute; $time = $fixedAddedMinute;
} }
@ -3512,7 +3515,7 @@ class learnpathItem
$total_time += $total_sec; $total_time += $total_sec;
} else { } 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_sec = self::fixAbusiveTime($total_sec); $total_sec = $this->fixAbusiveTime($total_sec);
$total_time = $total_time - $this->last_scorm_session_time + $total_sec; $total_time = $total_time - $this->last_scorm_session_time + $total_sec;
$this->last_scorm_session_time = $total_sec; $this->last_scorm_session_time = $total_sec;
@ -3845,7 +3848,7 @@ class learnpathItem
$row_dates['exe_date'] $row_dates['exe_date']
); );
$mytime = ((int) $time_exe_date - (int) $time_start_date); $mytime = ((int) $time_exe_date - (int) $time_start_date);
$mytime = self::fixAbusiveTime($mytime); $mytime = $this->fixAbusiveTime($mytime);
$total_time = " total_time = ".$mytime.", "; $total_time = " total_time = ".$mytime.", ";
} }
} else { } else {

Loading…
Cancel
Save