77 global
$ilDB, $ilPluginAdmin;
79 $this->obj_data = array();
85 $set = $ilDB->query(
"SELECT * FROM il_object_def");
86 while ($rec = $ilDB->fetchAssoc($set))
88 $this->obj_data[$rec[
"id"]] = array(
90 "class_name" => $rec[
"class_name"],
91 "location" => $rec[
"location"],
92 "checkbox" => $rec[
"checkbox"],
93 "inherit" => $rec[
"inherit"],
94 "component" => $rec[
"component"],
95 "translate" => $rec[
"translate"],
96 "devmode" => $rec[
"devmode"],
97 "allow_link" => $rec[
"allow_link"],
98 "allow_copy" => $rec[
"allow_copy"],
99 "rbac" => $rec[
"rbac"],
100 "group" => $rec[
"grp"],
101 "system" => $rec[
"system"],
102 "default_pos" => $rec[
"default_pos"],
103 "sideblock" => $rec[
"sideblock"],
104 'export' => $rec[
'export']);
105 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
107 $defIds[] = $rec[
"id"];
110 $set2 = $ilDB->query(
"SELECT * FROM il_object_subobj WHERE ".
111 $ilDB->in(
'parent', $defIds,
false,
'text'));
112 while ($rec2 = $ilDB->fetchAssoc($set2))
114 $max = $rec2[
"mmax"];
119 $this->obj_data[$rec2[
"parent"]][
"subobjects"][$rec2[
"subobj"]] = array(
120 "name" => $rec2[
"subobj"],
122 "lng" => $rec2[
"subobj"]
126 $set = $ilDB->query(
"SELECT * FROM il_object_group");
127 $this->obj_group = array();
128 while ($rec = $ilDB->fetchAssoc($set))
130 $this->obj_group[$rec[
"id"]] = $rec;
134 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"Repository",
"robj");
135 foreach ($pl_names as $pl_name)
137 include_once(
"./Services/Component/classes/class.ilPlugin.php");
139 if ($pl_id !=
"" && !isset($this->obj_data[$pl_id]))
141 include_once(
"./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
143 $pl_name).
"/classes";
145 $this->obj_data[$pl_id] = array(
147 "class_name" => $pl_name,
160 "default_pos" =>
"2000",
162 $this->obj_data[$rec[
"id"]][
"subobjects"] = array();
164 $this->obj_data[
"crs"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id);
165 $this->obj_data[
"grp"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id);
166 $this->obj_data[
"cat"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id);
167 $this->obj_data[
"root"][
"subobjects"][$pl_id] = array(
"name" => $pl_id,
"max" =>
"",
"lng" => $pl_id);
186 return $this->obj_data[$a_obj_name][
"class_name"];
198 return $this->obj_data[$a_obj_name][
"location"];
206 return $this->obj_group[$a_id];
214 return $this->obj_data[$a_obj_name][
"group"];
225 return (
bool) $this->obj_data[$a_obj_name][
"checkbox"];
238 if ($a_obj_name ==
"root")
240 if (!isset($this->root_trans_type))
242 $q =
"SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = ".
243 $ilDB->quote(ROOT_FOLDER_ID,
'integer').
" ";
244 $set = $ilDB->query($q);
248 $this->root_trans_type =
"db";
252 $this->root_trans_type = $this->obj_data[$a_obj_name][
"translate"];
255 return $this->root_trans_type;
258 if (isset($this->obj_data[$a_obj_name]))
260 return $this->obj_data[$a_obj_name][
"translate"];
275 return (
bool) $this->obj_data[$a_obj_name][
"inherit"];
286 return (
bool) $this->obj_data[$a_obj_name][
"devmode"];
297 $types = array_keys($this->obj_data);
299 foreach ($types as
$type)
307 return $devtypes ? $devtypes : array();
319 return (
bool) $this->obj_data[$a_obj_name][
"rbac"];
331 return (
bool) isset($this->obj_data[$a_obj_name][
"plugin"]);
342 return (substr($a_str, 0, 1) ==
"x");
353 $types = array_keys($this->obj_data);
355 foreach ($types as
$type)
359 $rbactypes[] =
$type;
363 return $rbactypes ? $rbactypes : array();
374 return array_keys($this->obj_data);
385 return (
bool) $this->obj_data[$a_obj_name][
"allow_link"];
396 return (
bool) $this->obj_data[$a_obj_name][
"allow_copy"];
401 return (
bool) $this->obj_data[$a_obj_name][
'export'];
411 return isset($this->obj_data[$a_obj_type][
'subobjects'][
'rolf']);
428 if ($subobjects = $this->obj_data[$a_obj_type][
"subobjects"])
435 foreach ($subobjects as
$data => $sub)
437 if ($sub[
"module"] !=
"n")
439 if (!($ilSetting->get(
"obj_dis_creation_".$data)))
444 $pos = ($ilSetting->get(
"obj_add_new_pos_".
$data) > 0)
445 ? (
int) $ilSetting->get(
"obj_add_new_pos_".
$data)
446 : (int) $this->obj_data[
$data][
"default_pos"];
479 $recursivesubs = array();
483 $to_do = array($a_obj_type);
491 while (count($to_do) > 0)
493 $type = array_pop($to_do);
503 if(!$a_add_admin_objects and
$type ==
'adm')
511 #vd('xxxxxxxxxxxxx'.$type);
512 foreach ($subs as $subtype =>
$data)
514 #vd('------------------------->'.$subtype);
521 if($subtype ==
'rolf' or $subtype ==
'rolt')
525 if(!$a_add_admin_objects and $subtype ==
'adm')
530 $recursivesubs[$subtype] =
$data;
531 if (! in_array($subtype, $done)
532 && ! in_array($subtype, $to_do))
539 if($a_include_source_obj)
541 if(!isset($recursivesubs[$a_obj_type]))
543 $recursivesubs[$a_obj_type][
'name'] = $a_obj_type;
544 $recursivesubs[$a_obj_type][
'lng'] = $a_obj_type;
545 $recursivesubs[$a_obj_type][
'max'] = 0;
546 $recursivesubs[$a_obj_type][
'pos'] = -1;
565 foreach($this->obj_data[$a_obj_type][
"subobjects"] as $key => $value)
579 #$tmp_subs[] = "root";
581 return $tmp_subs ? $tmp_subs : array();
596 unset($subobjects[
"rolf"]);
597 unset($subobjects[
'rcrs']);
599 $sub_types = array_keys($subobjects);
602 foreach ($sub_types as
$type)
607 unset($subobjects[$type]);
624 if (is_array($this->obj_data[$a_obj_type][
"subobjects"]))
626 $data = array_keys($this->obj_data[$a_obj_type][
"subobjects"]);
628 $string =
"'".implode(
"','",
$data).
"'";
644 if(!is_array($this->obj_data[$a_obj_name][
'subobjects']))
648 return count($this->obj_data[$a_obj_name][
'subobjects']) > 1 ?
true :
false;
661 xml_set_object($a_xml_parser,$this);
662 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
663 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
679 $this->parent_tag_name = $a_attribs[
"name"];
682 $this->current_tag =
"property";
683 $this->current_tag_name = $a_attribs[
"name"];
685 $this->obj_data[$this->parent_tag_name][
"properties"][$this->current_tag_name][
"module"] = $a_attribs[
"module"];
711 $this->current_tag =
'';
712 $this->current_tag_name =
'';
724 if(!$this->ilias->getSetting(
"ilinc_active"))
726 unset($subobjects[
$type]);
751 return (
bool) $this->obj_data[$a_obj_name][
"system"];
762 return (
bool) $this->obj_data[$a_obj_name][
"sideblock"];
773 $set = $ilDB->queryF(
"SELECT * FROM il_object_def WHERE component = %s",
774 array(
"text"), array($a_component_type.
"/".$a_component_name));
777 while($rec = $ilDB->fetchAssoc($set))
779 if ($rec[
"system"] != 1)
795 $set = $ilDB->queryF(
"SELECT component FROM il_object_def WHERE id = %s",
796 array(
"text"), array($a_obj_type));
798 if ($rec = $ilDB->fetchAssoc($set))
800 return $rec[
"component"];
811 global
$ilDB, $ilPluginAdmin;
813 $set = $ilDB->query(
"SELECT * FROM il_object_group");
817 $groups[$gr_rec[
"id"]] = $gr_rec;
820 if (!is_array($a_parent_obj_type))
822 $set = $ilDB->queryF(
"SELECT il_object_def.* FROM il_object_def, il_object_subobj ".
823 " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
825 " AND subobj = id ", array(
"text"), array($a_parent_obj_type));
829 $q =
"SELECT DISTINCT (id) as sid, il_object_def.* FROM il_object_def, il_object_subobj ".
830 " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
831 $ilDB->in(
"parent", $a_parent_obj_type,
false,
"text").
833 $set = $ilDB->query($q);
836 $grouped_obj = array();
837 while($rec = $ilDB->fetchAssoc($set))
839 if ($rec[
"grp"] !=
"")
841 $grouped_obj[$rec[
"grp"]][
"pos"] = (int) $groups[$rec[
"grp"]][
"default_pres_pos"];
842 $grouped_obj[$rec[
"grp"]][
"objs"][] = $rec[
"id"];
846 $grouped_obj[$rec[
"id"]][
"pos"] = (int) $rec[
"default_pres_pos"];
847 $grouped_obj[$rec[
"id"]][
"objs"][] = $rec[
"id"];
852 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"Repository",
"robj");
853 foreach ($pl_names as $pl_name)
855 include_once(
"./Services/Component/classes/class.ilPlugin.php");
857 if (!isset($grouped_obj[$pl_id]))
859 $grouped_obj[$pl_id] = array(
861 "objs" => array(0 => $pl_id)