ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjectDefinition.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
5
15class ilObjectDefinition // extends ilSaxParser
16{
20 protected $plugin_admin;
21
25 protected $settings;
26
33 public $obj_id;
34
40 public $parent;
41
47 public $obj_data;
48
49 public $sub_types = array();
50
51 const MODE_REPOSITORY = 1;
52 const MODE_WORKSPACE = 2;
54
58 public function __construct()
59 {
60 global $DIC;
61
62 $this->plugin_admin = $DIC["ilPluginAdmin"];
63 $this->settings = $DIC->settings();
64 $this->readDefinitionData();
65 }
66
67
68 protected function readDefinitionDataFromCache()
69 {
70 $this->obj_data = array();
71 $defIds = array();
72 $global_cache = ilCachedComponentData::getInstance();
73 foreach ($global_cache->getIlobjectDef() as $rec) {
74 $this->obj_data[$rec["id"]] = array(
75 "name" => $rec["id"],
76 "class_name" => $rec["class_name"],
77 "location" => $rec["location"],
78 "checkbox" => $rec["checkbox"],
79 "inherit" => $rec["inherit"],
80 "component" => $rec["component"],
81 "translate" => $rec["translate"],
82 "devmode" => $rec["devmode"],
83 "allow_link" => $rec["allow_link"],
84 "allow_copy" => $rec["allow_copy"],
85 "rbac" => $rec["rbac"],
86 "group" => $rec["grp"],
87 "system" => $rec["system"],
88 "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
89 "sideblock" => $rec["sideblock"],
90 'export' => $rec['export'],
91 'repository' => $rec['repository'],
92 'workspace' => $rec['workspace'],
93 'administration' => $rec['administration'],
94 'amet' => $rec['amet'],
95 'orgunit_permissions' => $rec['orgunit_permissions'],
96 'lti_provider' => $rec['lti_provider'],
97 'offline_handling' => $rec['offline_handling']
98 );
99 $this->obj_data[$rec["id"]]["subobjects"] = array();
100
101 $defIds[] = $rec["id"];
102 }
103
104 $subobj = $global_cache->lookupSubObjForParent($defIds);
105
106 foreach ($subobj as $rec2) {
107 $max = $rec2["mmax"];
108 if ($max <= 0) {
109 $max = "";
110 }
111 $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
112 "name" => $rec2["subobj"],
113 "max" => $max,
114 "lng" => $rec2["subobj"]
115 );
116 }
117 $this->obj_group = $global_cache->getIlObjectGroup();
118
119 $this->readPluginData();
120
121 $this->sub_types = $global_cache->getIlObjectSubType();
122 }
123
124
125 protected function readDefinitionDataFromDB()
126 {
127 global $DIC;
128
129 $ilDB = $DIC->database();
130
131 $this->obj_data = array();
132
133 // Select all object_definitions and collect the definition id's in
134 // this array.
135 $defIds = array();
136 $set = $ilDB->query("SELECT * FROM il_object_def");
137 while ($rec = $ilDB->fetchAssoc($set)) {
138 $this->obj_data[$rec["id"]] = array(
139 "name" => $rec["id"],
140 "class_name" => $rec["class_name"],
141 "location" => $rec["location"],
142 "checkbox" => $rec["checkbox"],
143 "inherit" => $rec["inherit"],
144 "component" => $rec["component"],
145 "translate" => $rec["translate"],
146 "devmode" => $rec["devmode"],
147 "allow_link" => $rec["allow_link"],
148 "allow_copy" => $rec["allow_copy"],
149 "rbac" => $rec["rbac"],
150 "group" => $rec["grp"],
151 "system" => $rec["system"],
152 "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
153 "sideblock" => $rec["sideblock"],
154 'export' => $rec['export'],
155 'repository' => $rec['repository'],
156 'workspace' => $rec['workspace'],
157 'administration' => $rec['administration'],
158 'amet' => $rec['amet'],
159 'orgunit_permissions' => $rec['orgunit_permissions'],
160 'lti_provider' => $rec['lti_provider'],
161 'offline_handling' => $rec['offline_handling']
162 );
163 $this->obj_data[$rec["id"]]["subobjects"] = array();
164
165 $defIds[] = $rec["id"];
166 }
167
168 // get all subobject definitions in a single query
169 $set2 = $ilDB->query("SELECT * FROM il_object_subobj WHERE " . $ilDB->in('parent', $defIds, false, 'text'));
170 while ($rec2 = $ilDB->fetchAssoc($set2)) {
171 $max = $rec2["mmax"];
172 if ($max <= 0) { // for backward compliance
173 $max = "";
174 }
175 $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
176 "name" => $rec2["subobj"],
177 "max" => $max,
178 "lng" => $rec2["subobj"]
179 );
180 }
181
182 $set = $ilDB->query("SELECT * FROM il_object_group");
183 $this->obj_group = array();
184 while ($rec = $ilDB->fetchAssoc($set)) {
185 $this->obj_group[$rec["id"]] = $rec;
186 }
187
188 $this->readPluginData();
189
190 $set = $ilDB->query("SELECT * FROM il_object_sub_type ");
191 $this->sub_types = array();
192 while ($rec = $ilDB->fetchAssoc($set)) {
193 $this->sub_types[$rec["obj_type"]][] = $rec;
194 }
195 }
196
197
201 public function readDefinitionData()
202 {
205 } else {
207 }
208 }
209
219 protected static function getGroupedPluginObjectTypes($grouped_obj, $component, $slotName, $slotId)
220 {
221 global $DIC;
222
223 $ilPluginAdmin = $DIC["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");
227 $pl_id = ilPlugin::lookupIdForName($component, $slotName, $slotId, $pl_name);
228 if (!isset($grouped_obj[$pl_id])) {
229 $grouped_obj[$pl_id] = array(
230 "pos" => "99992000", // "unassigned" group
231 "objs" => array(0 => $pl_id)
232 );
233 }
234 }
235 return $grouped_obj;
236 }
237
238
239 // PUBLIC METHODS
240
247 public function getClassName($a_obj_name)
248 {
249 return $this->obj_data[$a_obj_name]["class_name"];
250 }
251
252
259 public function getLocation($a_obj_name)
260 {
261 return $this->obj_data[$a_obj_name]["location"];
262 }
263
267 public function getGroup($a_id)
268 {
269 return $this->obj_group[$a_id];
270 }
271
275 public function getGroupOfObj($a_obj_name)
276 {
277 return $this->obj_data[$a_obj_name]["group"];
278 }
279
286 public function hasCheckbox($a_obj_name)
287 {
288 return (bool) $this->obj_data[$a_obj_name]["checkbox"];
289 }
290
297 public function getTranslationType($a_obj_name)
298 {
299 global $DIC;
300
301 $ilDB = $DIC->database();
302
303 if ($a_obj_name == "root") {
304 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);
308 $rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
309 if ($rec["cnt"] > 0) {
310 $this->root_trans_type = "db";
311 } else {
312 $this->root_trans_type = $this->obj_data[$a_obj_name]["translate"];
313 }
314 }
315 return $this->root_trans_type;
316 }
317
318 if (isset($this->obj_data[$a_obj_name])) {
319 return $this->obj_data[$a_obj_name]["translate"];
320 }
321
322 return "";
323 }
324
325
332 public function stopInheritance($a_obj_name)
333 {
334 return (bool) $this->obj_data[$a_obj_name]["inherit"];
335 }
336
343 public function getDevMode($a_obj_name)
344 {
345 return (bool) $this->obj_data[$a_obj_name]["devmode"];
346 }
347
354 public function getDevModeAll()
355 {
356 $types = array_keys($this->obj_data);
357
358 foreach ($types as $type) {
359 if ($this->getDevMode($type)) {
360 $devtypes[] = $type;
361 }
362 }
363
364 return $devtypes ? $devtypes : array();
365 }
366
374 public function isRBACObject($a_obj_name)
375 {
376 return (bool) $this->obj_data[$a_obj_name]["rbac"];
377 }
378
386 public function isPlugin($a_obj_name)
387 {
388 return (bool) isset($this->obj_data[$a_obj_name]["plugin"]);
389 }
390
397 public function isPluginTypeName($a_str)
398 {
399 return (substr($a_str, 0, 1) == "x");
400 }
401
407 public function isActivePluginType($type)
408 {
409 $ilPluginAdmin = $this->plugin_admin;
410 $isRepoPlugin = $ilPluginAdmin->isActive(
412 "Repository",
413 "robj",
414 ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $type)
415 );
416 $isOrguPlugin = $ilPluginAdmin->isActive(
418 "OrgUnit",
419 "orguext",
420 ilPlugin::lookupNameForId(IL_COMP_MODULE, "OrgUnit", "orguext", $type)
421 );
422 return $isRepoPlugin || $isOrguPlugin;
423 }
424
431 public function getAllRBACObjects()
432 {
433 $types = array_keys($this->obj_data);
434
435 foreach ($types as $type) {
436 if ($this->isRBACObject($type)) {
437 $rbactypes[] = $type;
438 }
439 }
440
441 return $rbactypes ? $rbactypes : array();
442 }
443
450 public function getAllObjects()
451 {
452 return array_keys($this->obj_data);
453 }
454
461 public function allowLink($a_obj_name)
462 {
463 return (bool) $this->obj_data[$a_obj_name]["allow_link"];
464 }
465
472 public function allowCopy($a_obj_name)
473 {
474 return (bool) $this->obj_data[$a_obj_name]["allow_copy"];
475 }
476
477 public function allowExport($a_obj_name)
478 {
479 return (bool) $this->obj_data[$a_obj_name]['export'];
480 }
481
487 public function hasLocalRoles($a_obj_type)
488 {
489 switch ($a_obj_type) {
490 case 'root':
491 return false;
492
493 default:
494 return true;
495 }
496 }
497
506 public function getSubObjects($a_obj_type, $a_filter = true)
507 {
509
510 $subs = array();
511
512 if ($subobjects = $this->obj_data[$a_obj_type]["subobjects"]) {
513 // Filter some objects e.g chat object are creatable if chat is active
514 if ($a_filter) {
515 $this->__filterObjects($subobjects);
516 }
517 foreach ($subobjects as $data => $sub) {
518 if ($sub["module"] != "n") {
519 if (!($ilSetting->get("obj_dis_creation_" . $data))) {
520 $subs[$data] = $sub;
521
522 // determine position
523 $pos = ($ilSetting->get("obj_add_new_pos_" . $data) > 0)
524 ? (int) $ilSetting->get("obj_add_new_pos_" . $data)
525 : (int) $this->obj_data[$data]["default_pos"];
526 $subs[$data]["pos"] = $pos;
527 }
528 }
529 }
530
531 $subs2 = ilUtil::sortArray($subs, "pos", 'ASC', true, true);
532
533 return $subs2;
534 }
535
536 return $subs;
537 }
538
552 public function getSubObjectsRecursively($a_obj_type, $a_include_source_obj = true, $a_add_admin_objects = false)
553 {
555
556 // This associative array is used to collect all subobject types.
557 // key=>type, value=data
558 $recursivesubs = array();
559
560 // This array is used to keep track of the object types, we
561 // need to call function getSubobjects() for.
562 $to_do = array($a_obj_type);
563
564 // This array is used to keep track of the object types, we
565 // have called function getSubobjects() already. This is to
566 // prevent endless loops, for object types that support
567 // themselves as subobject types either directly or indirectly.
568 $done = array();
569
570 while (count($to_do) > 0) {
571 $type = array_pop($to_do);
572 $done[] = $type;
573
574 // no recovery folder subitems
575 if ($type == 'recf') {
576 continue;
577 }
578
579 // Hide administration if desired
580 if (!$a_add_admin_objects and $type == 'adm') {
581 $subs = array();
582 } else {
583 $subs = $this->getSubObjects($type);
584 }
585 #vd('xxxxxxxxxxxxx'.$type);
586 foreach ($subs as $subtype => $data) {
587 #vd('------------------------->'.$subtype);
588
589 // Hide role templates and folder from view
590 if ($this->getDevMode($subtype) or !$this->isRBACObject($subtype)) {
591 continue;
592 }
593 if ($subtype == 'rolt') {
594 continue;
595 }
596 if (!$a_add_admin_objects and $subtype == 'adm') {
597 continue;
598 }
599
600 $recursivesubs[$subtype] = $data;
601 if (!in_array($subtype, $done)
602 && !in_array($subtype, $to_do)) {
603 $to_do[] = $subtype;
604 }
605 }
606 }
607
608 if ($a_include_source_obj) {
609 if (!isset($recursivesubs[$a_obj_type])) {
610 $recursivesubs[$a_obj_type]['name'] = $a_obj_type;
611 $recursivesubs[$a_obj_type]['lng'] = $a_obj_type;
612 $recursivesubs[$a_obj_type]['max'] = 0;
613 $recursivesubs[$a_obj_type]['pos'] = -1;
614 }
615 }
616 return ilUtil::sortArray($recursivesubs, "pos", 'ASC', true, true);
617 }
618
619
629 public function getSubobjectsToFilter($a_obj_type = "adm")
630 {
631 foreach ($this->obj_data[$a_obj_type]["subobjects"] as $key => $value) {
632 switch ($key) {
633 case "rolf":
634 case "orgu":
635 // DO NOTHING
636 break;
637
638 default:
639 $tmp_subs[] = $key;
640 }
641 }
642 // ADD adm and root object
643 $tmp_subs[] = "adm";
644 #$tmp_subs[] = "root";
645
646 return $tmp_subs ? $tmp_subs : array();
647 }
648
658 public function getCreatableSubObjects($a_obj_type, $a_context = self::MODE_REPOSITORY, $a_parent_ref_id = null)
659 {
660 $subobjects = $this->getSubObjects($a_obj_type);
661
662 // remove role folder object from list
663 unset($subobjects["rolf"]);
664
665 $sub_types = array_keys($subobjects);
666
667 // remove object types in development from list
668 foreach ($sub_types as $type) {
669 if ($this->getDevMode($type) || $this->isSystemObject($type)) {
670 unset($subobjects[$type]);
671 }
672 if ($a_context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type)) {
673 unset($subobjects[$type]);
674 }
675 if ($a_context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type)) {
676 unset($subobjects[$type]);
677 }
678 if ($a_context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type)) {
679 unset($subobjects[$type]);
680 }
681 }
682
683 if ($a_obj_type == "prg") {
684 // ask study program which objects are allowed to create on the concrete node.
685 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
686 return ilObjStudyProgramme::getCreatableSubObjects($subobjects, $a_parent_ref_id);
687 }
688
689 return $subobjects;
690 }
691
698 public function getSubObjectsAsString($a_obj_type)
699 {
700 $string = "";
701
702 if (is_array($this->obj_data[$a_obj_type]["subobjects"])) {
703 $data = array_keys($this->obj_data[$a_obj_type]["subobjects"]);
704
705 $string = "'" . implode("','", $data) . "'";
706 }
707
708 return $string;
709 }
710
719 public function isContainer($a_obj_name)
720 {
721 if (!is_array($this->obj_data[$a_obj_name]['subobjects'])) {
722 return false;
723 }
724 return count($this->obj_data[$a_obj_name]['subobjects']) >= 1 ? true : false;
725 }
726
727 // PRIVATE METHODS
728
735 public function setHandlers($a_xml_parser)
736 {
737 xml_set_object($a_xml_parser, $this);
738 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
739 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
740 }
741
750 public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
751 {
752 switch ($a_name) {
753 case 'object':
754 $this->parent_tag_name = $a_attribs["name"];
755 break;
756 case 'property':
757 $this->current_tag = "property";
758 $this->current_tag_name = $a_attribs["name"];
759// $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["name"] = $a_attribs["name"];
760 $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $a_attribs["module"];
761//echo '<br>$this->obj_data["'.$this->parent_tag_name.'"]["properties"]["'.$this->current_tag_name.'"]["module"] = "'.$a_attribs["module"].'";';
762 break;
763 }
764 }
765
773 public function handlerCharacterData($a_xml_parser, $a_data)
774 {
775 }
776
784 public function handlerEndTag($a_xml_parser, $a_name)
785 {
786 $this->current_tag = '';
787 $this->current_tag_name = '';
788 }
789
790
791 public function __filterObjects(&$subobjects)
792 {
793 foreach ($subobjects as $type => $data) {
794 switch ($type) {
795 default:
796 // DO NOTHING
797 }
798 }
799 }
800
814 public function isSystemObject($a_obj_name)
815 {
816 return (bool) $this->obj_data[$a_obj_name]["system"];
817 }
818
825 public function isSideBlock($a_obj_name)
826 {
827 return (bool) $this->obj_data[$a_obj_name]["sideblock"];
828 }
829
834 public function getSideBlockTypes(bool $filter_repository_types = true) : array
835 {
836 $side_block_types = [];
837 foreach (array_keys($this->obj_data) as $type) {
838 if (
839 $filter_repository_types &&
840 !$this->isAllowedInRepository($type)
841 ) {
842 continue;
843 }
844 if ($this->isSideBlock($type)) {
845 $side_block_types[] = $type;
846 }
847 }
848 return $side_block_types;
849 }
850
855 $a_component_type,
856 $a_component_name
857 ) {
858 global $DIC;
859
860 $ilDB = $DIC->database();
861
862 $set = $ilDB->queryF(
863 "SELECT * FROM il_object_def WHERE component = %s",
864 array("text"),
865 array($a_component_type . "/" . $a_component_name)
866 );
867
868 $types = array();
869 while ($rec = $ilDB->fetchAssoc($set)) {
870 if ($rec["system"] != 1) {
871 $types[] = $rec;
872 }
873 }
874
875 return $types;
876 }
877
881 public static function getComponentForType($a_obj_type)
882 {
883 global $DIC;
884
885 $ilDB = $DIC->database();
886
887 $set = $ilDB->queryF(
888 "SELECT component FROM il_object_def WHERE id = %s",
889 array("text"),
890 array($a_obj_type)
891 );
892
893 if ($rec = $ilDB->fetchAssoc($set)) {
894 return $rec["component"];
895 }
896
897 return "";
898 }
899
904 public static function getGroupedRepositoryObjectTypes($a_parent_obj_type)
905 {
906 global $DIC;
907
908 $ilDB = $DIC->database();
909
910 $set = $ilDB->query("SELECT * FROM il_object_group");
911 $groups = array();
912 while ($gr_rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
913 $groups[$gr_rec["id"]] = $gr_rec;
914 }
915
916 $global_cache = ilCachedComponentData::getInstance();
917
918 $recs = $global_cache->lookupGroupedRepObj($a_parent_obj_type);
919
920 $grouped_obj = array();
921 foreach ((array) $recs as $rec) {
922 if ($rec["grp"] != "") {
923 $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
924 $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
925 } else {
926 $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
927 $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
928 }
929 }
930 // now get objects from repository plugin
931 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_SERVICE, "Repository", "robj");
932 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_MODULE, "OrgUnit", "orguext");
933
934 $ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true);
935 return $ret;
936 }
937
945 public function isAllowedInRepository($a_obj_name)
946 {
947 return (bool) $this->obj_data[$a_obj_name]["repository"];
948 }
949
956 public function getAllRepositoryTypes($a_incl_adm = false)
957 {
958 $types = array_keys($this->obj_data);
959
960 foreach ($types as $type) {
961 if ($this->isAllowedInRepository($type) &&
962 (!$this->isAdministrationObject($type) || $a_incl_adm)) {
963 $rbactypes[] = $type;
964 }
965 }
966
967 return $rbactypes ? $rbactypes : array();
968 }
969
970
978 public function isAllowedInWorkspace($a_obj_name)
979 {
980 return (bool) $this->obj_data[$a_obj_name]["workspace"];
981 }
982
988 public function isAdministrationObject($a_obj_name)
989 {
990 return (bool) $this->obj_data[$a_obj_name]['administration'];
991 }
992
999 public function isInactivePlugin($a_type)
1000 {
1001 if (substr($a_type, 0, 1) == "x" && !$this->isPlugin($a_type)) {
1002 return true;
1003 }
1004 return false;
1005 }
1006
1014 {
1015 $amet = array();
1016 foreach ($this->obj_data as $k => $v) {
1017 if ($v["amet"]) {
1018 $amet[] = array("obj_type" => $k, "sub_type" => "");
1019 }
1020 }
1021
1022 foreach ($this->sub_types as $type => $sub_types) {
1023 foreach ($sub_types as $t) {
1024 if ($t["amet"]) {
1025 $amet[] = array("obj_type" => $type, "sub_type" => $t["sub_type"]);
1026 }
1027 }
1028 }
1029
1030 return $amet;
1031 }
1032
1038 {
1039 $types = [];
1040 foreach ($this->obj_data as $type => $object_info) {
1041 if ($object_info['orgunit_permissions']) {
1042 $types[] = $type;
1043 }
1044 }
1045 return $types;
1046 }
1047
1052 public function getLTIProviderTypes()
1053 {
1054 $types = [];
1055 foreach ($this->obj_data as $type => $object_info) {
1056 if ($object_info['lti_provider']) {
1057 $types[] = $type;
1058 }
1059 }
1060 return $types;
1061 }
1062
1068 public function isOrgUnitPermissionType($a_obj_type)
1069 {
1070 return in_array($a_obj_type, $this->getOrgUnitPermissionTypes());
1071 }
1072
1079 public function getPositionByType($a_type)
1080 {
1082
1083 return ($ilSetting->get("obj_add_new_pos_" . $a_type) > 0)
1084 ? (int) $ilSetting->get("obj_add_new_pos_" . $a_type)
1085 : (int) $this->obj_data[$a_type]["default_pos"];
1086 }
1087
1092 public function getPlugins()
1093 {
1094 $plugins = array();
1095 foreach ((array) $this->obj_data as $type => $pl_data) {
1096 if ($this->isPlugin($type)) {
1097 $plugins[$type] = $pl_data;
1098 }
1099 }
1100 return $plugins;
1101 }
1102
1109 {
1110 $res = $grp_map = $cnt_grp = array();
1111
1112 // all repository object types
1113 foreach ($this->getSubObjectsRecursively("root") as $rtype) {
1114 $type = $rtype["name"];
1115
1116 // obsolete
1117 if ($type == "rolf") {
1118 continue;
1119 }
1120
1121 // gather group data
1122 $type_grp = $this->getGroupOfObj($type);
1123 if ($type_grp) {
1124 $grp_map[$type_grp][] = $type;
1125 }
1126
1127 // add basic container types
1128 if ($this->isContainer($type)) {
1129 // add to cnt_grp
1130 if ($type_grp) {
1131 $cnt_grp[] = $type_grp;
1132 }
1133
1134 $res[] = $type;
1135 }
1136 }
1137
1138 // add complete groups (cat => rcat, catr; crs => rcrs, crsr; ...)
1139 foreach ($cnt_grp as $grp) {
1140 $res = array_merge($res, $grp_map[$grp]);
1141 }
1142
1143 // add very special case
1144 // outcommented, see bug #25662
1145 // $res[] = "itgr";
1146
1147 return array_unique($res);
1148 }
1149
1156 public function supportsOfflineHandling($a_obj_type)
1157 {
1158 return
1159 isset($this->obj_data[$a_obj_type]) &&
1160 (bool) $this->obj_data[$a_obj_type]['offline_handling'];
1161 }
1162
1163
1169 protected function readPluginData()
1170 {
1171 $this->parsePluginData(IL_COMP_SERVICE, "Repository", "robj", false);
1172 $this->parsePluginData(IL_COMP_MODULE, "OrgUnit", "orguext", true);
1173 }
1174
1182 protected function parsePluginData($component, $slotName, $slotId, $isInAdministration)
1183 {
1184 $ilPluginAdmin = $this->plugin_admin;
1185 $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
1186 foreach ($pl_names as $pl_name) {
1187 include_once("./Services/Component/classes/class.ilPlugin.php");
1188 $pl_id = ilPlugin::lookupIdForName($component, $slotName, $slotId, $pl_name);
1189 if ($pl_id != "" && !isset($this->obj_data[$pl_id])) {
1190 include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
1191 $loc = ilPlugin::_getDirectory($component, $slotName, $slotId, $pl_name) . "/classes";
1192 // The plugin_id is the same as the type_id in repository object plugins.
1194
1195 $this->obj_data[$pl_id] = array(
1196 "name" => $pl_id,
1197 "class_name" => $pl_name,
1198 "plugin" => "1",
1199 "location" => $loc,
1200 "checkbox" => "1",
1201 "inherit" => "0",
1202 "component" => "",
1203 "translate" => "0",
1204 "devmode" => "0",
1205 "allow_link" => "1",
1206 "allow_copy" => $pl->allowCopy() ? '1' : '0',
1207 "rbac" => "1",
1208 "group" => null,
1209 "system" => "0",
1210 "default_pos" => "99992000", // "unassigned" group
1211 'repository' => '1',
1212 'workspace' => '0',
1213 'administration' => $isInAdministration?'1':'0',
1214 "sideblock" => "0",
1215 'export' => $ilPluginAdmin->supportsExport($component, $slotName, $slotId, $pl_name),
1216 'offline_handling' => '0',
1217 'orgunit_permissions' => $pl->useOrguPermissions() ? '1' : '0'
1218 );
1219 $parent_types = $pl->getParentTypes();
1220 foreach ($parent_types as $parent_type) {
1221 $this->obj_data[$parent_type]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
1222 }
1223 }
1224 }
1225 }
1226}
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
const IL_COMP_MODULE
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
static getInstance($component)
static getCreatableSubObjects(array $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 necessary 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
getOrgUnitPermissionTypes()
Get object type with orgunit position permission support.
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
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
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
isOrgUnitPermissionType($a_obj_type)
Check if object type offers orgunit position support.
getLTIProviderTypes()
Get object types which offer lti provider support.
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.
isSideBlock($a_obj_name)
Check, whether object type is a side block.
static getRepositoryObjectTypesForComponent( $a_component_type, $a_component_name)
Get all repository object types of component.
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' ...)
supportsOfflineHandling($a_obj_type)
check whether obj_type supports centralised offline handling
setHandlers($a_xml_parser)
set event handler
isAdministrationObject($a_obj_name)
Check if administration object.
getSideBlockTypes(bool $filter_repository_types=true)
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 getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
static lookupNameForId(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_id)
static _getDirectory(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Get plugin directory.
static lookupIdForName(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_name)
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
const ROOT_FOLDER_ID
Definition: constants.php:30
global $DIC
Definition: goto.php:24
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$type
foreach($_POST as $key=> $value) $res
settings()
Definition: settings.php:2
global $ilDB
$data
Definition: storeScorm.php:23