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

Public Member Functions

 ilTracking ()
 _getLastAccess ()
 get last access data of current user
 _hasEntry ($a_obj_id, $a_obj_type, $a_sub_id=0, $a_sub_type="")
 _trackAccess ($a_obj_id, $a_obj_type, $a_sub_id=0, $a_sub_type="", $a_action_type="read")
 track access to an object by current user
 TestTitle ($user_id)
 numDay ($from, $to)
 numHour ($from, $to)
 addHour ($time)
 addDay ($time)
 getSubId ($id)
 getSubTest ($id)
 getTestId ($id)
 countResults ($condition)
 searchResults ($condition)
 searchTestResults ($condition)
 searchUserId ($condition)
 searchTestId ($condition)
 getPerTestId ($test)
 countNum ($from, $from1, $condition)
 selectTime ($from, $to, $condition)
 getTest ($id)

Data Fields

 $objId
 $userId
 $actionType
 $phpScript
 $clientIp
 $accObjType
 $accObjId
 $accSubType
 $accSubId
 $lanugage
 $browser
 $sessionId
 $acc_time
 $db

Detailed Description

Definition at line 12 of file class.ilTracking.php.

Member Function Documentation

ilTracking::_getLastAccess ( )

get last access data of current user

Definition at line 44 of file class.ilTracking.php.

References $ilDB, $q, $res, and DB_FETCHMODE_ASSOC.

{
global $ilUser, $ilDB;
$ilDB->setLimit(1);
$q = "SELECT * from ut_access "
." WHERE "
." user_id = ".$ilDB->quote($ilUser->getId(),'integer')
." ORDER BY acc_time DESC";
$res = $ilDB->query($q);
return $res->fetchRow(DB_FETCHMODE_ASSOC);
}
ilTracking::_hasEntry (   $a_obj_id,
  $a_obj_type,
  $a_sub_id = 0,
  $a_sub_type = "" 
)

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

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

Referenced by _trackAccess().

{
global $ilDB;
// We query for the session_id since it is more unique than the user_id.
$query = "SELECT COUNT(id) as num_entries FROM ut_access ".
"WHERE session_id = ".$ilDB->quote(session_id(), "text")." ".
"AND acc_obj_id = ".$ilDB->quote($a_obj_id, "integer")." ".
"AND acc_sub_id = ".$ilDB->quote($a_sub_id, "text")." ";
$res = $ilDB->query($query);
return $row->num_entries ? true : false;
}

+ Here is the caller graph for this function:

ilTracking::_trackAccess (   $a_obj_id,
  $a_obj_type,
  $a_sub_id = 0,
  $a_sub_type = "",
  $a_action_type = "read" 
)

track access to an object by current user

Parameters
int$a_obj_idobject id
string$a_obj_typeobject type (e.g. "lm")
int$a_sub_idsubobject id
string$a_sub_typesubobject type (e.g. "pg")
string$a_action_type"read", "write", ...

Definition at line 82 of file class.ilTracking.php.

References $ilDB, $q, ilObjUserTracking\_enabledLearningProgress(), ilObjUserTracking\_enabledTracking(), ilObjUserTracking\_enabledUserRelatedData(), _hasEntry(), ilLearningProgress\_tracProgress(), and ilUtil\now().

Referenced by ilLMPresentationGUI\ilPage(), and ilObjFileBasedLMGUI\showLearningModule().

