/** * Get drop down */ function getDropDown() { global $tree, $rbacsystem, $lng, $ilSetting, $objDefinition; $tpl = new ilTemplate("tpl.admin_drop_down.html", true, true, "Services/Administration"); $objects = $tree->getChilds(SYSTEM_FOLDER_ID); foreach ($objects as $object) { $new_objects[$object["title"] . ":" . $object["child"]] = $object; //have to set it manually as translation type of main node cannot be "sys" as this type is a orgu itself. if ($object["type"] == "orgu") { $new_objects[$object["title"] . ":" . $object["child"]]["title"] = $lng->txt("obj_orgu"); } } // add entry for switching to repository admin // note: please see showChilds methods which prevents infinite look $new_objects[$lng->txt("repository_admin") . ":" . ROOT_FOLDER_ID] = array("tree" => 1, "child" => ROOT_FOLDER_ID, "ref_id" => ROOT_FOLDER_ID, "depth" => 3, "type" => "root", "title" => $lng->txt("repository_admin"), "description" => $lng->txt("repository_admin_desc"), "desc" => $lng->txt("repository_admin_desc")); //$nd = $tree->getNodeData(SYSTEM_FOLDER_ID); //var_dump($nd); $new_objects[$lng->txt("general_settings") . ":" . SYSTEM_FOLDER_ID] = array("tree" => 1, "child" => SYSTEM_FOLDER_ID, "ref_id" => SYSTEM_FOLDER_ID, "depth" => 2, "type" => "adm", "title" => $lng->txt("general_settings")); ksort($new_objects); // determine items to show $items = array(); foreach ($new_objects as $c) { // check visibility if ($tree->getParentId($c["ref_id"]) == ROOT_FOLDER_ID && $c["type"] != "adm" && $_GET["admin_mode"] != "repository") { continue; } // these objects may exist due to test cases that didnt clear // data properly if ($c["type"] == "" || $c["type"] == "objf" || $c["type"] == "xxx") { continue; } $accessible = $rbacsystem->checkAccess('visible,read', $c["ref_id"]); if (!$accessible) { continue; } if ($c["ref_id"] == ROOT_FOLDER_ID && !$rbacsystem->checkAccess('write', $c["ref_id"])) { continue; } if ($c["type"] == "rolf" && $c["ref_id"] != ROLE_FOLDER_ID) { continue; } $items[] = $c; } $cnt = 0; $titems = array(); foreach ($items as $i) { $titems[$i["type"]] = $i; } // admin menu layout $layout = array(1 => array("basic" => array("adm", "stys", "adve", "lngf", "cmps", "accs", "hlps", "trac"), "users" => array("usrf", 'tos', "rolf", "auth", "ps", "orgu")), 2 => array("services" => array("pdts", "nwss", "tags", "prfa", "skmg", "cals", "mail", "---", "seas", "mds", "cert", 'ecss', "pays", "extt")), 3 => array("objects" => array("reps", "---", "blga", "chta", "crss", "facs", "frma", "grps", "lrss", "mcts", "mobs", "svyf", "assf", "wbrs", "wiks", "---", 'otpl', 'sysc', "root", "recf"))); // now get all items and groups that are accessible $groups = array(); for ($i = 1; $i <= 3; $i++) { $groups[$i] = array(); foreach ($layout[$i] as $group => $entries) { $groups[$i][$group] = array(); $entries_since_last_sep = false; foreach ($entries as $e) { if ($e == "---" || $titems[$e]["type"] != "") { if ($e == "---" && $entries_since_last_sep) { $groups[$i][$group][] = $e; $entries_since_last_sep = false; } else { if ($e != "---") { $groups[$i][$group][] = $e; $entries_since_last_sep = true; } } } } } } include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php"; $gl = new ilGroupedListGUI(); for ($i = 1; $i <= 3; $i++) { if ($i > 1) { $gl->nextColumn(); } foreach ($groups[$i] as $group => $entries) { if (count($entries) > 0) { $gl->addGroupHeader($lng->txt("adm_" . $group)); foreach ($entries as $e) { if ($e == "---") { $gl->addSeparator(); } else { $path = ilUtil::getImagePath("icon_" . $titems[$e]["type"] . "_s.png"); $icon = $path != "" ? ilUtil::img($path) . " " : ""; if ($_GET["admin_mode"] == "settings" && $titems[$e]["ref_id"] == ROOT_FOLDER_ID) { $gl->addEntry($icon . $titems[$e]["title"], "ilias.php?baseClass=ilAdministrationGUI&ref_id=" . $titems[$e]["ref_id"] . "&admin_mode=repository", "_top", "", "", "mm_adm_rep", ilHelp::getMainMenuTooltip("mm_adm_rep"), "bottom center", "top center", false); } else { $gl->addEntry($icon . $titems[$e]["title"], "ilias.php?baseClass=ilAdministrationGUI&ref_id=" . $titems[$e]["ref_id"] . "&cmd=jump", "_top", "", "", "mm_adm_" . $titems[$e]["type"], ilHelp::getMainMenuTooltip("mm_adm_" . $titems[$e]["type"]), "bottom center", "top center", false); } } } } } } //$gl->addSeparator(); echo $gl->getHTML(); exit; }
/** * Get rendered html of sub object list * * @return string */ protected function getHTML() { global $ilCtrl; if ($this->mode != ilObjectDefinition::MODE_WORKSPACE && !isset($this->url_creation)) { $base_url = "ilias.php?baseClass=ilRepositoryGUI&ref_id=" . $this->parent_ref_id . "&cmd=create"; } else { $base_url = $this->url_creation; } $base_url = $ilCtrl->appendRequestTokenParameterString($base_url); if ($this->url_creation_callback) { $base_url .= "&crtcb=" . $this->url_creation_callback; } include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php"; $gl = new ilGroupedListGUI(); $gl->setAsDropDown(true, true); foreach ($this->sub_objects as $item) { switch ($item["type"]) { case "column_separator": $gl->nextColumn(); break; /* case "separator": $gl->addSeparator(); break; */ /* case "separator": $gl->addSeparator(); break; */ case "group": $gl->addGroupHeader($item["title"]); break; case "object": $type = $item["value"]; $path = ilObject::_getIcon('', 'tiny', $type); $icon = $path != "" ? ilUtil::img($path) . " " : ""; $url = $base_url . "&new_type=" . $type; $ttip = ilHelp::getObjCreationTooltipText($type); $gl->addEntry($icon . $item["title"], $url, "_top", "", "", $type, $ttip, "bottom center", "top center", false); break; } } $this->gl = $gl; return $gl->getHTML(); }