84 global $ilDB, $ilPluginAdmin;
86 $this->obj_data = array();
92 $set = $ilDB->query(
"SELECT * FROM il_object_def");
93 while ($rec = $ilDB->fetchAssoc($set))
95 $this->obj_data[$rec[
"id"]] = array(
97 "class_name" => $rec[
"class_name"],
98 "location" => $rec[
"location"],
99 "checkbox" => $rec[
"checkbox"],
100 "inherit" => $rec[
"inherit"],
101 "component" => $rec[
"component"],
102 "translate" => $rec[
"translate"],
103 "devmode" => $rec[
"devmode"],
104 "allow_link" => $rec[
"allow_link"],
105 "allow_copy" => $rec[
"allow_copy"],
106 "rbac" => $rec[
"rbac"],
107 "group" => $rec[
"grp"],
108 "system" => $rec[
"system"],
109 "default_pos" =>
"9999".str_pad($rec[
"default_pos"], 4,
"0", STR_PAD_LEFT),
110 "sideblock" => $rec[
"sideblock"],
111 'export' => $rec[
'export'],
112 'repository' => $rec[
'repository'],
113 'workspace' => $rec[
'workspace'],
114 'administration' => $rec[
'administration'],
115 'amet' => $rec[
'amet']
117 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
119 $defIds[] = $rec[
"id"];
123 $set2 = $ilDB->query(
"SELECT * FROM il_object_subobj WHERE ".
124 $ilDB->in(
'parent', $defIds,
false,
'text'));
125 while ($rec2 = $ilDB->fetchAssoc($set2))
127 $max = $rec2[
"mmax"];
132 $this->obj_data[$rec2[
"parent"]][
"subobjects"][$rec2[
"subobj"]] = array(
133 "name" => $rec2[
"subobj"],
135 "lng" => $rec2[
"subobj"]
139 $set = $ilDB->query(
"SELECT * FROM il_object_group");
140 $this->obj_group = array();
141 while ($rec = $ilDB->fetchAssoc($set))
143 $this->obj_group[$rec[
"id"]] = $rec;
147 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"Repository",
"robj");
148 foreach ($pl_names as $pl_name)
150 include_once(
"./Services/Component/classes/class.ilPlugin.php");
152 if ($pl_id !=
"" && !isset($this->obj_data[$pl_id]))
154 include_once(
"./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
156 $pl_name).
"/classes";
158 $this->obj_data[$pl_id] = array(
160 "class_name" => $pl_name,
173 "default_pos" =>
"99992000",
176 'administration' =>
'0',
178 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
181 $this->obj_data[
"crs"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
182 $this->obj_data[
"fold"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
183 $this->obj_data[
"grp"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
184 $this->obj_data[
"cat"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
185 $this->obj_data[
"root"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
191 $set = $ilDB->query(
"SELECT * FROM il_object_sub_type ");
192 $this->sub_types = array();
193 while ($rec = $ilDB->fetchAssoc($set))
195 $this->sub_types[$rec[
"obj_type"]][] = $rec;
211 return $this->obj_data[$a_obj_name][
"class_name"];
223 return $this->obj_data[$a_obj_name][
"location"];
231 return $this->obj_group[$a_id];
239 return $this->obj_data[$a_obj_name][
"group"];
250 return (
bool) $this->obj_data[$a_obj_name][
"checkbox"];
263 if ($a_obj_name ==
"root")
265 if (!isset($this->root_trans_type))
267 $q =
"SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = ".
268 $ilDB->quote(ROOT_FOLDER_ID,
'integer').
" ";
269 $set = $ilDB->query($q);
273 $this->root_trans_type =
"db";
277 $this->root_trans_type = $this->obj_data[$a_obj_name][
"translate"];
280 return $this->root_trans_type;
283 if (isset($this->obj_data[$a_obj_name]))
285 return $this->obj_data[$a_obj_name][
"translate"];
300 return (
bool) $this->obj_data[$a_obj_name][
"inherit"];
311 return (
bool) $this->obj_data[$a_obj_name][
"devmode"];
322 $types = array_keys($this->obj_data);
324 foreach ($types as $type)
332 return $devtypes ? $devtypes : array();
344 return (
bool) $this->obj_data[$a_obj_name][
"rbac"];
356 return (
bool) isset($this->obj_data[$a_obj_name][
"plugin"]);
367 return (substr($a_str, 0, 1) ==
"x");
378 $types = array_keys($this->obj_data);
380 foreach ($types as $type)
384 $rbactypes[] = $type;
388 return $rbactypes ? $rbactypes : array();
399 return array_keys($this->obj_data);
410 return (
bool) $this->obj_data[$a_obj_name][
"allow_link"];
421 return (
bool) $this->obj_data[$a_obj_name][
"allow_copy"];
426 return (
bool) $this->obj_data[$a_obj_name][
'export'];
436 return isset($this->obj_data[$a_obj_type][
'subobjects'][
'rolf']);
453 if ($subobjects = $this->obj_data[$a_obj_type][
"subobjects"])
460 foreach ($subobjects as $data => $sub)
462 if ($sub[
"module"] !=
"n")
464 if (!($ilSetting->get(
"obj_dis_creation_".$data)))
469 $pos = ($ilSetting->get(
"obj_add_new_pos_".$data) > 0)
470 ? (
int) $ilSetting->get(
"obj_add_new_pos_".$data)
471 : (int) $this->obj_data[$data][
"default_pos"];
472 $subs[$data][
"pos"] = $pos;
504 $recursivesubs = array();
508 $to_do = array($a_obj_type);
516 while (count($to_do) > 0)
518 $type = array_pop($to_do);
528 if(!$a_add_admin_objects and $type ==
'adm')
536 #vd('xxxxxxxxxxxxx'.$type);
537 foreach ($subs as $subtype => $data)
539 #vd('------------------------->'.$subtype);
546 if($subtype ==
'rolf' or $subtype ==
'rolt')
550 if(!$a_add_admin_objects and $subtype ==
'adm')
555 $recursivesubs[$subtype] = $data;
556 if (! in_array($subtype, $done)
557 && ! in_array($subtype, $to_do))
564 if($a_include_source_obj)
566 if(!isset($recursivesubs[$a_obj_type]))
568 $recursivesubs[$a_obj_type][
'name'] = $a_obj_type;
569 $recursivesubs[$a_obj_type][
'lng'] = $a_obj_type;
570 $recursivesubs[$a_obj_type][
'max'] = 0;
571 $recursivesubs[$a_obj_type][
'pos'] = -1;
589 foreach($this->obj_data[$a_obj_type][
"subobjects"] as $key => $value)
603 #$tmp_subs[] = "root";
605 return $tmp_subs ? $tmp_subs : array();
621 unset($subobjects[
"rolf"]);
630 unset($subobjects[$type]);
634 unset($subobjects[$type]);
638 unset($subobjects[$type]);
642 unset($subobjects[$type]);
645 if(in_array($type, array(
'icrs',
'icla')))
647 unset($subobjects[$type]);
664 if (is_array($this->obj_data[$a_obj_type][
"subobjects"]))
666 $data = array_keys($this->obj_data[$a_obj_type][
"subobjects"]);
668 $string =
"'".implode(
"','", $data).
"'";
684 if(!is_array($this->obj_data[$a_obj_name][
'subobjects']))
688 return count($this->obj_data[$a_obj_name][
'subobjects']) > 1 ?
true :
false;
701 xml_set_object($a_xml_parser,$this);
702 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
703 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
719 $this->parent_tag_name = $a_attribs[
"name"];
722 $this->current_tag =
"property";
723 $this->current_tag_name = $a_attribs[
"name"];
725 $this->obj_data[$this->parent_tag_name][
"properties"][$this->current_tag_name][
"module"] = $a_attribs[
"module"];
751 $this->current_tag =
'';
752 $this->current_tag_name =
'';
758 foreach($subobjects as $type => $data)
763 if(!$this->ilias->getSetting(
"chat_active"))
765 unset($subobjects[$type]);
770 if(!$this->ilias->getSetting(
"ilinc_active"))
772 unset($subobjects[$type]);
797 return (
bool) $this->obj_data[$a_obj_name][
"system"];
808 return (
bool) $this->obj_data[$a_obj_name][
"sideblock"];
819 $set = $ilDB->queryF(
"SELECT * FROM il_object_def WHERE component = %s",
820 array(
"text"), array($a_component_type.
"/".$a_component_name));
823 while($rec = $ilDB->fetchAssoc($set))
825 if ($rec[
"system"] != 1)
841 $set = $ilDB->queryF(
"SELECT component FROM il_object_def WHERE id = %s",
842 array(
"text"), array($a_obj_type));
844 if ($rec = $ilDB->fetchAssoc($set))
846 return $rec[
"component"];
857 global $ilDB, $ilPluginAdmin;
859 $set = $ilDB->query(
"SELECT * FROM il_object_group");
863 $groups[$gr_rec[
"id"]] = $gr_rec;
866 if (!is_array($a_parent_obj_type))
868 $set = $ilDB->queryF(
"SELECT il_object_def.* FROM il_object_def, il_object_subobj ".
869 " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
871 " AND subobj = id ", array(
"text"), array($a_parent_obj_type));
875 $q =
"SELECT DISTINCT (id) as sid, il_object_def.* FROM il_object_def, il_object_subobj ".
876 " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
877 $ilDB->in(
"parent", $a_parent_obj_type,
false,
"text").
879 $set = $ilDB->query($q);
882 $grouped_obj = array();
883 while($rec = $ilDB->fetchAssoc($set))
885 if ($rec[
"grp"] !=
"")
887 $grouped_obj[$rec[
"grp"]][
"pos"] = (int) $groups[$rec[
"grp"]][
"default_pres_pos"];
888 $grouped_obj[$rec[
"grp"]][
"objs"][] = $rec[
"id"];
892 $grouped_obj[$rec[
"id"]][
"pos"] = (int) $rec[
"default_pres_pos"];
893 $grouped_obj[$rec[
"id"]][
"objs"][] = $rec[
"id"];
898 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"Repository",
"robj");
899 foreach ($pl_names as $pl_name)
901 include_once(
"./Services/Component/classes/class.ilPlugin.php");
903 if (!isset($grouped_obj[$pl_id]))
905 $grouped_obj[$pl_id] = array(
907 "objs" => array(0 => $pl_id)
928 return (
bool) $this->obj_data[$a_obj_name][
"repository"];
939 $types = array_keys($this->obj_data);
941 foreach ($types as $type)
946 $rbactypes[] = $type;
950 return $rbactypes ? $rbactypes : array();
963 return (
bool) $this->obj_data[$a_obj_name][
"workspace"];
973 return (
bool) $this->obj_data[$a_obj_name][
'administration'];
984 if (substr($a_type, 0, 1) ==
"x" && !$this->
isPlugin($a_type))
1000 foreach ($this->obj_data as $k => $v)
1004 $amet[] = array(
"obj_type" => $k,
"sub_type" =>
"");
1008 foreach ($this->sub_types as $type =>
$sub_types)
1014 $amet[] = array(
"obj_type" => $type,
"sub_type" => $t[
"sub_type"]);