{
global $ilUser, $ilDB;
include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
{
return false;
}
include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
ilLearningProgress::_tracProgress($ilUser->getId(),$a_obj_id,$a_obj_type);
{
$user_id = $ilUser->getId();
}
else
{
$user_id = 0;
}
$client_ip = getenv("REMOTE_ADDR");
$script = substr($_SERVER["SCRIPT_FILENAME"], strlen(IL_ABSOLUTE_PATH) - 1,
strlen($_SERVER["SCRIPT_FILENAME"]) - strlen(IL_ABSOLUTE_PATH) + 1);
$language = $ilUser->getLanguage();
$session_id = session_id();
#$last_access = ilTracking::_getLastAccess();
if(ilTracking::_hasEntry($a_obj_id, $a_obj_type,$a_sub_id, $a_sub_type))
{
return true;
}
$q = "INSERT INTO ut_access ("
."id,"
."user_id, action_type, php_script, client_ip,"
."acc_obj_type, acc_obj_id, acc_sub_type, acc_sub_id,"
."language, browser, session_id, acc_time, ut_month"
.") VALUES ("
.$ilDB->quote($ilDB->nextId('ut_access'),'integer').','
.$ilDB->quote($user_id, "integer").","
.$ilDB->quote($a_action_type, "text").","
.$ilDB->quote($script, "text").","
.$ilDB->quote($client_ip, "text").","
.$ilDB->quote($a_obj_type, "text").","
.$ilDB->quote($a_obj_id, "integer").","
.$ilDB->quote($a_sub_type, "text").","
.$ilDB->quote($a_sub_id, "integer").","
.$ilDB->quote($language, "text").","
.$ilDB->quote(substr($_SERVER["HTTP_USER_AGENT"],0.255)).","
.$ilDB->quote($session_id, "text").", "
.$ilDB->quote(ilUtil::now(), "timestamp").", "
.$ilDB->quote(substr(ilUtil::now(), 0, 7), "text")
.")";
$ilDB->manipulate($q);
/*
if(($session_id == $last_access["session_id"]) &&
($a_obj_id == $last_access["acc_obj_id"]) &&
($a_obj_type == $last_access["acc_obj_type"]) &&
($a_sub_id == $last_access["acc_sub_id"]) &&
($a_sub_type == $last_access["acc_sub_type"])
)
{
return true;
}
else
{
$q = "INSERT INTO ut_access ("
."user_id, action_type, php_script, client_ip,"
."acc_obj_type, acc_obj_id, acc_sub_type, acc_sub_id,"
."language, browser, session_id, acc_time"
.") VALUES ("
.$ilDB->quote($user_id).","
.$ilDB->quote($a_action_type).","
.$ilDB->quote($script).","
.$ilDB->quote($client_ip).","
.$ilDB->quote($a_obj_type).","
.$ilDB->quote($a_obj_id).","
.$ilDB->quote($a_sub_type).","
.$ilDB->quote($a_sub_id).","
.$ilDB->quote($language).","
.$ilDB->quote($_SERVER["HTTP_USER_AGENT"]).","
.$ilDB->quote($session_id).", now()"
.")";
$ilDB->query($q);
}
*/
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTracking::addDay (   $time)

Definition at line 233 of file class.ilTracking.php.

References $ret.

{
$time = strtotime($time);
$day = date("d",$time);
$month = date("m",$time);
$year = date("y",$time);
$min = date("i",$time);
$hour = date("h",$time);
$sec = date("s",$time);
$day = $day + 1;
$ret = date ("Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
return $ret;
}
ilTracking::addHour (   $time)

Definition at line 220 of file class.ilTracking.php.

References $ret.

{
$time = strtotime($time);
$day = date("d",$time);
$month = date("m",$time);
$year = date("Y",$time);
$hour = date("H",$time);
$min = date("i",$time);
$sec = date("s",$time);
$hour = $hour+1;
$ret = date("H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
return $ret;
}
ilTracking::countNum (   $from,
  $from1,
  $condition 
)

Definition at line 375 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT count(*) from ut_access "
." WHERE (acc_time > ".$ilDB->quote($from, "timestamp")
." AND acc_time <= ".$ilDB->quote($from1, "integer").")"
." AND ".$condition;
//echo $condition;echo "<br>";
//echo $q;
$res = $this->ilias->db->query($q);
$result = $res->fetchRow();
return $result[0];
}
ilTracking::countResults (   $condition)

Definition at line 291 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT count(*) from ut_access "
." WHERE "
.$condition;
$res = $this->ilias->db->query($q);
$result = $res->fetchRow();
return $result[0];
}
ilTracking::getPerTestId (   $test)

Definition at line 364 of file class.ilTracking.php.

References $ilDB, $q, $res, $result, and $test.

{
global $ilDB;
$q = "select obj_id from object_data where type = ".
$ilDB->quote("tst", "text")." and title = ".$ilDB->quote($test, "text");
$res = $this->ilias->db->query($q);
$result = $res->fetchRow();
return $result[0];
}
ilTracking::getSubId (   $id)

Definition at line 247 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT obj_id from object_data "
." where type = ".$ilDB->quote("lm", "text")." and "
." owner = ".$ilDB->quote($id, "integer");
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::getSubTest (   $id)

Definition at line 261 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT obj_id from object_data "
." where type = ".$ilDB->quote("tst", "text")." and "
." owner = ".$ilDB->quote($id, "integer");
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::getTest (   $id)

Definition at line 408 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT title from object_data "
." WHERE "
." type = ".$ilDB->quote("tst", "text")
." and "
." owner = ".$ilDB->quote($id, "integer");
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::getTestId (   $id)

Definition at line 276 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "select obj_id from object_data "
." where type = ".$ilDB->quote("tst", "text")." and "
." owner = ".$ilDB->quote($id, "integer");
$res = $this->ilias->db->query($q);
for ($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::ilTracking ( )

Definition at line 30 of file class.ilTracking.php.

References $ilDB, $lng, and $tpl.

{
global $ilias,$tpl,$lng,$ilDB;
$this->ilias =& $ilias;
$this->tpl =& $tpl;
$this->lng =& $lng;
$this->db = $ilDB;
}
ilTracking::numDay (   $from,
  $to 
)

Definition at line 191 of file class.ilTracking.php.

References $ret.

{
$from = strtotime($from);
$to = strtotime($to);
$dayf = date ("d",$from);
$dayt = date ("d",$to);
$yearf = date ("Y",$from);
$yeart = date ("Y",$to);
$montht = date ("m",$to);
$monthf = date ("m",$from);
$ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
return $ret;
}
ilTracking::numHour (   $from,
  $to 
)

Definition at line 204 of file class.ilTracking.php.

References $ret.

{
$from = strtotime($from);
$to = strtotime($to);
$dayf = date ("d",$from);
$dayt = date ("d",$to);
$yearf = date ("Y",$from);
$yeart = date ("Y",$to);
$montht = date ("m",$to);
$monthf = date ("m",$from);
$hourt = date ("h",$to);
$hourf = date ("h",$from);
$ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
$ret = strftime($ret);
return $ret;
}
ilTracking::searchResults (   $condition)

Definition at line 303 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT a.login,b.acc_obj_type,b.language,b.client_ip,b.acc_time "
." FROM usr_data a,ut_access b "
." WHERE a.usr_id=b.user_id "
." AND ".$condition;
//echo $q;
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::searchTestId (   $condition)

Definition at line 351 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "select user_fi from tst_active where ".$condition;
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::searchTestResults (   $condition)

Definition at line 320 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT a.login,b.acc_obj_type,b.client_ip,b.acc_time "
." FROM usr_data a,ut_access b "
." WHERE a.usr_id=b.user_id "
." AND ".$condition;
//echo $q;
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::searchUserId (   $condition)

Definition at line 337 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT user_id from ut_access where ".$condition;
//echo $q;
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::selectTime (   $from,
  $to,
  $condition 
)

Definition at line 390 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = "SELECT acc_time from ut_access "
." WHERE (acc_time > ".$ilDB->quote($from, "timestamp")
." AND acc_time <= ".$ilDB->quote($to, "integer").")"
." AND ".$condition;
//echo $q;
//echo "<br>";
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}
ilTracking::TestTitle (   $user_id)

Definition at line 174 of file class.ilTracking.php.

References $ilDB, $q, $res, and $result.

{
global $ilDB;
$q = " SELECT title from object_data "
." WHERE type = ".$ilDB->quote("tst", "text")
." AND owner = ".$ilDB->quote($user_id ,'integer');
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}

Field Documentation

ilTracking::$acc_time

Definition at line 26 of file class.ilTracking.php.

ilTracking::$accObjId

Definition at line 20 of file class.ilTracking.php.

ilTracking::$accObjType

Definition at line 19 of file class.ilTracking.php.

ilTracking::$accSubId

Definition at line 22 of file class.ilTracking.php.

ilTracking::$accSubType

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

ilTracking::$actionType

Definition at line 16 of file class.ilTracking.php.

ilTracking::$browser

Definition at line 24 of file class.ilTracking.php.

ilTracking::$clientIp

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

ilTracking::$db

Definition at line 28 of file class.ilTracking.php.

ilTracking::$lanugage

Definition at line 23 of file class.ilTracking.php.

ilTracking::$objId

Definition at line 14 of file class.ilTracking.php.

ilTracking::$phpScript

Definition at line 17 of file class.ilTracking.php.

ilTracking::$sessionId

Definition at line 25 of file class.ilTracking.php.

ilTracking::$userId

Definition at line 15 of file class.ilTracking.php.


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