function lockObject()
 {
     global $tree, $ilUser, $rbacsystem;
     if (!$rbacsystem->checkAccess("write", $_GET['item_ref_id'])) {
         $this->ilErr->raiseError($this->lng->txt('err_no_permission'), $this->ilErr->MESSAGE);
     }
     require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
     if (ilDAVServer::_isActive() && ilDAVServer::_isActionsVisible()) {
         require_once 'Services/WebDAV/classes/class.ilDAVLocks.php';
         $locks = new ilDAVLocks();
         $result = $locks->lockRef($_GET['item_ref_id'], $ilUser->getId(), $ilUser->getLogin(), 'ref_' . $_GET['item_ref_id'] . '_usr_' . $ilUser->getId(), time() + 60, 0, 'exclusive');
         ilUtil::sendInfo($this->lng->txt($result === true ? 'object_locked' : $result), true);
     }
     $this->renderObject();
 }
 /**
  * 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++;
                     			}*/
                 }
             }
             if ($count_anonymous_reads > 0) {
                 $this->addProperty($this->lng->txt("readcount_anonymous_users"), $count_anonymous_reads);
             }
             if ($count_user_reads > 0) {
                 $this->addProperty($this->lng->txt("readcount_users"), $count_user_reads);
             }
             if ($count_users > 0) {
                 $this->addProperty($this->lng->txt("accesscount_registered_users"), $count_users);
             }
         }
     }
     // END ChangeEvent: Display change event info
     // BEGIN WebDAV: Display locking information
     require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
     if (ilDAVServer::_isActive()) {
         global $ilias, $ilUser;
         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
             $davLocks = new ilDAVLocks();
             // Show lock info
             if ($ilias->account->getId() != ANONYMOUS_USER_ID) {
                 $locks =& $davLocks->getLocksOnObjectObj($a_obj->getId());
                 if (count($locks) > 0) {
                     $lockUser = new ilObjUser($locks[0]['ilias_owner']);
                     $this->addProperty($this->lng->txt("in_use_by"), $lockUser->getPublicName(), "./ilias.php?user=" . $locks[0]['ilias_owner'] . '&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI');
                 }
             }
         }
     }
     // END WebDAV: Display locking information
 }
 /**
  * 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;
 }