Exemplo n.º 1
0
 /**
  * prepare output
  */
 protected function prepareOutput()
 {
     global $ilLocator, $tpl, $ilUser;
     $this->tpl->getStandardTemplate();
     // administration prepare output
     if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
         $this->addAdminLocatorItems();
         $tpl->setLocator();
         //			ilUtil::sendInfo();
         ilUtil::infoPanel();
         $this->setTitleAndDescription();
         if ($this->getCreationMode() != true) {
             $this->setAdminTabs();
         }
         return false;
     }
     // set locator
     $this->setLocator();
     // catch feedback message
     //		ilUtil::sendInfo();
     ilUtil::infoPanel();
     // in creation mode (parent) object and gui object
     // do not fit
     if ($this->getCreationMode() == true) {
         // repository vs. workspace
         if ($this->call_by_reference) {
             // get gui class of parent and call their title and description method
             $obj_type = ilObject::_lookupType($_GET["ref_id"], true);
             $class_name = $this->objDefinition->getClassName($obj_type);
             $class = strtolower("ilObj" . $class_name . "GUI");
             $class_path = $this->ctrl->lookupClassPath($class);
             include_once $class_path;
             $class_name = $this->ctrl->getClassForClasspath($class_path);
             //echo "<br>instantiating parent for title and description";
             $this->parent_gui_obj = new $class_name("", $_GET["ref_id"], true, false);
             // the next line prevents the header action menu being shown
             $this->parent_gui_obj->setCreationMode(true);
             $this->parent_gui_obj->setTitleAndDescription();
         }
     } else {
         // set title and description and title icon
         $this->setTitleAndDescription();
         // set tabs
         $this->setTabs();
         // BEGIN WebDAV: Display Mount Webfolder icon.
         require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
         if (ilDAVServer::_isActive() && $ilUser->getId() != ANONYMOUS_USER_ID) {
             $this->showMountWebfolderIcon();
         }
         // END WebDAV: Display Mount Webfolder icon.
         // fileupload support
         require_once './Services/FileUpload/classes/class.ilFileUploadUtil.php';
         if (ilFileUploadUtil::isUploadAllowed($this->ref_id, $this->object->getType())) {
             $this->enableDragDropFileUpload();
         }
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * 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
 }
 /**
  * Init password form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initPasswordForm()
 {
     global $lng, $ilUser, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // Check whether password change is allowed
     if ($this->allowPasswordChange()) {
         // The current password needs to be checked for verification
         // unless the user uses Shibboleth authentication with additional
         // local authentication for WebDAV.
         //if (
         //	($ilUser->getAuthMode(true) != AUTH_SHIBBOLETH || !$ilSetting->get("shib_auth_allow_local"))
         //)
         if ($ilUser->getAuthMode(true) == AUTH_LOCAL) {
             // current password
             $cpass = new ilPasswordInputGUI($lng->txt("current_password"), "current_password");
             $cpass->setRetype(false);
             $cpass->setSkipSyntaxCheck(true);
             // only if a password exists.
             if ($ilUser->getPasswd()) {
                 $cpass->setRequired(true);
             }
             $this->form->addItem($cpass);
         }
         // new password
         $ipass = new ilPasswordInputGUI($lng->txt("desired_password"), "new_password");
         $ipass->setRequired(true);
         $ipass->setInfo(ilUtil::getPasswordRequirementsInfo());
         if ($ilSetting->get("passwd_auto_generate") == 1) {
             $ipass->setPreSelection(true);
             $this->form->addItem($ipass);
             $this->form->addCommandButton("savePassword", $lng->txt("save"));
             $this->form->addCommandButton("showPassword", $lng->txt("new_list_password"));
         } else {
             $this->form->addItem($ipass);
             $this->form->addCommandButton("savePassword", $lng->txt("save"));
         }
         switch ($ilUser->getAuthMode(true)) {
             case AUTH_LOCAL:
                 $this->form->setTitle($lng->txt("chg_password"));
                 break;
             case AUTH_SHIBBOLETH:
             case AUTH_CAS:
                 require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
                 if (ilDAVServer::_isActive()) {
                     $this->form->setTitle($lng->txt("chg_ilias_and_webfolder_password"));
                 } else {
                     $this->form->setTitle($lng->txt("chg_ilias_password"));
                 }
                 break;
             default:
                 $this->form->setTitle($lng->txt("chg_ilias_password"));
                 break;
         }
         $this->form->setFormAction($this->ctrl->getFormAction($this));
     }
 }
Exemplo n.º 4
0
 /**
  * prepares ilias to get output rendered by sub gui class
  *
  * @global ilLocator $ilLocator
  * @global ilTemplate $tpl
  * @global ilObjUser $ilUser
  * @return boolean
  */
 private function prepareSubGuiOutput()
 {
     global $ilUser;
     $this->tpl->getStandardTemplate();
     // set locator
     $this->setLocator();
     // catch feedback message
     ilUtil::infoPanel();
     // set title and description and title icon
     $this->setTitleAndDescription();
     // BEGIN WebDAV: Display Mount Webfolder icon.
     require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
     if (ilDAVServer::_isActive() && $ilUser->getId() != ANONYMOUS_USER_ID) {
         $this->showMountWebfolderIcon();
     }
     // END WebDAV: Display Mount Webfolder icon.
 }
Exemplo n.º 5
0
 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();
 }