function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
 {
     global $ilUser;
     parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
     include_once "./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php";
     $this->last_accessed_page = ilObjLearningModuleAccess::_getLastAccessedPage($a_ref_id, $ilUser->getId());
 }
 public function preload()
 {
     global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem;
     if (!$this->obj_ids) {
         return;
     }
     $this->obj_ids = array_unique($this->obj_ids);
     $this->types = array_unique($this->types);
     if ($this->ref_ids) {
         $this->ref_ids = array_unique($this->ref_ids);
     }
     // type specific preloads
     include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
     foreach ($this->types as $type) {
         $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]);
         if (is_array($this->ref_ids_by_type[$type])) {
             $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]);
         }
         if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
             ilConditionHandler::preloadConditionsForTargetRecords($type, $this->obj_ids_by_type[$type]);
         }
         $class = $objDefinition->getClassName($type);
         $location = $objDefinition->getLocation($type);
         if ($class && $location) {
             $full_class = "ilObj" . $class . "Access";
             include_once $location . "/class." . $full_class . ".php";
             if (class_exists($full_class)) {
                 call_user_func(array($full_class, "_preloadData"), $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]);
             }
         }
     }
     if ($this->ref_ids) {
         $tree->preloadDeleted($this->ref_ids);
         $tree->preloadDepthParent($this->ref_ids);
         $ilObjDataCache->preloadReferenceCache($this->ref_ids, false);
         $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId());
         if ($ilUser->getId != ANONYMOUS_USER_ID && $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) {
             ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids);
         }
         include_once "./Services/Object/classes/class.ilObjectActivation.php";
         ilObjectActivation::preloadData($this->ref_ids);
     }
     include_once "./Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) {
         include_once "./Services/Rating/classes/class.ilRating.php";
         include_once "./Services/Rating/classes/class.ilRatingGUI.php";
         ilRating::preloadListGUIData($this->obj_ids);
         include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
         ilAdvancedMDValues::preloadByObjIds($this->obj_ids);
     }
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
         include_once "./Services/Tracking/classes/class.ilLPStatus.php";
         ilLPStatus::preloadListGUIData($this->obj_ids);
     }
 }
 /**
  * overwritten from base class
  */
 function getDescription()
 {
     global $ilSetting;
     if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id)) {
         $this->__readLink();
         $desc = $this->link_data['description'];
         // #10682
         if ($ilSetting->get("rep_shorten_description")) {
             $desc = ilUtil::shortenText($desc, $ilSetting->get("rep_shorten_description_length"), true);
         }
         return $desc;
     }
     return parent::getDescription();
 }
 public function getCommands()
 {
     $commands = parent::getCommands();
     // #10182 - handle edit and contribute
     $permissions = array();
     foreach ($commands as $idx => $item) {
         if ($item["lang_var"] == "edit" && $item["granted"]) {
             $permissions[$item["permission"]] = $idx;
         }
     }
     if (sizeof($permissions) == 2) {
         unset($commands[$permissions["contribute"]]);
     }
     return $commands;
 }
 /**
  * Get item properties
  *
  * @return	array		array of property arrays:
  *						"alert" (boolean) => display as an alert property (usually in red)
  *						"property" (string) => property name
  *						"value" (string) => property value
  */
 function getProperties()
 {
     global $lng;
     // BEGIN WebDAV: Get parent properties
     // BEGIN ChangeEvent: Get parent properties
     $props = parent::getProperties();
     // END ChangeEvent: Get parent properties
     // END WebDAV: Get parent properties
     // offline
     include_once 'Modules/Poll/classes/class.ilObjPollAccess.php';
     if (!ilObjPollAccess::_lookupOnline($this->obj_id)) {
         $props[] = array("alert" => true, "property" => $lng->txt("status"), "value" => $lng->txt("offline"));
     }
     return $props;
 }
 public function insertIconsAndCheckboxes()
 {
     global $lng, $ilias;
     // FSX removed $this->getCheckboxStatus() in if-Statement: 0014726
     if (!$ilias->getSetting('custom_icons')) {
         parent::insertIconsAndCheckboxes();
         return;
     }
     $icons_cache = ilObjOrgUnit::getIconsCache();
     if (isset($icons_cache[$this->obj_id])) {
         $icon_file = $icons_cache[$this->obj_id];
         // icon link
         if (!$this->default_command or !$this->getCommandsStatus() and !$this->restrict_to_goto) {
         } else {
             $this->tpl->setCurrentBlock("icon_link_s");
             if ($this->default_command["frame"] != "") {
                 $this->tpl->setVariable("ICON_TAR", "target='" . $this->default_command["frame"] . "'");
             }
             $this->tpl->setVariable("ICON_HREF", $this->default_command["link"]);
             $this->tpl->parseCurrentBlock();
             $this->tpl->touchBlock("icon_link_e");
         }
         $this->enableIcon(false);
         if ($this->getContainerObject()->isActiveAdministrationPanel() && !$_SESSION['clipboard']) {
             $this->tpl->touchBlock("i_1");
             // indent main div  }
             $this->tpl->touchBlock("d_2");
             // indent main div  } #0014913
         } else {
             $this->tpl->touchBlock("d_1");
         }
         parent::insertIconsAndCheckboxes();
         $this->tpl->setCurrentBlock("icon");
         $this->tpl->setVariable("ALT_ICON", $lng->txt("icon") . " " . $lng->txt("obj_" . $this->getIconImageType()));
         $this->tpl->setVariable("SRC_ICON", $icon_file);
         $this->tpl->parseCurrentBlock();
         $this->enableIcon(true);
     } else {
         parent::insertIconsAndCheckboxes();
     }
 }
 /**
  * Get subitems of container
  * 
  * @param bool administration panel enabled
  * @param bool side blocks enabled
  *
  * @return	array
  */
 function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
 {
     global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem, $ilSetting;
     // Caching
     if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) && !$a_get_single) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     $type_grps = $this->getGroupedObjTypes();
     $objects = $tree->getChilds($this->getRefId(), "title");
     // using long descriptions?
     $short_desc = $ilSetting->get("rep_shorten_description");
     $short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
     if (!$short_desc || $short_desc_max_length != ilObject::TITLE_LENGTH) {
         // using (part of) shortened description
         if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::TITLE_LENGTH) {
             foreach ($objects as $key => $object) {
                 $objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
             }
         } else {
             $obj_ids = array();
             foreach ($objects as $key => $object) {
                 $obj_ids[] = $object["obj_id"];
             }
             if (sizeof($obj_ids)) {
                 $long_desc = ilObject::getLongDescriptions($obj_ids);
                 foreach ($objects as $key => $object) {
                     if ($short_desc && $short_desc_max_length) {
                         $long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
                     }
                     $objects[$key]["description"] = $long_desc[$object["obj_id"]];
                 }
             }
         }
     }
     $found = false;
     $all_obj_types = array();
     $all_ref_ids = array();
     $all_obj_ids = array();
     include_once 'Services/Container/classes/class.ilContainerSorting.php';
     $sort = ilContainerSorting::_getInstance($this->getId());
     // TODO: check this
     // get items attached to a session
     include_once './Modules/Session/classes/class.ilEventItems.php';
     $event_items = ilEventItems::_getItemsOfContainer($this->getRefId());
     foreach ($objects as $key => $object) {
         if ($a_get_single > 0 && $object["child"] != $a_get_single) {
             continue;
         }
         // hide object types in devmode
         if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm" || $object["type"] == "rolf") {
             continue;
         }
         // remove inactive plugins
         if ($objDefinition->isInactivePlugin($object["type"])) {
             continue;
         }
         // BEGIN WebDAV: Don't display hidden Files, Folders and Categories
         if (in_array($object['type'], array('file', 'fold', 'cat'))) {
             include_once 'Modules/File/classes/class.ilObjFileAccess.php';
             if (ilObjFileAccess::_isFileHidden($object['title'])) {
                 $this->setHiddenFilesFound(true);
                 if (!$a_admin_panel_enabled) {
                     continue;
                 }
             }
         }
         // END WebDAV: Don't display hidden Files, Folders and Categories
         // filter out items that are attached to an event
         if (in_array($object['ref_id'], $event_items)) {
             continue;
         }
         // filter side block items
         if (!$a_include_side_block && $objDefinition->isSideBlock($object['type'])) {
             continue;
         }
         $all_obj_types[$object["type"]] = $object["type"];
         $obj_ids_of_type[$object["type"]][] = $object["obj_id"];
         $ref_ids_of_type[$object["type"]][] = $object["child"];
         $all_ref_ids[] = $object["child"];
         $all_obj_ids[] = $object["obj_id"];
     }
     // data preloader
     if (!self::$data_preloaded && sizeof($all_ref_ids)) {
         // type specific preloads
         foreach ($all_obj_types as $t) {
             // condition handler: preload conditions
             include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
             ilConditionHandler::preloadConditionsForTargetRecords($t, $obj_ids_of_type[$t]);
             $class = $objDefinition->getClassName($t);
             $location = $objDefinition->getLocation($t);
             $full_class = "ilObj" . $class . "Access";
             include_once $location . "/class." . $full_class . ".php";
             call_user_func(array($full_class, "_preloadData"), $obj_ids_of_type[$t], $ref_ids_of_type[$t]);
         }
         // general preloads
         $tree->preloadDeleted($all_ref_ids);
         $tree->preloadDepthParent($all_ref_ids);
         $ilObjDataCache->preloadReferenceCache($all_ref_ids, false);
         ilObjUser::preloadIsDesktopItem($ilUser->getId(), $all_ref_ids);
         $rbacsystem->preloadRbacPaCache($all_ref_ids, $ilUser->getId());
         include_once "./Services/Object/classes/class.ilObjectListGUI.php";
         ilObjectListGUI::preloadCommonProperties($all_obj_ids);
         include_once "./Services/Object/classes/class.ilObjectActivation.php";
         ilObjectActivation::preloadData($all_ref_ids);
         self::$data_preloaded = true;
     }
     foreach ($objects as $key => $object) {
         // see above, objects were filtered
         if (!in_array($object["child"], $all_ref_ids)) {
             continue;
         }
         // group object type groups together (e.g. learning resources)
         $type = $objDefinition->getGroupOfObj($object["type"]);
         if ($type == "") {
             $type = $object["type"];
         }
         // this will add activation properties (ilObjActivation)
         $this->addAdditionalSubItemInformation($object);
         $this->items[$type][$key] = $object;
         $this->items["_all"][$key] = $object;
         if ($object["type"] != "sess") {
             $this->items["_non_sess"][$key] = $object;
         }
     }
     $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items);
     return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
 }
 /**
  * get properties
  *
  * @access public
  * @return
  */
 public function getProperties()
 {
     return parent::getProperties();
 }
