Public Member Functions | Data Fields

ilObjUserTracking Class Reference

Inheritance diagram for ilObjUserTracking:
Collaboration diagram for ilObjUserTracking:

Public Member Functions

 ilObjUserTracking ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 setActivationStatus ($a_status)
 getActivationStatus ()
 enableTracking ($a_enable)
 enable user tracking
 enabledTracking ()
 _enabledTracking ()
 check wether learing progress is enabled or not
 enabledLearningProgress ()
 _enabledLearningProgress ()
 check wether learing progress is enabled or not
 enableUserRelatedData ($a_enable)
 enable tracking of user related data
 enabledUserRelatedData ()
 _enabledUserRelatedData ()
 check wether user related tracking is enabled or not
 setValidTimeSpan ($a_time_span)
 getValidTimeSpan ()
 _getValidTimeSpan ()
 updateSettings ()
 validateSettings ()
 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, $a_searchTermsCondition="", $a_objectCondition="")
 get total number of records older than given month (YYYY-MM)
 getAccessTotalPerObj ($a_condition, $a_searchTermsCondition="")
 get total number of records older than given month (YYYY-MM)
 getDuration ($a_obj_id)
 getAccessPerUserDetail ($a_condition, $a_searchTermsCondition="", $a_objectCondition="")
 get per user of records older than given month (YYYY-MM)
 deleteTrackingDataBeforeMonth ($a_month)
 delete tracking data of month (YYYY-MM) and before
 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.
 __readSettings ()
 _deleteUser ($a_usr_id)

Data Fields

 $valid_time_span = null

Detailed Description

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


Member Function Documentation

ilObjUserTracking::__readSettings (  ) 

Definition at line 446 of file class.ilObjUserTracking.php.

References ilObject::$ilias, enableUserRelatedData(), and setValidTimeSpan().

