4require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
56 $this->
ilias = $ilias;
80 $this->obj_data = array();
83 foreach ($global_cache->getIlobjectDef() as $rec) {
84 $this->obj_data[$rec[
"id"]] = array(
86 "class_name" => $rec[
"class_name"],
87 "location" => $rec[
"location"],
88 "checkbox" => $rec[
"checkbox"],
89 "inherit" => $rec[
"inherit"],
90 "component" => $rec[
"component"],
91 "translate" => $rec[
"translate"],
92 "devmode" => $rec[
"devmode"],
93 "allow_link" => $rec[
"allow_link"],
94 "allow_copy" => $rec[
"allow_copy"],
95 "rbac" => $rec[
"rbac"],
96 "group" => $rec[
"grp"],
97 "system" => $rec[
"system"],
98 "default_pos" =>
"9999" . str_pad($rec[
"default_pos"], 4,
"0", STR_PAD_LEFT),
99 "sideblock" => $rec[
"sideblock"],
100 'export' => $rec[
'export'],
101 'repository' => $rec[
'repository'],
102 'workspace' => $rec[
'workspace'],
103 'administration' => $rec[
'administration'],
104 'amet' => $rec[
'amet']
106 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
108 $defIds[] = $rec[
"id"];
111 $subobj = $global_cache->lookupSubObjForParent($defIds);
113 foreach ($subobj as $rec2) {
115 $max = $rec2[
"mmax"];
119 $this->obj_data[$rec2[
"parent"]][
"subobjects"][$rec2[
"subobj"]] = array(
120 "name" => $rec2[
"subobj"],
122 "lng" => $rec2[
"subobj"]
125 $this->obj_group = $global_cache->getIlObjectGroup();
129 $this->sub_types = $global_cache->getIlObjectSubType();
136 $this->obj_data = array();
141 $set =
$ilDB->query(
"SELECT * FROM il_object_def");
142 while ($rec =
$ilDB->fetchAssoc($set)) {
143 $this->obj_data[$rec[
"id"]] = array(
144 "name" => $rec[
"id"],
145 "class_name" => $rec[
"class_name"],
146 "location" => $rec[
"location"],
147 "checkbox" => $rec[
"checkbox"],
148 "inherit" => $rec[
"inherit"],
149 "component" => $rec[
"component"],
150 "translate" => $rec[
"translate"],
151 "devmode" => $rec[
"devmode"],
152 "allow_link" => $rec[
"allow_link"],
153 "allow_copy" => $rec[
"allow_copy"],
154 "rbac" => $rec[
"rbac"],
155 "group" => $rec[
"grp"],
156 "system" => $rec[
"system"],
157 "default_pos" =>
"9999" . str_pad($rec[
"default_pos"], 4,
"0", STR_PAD_LEFT),
158 "sideblock" => $rec[
"sideblock"],
159 'export' => $rec[
'export'],
160 'repository' => $rec[
'repository'],
161 'workspace' => $rec[
'workspace'],
162 'administration' => $rec[
'administration'],
163 'amet' => $rec[
'amet']
165 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
167 $defIds[] = $rec[
"id"];
171 $set2 =
$ilDB->query(
"SELECT * FROM il_object_subobj WHERE " .
$ilDB->in(
'parent', $defIds,
false,
'text'));
172 while ($rec2 =
$ilDB->fetchAssoc($set2)) {
173 $max = $rec2[
"mmax"];
178 $this->obj_data[$rec2[
"parent"]][
"subobjects"][$rec2[
"subobj"]] = array(
179 "name" => $rec2[
"subobj"],
181 "lng" => $rec2[
"subobj"]
185 $set =
$ilDB->query(
"SELECT * FROM il_object_group");
186 $this->obj_group = array();
187 while ($rec =
$ilDB->fetchAssoc($set)) {
188 $this->obj_group[$rec[
"id"]] = $rec;
193 $set =
$ilDB->query(
"SELECT * FROM il_object_sub_type ");
194 $this->sub_types = array();
195 while ($rec =
$ilDB->fetchAssoc($set)) {
196 $this->sub_types[$rec[
"obj_type"]][] = $rec;
223 global $ilPluginAdmin;
224 $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
225 foreach ($pl_names as $pl_name) {
226 include_once(
"./Services/Component/classes/class.ilPlugin.php");
228 if (!isset($grouped_obj[$pl_id])) {
229 $grouped_obj[$pl_id] = array(
231 "objs" => array(0 => $pl_id)
249 return $this->obj_data[$a_obj_name][
"class_name"];
261 return $this->obj_data[$a_obj_name][
"location"];
269 return $this->obj_group[$a_id];
277 return $this->obj_data[$a_obj_name][
"group"];
288 return (
bool) $this->obj_data[$a_obj_name][
"checkbox"];
301 if ($a_obj_name ==
"root")
303 if (!isset($this->root_trans_type))
305 $q =
"SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = ".
306 $ilDB->quote(ROOT_FOLDER_ID,
'integer').
" ";
307 $set =
$ilDB->query($q);
311 $this->root_trans_type =
"db";
315 $this->root_trans_type = $this->obj_data[$a_obj_name][
"translate"];
318 return $this->root_trans_type;
321 if (isset($this->obj_data[$a_obj_name]))
323 return $this->obj_data[$a_obj_name][
"translate"];
338 return (
bool) $this->obj_data[$a_obj_name][
"inherit"];
349 return (
bool) $this->obj_data[$a_obj_name][
"devmode"];
360 $types = array_keys($this->obj_data);
362 foreach ($types as $type)
370 return $devtypes ? $devtypes : array();
382 return (
bool) $this->obj_data[$a_obj_name][
"rbac"];
394 return (
bool) isset($this->obj_data[$a_obj_name][
"plugin"]);
405 return (substr($a_str, 0, 1) ==
"x");
414 global $ilPluginAdmin;
415 $isRepoPlugin = $ilPluginAdmin->isActive(
IL_COMP_SERVICE,
"Repository",
"robj",
417 $isOrguPlugin = $ilPluginAdmin->isActive(
IL_COMP_MODULE,
"OrgUnit",
"orguext",
419 return $isRepoPlugin || $isOrguPlugin;
430 $types = array_keys($this->obj_data);
432 foreach ($types as $type)
436 $rbactypes[] = $type;
440 return $rbactypes ? $rbactypes : array();
451 return array_keys($this->obj_data);
462 return (
bool) $this->obj_data[$a_obj_name][
"allow_link"];
473 return (
bool) $this->obj_data[$a_obj_name][
"allow_copy"];
478 return (
bool) $this->obj_data[$a_obj_name][
'export'];
512 if ($subobjects = $this->obj_data[$a_obj_type][
"subobjects"])
519 foreach ($subobjects as
$data => $sub)
521 if ($sub[
"module"] !=
"n")
523 if (!(
$ilSetting->get(
"obj_dis_creation_".$data)))
530 : (int) $this->obj_data[
$data][
"default_pos"];
531 $subs[
$data][
"pos"] = $pos;
563 $recursivesubs = array();
567 $to_do = array($a_obj_type);
575 while (count($to_do) > 0)
577 $type = array_pop($to_do);
587 if(!$a_add_admin_objects and $type ==
'adm')
595 #vd('xxxxxxxxxxxxx'.$type);
596 foreach ($subs as $subtype =>
$data)
598 #vd('------------------------->'.$subtype);
605 if($subtype ==
'rolt')
609 if(!$a_add_admin_objects and $subtype ==
'adm')
614 $recursivesubs[$subtype] =
$data;
615 if (! in_array($subtype, $done)
616 && ! in_array($subtype, $to_do))
623 if($a_include_source_obj)
625 if(!isset($recursivesubs[$a_obj_type]))
627 $recursivesubs[$a_obj_type][
'name'] = $a_obj_type;
628 $recursivesubs[$a_obj_type][
'lng'] = $a_obj_type;
629 $recursivesubs[$a_obj_type][
'max'] = 0;
630 $recursivesubs[$a_obj_type][
'pos'] = -1;
648 foreach($this->obj_data[$a_obj_type][
"subobjects"] as $key => $value)
662 #$tmp_subs[] = "root";
664 return $tmp_subs ? $tmp_subs : array();
681 unset($subobjects[
"rolf"]);
690 unset($subobjects[$type]);
694 unset($subobjects[$type]);
698 unset($subobjects[$type]);
702 unset($subobjects[$type]);
706 if ($a_obj_type ==
"prg") {
708 require_once(
"Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
725 if (is_array($this->obj_data[$a_obj_type][
"subobjects"]))
727 $data = array_keys($this->obj_data[$a_obj_type][
"subobjects"]);
729 $string =
"'".implode(
"','",
$data).
"'";
745 if(!is_array($this->obj_data[$a_obj_name][
'subobjects']))
749 return count($this->obj_data[$a_obj_name][
'subobjects']) >= 1 ? true :
false;
762 xml_set_object($a_xml_parser,$this);
763 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
764 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
780 $this->parent_tag_name = $a_attribs[
"name"];
783 $this->current_tag =
"property";
784 $this->current_tag_name = $a_attribs[
"name"];
786 $this->obj_data[$this->parent_tag_name][
"properties"][$this->current_tag_name][
"module"] = $a_attribs[
"module"];
812 $this->current_tag =
'';
813 $this->current_tag_name =
'';
819 foreach($subobjects as $type =>
$data)
844 return (
bool) $this->obj_data[$a_obj_name][
"system"];
855 return (
bool) $this->obj_data[$a_obj_name][
"sideblock"];
866 $set =
$ilDB->queryF(
"SELECT * FROM il_object_def WHERE component = %s",
867 array(
"text"), array($a_component_type.
"/".$a_component_name));
870 while($rec =
$ilDB->fetchAssoc($set))
872 if ($rec[
"system"] != 1)
888 $set =
$ilDB->queryF(
"SELECT component FROM il_object_def WHERE id = %s",
889 array(
"text"), array($a_obj_type));
891 if ($rec =
$ilDB->fetchAssoc($set))
893 return $rec[
"component"];
907 $set =
$ilDB->query(
"SELECT * FROM il_object_group");
911 $groups[$gr_rec[
"id"]] = $gr_rec;
916 $recs = $global_cache->lookupGroupedRepObj($a_parent_obj_type);
918 $grouped_obj = array();
919 foreach((array)$recs as $rec)
921 if ($rec[
"grp"] !=
"")
923 $grouped_obj[$rec[
"grp"]][
"pos"] = (int) $groups[$rec[
"grp"]][
"default_pres_pos"];
924 $grouped_obj[$rec[
"grp"]][
"objs"][] = $rec[
"id"];
928 $grouped_obj[$rec[
"id"]][
"pos"] = (int) $rec[
"default_pres_pos"];
929 $grouped_obj[$rec[
"id"]][
"objs"][] = $rec[
"id"];
949 return (
bool) $this->obj_data[$a_obj_name][
"repository"];
960 $types = array_keys($this->obj_data);
962 foreach ($types as $type)
967 $rbactypes[] = $type;
971 return $rbactypes ? $rbactypes : array();
984 return (
bool) $this->obj_data[$a_obj_name][
"workspace"];
994 return (
bool) $this->obj_data[$a_obj_name][
'administration'];
1021 foreach ($this->obj_data as $k => $v)
1025 $amet[] = array(
"obj_type" => $k,
"sub_type" =>
"");
1029 foreach ($this->sub_types as $type =>
$sub_types)
1035 $amet[] = array(
"obj_type" => $type,
"sub_type" =>
$t[
"sub_type"]);
1053 return (
$ilSetting->get(
"obj_add_new_pos_".$a_type) > 0)
1054 ? (int)
$ilSetting->get(
"obj_add_new_pos_".$a_type)
1055 : (int) $this->obj_data[
$a_type][
"default_pos"];
1065 foreach((array) $this->obj_data as $type => $pl_data)
1069 $plugins[$type] = $pl_data;
1082 $res = $grp_map = $cnt_grp = array();
1087 $type = $rtype[
"name"];
1099 $grp_map[$type_grp][] = $type;
1108 $cnt_grp[] = $type_grp;
1116 foreach($cnt_grp as $grp)
1118 $res = array_merge(
$res, $grp_map[$grp]);
1124 return array_unique(
$res);
1145 global $ilPluginAdmin;
1146 $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
1147 foreach ($pl_names as $pl_name) {
1148 include_once(
"./Services/Component/classes/class.ilPlugin.php");
1150 if ($pl_id !=
"" && !isset($this->obj_data[$pl_id])) {
1151 include_once(
"./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
1156 $this->obj_data[$pl_id] = array(
1158 "class_name" => $pl_name,
1166 "allow_link" =>
"1",
1167 "allow_copy" => $pl->allowCopy() ?
'1' :
'0',
1171 "default_pos" =>
"99992000",
1172 'repository' =>
'1',
1174 'administration' => $isInAdministration?
'1':
'0',
1176 'export' => $ilPluginAdmin->supportsExport($component, $slotName, $slotId, $pl_name)
1178 $parent_types = $pl->getParentTypes();
1179 foreach($parent_types as $parent_type) {
1180 $this->obj_data[$parent_type][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
An exception for terminatinating execution or to throw for unit testing.
static getInstance($component)
static getCreatableSubObjects($a_subobjects, $a_ref_id)
Filter the list of possible subobjects for the objects that actually could be created on a concrete n...
parses the objects.xml it handles the xml-description of all ilias objects
getTranslationType($a_obj_name)
get translation type (sys, db or 0)s
getSubobjectsToFilter($a_obj_type="adm")
get all subjects except (rolf) of the adm object This is neceesary for filtering these objects in rol...
getSubObjectsRecursively($a_obj_type, $a_include_source_obj=true, $a_add_admin_objects=false)
Get all subobjects by type.
getCreatableSubObjects($a_obj_type, $a_context=self::MODE_REPOSITORY, $a_parent_ref_id=null)
get only creatable subobjects by type
static getComponentForType($a_obj_type)
Get component for object type.
getAllRepositoryTypes($a_incl_adm=false)
get all RBAC object types
getAllRBACObjects()
get all RBAC object types
isPlugin($a_obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type
getGroupOfObj($a_obj_name)
Get Group of object type.
readDefinitionData()
Read object definition data.
getDevModeAll()
get all object types in devmode
handlerCharacterData($a_xml_parser, $a_data)
end tag handler
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
getDevMode($a_obj_name)
get devmode status by type
__construct()
Constructor.
static getGroupedRepositoryObjectTypes($a_parent_obj_type)
hasLocalRoles($a_obj_type)
Check whether the creation of local roles is allowed Currently disabled for type "root" and "adm".
getLocation($a_obj_name)
get location by type
isAllowedInRepository($a_obj_name)
checks if object type can be used in repository context
readDefinitionDataFromCache()
isActivePluginType($type)
Returns true iff the given type is an active type of a repositoryObject or Organisation Unit Extensio...
allowLink($a_obj_name)
checks if linking of an object type is allowed
__filterObjects(&$subobjects)
stopInheritance($a_obj_name)
Does object permits stopping inheritance?
readPluginData()
Loads the different plugins into the object definition.
allowCopy($a_obj_name)
checks if copying of an object type is allowed
isSystemObject($a_obj_name)
checks if object type is a system object
isAllowedInWorkspace($a_obj_name)
checks if object type can be used in workspace context
isInactivePlugin($a_type)
Check whether type belongs to inactive plugin.
readDefinitionDataFromDB()
static getRepositoryObjectTypesForComponent($a_component_type, $a_component_name)
Get all repository object types of component.
isSideBlock($a_obj_name)
Check, whether object type is a side block.
getClassName($a_obj_name)
get class name by type
parsePluginData($component, $slotName, $slotId, $isInAdministration)
loads a single plugin definition into the object definition
getSubObjectsAsString($a_obj_type)
get a string of all subobjects by type
getPlugins()
Get plugin object info.
getAdvancedMetaDataTypes()
Get advanced meta data objects.
getAllObjects()
get all object types
getGroup($a_id)
Get Group information.
getSubObjects($a_obj_type, $a_filter=true)
get all subobjects by type
getExplorerContainerTypes()
Get all object types which are defined as container in an explorer context.
isPluginTypeName($a_str)
Check if given type is a plugin type name (starts with an "x")
hasCheckbox($a_obj_name)
should the object get a checkbox (needed for 'cut','copy' ...)
isContainer($a_obj_name)
Check if object type is container ('crs','fold','grp' ...)
setHandlers($a_xml_parser)
set event handler
isAdministrationObject($a_obj_name)
Check if administration object.
const MODE_ADMINISTRATION
getPositionByType($a_type)
Get Position By Object Type.
handlerEndTag($a_xml_parser, $a_name)
end tag handler
static getGroupedPluginObjectTypes($grouped_obj, $component, $slotName, $slotId)
isRBACObject($a_obj_name)
get RBAC status by type returns true if object type is a RBAC object type
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
static lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
redirection script todo: (a better solution should control the processing via a xml file)