Example #9
0
 /**
  * Add header action menu
  * 
  * @param string $a_sub_type
  * @param int $a_sub_id
  * @return ilObjectListGUI
  */
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     global $ilAccess;
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         if (!$this->creation_mode && $this->object_id) {
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_WORKSPACE, $this->getAccessHandler(), $this->getType(), $this->node_id, $this->object_id);
             $dispatcher->setSubObject($a_sub_type, $a_sub_id);
             include_once "Services/Object/classes/class.ilObjectListGUI.php";
             ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
             $lg = $dispatcher->initHeaderAction();
             if (is_object($lg)) {
                 // to enable add to desktop / remove from desktop
                 if ($this instanceof ilDesktopItemHandling) {
                     $lg->setContainerObject($this);
                 }
                 // for activation checks see ilObjectGUI
                 // $lg->enableComments(true);
                 $lg->enableNotes(true);
                 // $lg->enableTags(true);
             }
             return $lg;
         }
     } else {
         return parent::initHeaderAction();
     }
 }
 function getHTML()
 {
     global $ilCtrl, $ilSetting, $tpl, $lng, $ilHelp, $ilDB;
     $ilDB->useSlave(true);
     // both views are activated (show buttons)
     if ($ilSetting->get('disable_my_offers') == 0 && $ilSetting->get('disable_my_memberships') == 0) {
         /*			$ilCtrl->setParameter($this, 'block_type', $this->getBlockType());			
         			$ilCtrl->setParameter($this, 'view', self::VIEW_MY_OFFERS);
         			$this->addHeaderLink($ilCtrl->getLinkTarget($this, 'changeView'), $this->lng->txt('pd_my_offers'),
         				($this->view == self::VIEW_MY_OFFERS ? false : true) 
         			);
         			$ilCtrl->setParameter($this, 'view', self::VIEW_MY_MEMBERSHIPS);
         			$this->addHeaderLink($ilCtrl->getLinkTarget($this, 'changeView'), $this->lng->txt('pd_my_memberships'),
         				($this->view == self::VIEW_MY_MEMBERSHIPS ? false : true) 
         			);
         			$ilCtrl->clearParameters($this);*/
     }
     // workaround to show details row
     $this->setData(array("dummy"));
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks("", $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     switch ((int) $this->view) {
         case self::VIEW_MY_MEMBERSHIPS:
             $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "crs_grp");
             if ($ilSetting->get('disable_my_offers') == 0) {
                 $tpl->setTitle($lng->txt("my_courses_groups"));
             }
             $this->setTitle($this->lng->txt('pd_my_memberships'));
             $this->setContent($this->getMembershipItemsBlockHTML());
             break;
         case self::VIEW_MY_OFFERS:
         default:
             $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "sel_items");
             if (!in_array(self::VIEW_MY_MEMBERSHIPS, $this->allowed_views)) {
                 $this->setTitle($this->lng->txt('selected_items'));
             } else {
                 $this->setTitle($this->lng->txt('pd_my_offers'));
             }
             $this->setContent($this->getSelectedItemsBlockHTML());
             break;
     }
     if ($this->getContent() == "") {
         $this->setEnableDetailRow(false);
     }
     $ilCtrl->clearParametersByClass("ilpersonaldesktopgui");
     $ilCtrl->clearParameters($this);
     $ilDB->useSlave(false);
     return parent::getHTML();
 }
 public function initListGUI(ilObjectListGUI $a_list_gui)
 {
     $a_list_gui->enableTags(true);
 }
 /**
  * Render folder
  */
 function render()
 {
     global $tpl, $ilUser, $ilTabs, $ilCtrl;
     unset($_SESSION['clipboard']['wsp2repo']);
     // add new item
     include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
     $gui = new ilObjectAddNewItemGUI($this->node_id);
     $gui->setMode(ilObjectDefinition::MODE_WORKSPACE);
     $gui->setCreationUrl($ilCtrl->getLinkTarget($this, "create"));
     $gui->render();
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJsLinks("", $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     include_once "Modules/WorkspaceFolder/classes/class.ilObjWorkspaceFolderTableGUI.php";
     $table = new ilObjWorkspaceFolderTableGUI($this, "render", $this->node_id, $this->getAccessHandler());
     $tpl->setContent($table->getHTML());
     include_once "Modules/WorkspaceFolder/classes/class.ilWorkspaceFolderExplorer.php";
     $exp = new ilWorkspaceFolderExplorer($this->ctrl->getLinkTarget($this), $ilUser->getId());
     if ($this->node_id != $exp->getRoot()) {
         $ilTabs->activateSubTab("content");
     }
     $left = "";
     // sub-folders
     if ($this->node_id != $exp->getRoot() || $exp->hasFolders($this->node_id)) {
         $exp->setTargetGet("wsp_id");
         $exp->setSessionExpandVariable('wspexpand');
         $exp->setExpand($this->node_id);
         $exp->setExpandTarget($this->ctrl->getLinkTarget($this));
         if ($_GET["wspexpand"] != "") {
             $exp->setExpand($_GET["wspexpand"]);
         }
         $exp->highlightNode($this->node_id);
         $exp->setOutput(0);
         $left .= $exp->getOutput();
     }
     $tpl->setLeftNavContent($left);
 }
 /**
  * Render root folder
  */
 function renderObject()
 {
     global $ilTabs;
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks("", $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $ilTabs->activateTab("view_content");
     $ret = parent::renderObject();
     return $ret;
 }
 /**
  * Get timing details for list gui
  *
  * @param ilObjectListGUI $a_list_gui
  * @param array &$a_item
  * @return array caption, value
  */
 public static function addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
 {
     global $lng;
     self::addAdditionalSubItemInformation($a_item);
     if (isset($a_item['timing_type'])) {
         if (!isset($a_item['masked_start'])) {
             $start = $a_item['start'];
             $end = $a_item['end'];
         } else {
             $start = $a_item['masked_start'];
             $end = $a_item['masked_end'];
         }
         $activation = '';
         switch ($a_item['timing_type']) {
             case ilObjectActivation::TIMINGS_ACTIVATION:
                 $activation = ilDatePresentation::formatPeriod(new ilDateTime($start, IL_CAL_UNIX), new ilDateTime($end, IL_CAL_UNIX));
                 break;
             case ilObjectActivation::TIMINGS_PRESETTING:
                 $activation = ilDatePresentation::formatPeriod(new ilDate($start, IL_CAL_UNIX), new ilDate($end, IL_CAL_UNIX));
                 break;
         }
         if ($activation != "") {
             global $lng;
             $lng->loadLanguageModule('crs');
             $a_list_gui->addCustomProperty($lng->txt($a_item['activation_info']), $activation, false, true);
         }
     }
 }
 function addHeaderAction($a_redraw = false)
 {
     global $ilUser, $ilAccess;
     $wiki_id = $this->getPageObject()->getParentId();
     $page_id = $this->getPageObject()->getId();
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "wiki", $_GET["ref_id"], $wiki_id);
     $dispatcher->setSubObject("wpg", $page_id);
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $lg = $dispatcher->initHeaderAction();
     $lg->enableNotes(true);
     $lg->enableComments(ilObjWiki::_lookupPublicNotes($wiki_id), false);
     // rating
     if (ilObjWiki::_lookupRating($wiki_id) && $this->getPageObject()->getRating() && $this->getPageObject()->old_nr == 0) {
         $lg->enableRating(true, $this->lng->txt("wiki_rate_page"), ilObjWiki::_lookupRatingCategories($wiki_id), array("ilcommonactiondispatchergui", "ilratinggui"));
     }
     // notification
     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_WIKI, $ilUser->getId(), $wiki_id)) {
             $this->ctrl->setParameter($this, "ntf", 1);
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_wiki");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_notification_activated"));
         } else {
             $this->ctrl->setParameter($this, "ntf", 2);
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_wiki");
             if (ilNotification::hasNotification(ilNotification::TYPE_WIKI_PAGE, $ilUser->getId(), $page_id)) {
                 $this->ctrl->setParameter($this, "ntf", 3);
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_page");
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_page_notification_activated"));
             } else {
                 $this->ctrl->setParameter($this, "ntf", 4);
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_page");
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $this->lng->txt("wiki_notification_deactivated"));
             }
         }
         $this->ctrl->setParameter($this, "ntf", "");
     }
     if (!$a_redraw) {
         $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
     } else {
         return $lg->getHeaderAction();
     }
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     global $lng;
     $lng->loadLanguageModule('itgr');
     parent::__construct();
 }
 /**
  * Get command target frame.
  *
  * Overwrite this method if link frame is not current frame
  *
  * @param	string		$a_cmd			command
  *
  * @return	string		command target frame
  */
 function getCommandFrame($a_cmd)
 {
     // begin-patch fm
     return parent::getCommandFrame($a_cmd);
     // end-patch fm
 }
 /**
  * Get command target frame.
  *
  * Overwrite this method if link frame is not current frame
  *
  * @param	string		$a_cmd			command
  * @return	string		command target frame
  */
 function getCommandFrame($a_cmd)
 {
     return parent::getCommandFrame($a_cmd);
 }
 /**
  * Preload common properties
  *
  * @param
  * @return
  */
 static function preloadCommonProperties($a_obj_ids, $a_context)
 {
     global $lng, $ilSetting, $ilUser;
     if ($a_context == self::CONTEXT_REPOSITORY) {
         $active_notes = !$ilSetting->get("disable_notes");
         $active_comments = !$ilSetting->get("disable_comments");
         if ($active_notes || $active_comments) {
             include_once "./Services/Notes/classes/class.ilNote.php";
         }
         if ($active_comments) {
             // needed for action
             self::$comments_activation = ilNote::getRepObjActivation($a_obj_ids);
         }
         // properties are optional
         if ($ilSetting->get('comments_tagging_in_lists')) {
             if ($active_notes || $active_comments) {
                 self::$cnt_notes = ilNote::_countNotesAndCommentsMultiple($a_obj_ids, true);
                 $lng->loadLanguageModule("notes");
             }
             $tags_set = new ilSetting("tags");
             if ($tags_set->get("enable")) {
                 $all_users = $tags_set->get("enable_all_users");
                 include_once "./Services/Tagging/classes/class.ilTagging.php";
                 if (!$ilSetting->get('comments_tagging_in_lists_tags')) {
                     self::$cnt_tags = ilTagging::_countTags($a_obj_ids, $all_users);
                 } else {
                     $tag_user_id = null;
                     if (!$all_users) {
                         $tag_user_id = $ilUser->getId();
                     }
                     self::$tags = ilTagging::_getListTagsForObjects($a_obj_ids, $tag_user_id);
                 }
                 $lng->loadLanguageModule("tagging");
             }
         }
         $lng->loadLanguageModule("rating");
     }
     self::$preload_done = true;
 }
