本文整理汇总了PHP中ilChangeEvent类的典型用法代码示例。如果您正苦于以下问题:PHP ilChangeEvent类的具体用法?PHP ilChangeEvent怎么用?PHP ilChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testChangeEvent
/**
* change event test
* @param
* @return
*/
public function testChangeEvent()
{
global $ilUser;
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
$ret = ilChangeEvent::_deactivate();
$ret = ilChangeEvent::_activate();
$res = ilChangeEvent::_lookupUncaughtWriteEvents(9, $ilUser->getId());
$res = ilChangeEvent::_lookupChangeState(9, $ilUser->getId());
$res = ilChangeEvent::_lookupInsideChangeState(9, $ilUser->getId());
}
示例2: trackAccess
/**
* Track read access to the object
* Prevents a call of determineStatus() that would return "not attempted"
* @see ilLearningProgress::_tracProgress()
*
* @param $a_user_id
* @param $a_obj_id
* @param $a_ref_id
* @param string $a_obj_type
*/
public static function trackAccess($a_user_id, $a_obj_id, $a_ref_id)
{
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
ilChangeEvent::_recordReadEvent('xxco', $a_ref_id, $a_obj_id, $a_user_id);
$status = self::getLPDataForUser($a_obj_id, $a_user_id);
if ($status == self::LP_STATUS_NOT_ATTEMPTED_NUM) {
self::writeStatus($a_obj_id, $a_user_id, self::LP_STATUS_IN_PROGRESS_NUM);
self::raiseEventStatic($a_obj_id, $a_user_id, self::LP_STATUS_IN_PROGRESS_NUM, self::getPercentageForUser($a_obj_id, $a_user_id));
}
}
示例3: setOutput
/**
* Sets view output into column layout
*
* This method sets the output of the right and main column
* in the global standard template.
*/
public function setOutput()
{
global $tpl;
// BEGIN ChangeEvent: record read event.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
global $ilUser;
$obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
ilChangeEvent::_recordReadEvent($this->getContainerObject()->getType(), $this->getContainerObject()->getRefId(), $obj_id, $ilUser->getId());
// END ChangeEvent: record read event.
$tpl->setContent($this->getCenterColumnHTML());
$tpl->setRightContent($this->getRightColumnHTML());
}
示例4: determineStatus
/**
* Determine status
*
* @param integer object id
* @param integer user id
* @param object object (optional depends on object type)
* @return integer status
*/
function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
{
$status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
include_once "Services/Tracking/classes/class.ilChangeEvent.php";
if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
$status = self::LP_STATUS_IN_PROGRESS_NUM;
include_once "Modules/LearningModule/classes/class.ilLMTracker.php";
$tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $a_user_id);
if ($tracker->getAllQuestionsCorrect()) {
$status = self::LP_STATUS_COMPLETED_NUM;
}
}
return $status;
}
示例5: callObject
/**
* call remote object
*
* @return bool
*/
public function callObject()
{
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
ilChangeEvent::_recordReadEvent($this->getType(), $this->object->getRefId(), $this->object->getId(), $GLOBALS['ilUser']->getId());
// check if the assigned object is hosted on the same installation
$link = $this->object->getFullRemoteLink();
if ($link) {
ilUtil::redirect($link);
return true;
} else {
ilUtil::sendFailure('Cannot call remote object.');
$this->infoScreenObject();
return false;
}
}
示例6: _lookupProgressByObjId
/**
* lookup progress for a specific object
*
* @access public
* @param int obj_id
* @return array of progress data
*/
public static function _lookupProgressByObjId($a_obj_id)
{
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
foreach (ilChangeEvent::_lookupReadEvents($a_obj_id) as $row) {
if (isset($progress[$row['usr_id']])) {
$progress[$row['usr_id']]['spent_seconds'] += $row['spent_seconds'];
$progress[$row['usr_id']]['read_count'] += $row['read_count'];
$progress[$row['usr_id']]['ts'] = max($row['last_access'], $progress[$row['usr_id']]['ts']);
} else {
$progress[$row['usr_id']]['spent_seconds'] = $row['spent_seconds'];
$progress[$row['usr_id']]['read_count'] = $row['read_count'];
$progress[$row['usr_id']]['ts'] = $row['last_access'];
}
$progress[$row['usr_id']]['usr_id'] = $row['usr_id'];
$progress[$row['usr_id']]['obj_id'] = $row['obj_id'];
}
return $progress ? $progress : array();
}
示例7: determineStatus
/**
* Determine status
*
* @param integer object id
* @param integer user id
* @param object object (optional depends on object type)
* @return integer status
*/
function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
{
global $ilObjDataCache, $ilDB;
$status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
switch ($ilObjDataCache->lookupType($a_obj_id)) {
case 'dbk':
case 'lm':
case 'htlm':
include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
$status = self::LP_STATUS_IN_PROGRESS_NUM;
// completed?
$set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks " . "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " . "AND usr_id = " . $ilDB->quote($a_user_id, 'integer') . " " . "AND completed = '1' ");
if ($rec = $ilDB->fetchAssoc($set)) {
$status = self::LP_STATUS_COMPLETED_NUM;
}
}
break;
}
return $status;
}
示例8: setOutput
/**
* Sets view output into column layout
*
* This method sets the output of the right and main column
* in the global standard template.
*/
public function setOutput()
{
global $tpl, $ilCtrl;
// note: we do not want to get the center html in case of
// asynchronous calls to blocks in the right column (e.g. news)
// see #13012
if ($ilCtrl->getNextClass() == "ilcolumngui" && $ilCtrl->isAsynch()) {
$tpl->setRightContent($this->getRightColumnHTML());
}
// BEGIN ChangeEvent: record read event.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
global $ilUser;
//global $log;
//$log->write("setOutput");
$obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
ilChangeEvent::_recordReadEvent($this->getContainerObject()->getType(), $this->getContainerObject()->getRefId(), $obj_id, $ilUser->getId());
// END ChangeEvent: record read event.
$tpl->setContent($this->getCenterColumnHTML());
// see above, all other cases (this was the old position of setRightContent,
// maybe the position above is ok and all ifs can be removed)
if ($ilCtrl->getNextClass() != "ilcolumngui" || !$ilCtrl->isAsynch()) {
$tpl->setRightContent($this->getRightColumnHTML());
}
}
示例9: addToExternalSettingsForm
public function addToExternalSettingsForm($a_form_id)
{
switch ($a_form_id) {
case ilAdministrationSettingsFormHandler::FORM_LP:
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
$fields = array('trac_repository_changes' => array(ilChangeEvent::_isActive(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
return array(array("view", $fields));
}
}
示例10: increaseViewCount
protected function increaseViewCount()
{
global $ilUser;
$this->getWikiPage()->increaseViewCnt();
// enable object statistics
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
ilChangeEvent::_recordReadEvent("wiki", $this->getWikiPage()->getWikiRefId(), $this->getWikiPage()->getWikiId(), $ilUser->getId());
}
示例11: _syncReadEvent
/**
* Synch read event table
*
* @param
* @return
*/
function _syncReadEvent($a_obj_id, $a_user_id, $a_type, $a_ref_id)
{
global $ilDB, $ilLog;
// get attempts
$val_set = $ilDB->queryF('
SELECT rvalue FROM cmi_custom
WHERE user_id = %s
AND sco_id = %s
AND lvalue = %s
AND obj_id = %s', array('integer', 'integer', 'text', 'integer'), array($a_user_id, 0, 'package_attempts', $a_obj_id));
$val_rec = $ilDB->fetchAssoc($val_set);
$val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
if ($val_rec["rvalue"] == null) {
$val_rec["rvalue"] = "";
}
$attempts = $val_rec["rvalue"];
// time
$scos = array();
$val_set = $ilDB->queryF('SELECT cp_node_id FROM cp_node
WHERE nodename = %s
AND cp_node.slm_id = %s', array('text', 'integer'), array('item', $a_obj_id));
while ($val_rec = $ilDB->fetchAssoc($val_set)) {
array_push($scos, $val_rec['cp_node_id']);
}
$time = 0;
foreach ($scos as $sco) {
include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
$data_set = $ilDB->queryF('
SELECT total_time
FROM cmi_node
WHERE cp_node_id = %s
AND user_id = %s', array('integer', 'integer'), array($sco, $a_user_id));
while ($data_rec = $ilDB->fetchAssoc($data_set)) {
// see bug report 7246
// $sec = ilObjSCORM2004LearningModule::_ISODurationToCentisec($data_rec["session_time"]) / 100;
$sec = ilObjSCORM2004LearningModule::_ISODurationToCentisec($data_rec["total_time"]) / 100;
}
$time += (int) $sec;
$sec = 0;
//$ilLog->write("++".$time);
}
include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
ilChangeEvent::_recordReadEvent($a_type, $a_ref_id, $a_obj_id, $a_user_id, false, $attempts, $time);
}
示例12: redirectToLink
protected function redirectToLink($a_ref_id, $a_obj_id, $a_url)
{
global $ilUser;
if ($a_url) {
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
ilChangeEvent::_recordReadEvent("webr", $a_ref_id, $a_obj_id, $ilUser->getId());
ilUtil::redirect($a_url);
}
}
示例13: addObjectSections
/**
* add standard object section
*/
function addObjectSections()
{
global $lng, $ilCtrl, $ilUser, $ilAccess, $tree, $ilSetting, $ilObjDataCache;
$this->addSection($lng->txt("additional_info"));
$a_obj = $this->gui_object->object;
// links to the object
if (is_object($a_obj)) {
// permanent link
$type = $a_obj->getType();
$ref_id = $a_obj->getRefId();
if ($ref_id) {
include_once './Services/Link/classes/class.ilLink.php';
$href = ilLink::_getStaticLink($ref_id, $type, true);
include_once 'Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
if (ilECSServerSettings::getInstance()->activeServerExists()) {
$this->addProperty($lng->txt("object_id"), $a_obj->getId());
}
include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
$pm = new ilPermanentLinkGUI($type, $ref_id);
$pm->setIncludePermanentLinkText(false);
$pm->setAlignCenter(false);
$this->addProperty($lng->txt("perma_link"), $pm->getHTML(), "");
// bookmarks
$title = $ilObjDataCache->lookupTitle($a_obj->getId());
$bms = ilPermanentLinkGUI::_getBookmarksSelectionList($title, $href);
// links to resource
if ($ilAccess->checkAccess("write", "", $ref_id) || $ilAccess->checkAccess("edit_permissions", "", $ref_id)) {
$obj_id = $a_obj->getId();
$rs = ilObject::_getAllReferences($obj_id);
$refs = array();
foreach ($rs as $r) {
if ($tree->isInTree($r)) {
$refs[] = $r;
}
}
if (count($refs) > 1) {
$links = $sep = "";
foreach ($refs as $r) {
$cont_loc = new ilLocatorGUI();
$cont_loc->addContextItems($r, true);
$links .= $sep . $cont_loc->getHTML();
$sep = "<br />";
}
$this->addProperty($lng->txt("res_links"), '<div class="small">' . $links . '</div>');
}
}
}
}
// creation date
$this->addProperty($lng->txt("create_date"), ilDatePresentation::formatDate(new ilDateTime($a_obj->getCreateDate(), IL_CAL_DATETIME)));
// owner
if ($ilUser->getId() != ANONYMOUS_USER_ID and $a_obj->getOwner()) {
include_once './Services/Object/classes/class.ilObjectFactory.php';
include_once './Services/User/classes/class.ilObjUser.php';
if (ilObjUser::userExists(array($a_obj->getOwner()))) {
$ownerObj = ilObjectFactory::getInstanceByObjId($a_obj->getOwner(), false);
} else {
$ownerObj = ilObjectFactory::getInstanceByObjId(6, false);
}
if (!is_object($ownerObj) || $ownerObj->getType() != "usr") {
$this->addProperty($lng->txt("owner"), $lng->txt("no_owner"));
} else {
if ($ownerObj->hasPublicProfile()) {
$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $ownerObj->getId());
$this->addProperty($lng->txt("owner"), $ownerObj->getPublicName(), $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
} else {
$this->addProperty($lng->txt("owner"), $ownerObj->getPublicName());
}
}
}
// disk usage
require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
if ($ilUser->getId() != ANONYMOUS_USER_ID && ilDiskQuotaActivationChecker::_isActive()) {
$size = $a_obj->getDiskUsage();
if ($size !== null) {
$this->addProperty($lng->txt("disk_usage"), ilFormat::formatSize($size, 'long'));
}
}
// change event
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
if (ilChangeEvent::_isActive()) {
if ($ilUser->getId() != ANONYMOUS_USER_ID) {
$readEvents = ilChangeEvent::_lookupReadEvents($a_obj->getId());
$count_users = 0;
$count_members = 0;
$count_user_reads = 0;
$count_anonymous_reads = 0;
foreach ($readEvents as $evt) {
if ($evt['usr_id'] == ANONYMOUS_USER_ID) {
$count_anonymous_reads += $evt['read_count'];
} else {
$count_user_reads += $evt['read_count'];
$count_users++;
/* to do: if ($evt['user_id'] is member of $this->getRefId())
{
$count_members++;
}*/
//.........这里部分代码省略.........
示例14: adminSync
function adminSync()
{
global $ilCtrl, $lng;
include_once "Services/Tracking/classes/class.ilChangeEvent.php";
ilChangeEvent::_syncObjectStats(time(), 1);
ilUtil::sendSuccess($lng->txt("trac_sync_obj_stats_success"), true);
$ilCtrl->redirect($this, "admin");
}
示例15: view
/**
* Output course content
*/
function view()
{
// BEGIN ChangeEvent: record read event.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
global $ilUser;
$obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
ilChangeEvent::_recordReadEvent($this->container_obj->getType(), $this->container_obj->getRefId(), $obj_id, $ilUser->getId());
// END ChangeEvent: record read event.
$this->getCenterColumnHTML();
if (!$this->no_right_column) {
$this->tpl->setRightContent($this->getRightColumnHTML());
}
}