Public Member Functions | |
| ilLearningProgress () | |
| _tracProgress ($a_user_id, $a_obj_id, $a_obj_type= '') | |
| _getProgress ($a_user_id, $a_obj_id) | |
| _updateProgress ($data) | |
Data Fields | |
| $db = null | |
Definition at line 36 of file class.ilLearningProgress.php.
| ilLearningProgress::_getProgress | ( | $ | a_user_id, | |
| $ | a_obj_id | |||
| ) |
Definition at line 74 of file class.ilLearningProgress.php.
References $res.
Referenced by ilLearningProgressBaseGUI::__appendLPDetails(), ilLPObjectItemListGUI::__readUserStatusInfo(), _tracProgress(), ilObjGroupGUI::membersObject(), ilLPItemListGUI::renderObjectInfoXML(), and ilInfoScreenGUI::showLearningProgress().
{
global $ilDB;
$query = "SELECT * FROM ut_learning_progress ".
"WHERE user_id = '".$a_user_id."' ".
"AND obj_id = '".$a_obj_id."'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$progress['lp_id'] = $row->lp_id;
$progress['obj_id'] = $row->obj_id;
$progress['obj_type'] = $row->obj_type;
$progress['user_id'] = $row->user_id;
$progress['spent_time'] = $row->spent_time;
$progress['access_time'] = $row->access_time;
$progress['visits'] = $row->visits;
}
return $progress ? $progress : array();
}
Here is the caller graph for this function:| ilLearningProgress::_tracProgress | ( | $ | a_user_id, | |
| $ | a_obj_id, | |||
| $ | a_obj_type = '' | |||
| ) |
Definition at line 48 of file class.ilLearningProgress.php.
References _getProgress(), and _updateProgress().
Referenced by ilTracking::_trackAccess(), ilObjExerciseGUI::viewObject(), ilObjCourseGUI::viewObject(), and ilObjGroupGUI::viewObject().
{
global $ilDB,$ilObjDataCache;
if(!strlen($a_obj_type))
{
$a_obj_type = $ilObjDataCache->lookupType($a_obj_id);
}
if($progress = ilLearningProgress::_getProgress($a_user_id,$a_obj_id))
{
ilLearningProgress::_updateProgress($progress);
return true;
}
$query = "INSERT INTO ut_learning_progress ".
"SET user_id = '".$a_user_id."', ".
"obj_type = '".$a_obj_type."', ".
"obj_id = '".$a_obj_id."', ".
"spent_time = '0',".
"access_time = '".time()."', ".
"visits = '1'";
$ilDB->query($query);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilLearningProgress::_updateProgress | ( | $ | data | ) |
Definition at line 96 of file class.ilLearningProgress.php.
References $data, and ilObjUserTracking::_getValidTimeSpan().
Referenced by _tracProgress().
{
global $ilDB;
$spent = $data['spent_time'];
include_once('Services/Tracking/classes/class.ilObjUserTracking.php');
if((time() - $data['access_time']) <= ilObjUserTracking::_getValidTimeSpan())
{
$spent = $data['spent_time'] + time() - $data['access_time'];
}
$visits = $data['visits'] + 1;
$query = "UPDATE ut_learning_progress ".
"SET visits = visits + 1, ".
"spent_time = '".$spent."', ".
"access_time = '".time()."' ".
"WHERE lp_id = '".$data['lp_id']."'";
$ilDB->query($query);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilLearningProgress::ilLearningProgress | ( | ) |
Definition at line 40 of file class.ilLearningProgress.php.
{
global $ilDB;
$this->db = $ilDB;
}
| ilLearningProgress::$db = null |
Definition at line 38 of file class.ilLearningProgress.php.
1.7.1