/** * @param $a_type * @param $a_name * * @return mixed */ public static function getComponentInfo($a_type, $a_name) { $global_cache = ilCachedComponentData::getInstance(); return $global_cache->lookupCompInfo($a_type, $a_name); }
/** * Get all active plugins for a slot */ static final function getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id) { global $ilDB, $ilPluginAdmin; $plugins = array(); // $q = "SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype, "text"). // " AND component_name = ".$ilDB->quote($a_cname, "text"). // " AND slot_id = ".$ilDB->quote($a_slot_id, "text"). // " AND active = ".$ilDB->quote(1, "integer"); // // $set = $ilDB->query($q); $cached_component = ilCachedComponentData::getInstance(); // while($rec = $ilDB->fetchAssoc($set)) $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id); foreach ($lookupActivePluginsBySlotId as $rec) { if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"])) { $plugins[] = $rec["name"]; } } return $plugins; }
/** * Get all plugin slots */ static function getAllSlots() { $cached_component = ilCachedComponentData::getInstance(); $recs = $cached_component->getIlPluginslotById(); //global $ilDB; //$set = $ilDB->query("SELECT * FROM il_pluginslot "); //$slots = array(); //while ($rec = $ilDB->fetchAssoc($set)) foreach ($recs as $rec) { $pos = strpos($rec["component"], "/"); $slots[] = array("component_type" => substr($rec["component"], 0, $pos), "component_name" => substr($rec["component"], $pos + 1), "slot_id" => $rec["id"], "slot_name" => $rec["name"]); } return $slots; }
/** * 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; } $global_cache = ilCachedComponentData::getInstance(); // 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); // } $recs = $global_cache->lookupGroupedRepObj($a_parent_obj_type); $grouped_obj = array(); // while($rec = $ilDB->fetchAssoc($set)) foreach ((array) $recs as $rec) { 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; }