Example #20
0
 /**
  * Add header action menu
  * 
  * @param string $a_sub_type
  * @param int $a_sub_id
  * @return ilObjectListGUI
  */
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     global $ilAccess;
     if (!$this->creation_mode && $this->object) {
         include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
         $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, $this->object->getType(), $this->ref_id, $this->object->getId());
         $dispatcher->setSubObject($a_sub_type, $a_sub_id);
         include_once "Services/Object/classes/class.ilObjectListGUI.php";
         ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
         $lg = $dispatcher->initHeaderAction();
         if (is_object($lg)) {
             // to enable add to desktop / remove from desktop
             if ($this instanceof ilDesktopItemHandling) {
                 $lg->setContainerObject($this);
             }
             // enable multi download
             $lg->enableMultiDownload(true);
             // comments settings are always on (for the repository)
             // should only be shown if active or permission to toggle
             include_once "Services/Notes/classes/class.ilNote.php";
             if ($ilAccess->checkAccess("write", "", $this->ref_id) || $ilAccess->checkAccess("edit_permissions", "", $this->ref_id) || ilNote::commentsActivated($this->object->getId(), 0, $this->object->getType())) {
                 $lg->enableComments(true);
             }
             $lg->enableNotes(true);
             $lg->enableTags(true);
         }
         return $lg;
     }
 }
 protected function addItemDetails(ilObjectListGUI $a_item_list_gui, array $a_item)
 {
     global $lng, $ilCtrl;
     $item_ref_id = $a_item["ref_id"];
     if (is_array($this->objective_map)) {
         $details = array();
         if (isset($this->objective_map["material"][$item_ref_id])) {
             // #12965
             foreach ($this->objective_map["material"][$item_ref_id] as $objective_id) {
                 $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $objective_id);
                 $url = $ilCtrl->getLinkTargetByClass(array('illoeditorgui', 'ilcourseobjectivesgui'), 'edit');
                 $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', '');
                 $details[] = array('desc' => $lng->txt('crs_loc_tab_materials') . ': ', 'target' => '_top', 'link' => $url, 'name' => $this->objective_map["names"][$objective_id]);
             }
         }
         if ($this->objective_map["test_i"] == $item_ref_id) {
             $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
             $details[] = array('desc' => '', 'target' => '_top', 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'), 'name' => $lng->txt('crs_loc_tab_itest'));
             $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
         }
         if ($this->objective_map["test_q"] == $item_ref_id) {
             $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
             $details[] = array('desc' => '', 'target' => '_top', 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'), 'name' => $lng->txt('crs_loc_tab_qtest'));
             $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
         }
         // #15367 - patch LOK
         if (is_array($this->objective_map["test_ass"][$item_ref_id])) {
             foreach ($this->objective_map["test_ass"][$item_ref_id] as $type => $items) {
                 if ($type == ilLOSettings::TYPE_TEST_INITIAL) {
                     $caption = $lng->txt('crs_loc_tab_itest');
                     $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
                 } else {
                     $caption = $lng->txt('crs_loc_tab_qtest');
                     $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
                 }
                 foreach ($items as $objtv_title) {
                     $details[] = array('desc' => '', 'target' => '_top', 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testsOverview'), 'name' => $caption . " (" . $this->lng->txt("crs_loc_learning_objective") . ": " . $objtv_title . ")");
                 }
                 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
             }
         }
         if (sizeof($details)) {
             $a_item_list_gui->enableItemDetailLinks(true);
             $a_item_list_gui->setItemDetailLinks($details, $lng->txt('crs_loc_settings_tbl') . ': ');
         } else {
             $a_item_list_gui->enableItemDetailLinks(false);
         }
     }
     // order
     if ($this->getContainerGUI()->isActiveOrdering()) {
         $a_item_list_gui->enableCommands(true, true);
         $a_item_list_gui->enableProperties(false);
     } else {
         if (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
             $a_item_list_gui->enableCommands(true, true);
             $a_item_list_gui->enableProperties(false);
         }
     }
     if ($a_item['objective_id']) {
         $a_item_list_gui->setDefaultCommandParameters(array('objective_id' => $a_item['objective_id']));
         if ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
             $a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
             // check conditions of target
             include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
             $fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
             if (!$fullfilled || $a_item['objective_status']) {
                 $a_item_list_gui->disableTitleLink(true);
             }
         }
         include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
         $res = ilLOUserResults::lookupResult($this->getContainerObject()->getId(), $GLOBALS['ilUser']->getId(), $a_item['objective_id'], ilLOUserResults::TYPE_QUALIFIED);
         $res = $this->updateResult($res, $a_item['ref_id'], $a_item['objective_id'], $GLOBALS['ilUser']->getId());
         if ($res['is_final']) {
             $a_item_list_gui->disableTitleLink(true);
             $a_item_list_gui->enableProperties(true);
             $a_item_list_gui->addCustomProperty($this->lng->txt('crs_loc_passes_reached'), '', true);
         } elseif ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
             include_once './Modules/Course/classes/class.ilCourseObjective.php';
             $poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']);
             if ($poss_pass) {
                 $a_item_list_gui->enableProperties(true);
                 $a_item_list_gui->addCustomProperty($this->lng->txt('crs_loc_passes_left'), $poss_pass - $res['tries'] > 0 ? $poss_pass - $res['tries'] : 1, false);
             }
         }
     }
 }
 /**
  * Add header action
  */
 function addHeaderAction($a_redraw = false)
 {
     global $ilUser, $ilAccess;
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, $this->lm->getType(), $_GET["ref_id"], $this->lm->getId());
     $dispatcher->setSubObject("pg", $this->getCurrentPageId());
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $lg = $dispatcher->initHeaderAction();
     $lg->enableNotes(true);
     $lg->enableComments($this->lm->publicNotes(), false);
     if (!$a_redraw) {
         $this->tpl->setVariable("HEAD_ACTION", $lg->getHeaderAction());
     } else {
         return $lg->getHeaderAction();
     }
 }
 public function addHeaderAction($a_redraw = false)
 {
     global $ilUser, $ilAccess, $tpl, $lng, $ilCtrl;
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "dcl", $this->ref_id, $this->obj_id);
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $lg = $dispatcher->initHeaderAction();
     //$lg->enableNotes(true);
     //$lg->enableComments(ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), false);
     // notification
     if ($ilUser->getId() != ANONYMOUS_USER_ID && $this->object->getNotification() == 1) {
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_DATA_COLLECTION, $ilUser->getId(), $this->obj_id)) {
             //Command Activate Notification
             $ilCtrl->setParameter($this, "ntf", 1);
             $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_deactivate_dcl");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $lng->txt("dcl_notification_activated"));
         } else {
             //Command Deactivate Notification
             $ilCtrl->setParameter($this, "ntf", 2);
             $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_activate_dcl");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $lng->txt("dcl_notification_deactivated"));
         }
         $ilCtrl->setParameter($this, "ntf", "");
     }
     if (!$a_redraw) {
         $tpl->setHeaderActionMenu($lg->getHeaderAction());
     } else {
         return $lg->getHeaderAction();
     }
     $tpl->setHeaderActionMenu($lg->getHeaderAction());
 }
 /**
  * get command frame
  *
  * @access public
  * @param
  * @return
  */
 public function getCommandFrame($a_cmd)
 {
     switch ($a_cmd) {
         case 'show':
             include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
             include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
             if (ilECSExport::_isRemote(ilECSImport::lookupServerId($this->obj_id), ilECSImport::_lookupEContentId($this->obj_id))) {
                 return '_blank';
             }
         default:
             return parent::getCommandFrame($a_cmd);
     }
 }
 /**
  * inititialize new item
  *
  * @param	int			$a_ref_id		reference id
  * @param	int			$a_obj_id		object id
  * @param	string		$a_title		title
  * @param	string		$a_description	description
  */
 function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
 {
     parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
 }
