ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilOnlineTracking Class Reference
+ Collaboration diagram for ilOnlineTracking:

Public Member Functions

 _getOnlineTime ($a_user_id)
 _addUser ($a_user_id)
 Add access time.
 _updateAccess ($a_usr_id)
 Update access time.

Detailed Description

Definition at line 18 of file class.ilOnlineTracking.php.

Member Function Documentation

ilOnlineTracking::_addUser (   $a_user_id)

Add access time.

Parameters
int$a_user_id
Returns

Definition at line 42 of file class.ilOnlineTracking.php.

References $ilDB, and $res.

Referenced by ilStartUpGUI\showLogin().

{
global $ilDB;
$res = $ilDB->query("SELECT * FROM ut_online WHERE usr_id = ".
$ilDB->quote($a_user_id, "integer"));
if($res->numRows())
{
return false;
}
$ilDB->manipulate(sprintf("INSERT INTO ut_online (usr_id, access_time) VALUES (%s,%s)",
$ilDB->quote($a_user_id, "integer"),
$ilDB->quote(time(), "integer")));
return true;
}

+ Here is the caller graph for this function:

ilOnlineTracking::_getOnlineTime (   $a_user_id)

Definition at line 21 of file class.ilOnlineTracking.php.

References $ilDB, $res, and $row.

Referenced by ilLPListOfProgressGUI\__appendUserInfo(), and ilLPItemListGUI\renderObjectInfoXML().

{
global $ilDB;
$res = $ilDB->query("SELECT * FROM ut_online WHERE usr_id = ".
$ilDB->quote($a_user_id, "integer"));
while ($row = $ilDB->fetchObject($res))
{
$access_time = $row->access_time;
$online_time = $row->online_time;
}
return (int) $online_time;
}

+ Here is the caller graph for this function:

ilOnlineTracking::_updateAccess (   $a_usr_id)

Update access time.

Parameters
int$a_usr_id
Returns

Definition at line 66 of file class.ilOnlineTracking.php.

References $diff, $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilInitialisation\initILIAS().

{
global $ilDB,$ilias;
$query = "SELECT * FROM ut_online WHERE usr_id = ".
$ilDB->quote($a_usr_id,'integer');
$res = $ilDB->query($query);
if(!$res->numRows())
{
return false;
}
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$access_time = $row->access_time;
$online_time = $row->online_time;
}
$time_span = (int) $ilias->getSetting("tracking_time_span",300);
if(($diff = time() - $access_time) <= $time_span)
{
$ilDB->manipulate(sprintf("UPDATE ut_online SET online_time = online_time + %s, ".
"access_time = %s WHERE usr_id = %s",
$ilDB->quote($diff, "integer"),
$ilDB->quote(time(), "integer"),
$ilDB->quote($a_usr_id, "integer")));
}
else
{
$ilDB->manipulate(sprintf("UPDATE ut_online SET ".
"access_time = %s WHERE usr_id = %s",
$ilDB->quote(time(), "integer"),
$ilDB->quote($a_usr_id, "integer")));
}
return true;
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: