34 $this->ilias =& $ilias;
46 global $ilUser,
$ilDB;
49 $q =
"SELECT * from ut_access "
51 .
" user_id = ".$ilDB->quote($ilUser->getId(),
'integer')
52 .
" ORDER BY acc_time DESC";
57 function _hasEntry($a_obj_id, $a_obj_type,$a_sub_id = 0, $a_sub_type =
"")
63 $query =
"SELECT COUNT(id) as num_entries FROM ut_access ".
64 "WHERE session_id = ".$ilDB->quote(session_id(),
"text").
" ".
65 "AND acc_obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
66 "AND acc_sub_id = ".$ilDB->quote($a_sub_id,
"text").
" ";
70 return $row->num_entries ?
true :
false;
82 function _trackAccess($a_obj_id, $a_obj_type,$a_sub_id = 0, $a_sub_type =
"", $a_action_type =
"read")
84 global $ilUser,
$ilDB;
87 include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
93 include_once
'Services/Tracking/classes/class.ilLearningProgress.php';
98 $user_id = $ilUser->getId();
105 $client_ip = getenv(
"REMOTE_ADDR");
106 $script = substr($_SERVER[
"SCRIPT_FILENAME"], strlen(IL_ABSOLUTE_PATH) - 1,
107 strlen($_SERVER[
"SCRIPT_FILENAME"]) - strlen(IL_ABSOLUTE_PATH) + 1);
108 $language = $ilUser->getLanguage();
109 $session_id = session_id();
111 #$last_access = ilTracking::_getLastAccess();
118 $q =
"INSERT INTO ut_access ("
120 .
"user_id, action_type, php_script, client_ip,"
121 .
"acc_obj_type, acc_obj_id, acc_sub_type, acc_sub_id,"
122 .
"language, browser, session_id, acc_time, ut_month"
124 .$ilDB->quote($ilDB->nextId(
'ut_access'),
'integer').
','
125 .$ilDB->quote($user_id,
"integer").
","
126 .$ilDB->quote($a_action_type,
"text").
","
127 .$ilDB->quote($script,
"text").
","
128 .$ilDB->quote($client_ip,
"text").
","
129 .$ilDB->quote($a_obj_type,
"text").
","
130 .$ilDB->quote($a_obj_id,
"integer").
","
131 .$ilDB->quote($a_sub_type,
"text").
","
132 .$ilDB->quote($a_sub_id,
"integer").
","
133 .$ilDB->quote($language,
"text").
","
134 .$ilDB->quote(substr($_SERVER[
"HTTP_USER_AGENT"],0.255)).
","
135 .$ilDB->quote($session_id,
"text").
", "
139 $ilDB->manipulate(
$q);
178 $q =
" SELECT title from object_data "
179 .
" WHERE type = ".$ilDB->quote(
"tst",
"text")
180 .
" AND owner = ".$ilDB->quote($user_id ,
'integer');
181 $res = $this->ilias->db->query(
$q);
182 for($i=0;$i<
$res->numRows();$i++)
193 $from = strtotime($from);
194 $to = strtotime($to);
195 $dayf = date (
"d",$from);
196 $dayt = date (
"d",$to);
197 $yearf = date (
"Y",$from);
198 $yeart = date (
"Y",$to);
199 $montht = date (
"m",$to);
200 $monthf = date (
"m",$from);
201 $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
206 $from = strtotime($from);
207 $to = strtotime($to);
208 $dayf = date (
"d",$from);
209 $dayt = date (
"d",$to);
210 $yearf = date (
"Y",$from);
211 $yeart = date (
"Y",$to);
212 $montht = date (
"m",$to);
213 $monthf = date (
"m",$from);
214 $hourt = date (
"h",$to);
215 $hourf = date (
"h",$from);
216 $ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
222 $time = strtotime($time);
223 $day = date(
"d",$time);
224 $month = date(
"m",$time);
225 $year = date(
"Y",$time);
226 $hour = date(
"H",$time);
227 $min = date(
"i",$time);
228 $sec = date(
"s",$time);
230 $ret = date(
"H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
235 $time = strtotime($time);
236 $day = date(
"d",$time);
237 $month = date(
"m",$time);
238 $year = date(
"y",$time);
239 $min = date(
"i",$time);
240 $hour = date(
"h",$time);
241 $sec = date(
"s",$time);
243 $ret = date (
"Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
251 $q =
"SELECT obj_id from object_data "
252 .
" where type = ".$ilDB->quote(
"lm",
"text").
" and "
253 .
" owner = ".$ilDB->quote($id,
"integer");
254 $res = $this->ilias->db->query(
$q);
255 for($i=0;$i<
$res->numRows();$i++)
265 $q =
"SELECT obj_id from object_data "
266 .
" where type = ".$ilDB->quote(
"tst",
"text").
" and "
267 .
" owner = ".$ilDB->quote($id,
"integer");
268 $res = $this->ilias->db->query(
$q);
269 for($i=0;$i<
$res->numRows();$i++)
280 $q =
"select obj_id from object_data "
281 .
" where type = ".$ilDB->quote(
"tst",
"text").
" and "
282 .
" owner = ".$ilDB->quote($id,
"integer");
283 $res = $this->ilias->db->query(
$q);
284 for ($i=0;$i<
$res->numRows();$i++)
295 $q =
"SELECT count(*) from ut_access "
298 $res = $this->ilias->db->query(
$q);
307 $q =
"SELECT a.login,b.acc_obj_type,b.language,b.client_ip,b.acc_time "
308 .
" FROM usr_data a,ut_access b "
309 .
" WHERE a.usr_id=b.user_id "
312 $res = $this->ilias->db->query(
$q);
313 for($i=0;$i<
$res->numRows();$i++)
324 $q =
"SELECT a.login,b.acc_obj_type,b.client_ip,b.acc_time "
325 .
" FROM usr_data a,ut_access b "
326 .
" WHERE a.usr_id=b.user_id "
329 $res = $this->ilias->db->query(
$q);
330 for($i=0;$i<
$res->numRows();$i++)
341 $q =
"SELECT user_id from ut_access where ".$condition;
343 $res = $this->ilias->db->query(
$q);
344 for($i=0;$i<
$res->numRows();$i++)
355 $q =
"select user_fi from tst_active where ".$condition;
356 $res = $this->ilias->db->query(
$q);
357 for($i=0;$i<
$res->numRows();$i++)
368 $q =
"select obj_id from object_data where type = ".
369 $ilDB->quote(
"tst",
"text").
" and title = ".$ilDB->quote(
$test,
"text");
370 $res = $this->ilias->db->query(
$q);
379 $q =
"SELECT count(*) from ut_access "
380 .
" WHERE (acc_time > ".$ilDB->quote($from,
"timestamp")
381 .
" AND acc_time <= ".$ilDB->quote($from1,
"integer").
")"
385 $res = $this->ilias->db->query(
$q);
394 $q =
"SELECT acc_time from ut_access "
395 .
" WHERE (acc_time > ".$ilDB->quote($from,
"timestamp")
396 .
" AND acc_time <= ".$ilDB->quote($to,
"integer").
")"
400 $res = $this->ilias->db->query(
$q);
401 for($i=0;$i<
$res->numRows();$i++)
412 $q =
"SELECT title from object_data "
414 .
" type = ".$ilDB->quote(
"tst",
"text")
416 .
" owner = ".$ilDB->quote($id,
"integer");
417 $res = $this->ilias->db->query(
$q);
418 for($i=0;$i<
$res->numRows();$i++)