/** * Get grouped repository object types */ static function getGroupedRepositoryObjectTypes($a_parent_obj_type) { global $ilDB, $ilPluginAdmin; $set = $ilDB->query("SELECT * FROM il_object_group"); $groups = array(); while ($gr_rec = $set->fetchRow(DB_FETCHMODE_ASSOC)) { $groups[$gr_rec["id"]] = $gr_rec; } if (!is_array($a_parent_obj_type)) { $set = $ilDB->queryF("SELECT il_object_def.* FROM il_object_def, il_object_subobj " . " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND " . " parent = %s " . " AND subobj = id ", array("text"), array($a_parent_obj_type)); } else { $q = "SELECT DISTINCT (id) as sid, il_object_def.* FROM il_object_def, il_object_subobj " . " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND " . $ilDB->in("parent", $a_parent_obj_type, false, "text") . " AND subobj = id "; $set = $ilDB->query($q); } $grouped_obj = array(); while ($rec = $ilDB->fetchAssoc($set)) { if ($rec["grp"] != "") { $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"]; $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"]; } else { $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"]; $grouped_obj[$rec["id"]]["objs"][] = $rec["id"]; } } //var_dump($grouped_obj); // now get objects from repository plugin $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj"); foreach ($pl_names as $pl_name) { include_once "./Services/Component/classes/class.ilPlugin.php"; $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name); if (!isset($grouped_obj[$pl_id])) { $grouped_obj[$pl_id] = array("pos" => "99992000", "objs" => array(0 => $pl_id)); } } //var_dump($grouped_obj); $ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true); //var_dump($ret); return $ret; }
protected static function getAllObjTypes() { global $ilPluginAdmin, $objDefinition; $res = array(); // parse modules include_once "./Services/Component/classes/class.ilModule.php"; foreach (ilModule::getAvailableCoreModules() as $mod) { $has_repo = false; $rep_types = $objDefinition->getRepositoryObjectTypesForComponent(IL_COMP_MODULE, $mod["subdir"]); if (sizeof($rep_types) > 0) { foreach ($rep_types as $ridx => $rt) { // we only want to display repository modules if ($rt["repository"]) { $has_repo = true; } else { unset($rep_types[$ridx]); } } } if ($has_repo) { foreach ($rep_types as $rt) { $res[] = $rt["id"]; } } } // parse plugins include_once "./Services/Component/classes/class.ilPlugin.php"; $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj"); foreach ($pl_names as $pl_name) { $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name); if ($pl_id) { $res[] = $pl_id; } } return $res; }
/** * Get pages for list. */ function getComponents() { global $objDefinition, $ilSetting, $lng, $ilPluginAdmin; // unassigned objects should be last $this->pos_group_options = array(0 => $lng->txt("rep_new_item_group_unassigned")); $pos_group_map[0] = "9999"; include_once "Services/Repository/classes/class.ilObjRepositorySettings.php"; foreach (ilObjRepositorySettings::getNewItemGroups() as $item) { $this->pos_group_options[$item["id"]] = $item["title"]; $pos_group_map[$item["id"]] = $item["pos"]; } $obj_types = array(); // parse modules include_once "./Services/Component/classes/class.ilModule.php"; foreach (ilModule::getAvailableCoreModules() as $mod) { $has_repo = false; $rep_types = $objDefinition->getRepositoryObjectTypesForComponent(IL_COMP_MODULE, $mod["subdir"]); if (sizeof($rep_types) > 0) { foreach ($rep_types as $ridx => $rt) { // we only want to display repository modules if ($rt["repository"]) { $has_repo = true; } else { unset($rep_types[$ridx]); } } } if ($has_repo) { foreach ($rep_types as $rt) { $obj_types[$rt["id"]] = array("object" => $rt["class_name"], "caption" => $lng->txt("obj_" . $rt["id"]), "subdir" => $mod["subdir"], "grp" => $rt["grp"], "default_pos" => $rt["default_pos"]); } } } // parse plugins include_once "./Services/Component/classes/class.ilPlugin.php"; $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj"); foreach ($pl_names as $pl_name) { $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name); if ($pl_id) { $obj_types[$pl_id] = array("object" => $pl_name, "caption" => ilPlugin::lookupTxt("rep_robj", $pl_id, "obj_" . $pl_id), "subdir" => $lng->txt("cmps_plugin"), "grp" => "", "default_pos" => 2000); } } // parse positions $data = array(); foreach ($obj_types as $obj_type => $item) { $org_pos = $ilSetting->get("obj_add_new_pos_" . $obj_type); if (!(int) $org_pos) { // no setting yet, use default $org_pos = $item["default_pos"]; } if (strlen($org_pos) < 8) { // "old" setting without group part, add "unassigned" group $org_pos = $pos_group_map[0] . str_pad($org_pos, 4, "0", STR_PAD_LEFT); } $pos_grp_id = $ilSetting->get("obj_add_new_pos_grp_" . $obj_type, 0); $group = null; if ($item["grp"] != "") { $group = $objDefinition->getGroup($item["grp"]); $group = $group["name"]; } $data[] = array("id" => $obj_type, "object" => $item["object"], "caption" => $item["caption"], "subdir" => $item["subdir"], "pos" => (int) substr($org_pos, 4), "pos_group" => $pos_grp_id, "creation" => !(bool) $ilSetting->get("obj_dis_creation_" . $obj_type, false), "group_id" => $item["grp"], "group" => $group, "sort_key" => (int) $org_pos); } $data = ilUtil::sortArray($data, "sort_key", "asc", true); $this->setData($data); }
/** * Get css file location */ public final function getStyleSheetLocation($a_css_file) { $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName()) . "_" . $this->getSlotId() . "_" . ilPlugin::lookupIdForName($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName()); $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2); if (is_int(strpos($css, "Customizing"))) { return $css; } return $this->getDirectory() . "/templates/" . $a_css_file; }
function lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name) { return parent::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name); // TODO: Change the autogenerated stub }