本文整理汇总了PHP中ilChangeEvent::_isActive方法的典型用法代码示例。如果您正苦于以下问题:PHP ilChangeEvent::_isActive方法的具体用法?PHP ilChangeEvent::_isActive怎么用?PHP ilChangeEvent::_isActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilChangeEvent
的用法示例。
在下文中一共展示了ilChangeEvent::_isActive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToExternalSettingsForm
public function addToExternalSettingsForm($a_form_id)
{
global $ilSetting;
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));
case ilAdministrationSettingsFormHandler::FORM_TAGGING:
$fields = array('adm_show_comments_tagging_in_lists' => array($ilSetting->get('comments_tagging_in_lists'), ilAdministrationSettingsFormHandler::VALUE_BOOL, array('adm_show_comments_tagging_in_lists_tags' => array($ilSetting->get('comments_tagging_in_lists_tags'), ilAdministrationSettingsFormHandler::VALUE_BOOL))));
return array(array("view", $fields));
}
}
示例2: 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));
}
}
示例3: 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++;
}*/
//.........这里部分代码省略.........
示例4: _activate
/**
* Activates change event tracking.
*
* @return mixed true on success, a string with an error message on failure.
*/
public static function _activate()
{
if (ilChangeEvent::_isActive()) {
return 'change event tracking is already active';
} else {
global $ilDB;
// Insert initial data into table write_event
// We need to do this here, because we need
// to catch up write events that occured while the change event tracking was
// deactivated.
// IGNORE isn't supported in oracle
$set = $ilDB->query(sprintf('SELECT r1.obj_id,r2.obj_id p,d.owner,%s,d.create_date ' . 'FROM object_data d ' . 'LEFT JOIN write_event w ON d.obj_id = w.obj_id ' . 'JOIN object_reference r1 ON d.obj_id=r1.obj_id ' . 'JOIN tree t ON t.child=r1.ref_id ' . 'JOIN object_reference r2 on r2.ref_id=t.parent ' . 'WHERE w.obj_id IS NULL', $ilDB->quote('create', 'text')));
while ($rec = $ilDB->fetchAssoc($set)) {
$nid = $ilDB->nextId("write_event");
$query = 'INSERT INTO write_event ' . '(write_id, obj_id,parent_obj_id,usr_id,action,ts) VALUES (' . $ilDB->quote($nid, "integer") . "," . $ilDB->quote($rec["obj_id"], "integer") . "," . $ilDB->quote($rec["p"], "integer") . "," . $ilDB->quote($rec["owner"], "integer") . "," . $ilDB->quote("create", "text") . "," . $ilDB->quote($rec["create_date"], "timestamp") . ')';
$res = $ilDB->query($query);
}
if ($ilDB->isError($res) || $ilDB->isError($res->result)) {
return 'couldn\'t insert initial data into table "write_event": ' . ($ilDB->isError($r->result) ? $r->result->getMessage() : $r->getMessage());
}
global $ilias;
$ilias->setSetting('enable_change_event_tracking', '1');
return $res;
}
}
示例5: getProperties
/**
* Get item properties
*
* Overwrite this method to add properties at
* the bottom of the item html
*
* @return array array of property arrays:
* "alert" (boolean) => display as an alert property (usually in red)
* "property" (string) => property name
* "value" (string) => property value
*/
public function getProperties($a_item = '')
{
global $objDefinition;
$props = array();
// please list alert properties first
// example (use $lng->txt instead of "Status"/"Offline" strings):
// $props[] = array("alert" => true, "property" => "Status", "value" => "Offline");
// $props[] = array("alert" => false, "property" => ..., "value" => ...);
// ...
// #8280: WebDav is only supported in repository
if ($this->context == self::CONTEXT_REPOSITORY) {
// BEGIN WebDAV Display locking information
require_once 'Services/WebDAV/classes/class.ilDAVActivationChecker.php';
if (ilDAVActivationChecker::_isActive()) {
require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
global $ilias, $lng;
// Show lock info
require_once 'Services/WebDAV/classes/class.ilDAVLocks.php';
$davLocks = new ilDAVLocks();
if ($ilias->account->getId() != ANONYMOUS_USER_ID) {
$locks =& $davLocks->getLocksOnObjectObj($this->obj_id);
if (count($locks) > 0) {
$lockUser = new ilObjUser($locks[0]['ilias_owner']);
$props[] = array("alert" => false, "property" => $lng->txt("in_use_by"), "value" => $lockUser->getLogin(), "link" => "./ilias.php?user=" . $locks[0]['ilias_owner'] . '&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI');
}
}
// END WebDAV Display locking information
if ($this->getDetailsLevel() == self::DETAILS_SEARCH) {
return $props;
}
// BEGIN WebDAV Display warning for invisible Unix files and files with special characters
if (preg_match('/^(\\.|\\.\\.)$/', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_special_filename"), 'propertyNameVisible' => false);
} else {
if (preg_match('/^\\./', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"), "value" => $lng->txt("filename_hidden_unix_file"), 'propertyNameVisible' => false);
} else {
if (preg_match('/~$/', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"), "value" => $lng->txt("filename_hidden_backup_file"), 'propertyNameVisible' => false);
} else {
if (preg_match('/[\\/]/', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_special_characters"), 'propertyNameVisible' => false);
} else {
if (preg_match('/[\\\\\\/:*?"<>|]/', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_windows_special_characters"), 'propertyNameVisible' => false);
} else {
if (preg_match('/\\.$/', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_windows_empty_extension"), 'propertyNameVisible' => false);
} else {
if (preg_match('/^(\\.|\\.\\.)$/', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_special_filename"), 'propertyNameVisible' => false);
} else {
if (preg_match('/#/', $this->title)) {
$props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_windows_webdav_issue"), 'propertyNameVisible' => false);
}
}
}
}
}
}
}
}
}
// END WebDAV Display warning for invisible files and files with special characters
// BEGIN ChangeEvent: display changes.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
if (ilChangeEvent::_isActive()) {
global $ilias, $lng, $ilUser;
if ($ilias->account->getId() != ANONYMOUS_USER_ID) {
// Performance improvement: for container objects
// we only display 'changed inside' events, for
// leaf objects we only display 'object new/changed'
// events
$isContainer = in_array($this->type, array('cat', 'fold', 'crs', 'grp'));
if ($isContainer) {
$state = ilChangeEvent::_lookupInsideChangeState($this->obj_id, $ilUser->getId());
if ($state > 0) {
$props[] = array("alert" => true, "value" => $lng->txt('state_changed_inside'), 'propertyNameVisible' => false);
}
} elseif ($this->type == "file") {
$state = ilChangeEvent::_lookupChangeState($this->obj_id, $ilUser->getId());
if ($state > 0) {
$props[] = array("alert" => true, "value" => $lng->txt($state == 1 ? 'state_unread' : 'state_changed'), 'propertyNameVisible' => false);
}
}
}
}
// END ChangeEvent: display changes.
}
//.........这里部分代码省略.........
示例6: __readSettings
protected function __readSettings()
{
global $ilSetting;
$this->enableLearningProgress($ilSetting->get("enable_tracking", 0));
$this->enableUserRelatedData($ilSetting->get("save_user_related_data", 0));
$this->enableObjectStatistics($ilSetting->get("object_statistics"), 0);
$this->setValidTimeSpan($ilSetting->get("tracking_time_span", self::DEFAULT_TIME_SPAN));
// $this->setLearningProgressDesktop($ilSetting->get("lp_desktop"), 1);
$this->setLearningProgressLearner($ilSetting->get("lp_learner"), 1);
$this->setLearningProgressListGUI($ilSetting->get("lp_list_gui"), 0);
// BEGIN ChangeEvent
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
$this->enableChangeEventTracking(ilChangeEvent::_isActive());
// END ChangeEvent
$this->setExtendedData($ilSetting->get("lp_extended_data"), 0);
return true;
}