Referenced by ilObjUserTracking().

        {
                global $ilias;

                #$this->enableTracking($ilias->getSetting("enable_tracking",0));
                $this->status = $ilias->getSetting('enable_tracking',UT_INACTIVE_BOTH);
                $this->enableUserRelatedData($ilias->getSetting("save_user_related_data",0));
                $this->setValidTimeSpan($ilias->getSetting("tracking_time_span",DEFAULT_TIME_SPAN));

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUserTracking::_deleteUser ( a_usr_id  ) 

Definition at line 458 of file class.ilObjUserTracking.php.

References $query.

Referenced by ilObjUser::delete().

        {
                global $ilDB;

                $query = "DELETE FROM ut_access WHERE user_id = '".$a_usr_id."'";
                $ilDB->query($query);

                $query = "DELETE FROM ut_learning_progress WHERE user_id = '".$a_usr_id."'";
                $ilDB->query($query);
                
                $query = "DELETE FROM ut_lp_filter WHERE usr_id = '".$a_usr_id."'";
                $ilDB->query($query);
                
                $query = "DELETE FROM ut_lp_marks WHERE usr_id = '".$a_usr_id."'";
                $ilDB->query($query);

                $query = "DELETE FROM ut_online WHERE usr_id = '".$a_usr_id."'";
                $ilDB->query($query);

                return true;
        }

Here is the caller graph for this function:

ilObjUserTracking::_enabledLearningProgress (  ) 
ilObjUserTracking::_enabledTracking (  ) 

check wether learing progress is enabled or not

Definition at line 96 of file class.ilObjUserTracking.php.

References ilObject::$ilias.

Referenced by ilTracking::_trackAccess(), and ilObjUserFolderGUI::getTabs().

        {
                global $ilias;

                $status = $ilias->getSetting("enable_tracking");

                return ($status == UT_ACTIVE_UT) || ($status == UT_ACTIVE_BOTH);
        }

Here is the caller graph for this function:

ilObjUserTracking::_enabledUserRelatedData (  ) 

check wether user related tracking is enabled or not

Definition at line 139 of file class.ilObjUserTracking.php.

Referenced by ilTracking::_trackAccess(), ilLMStatistics::calcStats(), ilObjUserFolderGUI::getTabs(), ilLearningProgressBaseGUI::ilLearningProgressBaseGUI(), ilObjCourseGUI::membersObject(), ilLPObjectItemListGUI::renderPath(), ilLPListOfSettingsGUI::show(), ilLMStatisticsGUI::show(), and ilObjUserTrackingGUI::showForm().

        {
                global $ilSetting;
                return (boolean) $ilSetting->get('save_user_related_data');
        }

Here is the caller graph for this function:

ilObjUserTracking::_getValidTimeSpan (  ) 

Definition at line 157 of file class.ilObjUserTracking.php.

References ilObject::$ilias.

Referenced by ilLearningProgress::_updateProgress(), and ilLPListOfSettingsGUI::show().

        {
                global $ilias;
                
                return (int) $ilias->getSetting("tracking_time_span",DEFAULT_TIME_SPAN);
        }

Here is the caller graph for this function:

ilObjUserTracking::allAuthor ( a_type,
type 
)

get all author

Definition at line 356 of file class.ilObjUserTracking.php.

References $author, $q, and ilObject::$type.

Referenced by ilObjUserTrackingGUI::getObjectCondition().

        {
                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;
        }

Here is the caller graph for this function:

ilObjUserTracking::authorLms ( id,
type 
)

get author's all lm or tst

Definition at line 376 of file class.ilObjUserTracking.php.

References ilObject::$id, $q, and ilObject::$type.

Referenced by ilObjUserTrackingGUI::getObjectCondition().

        {
                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;
                
        }

Here is the caller graph for this function:

ilObjUserTracking::countResults ( condition  ) 

Return the counts of search results.

Definition at line 424 of file class.ilObjUserTracking.php.

References $q, $res, and $result.

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

ilObjUserTracking::deleteTrackingDataBeforeMonth ( a_month  ) 

delete tracking data of month (YYYY-MM) and before

Definition at line 342 of file class.ilObjUserTracking.php.

References $q.

        {
                global $ilDB;

                $q = "DELETE FROM ut_access WHERE acc_time <= ".
                        "date_add('$a_month-01', INTERVAL 1 MONTH)";

                $ilDB->query($q);
        }

ilObjUserTracking::enabledLearningProgress (  ) 

Definition at line 105 of file class.ilObjUserTracking.php.

        {
                return ($this->status == UT_ACTIVE_LP) || ($this->status == UT_ACTIVE_BOTH);
        }

ilObjUserTracking::enabledTracking (  ) 

Definition at line 88 of file class.ilObjUserTracking.php.

        {
                return ($this->status == UT_ACTIVE_UT) || ($this->status == UT_ACTIVE_BOTH);
        }

ilObjUserTracking::enabledUserRelatedData (  ) 

Definition at line 130 of file class.ilObjUserTracking.php.

Referenced by updateSettings().

        {
                return $this->tracking_user_related ? true : false;
        }

Here is the caller graph for this function:

ilObjUserTracking::enableTracking ( a_enable  ) 

enable user tracking

Definition at line 79 of file class.ilObjUserTracking.php.

        {
                echo 'deprecated';

                $this->tracking_enabled = (bool) $a_enable;

                return true;
        }

ilObjUserTracking::enableUserRelatedData ( a_enable  ) 

enable tracking of user related data

Definition at line 125 of file class.ilObjUserTracking.php.

Referenced by __readSettings().

        {
                $this->tracking_user_related = (bool) $a_enable;
        }

Here is the caller graph for this function:

ilObjUserTracking::getAccessPerUserDetail ( a_condition,
a_searchTermsCondition = "",
a_objectCondition = "" 
)

get per user of records older than given month (YYYY-MM)

Definition at line 309 of file class.ilObjUserTracking.php.

References $q, ilObjUser::_lookupName(), and ilObject::_lookupTitle().

        {
                global $ilDB;

                $q = "SELECT id, user_id,client_ip,acc_obj_id,language ,acc_time FROM ut_access "
                        .($a_searchTermsCondition != "" ? $a_searchTermsCondition : " WHERE ")
                        .$a_condition
                        .$a_objectCondition
                        ." GROUP BY 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"],
                                        "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;
        }

Here is the call graph for this function:

ilObjUserTracking::getAccessTotalPerObj ( a_condition,
a_searchTermsCondition = "" 
)

get total number of records older than given month (YYYY-MM)

Definition at line 270 of file class.ilObjUserTracking.php.

References $q, ilObject::_lookupTitle(), getDuration(), and ilObject::getOwnerName().

        {
                global $ilDB;
                $q = "SELECT count(acc_obj_id) AS cnt, acc_obj_id FROM ut_access "
                        .($a_searchTermsCondition != "" ? $a_searchTermsCondition : " 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("id" => $cnt_rec["acc_obj_id"],
                                        "title" => ilObject::_lookupTitle($cnt_rec["acc_obj_id"]),
                                        "author" => $this->getOwnerName($cnt_rec["acc_obj_id"]),
                                        "duration" => $this->getDuration($cnt_rec["acc_obj_id"]),
                                        "cnt" => $cnt_rec["cnt"]);
                        }
                }
                return $acc;
        }

Here is the call graph for this function:

ilObjUserTracking::getAccessTotalPerUser ( a_condition,
a_searchTermsCondition = "",
a_objectCondition = "" 
)

get total number of records older than given month (YYYY-MM)

Definition at line 240 of file class.ilObjUserTracking.php.

References $q, and ilObjUser::_lookupName().

        {
                global $ilDB;

                $q = "SELECT count(*) as cnt, user_id FROM ut_access "
                        .($a_searchTermsCondition != "" ? $a_searchTermsCondition : " WHERE ")
                        .$a_condition
                        .$a_objectCondition
                        ." 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;
        }

