Minor - format code, update docs

1.10.x
jmontoyaa 9 years ago committed by Angel Fernando Quiroz Campos
parent 9b9f2e09d1
commit 9a27034102
  1. 44
      main/inc/lib/events.lib.php
  2. 2
      main/work/work.lib.php

@ -1769,13 +1769,19 @@ class Event
* end at the same second as the user connected to the course. * 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 $courseId The course in which to add the time
* @param int $userId The user for whom 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 $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 * @param string $ip IP address to go on record for this time record
*
* @return True on successful insertion, false otherwise * @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); $courseTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$time = $loginDate = $logoutDate = api_get_utc_datetime(); $time = $loginDate = $logoutDate = api_get_utc_datetime();
@ -1787,13 +1793,13 @@ class Event
// Get the current latest course connection register. We need that // Get the current latest course connection register. We need that
// record to re-use the data and create a new record. // record to re-use the data and create a new record.
$sql = "SELECT * $sql = "SELECT *
FROM $courseTrackingTable FROM $courseTrackingTable
WHERE WHERE
user_id = ".$userId." AND user_id = ".$userId." AND
c_id = ".$courseId." AND c_id = ".$courseId." AND
session_id = ".$sessionId." AND session_id = ".$sessionId." AND
login_course_date > '$time' - INTERVAL 3600 SECOND login_course_date > '$time' - INTERVAL 3600 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);
// Ignore if we didn't find any course connection record in the last // Ignore if we didn't find any course connection record in the last
@ -1833,16 +1839,16 @@ class Event
); );
// We update the course tracking table // We update the course tracking table
$sql = "UPDATE $courseTrackingTable $sql = "UPDATE $courseTrackingTable
SET SET
login_course_date = '$loginDate', login_course_date = '$loginDate',
logout_course_date = '$courseAccessLoginDate', logout_course_date = '$courseAccessLoginDate',
counter = 0 counter = 0
WHERE WHERE
course_access_id = ".intval($courseAccessId)." AND course_access_id = ".intval($courseAccessId)." AND
session_id = ".$sessionId; session_id = ".$sessionId;
$result = Database::query($sql); Database::query($sql);
return $result; return true;
} }
return false; return false;

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

Loading…
Cancel
Save