Example #26
0
 protected function modifyTitleLink($a_default_link)
 {
     include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
     $id = ilLOSettings::isObjectiveTest($this->ref_id);
     $cmd_link = $a_default_link;
     if ($id) {
         $ref_ids = ilObject::_getAllReferences($id);
         $ref_id = end($ref_ids);
         $this->ctrl->setParameterByClass("ilrepositorygui", 'ref_id', $ref_id);
         $this->ctrl->setParameterByClass("ilrepositorygui", 'tid', $this->ref_id);
         $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", 'redirectLocToTest');
         $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
         $this->ctrl->clearParametersByClass('ilrepositorygui');
     }
     return parent::modifyTitleLink($cmd_link);
 }
 /**
  * Workaround for course titles (linked if join or read permission is granted)
  * @param type $a_permission
  * @param type $a_cmd
  * @param type $a_ref_id
  * @param type $a_type
  * @param type $a_obj_id
  * @return type
  */
 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
 {
     // Only check cmd access for cmd 'register' and 'unregister'
     if ($a_cmd != 'view' and $a_cmd != 'leave') {
         $a_cmd = '';
     }
     if ($a_permission == 'crs_linked') {
         return parent::checkCommandAccess('read', $a_cmd, $a_ref_id, $a_type, $a_obj_id) || parent::checkCommandAccess('join', $a_cmd, $a_ref_id, $a_type, $a_obj_id);
     }
     return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
 }
 /**
  * Add header action
  */
 function addHeaderAction($a_redraw = false)
 {
     global $ilAccess, $tpl;
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, $this->lm->getType(), $_GET["ref_id"], $this->lm->getId());
     $dispatcher->setSubObject("pg", $this->getCurrentPageId());
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $lg = $dispatcher->initHeaderAction();
     $lg->enableNotes(true);
     $lg->enableComments($this->lm->publicNotes(), false);
     if ($this->lm->hasRating()) {
         $lg->enableRating(true, $this->lng->txt("lm_rating"), false, array("ilcommonactiondispatchergui", "ilratinggui"));
     }
     if (!$a_redraw) {
         $this->tpl->setVariable("HEAD_ACTION", $lg->getHeaderAction());
     } else {
         // we need to add onload code manually (rating, comments, etc.)
         return $lg->getHeaderAction() . $tpl->getOnLoadCodeForAsynch();
     }
 }
 /**
  * Workaround for course titles (linked if join or read permission is granted)
  * @param type $a_permission
  * @param type $a_cmd
  * @param type $a_ref_id
  * @param type $a_type
  * @param type $a_obj_id
  * @return type
  */
 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
 {
     if ($a_permission == 'grp_linked') {
         return parent::checkCommandAccess('read', '', $a_ref_id, $a_type, $a_obj_id) || parent::checkCommandAccess('join', 'join', $a_ref_id, $a_type, $a_obj_id);
     }
     return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
 }
 /**
  * @param string $a_cmd
  * @return string
  */
 public function getCommandLink($a_cmd)
 {
     switch ($a_cmd) {
         case 'thread':
             return 'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=viewThread&amp;cmdClass=ilobjforumgui&amp;ref_id=' . $this->ref_id . '&amp;thr_pk=' . $this->getChildId();
         case 'posting':
             $thread_post = $this->getChildId();
             return 'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=viewThread&amp;cmdClass=ilobjforumgui&amp;target=1&amp;ref_id=' . $this->ref_id . '&amp;thr_pk=' . $thread_post[0] . '&amp;pos_pk=' . $thread_post[1] . '#' . $thread_post[1];
         default:
             return parent::getCommandLink($a_cmd);
     }
 }