Here is the call graph for this function:

ilObjUserTracking::getActivationStatus (  ) 

Definition at line 71 of file class.ilObjUserTracking.php.

Referenced by updateSettings().

        {
                return $this->status;
        }

Here is the caller graph for this function:

ilObjUserTracking::getDuration ( a_obj_id  ) 

Definition at line 296 of file class.ilObjUserTracking.php.

References $data, $q, and $res.

Referenced by getAccessTotalPerObj().

        {
                global $ilDB;
                $q = "SELECT spent_time FROM ut_learning_progress"
                        ." WHERE obj_id = " . $ilDB->quote($a_obj_id);
                $res = $ilDB->query($q);
                $data = $res->fetchRow(DB_FETCHMODE_ASSOC);
                return $data["spent_time"];
        }

Here is the caller graph for this function:

ilObjUserTracking::getMonthTotalOverview (  ) 

get total number of accesses per month

Definition at line 204 of file class.ilObjUserTracking.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;
        }

ilObjUserTracking::getObjId ( title,
type 
)

get obj_id of some object

Definition at line 396 of file class.ilObjUserTracking.php.

References ilObject::$id, $obj_id, $q, ilObject::$title, and ilObject::$type.

        {
                global $ilDB;
                $q ="SELECT obj_id FROM object_data WHERE type = ".$ilDB->quote($type)." and title=".$ilDB->quote($title);
                $id = $ilDB->query($q);
                $obj_id = $id->fetchRow(DB_FETCHMODE_ASSOC);
                return $obj_id["obj_id"];
        }

ilObjUserTracking::getOwnerName ( id  ) 

Return the owner name of the object.

Definition at line 437 of file class.ilObjUserTracking.php.

References $q, $res, and $result.

        {
                $q =" select A.login from usr_data as A, object_data as B where A.usr_id=B.owner and B.obj_id = ".$id;
                $res = $this->ilias->db->query($q);
                $result = $res->fetchRow();
                return $result[0];
        }

ilObjUserTracking::getRecordsTotal (  ) 

get total number of tracking records

Definition at line 189 of file class.ilObjUserTracking.php.

References $q.

        {
                global $ilDB;

                $q = "SELECT count(*) AS cnt FROM ut_access";
                $cnt_set = $ilDB->query($q);

                $cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC);

                return $cnt_rec["cnt"];
        }

ilObjUserTracking::getTestId ( id  ) 

get Test_id of some test

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

References ilObject::$id, $q, $res, and $result.

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

ilObjUserTracking::getTotalOlderThanMonth ( a_month  ) 

get total number of records older than given month (YYYY-MM)

Definition at line 223 of file class.ilObjUserTracking.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"];
        }

ilObjUserTracking::getValidTimeSpan (  ) 

Definition at line 152 of file class.ilObjUserTracking.php.

Referenced by updateSettings(), and validateSettings().

        {
                return (int) $this->valid_time;
        } 

Here is the caller graph for this function:

ilObjUserTracking::ilObjUserTracking ( a_id = 0,
a_call_by_reference = true 
)

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

Definition at line 55 of file class.ilObjUserTracking.php.

References __readSettings(), and ilObject::ilObject().

        {
                $this->type = "trac";
                $this->ilObject($a_id,$a_call_by_reference);

                define("DEFAULT_TIME_SPAN",60*5);
                $this->__readSettings();
        }

Here is the call graph for this function:

ilObjUserTracking::setActivationStatus ( a_status  ) 

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

        {
                $this->status = $a_status;
        }

ilObjUserTracking::setValidTimeSpan ( a_time_span  ) 

Definition at line 145 of file class.ilObjUserTracking.php.

Referenced by __readSettings().

        {
                $this->valid_time = (int) $a_time_span;

                return true;
        }

Here is the caller graph for this function:

ilObjUserTracking::updateSettings (  ) 

Definition at line 164 of file class.ilObjUserTracking.php.

References ilObject::$ilias, enabledUserRelatedData(), getActivationStatus(), and getValidTimeSpan().

        {
                global $ilias;

                $ilias->setSetting("enable_tracking",$this->getActivationStatus());
                $ilias->setSetting("save_user_related_data",$this->enabledUserRelatedData() ? 1 : 0);
                $ilias->setSetting("tracking_time_span",$this->getValidTimeSpan());

                return true;
        }

Here is the call graph for this function:

ilObjUserTracking::validateSettings (  ) 

Definition at line 175 of file class.ilObjUserTracking.php.

References getValidTimeSpan().

        {
                if(!is_numeric($time = $this->getValidTimeSpan()) or
                   $time < 1 or
                   $time > 9999)
                {
                        return false;
                }
                return true;
        }

Here is the call graph for this function:


Field Documentation

ilObjUserTracking::$valid_time_span = null

Definition at line 46 of file class.ilObjUserTracking.php.


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