Minor - format code, update docs

pull/2487/head
jmontoyaa 8 years ago
parent 80348d1834
commit ea6e24f9fc
  1. 44
      main/inc/lib/events.lib.php
  2. 2
      main/work/work.lib.php

@ -1802,13 +1802,19 @@ class Event
* end at the same second as the user connected to the course.
* @param int $courseId The course in which to add the time
* @param int $userId The user for whom to add the time
* @param $sessionId The session in which to add the time (if any)
* @param int $sessionId The session in which to add the time (if any)
* @param string $virtualTime The amount of time to be added, in a hh:mm:ss format. If int, we consider it is expressed in hours.
* @param string $ip IP address to go on record for this time record
*
* @return True on successful insertion, false otherwise
*/
public static function eventAddVirtualCourseTime($courseId, $userId, $sessionId, $virtualTime = '', $ip = '')
{
public static function eventAddVirtualCourseTime(
$courseId,
$userId,
$sessionId,
$virtualTime = '',
$ip = ''
) {
$courseTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$time = $loginDate = $logoutDate = api_get_utc_datetime();
@ -1820,13 +1826,13 @@ class Event
// Get the current latest course connection register. We need that
// record to re-use the data and create a new record.
$sql = "SELECT *
FROM $courseTrackingTable
WHERE
user_id = ".$userId." AND
c_id = ".$courseId." AND
session_id = ".$sessionId." AND
login_course_date > '$time' - INTERVAL 3600 SECOND
ORDER BY login_course_date DESC LIMIT 0,1";
FROM $courseTrackingTable
WHERE
user_id = ".$userId." AND
c_id = ".$courseId." AND
session_id = ".$sessionId." AND
login_course_date > '$time' - INTERVAL 3600 SECOND
ORDER BY login_course_date DESC LIMIT 0,1";
$result = Database::query($sql);
// Ignore if we didn't find any course connection record in the last
@ -1866,16 +1872,16 @@ class Event
);
// We update the course tracking table
$sql = "UPDATE $courseTrackingTable
SET
login_course_date = '$loginDate',
logout_course_date = '$courseAccessLoginDate',
counter = 0
WHERE
course_access_id = ".intval($courseAccessId)." AND
session_id = ".$sessionId;
$result = Database::query($sql);
SET
login_course_date = '$loginDate',
logout_course_date = '$courseAccessLoginDate',
counter = 0
WHERE
course_access_id = ".intval($courseAccessId)." AND
session_id = ".$sessionId;
Database::query($sql);
return $result;
return true;
}
return false;

@ -3837,7 +3837,6 @@ function processWorkForm(
);
$workingTime = null;
foreach ($resultExtra as $field) {
$field = $field['value'];
@ -3848,6 +3847,7 @@ function processWorkForm(
// If no time was defined, or a time of "0" was set, do nothing
if (!empty($workingTime)) {
// If some time is set, get the list of docs handed in by
// this student (to make sure we count the time only once)
$userWorks = get_work_user_list(

Loading…
Cancel
Save