Minor - add documentation and error condition to session duration-related functions - refs #8317

1.9.x
Yannick Warnier 11 years ago
parent 2524196fb8
commit 8561a8acb3
  1. 3
      main/inc/lib/course.lib.php
  2. 17
      main/inc/lib/sessionmanager.lib.php

@ -4695,7 +4695,8 @@ class CourseManager
}
/**
* Get information from the track_e_course_access table
* Get login information from the track_e_course_access table, for any
* course in the given session
* @param int $sessionId
* @param int $userId
* @return array

@ -4684,6 +4684,8 @@ class SessionManager
}
/**
* Returns the number of days the student has left in a session when using
* sessions durations
* @param int $userId
* @param int $sessionId
* @param int $duration in days
@ -4691,6 +4693,8 @@ class SessionManager
*/
public static function getDayLeftInSession($sessionId, $userId, $duration)
{
// Get an array with the details of the first access of the student to
// this session
$courseAccess = CourseManager::getFirstCourseAccessPerSessionAndUser(
$sessionId,
$userId
@ -4698,6 +4702,11 @@ class SessionManager
$currentTime = time();
// If no previous access, return false
if (count($courseAccess) == 0) {
return false;
}
$firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
$endDateInSeconds = $firstAccess + $duration*24*60*60;
@ -4728,10 +4737,10 @@ class SessionManager
}
/**
* @param int $userId
* @param int $sessionId
*
* @param return array
* Gets one row from the session_rel_user table
* @param int The user ID
* @param int The session ID
* @return array
*/
public static function getUserSession($userId, $sessionId)
{

Loading…
Cancel
Save