81 global $ilDB, $ilPluginAdmin;
83 $this->obj_data = array();
89 $set = $ilDB->query(
"SELECT * FROM il_object_def");
90 while ($rec = $ilDB->fetchAssoc($set))
92 $this->obj_data[$rec[
"id"]] = array(
94 "class_name" => $rec[
"class_name"],
95 "location" => $rec[
"location"],
96 "checkbox" => $rec[
"checkbox"],
97 "inherit" => $rec[
"inherit"],
98 "component" => $rec[
"component"],
99 "translate" => $rec[
"translate"],
100 "devmode" => $rec[
"devmode"],
101 "allow_link" => $rec[
"allow_link"],
102 "allow_copy" => $rec[
"allow_copy"],
103 "rbac" => $rec[
"rbac"],
104 "group" => $rec[
"grp"],
105 "system" => $rec[
"system"],
106 "default_pos" => $rec[
"default_pos"],
107 "sideblock" => $rec[
"sideblock"],
108 'export' => $rec[
'export'],
109 'repository' => $rec[
'repository'],
110 'workspace' => $rec[
'workspace'],
111 'administration' => $rec[
'administration']
113 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
115 $defIds[] = $rec[
"id"];
119 $set2 = $ilDB->query(
"SELECT * FROM il_object_subobj WHERE ".
120 $ilDB->in(
'parent', $defIds,
false,
'text'));
121 while ($rec2 = $ilDB->fetchAssoc($set2))
123 $max = $rec2[
"mmax"];
128 $this->obj_data[$rec2[
"parent"]][
"subobjects"][$rec2[
"subobj"]] = array(
129 "name" => $rec2[
"subobj"],
131 "lng" => $rec2[
"subobj"]
135 $set = $ilDB->query(
"SELECT * FROM il_object_group");
136 $this->obj_group = array();
137 while ($rec = $ilDB->fetchAssoc($set))
139 $this->obj_group[$rec[
"id"]] = $rec;
143 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"Repository",
"robj");
144 foreach ($pl_names as $pl_name)
146 include_once(
"./Services/Component/classes/class.ilPlugin.php");
148 if ($pl_id !=
"" && !isset($this->obj_data[$pl_id]))
150 include_once(
"./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
152 $pl_name).
"/classes";
154 $this->obj_data[$pl_id] = array(
156 "class_name" => $pl_name,
169 "default_pos" =>
"2000",
172 'administration' =>
'0',
174 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
177 $this->obj_data[
"crs"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
178 $this->obj_data[
"fold"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
179 $this->obj_data[
"grp"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
180 $this->obj_data[
"cat"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
181 $this->obj_data[
"root"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id,
"plugin" =>
true);
200 return $this->obj_data[$a_obj_name][
"class_name"];
212 return $this->obj_data[$a_obj_name][
"location"];
220 return $this->obj_group[$a_id];
228 return $this->obj_data[$a_obj_name][
"group"];
239 return (
bool) $this->obj_data[$a_obj_name][
"checkbox"];
252 if ($a_obj_name ==
"root")
254 if (!isset($this->root_trans_type))
256 $q =
"SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = ".
257 $ilDB->quote(ROOT_FOLDER_ID,
'integer').
" ";
258 $set = $ilDB->query($q);
262 $this->root_trans_type =
"db";
266 $this->root_trans_type = $this->obj_data[$a_obj_name][
"translate"];
269 return $this->root_trans_type;
272 if (isset($this->obj_data[$a_obj_name]))
274 return $this->obj_data[$a_obj_name][
"translate"];
289 return (
bool) $this->obj_data[$a_obj_name][
"inherit"];
300 return (
bool) $this->obj_data[$a_obj_name][
"devmode"];
311 $types = array_keys($this->obj_data);
313 foreach ($types as $type)
321 return $devtypes ? $devtypes : array();
333 return (
bool) $this->obj_data[$a_obj_name][
"rbac"];
345 return (
bool) isset($this->obj_data[$a_obj_name][
"plugin"]);
356 return (substr($a_str, 0, 1) ==
"x");
367 $types = array_keys($this->obj_data);
369 foreach ($types as $type)
373 $rbactypes[] = $type;
377 return $rbactypes ? $rbactypes : array();
388 return array_keys($this->obj_data);
399 return (
bool) $this->obj_data[$a_obj_name][
"allow_link"];
410 return (
bool) $this->obj_data[$a_obj_name][
"allow_copy"];
415 return (
bool) $this->obj_data[$a_obj_name][
'export'];
425 return isset($this->obj_data[$a_obj_type][
'subobjects'][
'rolf']);
442 if ($subobjects = $this->obj_data[$a_obj_type][
"subobjects"])
449 foreach ($subobjects as
$data => $sub)
451 if ($sub[
"module"] !=
"n")
453 if (!($ilSetting->get(
"obj_dis_creation_".$data)))
458 $pos = ($ilSetting->get(
"obj_add_new_pos_".
$data) > 0)
459 ? (
int) $ilSetting->get(
"obj_add_new_pos_".
$data)
460 : (int) $this->obj_data[
$data][
"default_pos"];
461 $subs[
$data][
"pos"] = $pos;
493 $recursivesubs = array();
497 $to_do = array($a_obj_type);
505 while (count($to_do) > 0)
507 $type = array_pop($to_do);
517 if(!$a_add_admin_objects and $type ==
'adm')
525 #vd('xxxxxxxxxxxxx'.$type);
526 foreach ($subs as $subtype =>
$data)
528 #vd('------------------------->'.$subtype);
535 if($subtype ==
'rolf' or $subtype ==
'rolt')
539 if(!$a_add_admin_objects and $subtype ==
'adm')
544 $recursivesubs[$subtype] =
$data;
545 if (! in_array($subtype, $done)
546 && ! in_array($subtype, $to_do))
553 if($a_include_source_obj)
555 if(!isset($recursivesubs[$a_obj_type]))
557 $recursivesubs[$a_obj_type][
'name'] = $a_obj_type;
558 $recursivesubs[$a_obj_type][
'lng'] = $a_obj_type;
559 $recursivesubs[$a_obj_type][
'max'] = 0;
560 $recursivesubs[$a_obj_type][
'pos'] = -1;
578 foreach($this->obj_data[$a_obj_type][
"subobjects"] as $key => $value)
592 #$tmp_subs[] = "root";
594 return $tmp_subs ? $tmp_subs : array();
610 unset($subobjects[
"rolf"]);
612 $sub_types = array_keys($subobjects);
615 foreach ($sub_types as $type)
619 unset($subobjects[$type]);
623 unset($subobjects[$type]);
627 unset($subobjects[$type]);
644 if (is_array($this->obj_data[$a_obj_type][
"subobjects"]))
646 $data = array_keys($this->obj_data[$a_obj_type][
"subobjects"]);
648 $string =
"'".implode(
"','",
$data).
"'";
664 if(!is_array($this->obj_data[$a_obj_name][
'subobjects']))
668 return count($this->obj_data[$a_obj_name][
'subobjects']) > 1 ?
true :
false;
681 xml_set_object($a_xml_parser,$this);
682 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
683 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
699 $this->parent_tag_name = $a_attribs[
"name"];
702 $this->current_tag =
"property";
703 $this->current_tag_name = $a_attribs[
"name"];
705 $this->obj_data[$this->parent_tag_name][
"properties"][$this->current_tag_name][
"module"] = $a_attribs[
"module"];
731 $this->current_tag =
'';
732 $this->current_tag_name =
'';
738 foreach($subobjects as $type =>
$data)
743 if(!$this->ilias->getSetting(
"chat_active"))
745 unset($subobjects[$type]);
750 if(!$this->ilias->getSetting(
"ilinc_active"))
752 unset($subobjects[$type]);
777 return (
bool) $this->obj_data[$a_obj_name][
"system"];
788 return (
bool) $this->obj_data[$a_obj_name][
"sideblock"];
799 $set = $ilDB->queryF(
"SELECT * FROM il_object_def WHERE component = %s",
800 array(
"text"), array($a_component_type.
"/".$a_component_name));
803 while($rec = $ilDB->fetchAssoc($set))
805 if ($rec[
"system"] != 1)
821 $set = $ilDB->queryF(
"SELECT component FROM il_object_def WHERE id = %s",
822 array(
"text"), array($a_obj_type));
824 if ($rec = $ilDB->fetchAssoc($set))
826 return $rec[
"component"];
837 global $ilDB, $ilPluginAdmin;
839 $set = $ilDB->query(
"SELECT * FROM il_object_group");
843 $groups[$gr_rec[
"id"]] = $gr_rec;
846 if (!is_array($a_parent_obj_type))
848 $set = $ilDB->queryF(
"SELECT il_object_def.* FROM il_object_def, il_object_subobj ".
849 " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
851 " AND subobj = id ", array(
"text"), array($a_parent_obj_type));
855 $q =
"SELECT DISTINCT (id) as sid, il_object_def.* FROM il_object_def, il_object_subobj ".
856 " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
857 $ilDB->in(
"parent", $a_parent_obj_type,
false,
"text").
859 $set = $ilDB->query($q);
862 $grouped_obj = array();
863 while($rec = $ilDB->fetchAssoc($set))
865 if ($rec[
"grp"] !=
"")
867 $grouped_obj[$rec[
"grp"]][
"pos"] = (int) $groups[$rec[
"grp"]][
"default_pres_pos"];
868 $grouped_obj[$rec[
"grp"]][
"objs"][] = $rec[
"id"];
872 $grouped_obj[$rec[
"id"]][
"pos"] = (int) $rec[
"default_pres_pos"];
873 $grouped_obj[$rec[
"id"]][
"objs"][] = $rec[
"id"];
878 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"Repository",
"robj");
879 foreach ($pl_names as $pl_name)
881 include_once(
"./Services/Component/classes/class.ilPlugin.php");
883 if (!isset($grouped_obj[$pl_id]))
885 $grouped_obj[$pl_id] = array(
887 "objs" => array(0 => $pl_id)
908 return (
bool) $this->obj_data[$a_obj_name][
"repository"];
920 return (
bool) $this->obj_data[$a_obj_name][
"workspace"];
930 return (
bool) $this->obj_data[$a_obj_name][
'administration'];
941 if (substr($a_type, 0, 1) ==
"x" && !$this->
isPlugin($a_type))