Public Member Functions | |
ilObjSysUserTracking ($a_id=0, $a_call_by_reference=true) | |
Constructor public. | |
update () | |
update object data | |
ilClone ($a_parent_ref) | |
copy all entries of your object. | |
delete () | |
delete object and all related data | |
initDefaultRoles () | |
init default roles settings | |
notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0) | |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts. | |
getRecordsTotal () | |
get total number of tracking records | |
getMonthTotalOverview () | |
get total number of accesses per month | |
getTotalOlderThanMonth ($a_month) | |
get total number of records older than given month (YYYY-MM) | |
getAccessTotalPerUser ($a_condition) | |
get total number of records older than given month (YYYY-MM) | |
getAccessTotalPerObj ($a_condition) | |
get total number of records older than given month (YYYY-MM) | |
getAccessPerUserDetail ($a_condition) | |
get per user of records older than given month (YYYY-MM) | |
deleteTrackingDataBeforeMonth ($a_month) | |
delete tracking data of month (YYYY-MM) and before | |
enableTracking ($a_enable) | |
enable user tracking | |
_enabledTracking () | |
check wether user tracking is enabled or not | |
enableUserRelatedData ($a_enable) | |
enable tracking of user related data | |
_enabledUserRelatedData () | |
check wether user related tracking is enabled or not | |
allAuthor ($a_type, $type) | |
get all author | |
authorLms ($id, $type) | |
get author's all lm or tst | |
getObjId ($title, $type) | |
get obj_id of some object | |
getTestId ($id) | |
get Test_id of some test | |
countResults ($condition) | |
Return the counts of search results. | |
getOwnerName ($id) | |
Return the owner name of the object. |
Definition at line 38 of file class.ilObjSysUserTracking.php.
ilObjSysUserTracking::_enabledTracking | ( | ) |
check wether user tracking is enabled or not
Definition at line 376 of file class.ilObjSysUserTracking.php.
References ilObject::$ilias.
Referenced by ilUserTracking::_trackAccess().
{ global $ilias; return (boolean) $ilias->getSetting("enable_tracking"); }
ilObjSysUserTracking::_enabledUserRelatedData | ( | ) |
check wether user related tracking is enabled or not
Definition at line 403 of file class.ilObjSysUserTracking.php.
References ilObject::$ilias.
Referenced by ilUserTracking::_trackAccess().
{ global $ilias; return (boolean) $ilias->getSetting("save_user_related_data"); }
ilObjSysUserTracking::allAuthor | ( | $ | a_type, | |
$ | type | |||
) |
get all author
Definition at line 413 of file class.ilObjSysUserTracking.php.
References $author, $q, and ilObject::$type.
{ global $ilDB; $q = "SELECT distinct A.obj_id,A.type,A.title FROM object_data as A,object_data as B WHERE A.type = ".$ilDB->quote($a_type)." AND A.obj_id = B.owner AND B.type=".$ilDB->quote($type); //echo $q; $author = $ilDB->query($q); $all = array(); while ($aauthor = $author->fetchRow(DB_FETCHMODE_ASSOC)) { $all[] = array("title" => $aauthor["title"], "obj_id" =>$aauthor["obj_id"]); } return $all; }
ilObjSysUserTracking::authorLms | ( | $ | id, | |
$ | type | |||
) |
get author's all lm or tst
Definition at line 432 of file class.ilObjSysUserTracking.php.
References ilObject::$id, $q, and ilObject::$type.
{ global $ilDB; $q = "SELECT title,obj_id FROM object_data WHERE owner = ".$ilDB->quote($id)." and type=".$ilDB->quote($type); //echo $q."<br>"; $lms = $ilDB->query($q); $all = array(); while ($alms = $lms->fetchRow(DB_FETCHMODE_ASSOC)) { $all[] = array("title" => $alms["title"], "obj_id" =>$alms["obj_id"]); } return $all; }
ilObjSysUserTracking::countResults | ( | $ | condition | ) |
ilObjSysUserTracking::delete | ( | ) |
delete object and all related data
public
Reimplemented from ilObject.
Definition at line 106 of file class.ilObjSysUserTracking.php.
{ // always call parent delete function first!! if (!parent::delete()) { return false; } //put here your module specific stuff return true; }
ilObjSysUserTracking::deleteTrackingDataBeforeMonth | ( | $ | a_month | ) |
delete tracking data of month (YYYY-MM) and before
Definition at line 346 of file class.ilObjSysUserTracking.php.
References $q.
ilObjSysUserTracking::enableTracking | ( | $ | a_enable | ) |
enable user tracking
Definition at line 359 of file class.ilObjSysUserTracking.php.
References ilObject::$ilias.
{ global $ilias; if ($a_enable) { $ilias->setSetting("enable_tracking", 1); } else { $ilias->setSetting("enable_tracking", 0); } }
ilObjSysUserTracking::enableUserRelatedData | ( | $ | a_enable | ) |
enable tracking of user related data
Definition at line 386 of file class.ilObjSysUserTracking.php.
References ilObject::$ilias.
{ global $ilias; if ($a_enable) { $ilias->setSetting("save_user_related_data", 1); } else { $ilias->setSetting("save_user_related_data", 0); } }
ilObjSysUserTracking::getAccessPerUserDetail | ( | $ | a_condition | ) |
get per user of records older than given month (YYYY-MM)
Definition at line 317 of file class.ilObjSysUserTracking.php.
References $q, ilObjUser::_lookupName(), and ilObject::_lookupTitle().
{ global $ilDB; $q ="SELECT user_id,client_ip,acc_obj_id,language ,acc_time ". "FROM ut_access WHERE ".$a_condition; $cnt_set = $ilDB->query($q); $acc = array(); while($cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC)) { $name = ilObjUser::_lookupName($cnt_rec["user_id"]); if ($cnt_rec["user_id"] != 0) { $acc[] = array("user_id" => $cnt_rec["user_id"], "name" => $name["lastname"].", ".$name["firstname"], "client_ip" => $cnt_rec["client_ip"], "acc_obj_id" => ilObject::_lookupTitle($cnt_rec["acc_obj_id"]), "language" => $cnt_rec["language"], "acc_time" => $cnt_rec["acc_time"] ); } } return $acc; }
ilObjSysUserTracking::getAccessTotalPerObj | ( | $ | a_condition | ) |
get total number of records older than given month (YYYY-MM)
Definition at line 293 of file class.ilObjSysUserTracking.php.
References $q, ilObject::_lookupTitle(), and ilObject::getOwnerName().
{ global $ilDB; $q = "SELECT count(*) as cnt,acc_obj_id from ut_access where ".$a_condition. " GROUP BY acc_obj_id"; $cnt_set = $ilDB->query($q); //echo "q:".$q; $acc = array(); while ($cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC)) { if ($cnt_rec["cnt"] != "") { $acc[] = array("title" => ilObject::_lookupTitle($cnt_rec["acc_obj_id"]), "author" => $this->getOwnerName($cnt_rec["acc_obj_id"]), "cnt" => $cnt_rec["cnt"]); } } return $acc; }
ilObjSysUserTracking::getAccessTotalPerUser | ( | $ | a_condition | ) |
get total number of records older than given month (YYYY-MM)
Definition at line 266 of file class.ilObjSysUserTracking.php.
References $q, and ilObjUser::_lookupName().
{ global $ilDB; $q = "SELECT count(*) AS cnt, user_id ". "FROM ut_access WHERE ".$a_condition. " GROUP BY user_id"; $cnt_set = $ilDB->query($q); $acc = array(); while ($cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC)) { $name = ilObjUser::_lookupName($cnt_rec["user_id"]); if ($cnt_rec["user_id"] != 0) { $acc[] = array("user_id" => $cnt_rec["user_id"], "name" => $name["lastname"].", ".$name["firstname"], "cnt" => $cnt_rec["cnt"]); } } return $acc; }
ilObjSysUserTracking::getMonthTotalOverview | ( | ) |
get total number of accesses per month
Definition at line 230 of file class.ilObjSysUserTracking.php.
References $q.
{ global $ilDB; $q = "SELECT count(*) as cnt, count(distinct user_id) as user_cnt, date_format(acc_time,'%Y-%m') AS month FROM ut_access". " GROUP BY month ORDER BY month DESC"; $min_set = $ilDB->query($q); $months = array(); while ($min_rec = $min_set->fetchRow(DB_FETCHMODE_ASSOC)) { $months[] = array("month" => $min_rec["month"], "cnt" => $min_rec["cnt"], "user_cnt" => $min_rec["user_cnt"]); } return $months; }
ilObjSysUserTracking::getObjId | ( | $ | title, | |
$ | type | |||
) |
get obj_id of some object
Definition at line 452 of file class.ilObjSysUserTracking.php.
References ilObject::$id, $obj_id, $q, ilObject::$title, and ilObject::$type.
ilObjSysUserTracking::getOwnerName | ( | $ | id | ) |
Return the owner name of the object.
Definition at line 493 of file class.ilObjSysUserTracking.php.
ilObjSysUserTracking::getRecordsTotal | ( | ) |
get total number of tracking records
Definition at line 215 of file class.ilObjSysUserTracking.php.
References $q.
ilObjSysUserTracking::getTestId | ( | $ | id | ) |
get Test_id of some test
Definition at line 464 of file class.ilObjSysUserTracking.php.
References ilObject::$id, $q, $res, and $result.
ilObjSysUserTracking::getTotalOlderThanMonth | ( | $ | a_month | ) |
get total number of records older than given month (YYYY-MM)
Definition at line 249 of file class.ilObjSysUserTracking.php.
References $q.
{ global $ilDB; $q = "SELECT count(*) as cnt, date_add('$a_month-01', INTERVAL 1 MONTH) as d FROM ut_access WHERE acc_time < ". "date_add('$a_month-01', INTERVAL 1 MONTH)"; $cnt_set = $ilDB->query($q); $cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC); //echo "cnt:".$cnt_rec["cnt"].":date:".$cnt_rec["d"].":"; return $cnt_rec["cnt"]; }
ilObjSysUserTracking::ilClone | ( | $ | a_parent_ref | ) |
copy all entries of your object.
public
integer | ref_id of parent object |
Reimplemented from ilObject.
Definition at line 77 of file class.ilObjSysUserTracking.php.
References $rbacadmin.
{ global $rbacadmin; // always call parent ilClone function first!! $new_ref_id = parent::ilClone($a_parent_ref); // get object instance of ilCloned object //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id); // create a local role folder & default roles //$roles = $newObj->initDefaultRoles(); // ...finally assign role to creator of object //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n"); // always destroy objects in ilClone method because ilClone() is recursive and creates instances for each object in subtree! //unset($newObj); // ... and finally always return new reference ID!! return $new_ref_id; }
ilObjSysUserTracking::ilObjSysUserTracking | ( | $ | a_id = 0 , |
|
$ | a_call_by_reference = true | |||
) |
Constructor public.
integer | reference_id or object_id | |
boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 46 of file class.ilObjSysUserTracking.php.
References ilObject::ilObject().
{ $this->type = "trac"; $this->ilObject($a_id,$a_call_by_reference); }
ilObjSysUserTracking::initDefaultRoles | ( | ) |
init default roles settings
If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum)
public
Reimplemented from ilObject.
Definition at line 128 of file class.ilObjSysUserTracking.php.
References $rbacadmin.
{ global $rbacadmin; // create a local role folder //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId()); // create moderator role and assign role to rolefolder... //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId()); //$roles[] = $roleObj->getId(); //unset($rfoldObj); //unset($roleObj); return $roles ? $roles : array(); }
ilObjSysUserTracking::notify | ( | $ | a_event, | |
$ | a_ref_id, | |||
$ | a_parent_non_rbac_id, | |||
$ | a_node_id, | |||
$ | a_params = 0 | |||
) |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)
public
string | event | |
integer | reference id of object where the event occured | |
array | passes optional parameters if required |
Reimplemented from ilObject.
Definition at line 158 of file class.ilObjSysUserTracking.php.
References $_GET, $tree, and ilObject::getType().
{ global $tree; switch ($a_event) { case "link": //var_dump("<pre>",$a_params,"</pre>"); //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id; //exit; break; case "cut": //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id; //exit; break; case "copy": //var_dump("<pre>",$a_params,"</pre>"); //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id; //exit; break; case "paste": //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id; //exit; break; case "new": //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id; //exit; break; } // At the beginning of the recursive process it avoids second call of the notify function with the same parameter if ($a_node_id==$_GET["ref_id"]) { $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id); $parent_type = $parent_obj->getType(); if($parent_type == $this->getType()) { $a_node_id = (int) $tree->getParentId($a_node_id); } } parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params); }
ilObjSysUserTracking::update | ( | ) |
update object data
public
Reimplemented from ilObject.
Definition at line 58 of file class.ilObjSysUserTracking.php.
{ if (!parent::update()) { return false; } // put here object specific stuff return true; }