Example #1
0
 /**
  * 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());
 }
 /**
  * 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="******"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.
     }
     return $props;
 }