/** * Get subitems of container * @param bool $a_admin_panel_enabled[optional] * @param bool $a_include_side_block[optional] * @return array */ public function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false) { global $ilUser; // Caching if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block])) { return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]; } // Results are stored in $this->items parent::getSubItems($a_admin_panel_enabled, $a_include_side_block); $limit_sess = false; if (!$a_admin_panel_enabled && !$a_include_side_block && $this->items['sess'] && is_array($this->items['sess']) && $this->isSessionLimitEnabled() && $this->getViewMode() == ilContainer::VIEW_SESSIONS) { $limit_sess = true; } if (!$limit_sess) { return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]; } // do session limit // @todo move to gui class if (isset($_GET['crs_prev_sess'])) { $ilUser->writePref('crs_sess_show_prev_' . $this->getId(), (string) (int) $_GET['crs_prev_sess']); } if (isset($_GET['crs_next_sess'])) { $ilUser->writePref('crs_sess_show_next_' . $this->getId(), (string) (int) $_GET['crs_next_sess']); } $sessions = ilUtil::sortArray($this->items['sess'], 'start', 'ASC', true, false); $today = new ilDate(date('Ymd', time()), IL_CAL_DATE); $previous = $current = $next = array(); foreach ($sessions as $key => $item) { $start = new ilDateTime($item['start'], IL_CAL_UNIX); $end = new ilDateTime($item['end'], IL_CAL_UNIX); if (ilDateTime::_within($today, $start, $end, IL_CAL_DAY)) { $current[] = $item; } elseif (ilDateTime::_before($start, $today, IL_CAL_DAY)) { $previous[] = $item; } elseif (ilDateTime::_after($start, $today, IL_CAL_DAY)) { $next[] = $item; } } $num_previous_remove = max(count($previous) - $this->getNumberOfPreviousSessions(), 0); while ($num_previous_remove--) { if (!$ilUser->getPref('crs_sess_show_prev_' . $this->getId())) { array_shift($previous); } $this->items['sess_link']['prev']['value'] = 1; } $num_next_remove = max(count($next) - $this->getNumberOfNextSessions(), 0); while ($num_next_remove--) { if (!$ilUser->getPref('crs_sess_show_next_' . $this->getId())) { array_pop($next); } // @fixme $this->items['sess_link']['next']['value'] = 1; } $sessions = array_merge($previous, $current, $next); $this->items['sess'] = $sessions; // #15389 - see ilContainer::getSubItems() include_once 'Services/Container/classes/class.ilContainerSorting.php'; $sort = ilContainerSorting::_getInstance($this->getId()); $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]; }
/** * Render item group * * @param * @return */ function renderItemGroup($a_tpl, $a_itgr) { global $ilAccess, $lng; $perm_ok = $ilAccess->checkAccess("read", "", $a_itgr['ref_id']); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']); $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('itgr', $a_itgr['obj_id'], $items); // if no permissoin is given, set the items to "rendered" but // do not display the whole block if (!$perm_ok) { foreach ($items as $item) { $this->rendered_items[$item["child"]] = true; } return; } $item_list_gui = $this->getItemGUI($a_itgr); $item_list_gui->enableNotes(false); $item_list_gui->enableTags(false); $item_list_gui->enableComments(false); $item_list_gui->enableTimings(false); $item_list_gui->getListItemHTML($a_itgr["ref_id"], $a_itgr["obj_id"], $a_itgr["title"], $a_itgr["description"]); $commands_html = $item_list_gui->getCommandsHTML(); $this->addSeparatorRow($a_tpl); $a_tpl->setVariable("CB_ID", ' id="bl_cntr_' . $this->bl_cnt . '"'); if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"]) { $a_tpl->setCurrentBlock("select_all_row"); $a_tpl->setVariable("CHECKBOXNAME", "bl_cb_" . $this->bl_cnt); $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_" . $this->bl_cnt); $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_" . $this->bl_cnt); $a_tpl->setVariable("TXT_SELECT_ALL", $lng->txt("select_all")); $a_tpl->parseCurrentBlock(); $this->bl_cnt++; } $a_tpl->setCurrentBlock("container_header_row"); $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $a_itgr["title"]); $a_tpl->setVariable("CHR_COMMANDS", $commands_html); $a_tpl->parseCurrentBlock(); $a_tpl->touchBlock("container_row"); $this->resetRowType(); // render item group sub items $position = 1; foreach ($items as $item) { $html2 = $this->renderItem($item, $position++, false, "[itgr][" . $a_itgr['obj_id'] . "]"); if ($html2 != "") { $this->addStandardRow($a_tpl, $html2, $item["child"]); $this->rendered_items[$item["child"]] = true; } } // finish block $a_tpl->setCurrentBlock("container_block"); $a_tpl->parseCurrentBlock(); }
/** * Render item group * * @param * @return */ function renderItemGroup($a_itgr) { global $ilAccess, $lng; $perm_ok = $ilAccess->checkAccess("read", "", $a_itgr['ref_id']); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']); // if no permission is given, set the items to "rendered" but // do not display the whole block if (!$perm_ok) { foreach ($items as $item) { $this->renderer->hideItem($item["child"]); } return; } $item_list_gui = $this->getItemGUI($a_itgr); $item_list_gui->enableNotes(false); $item_list_gui->enableTags(false); $item_list_gui->enableComments(false); $item_list_gui->enableTimings(false); $item_list_gui->getListItemHTML($a_itgr["ref_id"], $a_itgr["obj_id"], $a_itgr["title"], $a_itgr["description"]); $commands_html = $item_list_gui->getCommandsHTML(); $this->renderer->addCustomBlock($a_itgr["ref_id"], $a_itgr["title"], $commands_html); // render item group sub items $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('itgr', $a_itgr['obj_id'], $items); $position = 1; foreach ($items as $item) { $html2 = $this->renderItem($item, $position++, false, "[itgr][" . $a_itgr['obj_id'] . "]"); if ($html2 != "") { // :TODO: show it multiple times? $this->renderer->addItemToBlock($a_itgr["ref_id"], $item["type"], $item["child"], $html2, true); } } }
/** * sort nodes * * @access public * @param * @return */ public function sortNodes($a_nodes, $a_parent_obj_id) { global $objDefinition; if ($a_parent_obj_id > 0) { $parent_type = ilObject::_lookupType($a_parent_obj_id); } else { $parent_type = "dummy"; $this->type_grps["dummy"] = array("root" => "dummy"); } if (empty($this->type_grps[$parent_type])) { $this->type_grps[$parent_type] = $objDefinition->getGroupedRepositoryObjectTypes($parent_type); } $group = array(); foreach ($a_nodes as $node) { $g = $objDefinition->getGroupOfObj($node["type"]); if ($g == "") { $g = $node["type"]; } $group[$g][] = $node; } $nodes = array(); foreach ($this->type_grps[$parent_type] as $t => $g) { if (is_array($group[$t])) { // do we have to sort this group?? include_once "./Services/Container/classes/class.ilContainer.php"; include_once "./Services/Container/classes/class.ilContainerSorting.php"; $sort = ilContainerSorting::_getInstance($a_parent_obj_id); $group = $sort->sortItems($group); foreach ($group[$t] as $k => $item) { $nodes[] = $item; } } } return $nodes; //return parent::sortNodes($a_nodes,$a_parent_obj_id); }
/** * info screen * * @access protected * @param * @return */ public function infoScreen() { global $ilAccess, $ilUser, $ilCtrl, $tree, $ilToolbar; $this->checkPermission('visible'); $this->tabs_gui->setTabActive('info_short'); $appointment_obj = $this->object->getFirstAppointment(); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); if ($this->object->enabledRegistration()) { include_once './Modules/Session/classes/class.ilEventParticipants.php'; if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) { $ilToolbar->addFormButton($this->lng->txt('event_unregister'), 'join'); } else { if (!isset($_SESSION['sess_hide_info'])) { ilUtil::sendInfo($this->lng->txt('sess_join_info')); } $ilToolbar->addFormButton($this->lng->txt('join_session'), 'join', '', true); } $ilToolbar->setFormAction($this->ctrl->getFormAction($this)); } // Session information if (strlen($this->object->getLocation()) or strlen($this->object->getDetails())) { $info->addSection($this->lng->txt('event_section_information')); } if (strlen($location = $this->object->getLocation())) { $info->addProperty($this->lng->txt('event_location'), nl2br($this->object->getLocation())); } if (strlen($this->object->getDetails())) { $info->addProperty($this->lng->txt('event_details_workflow'), nl2br($this->object->getDetails())); } // Tutor information if ($this->object->hasTutorSettings()) { $info->addSection($this->lng->txt('event_tutor_data')); if (strlen($fullname = $this->object->getName())) { $info->addProperty($this->lng->txt('event_lecturer'), $fullname); } if (strlen($email = $this->object->getEmail())) { $info->addProperty($this->lng->txt('tutor_email'), $email); } if (strlen($phone = $this->object->getPhone())) { $info->addProperty($this->lng->txt('tutor_phone'), $phone); } } $html = ''; include_once './Services/Object/classes/class.ilObjectActivation.php'; include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Modules/Session/classes/class.ilSessionObjectListGUIFactory.php'; $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId()); $parent_id = $tree->getParentId($this->object->getRefId()); $parent_id = ilObject::_lookupObjId($parent_id); $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems('sess', $this->object->getId(), $eventItems); foreach ($eventItems as $item) { $list_gui = ilSessionObjectListGUIFactory::factory($item['type']); $list_gui->setContainerObject($this); $this->modifyItemGUI($list_gui, $item, false); $html .= $list_gui->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); } if (strlen($html)) { $info->addSection($this->lng->txt('event_materials')); $info->addProperty(' ', $html); } // forward the command $this->ctrl->forwardCommand($info); // store read event require_once 'Services/Tracking/classes/class.ilChangeEvent.php'; ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(), $this->object->getId(), $ilUser->getId()); }
/** * Save Sorting * * @access public * @param * */ public function saveSortingObject() { include_once 'Services/Container/classes/class.ilContainerSorting.php'; $sorting = ilContainerSorting::_getInstance($this->object->getId()); // Allow comma $positions = str_replace(',', '.', $_POST['position']); $sorting->savePost($positions); ilUtil::sendSuccess($this->lng->txt('cntr_saved_sorting'), true); $this->ctrl->redirect($this, "editOrder"); }
/** * Save nmanual sorting * @return */ protected function saveSorting() { $this->checkPermission('write'); include_once './Services/Container/classes/class.ilContainerSorting.php'; $sort = ilContainerSorting::_getInstance($this->object->getId()); $sort->savePost((array) $_POST['position']); ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); $this->view(); }
/** * Sort childs * * @param array $a_childs array of child nodes * @param int $a_parent_node_id parent node id * @return array array of childs nodes */ function sortChilds($a_childs, $a_parent_node_id) { global $objDefinition; $parent_obj_id = ilObject::_lookupObjId($a_parent_node_id); if ($parent_obj_id > 0) { $parent_type = ilObject::_lookupType($parent_obj_id); } else { $parent_type = "dummy"; $this->type_grps["dummy"] = array("root" => "dummy"); } if (empty($this->type_grps[$parent_type])) { $this->type_grps[$parent_type] = $objDefinition->getGroupedRepositoryObjectTypes($parent_type); } $group = array(); foreach ($a_childs as $child) { $g = $objDefinition->getGroupOfObj($child["type"]); if ($g == "") { $g = $child["type"]; } $group[$g][] = $child; } // #14587 - $objDefinition->getGroupedRepositoryObjectTypes does NOT include side blocks! $wl = $this->getTypeWhiteList(); if (is_array($wl) && in_array("poll", $wl)) { $this->type_grps[$parent_type]["poll"] = array(); } $childs = array(); foreach ($this->type_grps[$parent_type] as $t => $g) { if (is_array($group[$t])) { // do we have to sort this group?? include_once "./Services/Container/classes/class.ilContainer.php"; include_once "./Services/Container/classes/class.ilContainerSorting.php"; $sort = ilContainerSorting::_getInstance($parent_obj_id); $group = $sort->sortItems($group); // need extra session sorting here if ($t == "sess") { } foreach ($group[$t] as $k => $item) { $childs[] = $item; } } } return $childs; }
/** * 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]; }
/** * render objective * * @access protected * @param int objective id * @return string html */ protected function renderObjective($a_objective_id) { global $ilUser, $lng; include_once './Modules/Course/classes/class.ilCourseObjective.php'; $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByObjective($a_objective_id); $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj', $a_objective_id, $items); include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php'; $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id); $pos = 1; foreach ($items as $item) { if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) { continue; } $chapters = $objectives_lm_obj->getChapters(); $item_list_gui2 = $this->getItemGUI($item); $item_list_gui2->enableIcon(true); if (count($chapters)) { $num = 0; $has_sections = false; foreach ($chapters as $chapter) { if ($chapter['ref_id'] != $item['child']) { continue; } $has_sections = true; include_once './Modules/LearningModule/classes/class.ilLMObject.php'; $details[$num]['desc'] = $lng->txt('obj_' . $chapter['type']) . ' -> '; $details[$num]['target'] = '_top'; $details[$num]['link'] = "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $chapter['ref_id'] . '&obj_id=' . $chapter['obj_id']; $details[$num]['name'] = ilLMObject::_lookupTitle($chapter['obj_id']); $num++; } if ($has_sections) { $item_list_gui2->enableItemDetailLinks(true); $item_list_gui2->setItemDetailLinks($details, $lng->txt('crs_suggested_sections') . ': '); } } if ($this->getContainerGUI()->isActiveAdministrationPanel()) { $item_list_gui2->enableCheckbox(true); if ($this->getContainerObject()->getOrderType() == ilContainer::SORT_MANUAL) { $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $item["ref_id"] . "]", sprintf('%.1f', $pos)); $pos++; } } $this->rendered_items[$item['child']] = true; $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded()); $this->objective_list_gui->addSubItemHTML($sub_item_html); } if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) { $this->objective_list_gui->enableCommands(false); } else { $this->objective_list_gui->enableCommands(true); } $html = $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription()); return $html; }
/** * 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]; }
/** * Sort childs * * @param array $a_childs array of child nodes * @param mixed $a_parent_node parent node * * @return array array of childs nodes */ function sortChilds($a_childs, $a_parent_node_id) { global $objDefinition; $parent_obj_id = ilObject::_lookupObjId($a_parent_node_id); if ($parent_obj_id > 0) { $parent_type = ilObject::_lookupType($parent_obj_id); } else { $parent_type = "dummy"; $this->type_grps["dummy"] = array("root" => "dummy"); } if (empty($this->type_grps[$parent_type])) { $this->type_grps[$parent_type] = $objDefinition->getGroupedRepositoryObjectTypes($parent_type); } // #14465 - item groups include_once './Services/Object/classes/class.ilObjectActivation.php'; $group = array(); foreach ($a_childs as $child) { // item group: get childs if ($child["type"] == "itgr") { $g = $child["child"]; $items = ilObjectActivation::getItemsByItemGroup($g); if ($items) { // add item group ref id to item group block $this->type_grps[$parent_type]["itgr"]["ref_ids"][] = $g; foreach ($items as $item) { $group[$g][] = $item; } } } else { $g = $objDefinition->getGroupOfObj($child["type"]); if ($g == "") { $g = $child["type"]; } $group[$g][] = $child; } } // custom block sorting? include_once "./Services/Container/classes/class.ilContainerSorting.php"; $sort = ilContainerSorting::_getInstance($parent_obj_id); $block_pos = $sort->getBlockPositions(); if (sizeof($block_pos)) { $tmp = $this->type_grps[$parent_type]; $this->type_grps[$parent_type] = array(); foreach ($block_pos as $block_type) { // type group if (!is_numeric($block_type) && array_key_exists($block_type, $tmp)) { $this->type_grps[$parent_type][$block_type] = $tmp[$block_type]; unset($tmp[$block_type]); } else { // using item group ref id directly $this->type_grps[$parent_type][$block_type] = array(); } } // append missing if (sizeof($tmp)) { foreach ($tmp as $block_type => $grp) { $this->type_grps[$parent_type][$block_type] = $grp; } } unset($tmp); } $childs = array(); $done = array(); foreach ($this->type_grps[$parent_type] as $t => $g) { // type group if (is_array($group[$t])) { // do we have to sort this group?? include_once "./Services/Container/classes/class.ilContainer.php"; include_once "./Services/Container/classes/class.ilContainerSorting.php"; $sort = ilContainerSorting::_getInstance($parent_obj_id); $group = $sort->sortItems($group); // need extra session sorting here if ($t == "sess") { } foreach ($group[$t] as $k => $item) { if (!in_array($item["child"], $done)) { $childs[] = $item; $done[] = $item["child"]; } } } else { if ($t == "itgr" && is_array($g["ref_ids"])) { foreach ($g["ref_ids"] as $ref_id) { if (isset($group[$ref_id])) { foreach ($group[$ref_id] as $k => $item) { if (!in_array($item["child"], $done)) { $childs[] = $item; $done[] = $item["child"]; } } } } } } } return $childs; }