/** * Get assignable items * * @param * @return */ function getAssignableItems() { if ($this->getItemGroupRefId() <= 0) { return array(); } $parent_node = $this->tree->getNodeData($this->tree->getParentId($this->getItemGroupRefId())); $materials = array(); $nodes = $this->tree->getChilds($parent_node["child"]); include_once "./Modules/File/classes/class.ilObjFileAccess.php"; foreach ($nodes as $node) { // filter side blocks and session, item groups and role folder if ($node['child'] == $parent_node["child"] || $this->obj_def->isSideBlock($node['type']) || in_array($node['type'], array('sess', 'itgr', 'rolf', 'adm'))) { continue; } // filter hidden files // see http://www.ilias.de/mantis/view.php?id=10269 if ($node['type'] == "file" && ilObjFileAccess::_isFileHidden($node['title'])) { continue; } $materials[] = $node; } $materials = ilUtil::sortArray($materials, "title", "asc"); return $materials; }
/** * parse tree * @param object $a_source * @return */ public function parseContainer($a_source) { global $tree, $objDefinition, $ilAccess; $first = true; foreach ($tree->getSubTree($root = $tree->getNodeData($a_source)) as $node) { if ($node['type'] == 'rolf') { continue; } if (!$objDefinition->allowExport($node['type'])) { #continue; } include_once "./Modules/File/classes/class.ilObjFileAccess.php"; if ($node['type'] == "file" && ilObjFileAccess::_isFileHidden($node['title'])) { continue; } $r = array(); if ($last = ilExportFileInfo::lookupLastExport($node['obj_id'], 'xml')) { $r['last_export'] = $last->getCreationDate()->get(IL_CAL_UNIX); } else { $r['last_export'] = 0; } $r['last'] = false; $r['source'] = $first; $r['ref_id'] = $node['child']; $r['depth'] = $node['depth'] - $root['depth']; $r['type'] = $node['type']; $r['title'] = $node['title']; $r['export'] = $objDefinition->allowExport($node['type']); $r['perm_export'] = $ilAccess->checkAccess('write', '', $node['child']); $rows[] = $r; $first = false; } $rows[] = array('last' => true); $this->setData((array) $rows); }
/** * 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) { // #12166 - keep translation, ignore long description if ($ilObjDataCache->isTranslatedDescription($object["obj_id"])) { $long_desc[$object["obj_id"]] = $object["description"]; } 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_ref_ids = array(); if (!self::$data_preloaded) { include_once "./Services/Object/classes/class.ilObjectListGUIPreloader.php"; $preloader = new ilObjectListGUIPreloader(ilObjectListGUI::CONTEXT_REPOSITORY); } 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 // including event items! if (!self::$data_preloaded) { $preloader->addItem($object["obj_id"], $object["type"], $object["child"]); } // 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_ref_ids[] = $object["child"]; } // data preloader if (!self::$data_preloaded) { $preloader->preload(); unset($preloader); 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 $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 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 all item information (title, commands, description) in HTML * * @access public * @param int $a_ref_id item reference id * @param int $a_obj_id item object id * @param int $a_title item title * @param int $a_description item description * @param bool $a_use_asynch * @param bool $a_get_asynch_commands * @param string $a_asynch_url * @param bool $a_context workspace/tree context * @return string html code */ function getListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch = false, $a_get_asynch_commands = false, $a_asynch_url = "", $a_context = self::CONTEXT_REPOSITORY) { global $ilAccess, $ilBench, $ilUser, $ilCtrl; // this variable stores wheter any admin commands // are included in the output $this->adm_commands_included = false; // only for permformance exploration $type = ilObject::_lookupType($a_obj_id); // initialization $ilBench->start("ilObjectListGUI", "1000_getListHTML_init{$type}"); $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description, $a_context); $ilBench->stop("ilObjectListGUI", "1000_getListHTML_init{$type}"); // prepare ajax calls include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; if ($a_context == self::CONTEXT_REPOSITORY) { $node_type = ilCommonActionDispatcherGUI::TYPE_REPOSITORY; } else { $node_type = ilCommonActionDispatcherGUI::TYPE_WORKSPACE; } $this->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash($node_type, $a_ref_id, $type, $a_obj_id)); if ($a_use_asynch && $a_get_asynch_commands) { return $this->insertCommands(true, true); } if ($this->rating_enabled) { if (ilRating::hasRatingInListGUI($this->obj_id, $this->type)) { $may_rate = $this->checkCommandAccess("read", "", $this->ref_id, $this->type); $rating = new ilRatingGUI(); $rating->setObject($this->obj_id, $this->type); /* $this->addCustomProperty( $this->lng->txt("rating_average_rating"), $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id), false, true );*/ $this->addCustomProperty("", $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id), false, true); } } // read from cache include_once "Services/Object/classes/class.ilListItemAccessCache.php"; $this->acache = new ilListItemAccessCache(); $cres = $this->acache->getEntry($ilUser->getId() . ":" . $a_ref_id); if ($this->acache->getLastAccessStatus() == "hit") { $this->access_cache = unserialize($cres); } else { // write to cache $this->storeAccessCache(); } // visible check if (!$this->checkCommandAccess("visible", "", $a_ref_id, "", $a_obj_id)) { $ilBench->stop("ilObjectListGUI", "2000_getListHTML_check_visible"); $this->resetCustomData(); return ""; } // BEGIN WEBDAV if ($type == 'file' and ilObjFileAccess::_isFileHidden($a_title)) { $this->resetCustomData(); return ""; } // END WEBDAV $this->tpl = new ilTemplate("tpl.container_list_item.html", true, true, "Services/Container", "DEFAULT", false, true); if ($this->getCommandsStatus() || $this->payment_enabled && IS_PAYMENT_ENABLED) { if (!$this->getSeparateCommands()) { $this->tpl->setVariable("COMMAND_SELECTION_LIST", $this->insertCommands($a_use_asynch, $a_get_asynch_commands, $a_asynch_url)); } } if ($this->getProgressInfoStatus()) { $this->insertProgressInfo(); } // insert title and describtion $this->insertTitle(); if (!$this->isMode(IL_LIST_AS_TRIGGER)) { if ($this->getDescriptionStatus()) { $this->insertDescription(); } } if ($this->getSearchFragmentStatus()) { $this->insertSearchFragment(); } if ($this->enabledRelevance()) { $this->insertRelevance(); } // properties $ilBench->start("ilObjectListGUI", "6000_insert_properties{$type}"); if ($this->getPropertiesStatus()) { $this->insertProperties(); } $ilBench->stop("ilObjectListGUI", "6000_insert_properties{$type}"); // notice properties $ilBench->start("ilObjectListGUI", "6500_insert_notice_properties{$type}"); if ($this->getNoticePropertiesStatus()) { $this->insertNoticeProperties(); } $ilBench->stop("ilObjectListGUI", "6500_insert_notice_properties{$type}"); // preconditions $ilBench->start("ilObjectListGUI", "7000_insert_preconditions"); if ($this->getPreconditionsStatus()) { $this->insertPreconditions(); } $ilBench->stop("ilObjectListGUI", "7000_insert_preconditions"); // path $ilBench->start("ilObjectListGUI", "8000_insert_path"); $this->insertPath(); $ilBench->stop("ilObjectListGUI", "8000_insert_path"); $ilBench->start("ilObjectListGUI", "8500_item_detail_links"); if ($this->getItemDetailLinkStatus()) { $this->insertItemDetailLinks(); } $ilBench->stop("ilObjectListGUI", "8500_item_detail_links"); // icons and checkboxes $this->insertIconsAndCheckboxes(); // input field for position $this->insertPositionField(); // subitems $this->insertSubItems(); // file upload if ($this->isFileUploadAllowed()) { $this->insertFileUpload(); } $this->resetCustomData(); $this->tpl->setVariable("DIV_CLASS", 'ilContainerListItemOuter'); $this->tpl->setVariable("DIV_ID", 'id = "' . $this->getUniqueItemId(true) . '"'); $this->tpl->setVariable("ADDITIONAL", $this->getAdditionalInformation()); // #11554 - make sure that internal ids are reset $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", ""); return $this->tpl->get(); }
/** * Returns true, if this file should be hidden in the repository view. */ function isHidden() { require_once 'Modules/File/classes/class.ilObjFileAccess.php'; return ilObjFileAccess::_isFileHidden($this->getTitle()); }