Public Member Functions

ilOnlineTracking Class Reference

Public Member Functions

 _getOnlineTime ($a_user_id)
 _addUser ($a_user_id)
 _updateAccess ($a_usr_id)

Detailed Description

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


Member Function Documentation

ilOnlineTracking::_addUser ( a_user_id  ) 

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

References $query, and $res.

Referenced by ilStartUpGUI::showLogin().

        {
                global $ilDB;

                $query = "SELECT * FROM ut_online WHERE usr_id = '".$a_user_id."'";
                $res = $ilDB->query($query);
                
                if($res->numRows())
                {
                        return false;
                }
                $query = "INSERT INTO ut_online SET usr_id = '".$a_user_id."', access_time = '".time()."'";
                $ilDB->query($query);

                return true;
        }

Here is the caller graph for this function:

ilOnlineTracking::_getOnlineTime ( a_user_id  ) 

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

References $query, $res, and $row.

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

        {
                global $ilDB;

                $query = "SELECT * FROM ut_online WHERE usr_id = '".$a_user_id."'";
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $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  ) 

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

References $ilias, $query, $res, and $row.

Referenced by ilInitialisation::initILIAS().

        {
                global $ilDB,$ilias;

                $query = "SELECT * FROM ut_online WHERE usr_id = '".$a_usr_id."'";
                $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)
                {
                        $query = "UPDATE ut_online SET online_time = online_time + '".$diff."', access_time = '".time().
                                "' WHERE usr_id = '".$a_usr_id."'";
                        $ilDB->query($query);
                }
                else
                {
                        $query = "UPDATE ut_online SET access_time = '".time().
                                "' WHERE usr_id = '".$a_usr_id."'";
                        $ilDB->query($query);
                }
                return true;
        }

Here is the caller graph for this function:


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