function getTabs(&$tabs_gui) { global $rbacsystem; $this->ctrl->setParameter($this, "ref_id", $this->ref_id); $tabs_gui->addTarget("settings", $this->ctrl->getLinkTarget($this, "settings"), "settings", get_class($this)); if ($rbacsystem->checkAccess("read", $this->object->getRefId())) { if (ilObjUserTracking::_enabledObjectStatistics()) { $tabs_gui->addTarget("statistics", $this->ctrl->getLinkTargetByClass("illpobjectstatisticsgui", "access"), "", "illpobjectstatisticsgui"); } if (ilObjUserTracking::_enabledLearningProgress()) { $tabs_gui->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("illearningprogressgui", "show"), "", "illearningprogressgui"); } // session statistics if (ilObjUserTracking::_enabledSessionStatistics()) { $tabs_gui->addTarget("session_statistics", $this->ctrl->getLinkTargetByClass("ilsessionstatisticsgui", ""), "", "ilsessionstatisticsgui"); } } if ($rbacsystem->checkAccess("edit_permission", $this->object->getRefId())) { $tabs_gui->addTarget("perm_settings", $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"), array("perm", "info", "owner"), 'ilpermissiongui'); } }
function _recordObjStats($a_obj_id, $a_spent_seconds, $a_read_count, $a_childs_spent_seconds = null, $a_child_read_count = null) { global $ilDB; if (!ilObjUserTracking::_enabledObjectStatistics() || (int) $a_obj_id <= 0) { return; } $now = time(); $fields = array(); $fields["obj_id"] = array("integer", $a_obj_id); $fields["obj_type"] = array("text", ilObject::_lookupType($a_obj_id)); $fields["tstamp"] = array("timestamp", $now); $fields["yyyy"] = array("integer", date("Y")); $fields["mm"] = array("integer", date("m")); $fields["dd"] = array("integer", date("d")); $fields["hh"] = array("integer", date("H")); if ($a_spent_seconds > 0) { $fields["spent_seconds"] = array("integer", $a_spent_seconds); } if ($a_read_count > 0) { $fields["read_count"] = array("integer", $a_read_count); } if ($a_childs_spent_seconds > 0) { $fields["childs_spent_seconds"] = array("integer", $a_childs_spent_seconds); } if ($a_child_read_count > 0) { $fields["childs_read_count"] = array("integer", $a_child_read_count); } $ilDB->insert("obj_stat_log", $fields); // 0.01% probability if (mt_rand(1, 100) == 1) { self::_syncObjectStats($now); } }