ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 */
4 require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
5 
15 class 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  );
98  $this->obj_data[$rec["id"]]["subobjects"] = array();
99 
100  $defIds[] = $rec["id"];
101  }
102 
103  $subobj = $global_cache->lookupSubObjForParent($defIds);
104 
105  foreach ($subobj as $rec2) {
106  $max = $rec2["mmax"];
107  if ($max <= 0) {
108  $max = "";
109  }
110  $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
111  "name" => $rec2["subobj"],
112  "max" => $max,
113  "lng" => $rec2["subobj"]
114  );
115  }
116  $this->obj_group = $global_cache->getIlObjectGroup();
117 
118  $this->readPluginData();
119 
120  $this->sub_types = $global_cache->getIlObjectSubType();
121  }
122 
123 
124  protected function readDefinitionDataFromDB()
125  {
126  global $DIC;
127 
128  $ilDB = $DIC->database();
129 
130  $this->obj_data = array();
131 
132  // Select all object_definitions and collect the definition id's in
133  // this array.
134  $defIds = array();
135  $set = $ilDB->query("SELECT * FROM il_object_def");
136  while ($rec = $ilDB->fetchAssoc($set)) {
137  $this->obj_data[$rec["id"]] = array(
138  "name" => $rec["id"],
139  "class_name" => $rec["class_name"],
140  "location" => $rec["location"],
141  "checkbox" => $rec["checkbox"],
142  "inherit" => $rec["inherit"],
143  "component" => $rec["component"],
144  "translate" => $rec["translate"],
145  "devmode" => $rec["devmode"],
146  "allow_link" => $rec["allow_link"],
147  "allow_copy" => $rec["allow_copy"],
148  "rbac" => $rec["rbac"],
149  "group" => $rec["grp"],
150  "system" => $rec["system"],
151  "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
152  "sideblock" => $rec["sideblock"],
153  'export' => $rec['export'],
154  'repository' => $rec['repository'],
155  'workspace' => $rec['workspace'],
156  'administration' => $rec['administration'],
157  'amet' => $rec['amet'],
158  'orgunit_permissions' => $rec['orgunit_permissions'],
159  'lti_provider' => $rec['lti_provider']
160  );
161  $this->obj_data[$rec["id"]]["subobjects"] = array();
162 
163  $defIds[] = $rec["id"];
164  }
165 
166  // get all subobject definitions in a single query
167  $set2 = $ilDB->query("SELECT * FROM il_object_subobj WHERE " . $ilDB->in('parent', $defIds, false, 'text'));
168  while ($rec2 = $ilDB->fetchAssoc($set2)) {
169  $max = $rec2["mmax"];
170  if ($max <= 0) { // for backward compliance
171  $max = "";
172  }
173  $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
174  "name" => $rec2["subobj"],
175  "max" => $max,
176  "lng" => $rec2["subobj"]
177  );
178  }
179 
180  $set = $ilDB->query("SELECT * FROM il_object_group");
181  $this->obj_group = array();
182  while ($rec = $ilDB->fetchAssoc($set)) {
183  $this->obj_group[$rec["id"]] = $rec;
184  }
185 
186  $this->readPluginData();
187 
188  $set = $ilDB->query("SELECT * FROM il_object_sub_type ");
189  $this->sub_types = array();
190  while ($rec = $ilDB->fetchAssoc($set)) {
191  $this->sub_types[$rec["obj_type"]][] = $rec;
192  }
193  }
194 
195 
199  public function readDefinitionData()
200  {
203  } else {
204  $this->readDefinitionDataFromDB();
205  }
206  }
207 
217  protected static function getGroupedPluginObjectTypes($grouped_obj, $component, $slotName, $slotId)
218  {
219  global $DIC;
220 
221  $ilPluginAdmin = $DIC["ilPluginAdmin"];
222  $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
223  foreach ($pl_names as $pl_name) {
224  include_once("./Services/Component/classes/class.ilPlugin.php");
225  $pl_id = ilPlugin::lookupIdForName($component, $slotName, $slotId, $pl_name);
226  if (!isset($grouped_obj[$pl_id])) {
227  $grouped_obj[$pl_id] = array(
228  "pos" => "99992000", // "unassigned" group
229  "objs" => array(0 => $pl_id)
230  );
231  }
232  }
233  return $grouped_obj;
234  }
235 
236 
237  // PUBLIC METHODS
238 
245  public function getClassName($a_obj_name)
246  {
247  return $this->obj_data[$a_obj_name]["class_name"];
248  }
249 
250 
257  public function getLocation($a_obj_name)
258  {
259  return $this->obj_data[$a_obj_name]["location"];
260  }
261 
265  public function getGroup($a_id)
266  {
267  return $this->obj_group[$a_id];
268  }
269 
273  public function getGroupOfObj($a_obj_name)
274  {
275  return $this->obj_data[$a_obj_name]["group"];
276  }
277 
284  public function hasCheckbox($a_obj_name)
285  {
286  return (bool) $this->obj_data[$a_obj_name]["checkbox"];
287  }
288 
295  public function getTranslationType($a_obj_name)
296  {
297  global $DIC;
298 
299  $ilDB = $DIC->database();
300 
301  if ($a_obj_name == "root") {
302  if (!isset($this->root_trans_type)) {
303  $q = "SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = " .
304  $ilDB->quote(ROOT_FOLDER_ID, 'integer') . " ";
305  $set = $ilDB->query($q);
306  $rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
307  if ($rec["cnt"] > 0) {
308  $this->root_trans_type = "db";
309  } else {
310  $this->root_trans_type = $this->obj_data[$a_obj_name]["translate"];
311  }
312  }
313  return $this->root_trans_type;
314  }
315 
316  if (isset($this->obj_data[$a_obj_name])) {
317  return $this->obj_data[$a_obj_name]["translate"];
318  }
319 
320  return "";
321  }
322 
323 
330  public function stopInheritance($a_obj_name)
331  {
332  return (bool) $this->obj_data[$a_obj_name]["inherit"];
333  }
334 
341  public function getDevMode($a_obj_name)
342  {
343  return (bool) $this->obj_data[$a_obj_name]["devmode"];
344  }
345 
352  public function getDevModeAll()
353  {
354  $types = array_keys($this->obj_data);
355 
356  foreach ($types as $type) {
357  if ($this->getDevMode($type)) {
358  $devtypes[] = $type;
359  }
360  }
361 
362  return $devtypes ? $devtypes : array();
363  }
364 
372  public function isRBACObject($a_obj_name)
373  {
374  return (bool) $this->obj_data[$a_obj_name]["rbac"];
375  }
376 
384  public function isPlugin($a_obj_name)
385  {
386  return (bool) isset($this->obj_data[$a_obj_name]["plugin"]);
387  }
388 
395  public function isPluginTypeName($a_str)
396  {
397  return (substr($a_str, 0, 1) == "x");
398  }
399 
405  public function isActivePluginType($type)
406  {
407  $ilPluginAdmin = $this->plugin_admin;
408  $isRepoPlugin = $ilPluginAdmin->isActive(
410  "Repository",
411  "robj",
412  ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $type)
413  );
414  $isOrguPlugin = $ilPluginAdmin->isActive(
416  "OrgUnit",
417  "orguext",
418  ilPlugin::lookupNameForId(IL_COMP_MODULE, "OrgUnit", "orguext", $type)
419  );
420  return $isRepoPlugin || $isOrguPlugin;
421  }
422 
429  public function getAllRBACObjects()
430  {
431  $types = array_keys($this->obj_data);
432 
433  foreach ($types as $type) {
434  if ($this->isRBACObject($type)) {
435  $rbactypes[] = $type;
436  }
437  }
438 
439  return $rbactypes ? $rbactypes : array();
440  }
441 
448  public function getAllObjects()
449  {
450  return array_keys($this->obj_data);
451  }
452 
459  public function allowLink($a_obj_name)
460  {
461  return (bool) $this->obj_data[$a_obj_name]["allow_link"];
462  }
463 
470  public function allowCopy($a_obj_name)
471  {
472  return (bool) $this->obj_data[$a_obj_name]["allow_copy"];
473  }
474 
475  public function allowExport($a_obj_name)
476  {
477  return (bool) $this->obj_data[$a_obj_name]['export'];
478  }
479 
485  public function hasLocalRoles($a_obj_type)
486  {
487  switch ($a_obj_type) {
488  case 'root':
489  return false;
490 
491  default:
492  return true;
493  }
494  }
495 
504  public function getSubObjects($a_obj_type, $a_filter = true)
505  {
507 
508  $subs = array();
509 
510  if ($subobjects = $this->obj_data[$a_obj_type]["subobjects"]) {
511  // Filter some objects e.g chat object are creatable if chat is active
512  if ($a_filter) {
513  $this->__filterObjects($subobjects);
514  }
515  foreach ($subobjects as $data => $sub) {
516  if ($sub["module"] != "n") {
517  if (!($ilSetting->get("obj_dis_creation_" . $data))) {
518  $subs[$data] = $sub;
519 
520  // determine position
521  $pos = ($ilSetting->get("obj_add_new_pos_" . $data) > 0)
522  ? (int) $ilSetting->get("obj_add_new_pos_" . $data)
523  : (int) $this->obj_data[$data]["default_pos"];
524  $subs[$data]["pos"] = $pos;
525  }
526  }
527  }
528 
529  $subs2 = ilUtil::sortArray($subs, "pos", 'ASC', true, true);
530 
531  return $subs2;
532  }
533 
534  return $subs;
535  }
536 
550  public function getSubObjectsRecursively($a_obj_type, $a_include_source_obj = true, $a_add_admin_objects = false)
551  {
553 
554  // This associative array is used to collect all subobject types.
555  // key=>type, value=data
556  $recursivesubs = array();
557 
558  // This array is used to keep track of the object types, we
559  // need to call function getSubobjects() for.
560  $to_do = array($a_obj_type);
561 
562  // This array is used to keep track of the object types, we
563  // have called function getSubobjects() already. This is to
564  // prevent endless loops, for object types that support
565  // themselves as subobject types either directly or indirectly.
566  $done = array();
567 
568  while (count($to_do) > 0) {
569  $type = array_pop($to_do);
570  $done[] = $type;
571 
572  // no recovery folder subitems
573  if ($type == 'recf') {
574  continue;
575  }
576 
577  // Hide administration if desired
578  if (!$a_add_admin_objects and $type == 'adm') {
579  $subs = array();
580  } else {
581  $subs = $this->getSubObjects($type);
582  }
583  #vd('xxxxxxxxxxxxx'.$type);
584  foreach ($subs as $subtype => $data) {
585  #vd('------------------------->'.$subtype);
586 
587  // Hide role templates and folder from view
588  if ($this->getDevMode($subtype) or !$this->isRBACObject($subtype)) {
589  continue;
590  }
591  if ($subtype == 'rolt') {
592  continue;
593  }
594  if (!$a_add_admin_objects and $subtype == 'adm') {
595  continue;
596  }
597 
598  $recursivesubs[$subtype] = $data;
599  if (!in_array($subtype, $done)
600  && !in_array($subtype, $to_do)) {
601  $to_do[] = $subtype;
602  }
603  }
604  }
605 
606  if ($a_include_source_obj) {
607  if (!isset($recursivesubs[$a_obj_type])) {
608  $recursivesubs[$a_obj_type]['name'] = $a_obj_type;
609  $recursivesubs[$a_obj_type]['lng'] = $a_obj_type;
610  $recursivesubs[$a_obj_type]['max'] = 0;
611  $recursivesubs[$a_obj_type]['pos'] = -1;
612  }
613  }
614  return ilUtil::sortArray($recursivesubs, "pos", 'ASC', true, true);
615  }
616 
617 
627  public function getSubobjectsToFilter($a_obj_type = "adm")
628  {
629  foreach ($this->obj_data[$a_obj_type]["subobjects"] as $key => $value) {
630  switch ($key) {
631  case "rolf":
632  case "orgu":
633  // DO NOTHING
634  break;
635 
636  default:
637  $tmp_subs[] = $key;
638  }
639  }
640  // ADD adm and root object
641  $tmp_subs[] = "adm";
642  #$tmp_subs[] = "root";
643 
644  return $tmp_subs ? $tmp_subs : array();
645  }
646 
656  public function getCreatableSubObjects($a_obj_type, $a_context = self::MODE_REPOSITORY, $a_parent_ref_id = null)
657  {
658  $subobjects = $this->getSubObjects($a_obj_type);
659 
660  // remove role folder object from list
661  unset($subobjects["rolf"]);
662 
663  $sub_types = array_keys($subobjects);
664 
665  // remove object types in development from list
666  foreach ($sub_types as $type) {
667  if ($this->getDevMode($type) || $this->isSystemObject($type)) {
668  unset($subobjects[$type]);
669  }
670  if ($a_context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type)) {
671  unset($subobjects[$type]);
672  }
673  if ($a_context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type)) {
674  unset($subobjects[$type]);
675  }
676  if ($a_context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type)) {
677  unset($subobjects[$type]);
678  }
679  }
680 
681  if ($a_obj_type == "prg") {
682  // ask study program which objects are allowed to create on the concrete node.
683  require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
684  return ilObjStudyProgramme::getCreatableSubObjects($subobjects, $a_parent_ref_id);
685  }
686 
687  return $subobjects;
688  }
689 
696  public function getSubObjectsAsString($a_obj_type)
697  {
698  $string = "";
699 
700  if (is_array($this->obj_data[$a_obj_type]["subobjects"])) {
701  $data = array_keys($this->obj_data[$a_obj_type]["subobjects"]);
702 
703  $string = "'" . implode("','", $data) . "'";
704  }
705 
706  return $string;
707  }
708 
717  public function isContainer($a_obj_name)
718  {
719  if (!is_array($this->obj_data[$a_obj_name]['subobjects'])) {
720  return false;
721  }
722  return count($this->obj_data[$a_obj_name]['subobjects']) >= 1 ? true : false;
723  }
724 
725  // PRIVATE METHODS
726 
733  public function setHandlers($a_xml_parser)
734  {
735  xml_set_object($a_xml_parser, $this);
736  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
737  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
738  }
739 
748  public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
749  {
750  switch ($a_name) {
751  case 'object':
752  $this->parent_tag_name = $a_attribs["name"];
753  break;
754  case 'property':
755  $this->current_tag = "property";
756  $this->current_tag_name = $a_attribs["name"];
757 // $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["name"] = $a_attribs["name"];
758  $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $a_attribs["module"];
759 //echo '<br>$this->obj_data["'.$this->parent_tag_name.'"]["properties"]["'.$this->current_tag_name.'"]["module"] = "'.$a_attribs["module"].'";';
760  break;
761  }
762  }
763 
771  public function handlerCharacterData($a_xml_parser, $a_data)
772  {
773  }
774 
782  public function handlerEndTag($a_xml_parser, $a_name)
783  {
784  $this->current_tag = '';
785  $this->current_tag_name = '';
786  }
787 
788 
789  public function __filterObjects(&$subobjects)
790  {
791  foreach ($subobjects as $type => $data) {
792  switch ($type) {
793  default:
794  // DO NOTHING
795  }
796  }
797  }
798 
812  public function isSystemObject($a_obj_name)
813  {
814  return (bool) $this->obj_data[$a_obj_name]["system"];
815  }
816 
823  public function isSideBlock($a_obj_name)
824  {
825  return (bool) $this->obj_data[$a_obj_name]["sideblock"];
826  }
827 
831  public static function getRepositoryObjectTypesForComponent(
832  $a_component_type,
833  $a_component_name
834  ) {
835  global $DIC;
836 
837  $ilDB = $DIC->database();
838 
839  $set = $ilDB->queryF(
840  "SELECT * FROM il_object_def WHERE component = %s",
841  array("text"),
842  array($a_component_type . "/" . $a_component_name)
843  );
844 
845  $types = array();
846  while ($rec = $ilDB->fetchAssoc($set)) {
847  if ($rec["system"] != 1) {
848  $types[] = $rec;
849  }
850  }
851 
852  return $types;
853  }
854 
858  public static function getComponentForType($a_obj_type)
859  {
860  global $DIC;
861 
862  $ilDB = $DIC->database();
863 
864  $set = $ilDB->queryF(
865  "SELECT component FROM il_object_def WHERE id = %s",
866  array("text"),
867  array($a_obj_type)
868  );
869 
870  if ($rec = $ilDB->fetchAssoc($set)) {
871  return $rec["component"];
872  }
873 
874  return "";
875  }
876 
881  public static function getGroupedRepositoryObjectTypes($a_parent_obj_type)
882  {
883  global $DIC;
884 
885  $ilDB = $DIC->database();
886 
887  $set = $ilDB->query("SELECT * FROM il_object_group");
888  $groups = array();
889  while ($gr_rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
890  $groups[$gr_rec["id"]] = $gr_rec;
891  }
892 
893  $global_cache = ilCachedComponentData::getInstance();
894 
895  $recs = $global_cache->lookupGroupedRepObj($a_parent_obj_type);
896 
897  $grouped_obj = array();
898  foreach ((array) $recs as $rec) {
899  if ($rec["grp"] != "") {
900  $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
901  $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
902  } else {
903  $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
904  $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
905  }
906  }
907  // now get objects from repository plugin
908  $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_SERVICE, "Repository", "robj");
909  $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_MODULE, "OrgUnit", "orguext");
910 
911  $ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true);
912  return $ret;
913  }
914 
922  public function isAllowedInRepository($a_obj_name)
923  {
924  return (bool) $this->obj_data[$a_obj_name]["repository"];
925  }
926 
933  public function getAllRepositoryTypes($a_incl_adm = false)
934  {
935  $types = array_keys($this->obj_data);
936 
937  foreach ($types as $type) {
938  if ($this->isAllowedInRepository($type) &&
939  (!$this->isAdministrationObject($type) || $a_incl_adm)) {
940  $rbactypes[] = $type;
941  }
942  }
943 
944  return $rbactypes ? $rbactypes : array();
945  }
946 
947 
955  public function isAllowedInWorkspace($a_obj_name)
956  {
957  return (bool) $this->obj_data[$a_obj_name]["workspace"];
958  }
959 
965  public function isAdministrationObject($a_obj_name)
966  {
967  return (bool) $this->obj_data[$a_obj_name]['administration'];
968  }
969 
976  public function isInactivePlugin($a_type)
977  {
978  if (substr($a_type, 0, 1) == "x" && !$this->isPlugin($a_type)) {
979  return true;
980  }
981  return false;
982  }
983 
990  public function getAdvancedMetaDataTypes()
991  {
992  $amet = array();
993  foreach ($this->obj_data as $k => $v) {
994  if ($v["amet"]) {
995  $amet[] = array("obj_type" => $k, "sub_type" => "");
996  }
997  }
998 
999  foreach ($this->sub_types as $type => $sub_types) {
1000  foreach ($sub_types as $t) {
1001  if ($t["amet"]) {
1002  $amet[] = array("obj_type" => $type, "sub_type" => $t["sub_type"]);
1003  }
1004  }
1005  }
1006 
1007  return $amet;
1008  }
1009 
1014  public function getOrgUnitPermissionTypes()
1015  {
1016  $types = [];
1017  foreach ($this->obj_data as $type => $object_info) {
1018  if ($object_info['orgunit_permissions']) {
1019  $types[] = $type;
1020  }
1021  }
1022  return $types;
1023  }
1024 
1029  public function getLTIProviderTypes()
1030  {
1031  $types = [];
1032  foreach ($this->obj_data as $type => $object_info) {
1033  if ($object_info['lti_provider']) {
1034  $types[] = $type;
1035  }
1036  }
1037  return $types;
1038  }
1039 
1045  public function isOrgUnitPermissionType($a_obj_type)
1046  {
1047  return in_array($a_obj_type, $this->getOrgUnitPermissionTypes());
1048  }
1049 
1056  public function getPositionByType($a_type)
1057  {
1059 
1060  return ($ilSetting->get("obj_add_new_pos_" . $a_type) > 0)
1061  ? (int) $ilSetting->get("obj_add_new_pos_" . $a_type)
1062  : (int) $this->obj_data[$a_type]["default_pos"];
1063  }
1064 
1069  public function getPlugins()
1070  {
1071  $plugins = array();
1072  foreach ((array) $this->obj_data as $type => $pl_data) {
1073  if ($this->isPlugin($type)) {
1074  $plugins[$type] = $pl_data;
1075  }
1076  }
1077  return $plugins;
1078  }
1079 
1085  public function getExplorerContainerTypes()
1086  {
1087  $res = $grp_map = $cnt_grp = array();
1088 
1089  // all repository object types
1090  foreach ($this->getSubObjectsRecursively("root") as $rtype) {
1091  $type = $rtype["name"];
1092 
1093  // obsolete
1094  if ($type == "rolf") {
1095  continue;
1096  }
1097 
1098  // gather group data
1099  $type_grp = $this->getGroupOfObj($type);
1100  if ($type_grp) {
1101  $grp_map[$type_grp][] = $type;
1102  }
1103 
1104  // add basic container types
1105  if ($this->isContainer($type)) {
1106  // add to cnt_grp
1107  if ($type_grp) {
1108  $cnt_grp[] = $type_grp;
1109  }
1110 
1111  $res[] = $type;
1112  }
1113  }
1114 
1115  // add complete groups (cat => rcat, catr; crs => rcrs, crsr; ...)
1116  foreach ($cnt_grp as $grp) {
1117  $res = array_merge($res, $grp_map[$grp]);
1118  }
1119 
1120  // add very special case
1121  // outcommented, see bug #25662
1122  // $res[] = "itgr";
1123 
1124  return array_unique($res);
1125  }
1126 
1132  protected function readPluginData()
1133  {
1134  $this->parsePluginData(IL_COMP_SERVICE, "Repository", "robj", false);
1135  $this->parsePluginData(IL_COMP_MODULE, "OrgUnit", "orguext", true);
1136  }
1137 
1145  protected function parsePluginData($component, $slotName, $slotId, $isInAdministration)
1146  {
1147  $ilPluginAdmin = $this->plugin_admin;
1148  $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
1149  foreach ($pl_names as $pl_name) {
1150  include_once("./Services/Component/classes/class.ilPlugin.php");
1151  $pl_id = ilPlugin::lookupIdForName($component, $slotName, $slotId, $pl_name);
1152  if ($pl_id != "" && !isset($this->obj_data[$pl_id])) {
1153  include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
1154  $loc = ilPlugin::_getDirectory($component, $slotName, $slotId, $pl_name) . "/classes";
1155  // The plugin_id is the same as the type_id in repository object plugins.
1157 
1158  $this->obj_data[$pl_id] = array(
1159  "name" => $pl_id,
1160  "class_name" => $pl_name,
1161  "plugin" => "1",
1162  "location" => $loc,
1163  "checkbox" => "1",
1164  "inherit" => "0",
1165  "component" => "",
1166  "translate" => "0",
1167  "devmode" => "0",
1168  "allow_link" => "1",
1169  "allow_copy" => $pl->allowCopy() ? '1' : '0',
1170  "rbac" => "1",
1171  "group" => null,
1172  "system" => "0",
1173  "default_pos" => "99992000", // "unassigned" group
1174  'repository' => '1',
1175  'workspace' => '0',
1176  'administration' => $isInAdministration?'1':'0',
1177  "sideblock" => "0",
1178  'export' => $ilPluginAdmin->supportsExport($component, $slotName, $slotId, $pl_name)
1179  );
1180  $parent_types = $pl->getParentTypes();
1181  foreach ($parent_types as $parent_type) {
1182  $this->obj_data[$parent_type]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
1183  }
1184  }
1185  }
1186  }
1187 }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getPositionByType($a_type)
Get Position By Object Type.
getCreatableSubObjects($a_obj_type, $a_context=self::MODE_REPOSITORY, $a_parent_ref_id=null)
get only creatable subobjects by type
hasCheckbox($a_obj_name)
should the object get a checkbox (needed for &#39;cut&#39;,&#39;copy&#39; ...)
getSubObjectsAsString($a_obj_type)
get a string of all subobjects by type
$type
setHandlers($a_xml_parser)
set event handler
global $DIC
Definition: saml.php:7
isAllowedInRepository($a_obj_name)
checks if object type can be used in repository context
static getInstance($component)
readDefinitionData()
Read object definition data.
getAdvancedMetaDataTypes()
Get advanced meta data objects.
handlerCharacterData($a_xml_parser, $a_data)
end tag handler
getOrgUnitPermissionTypes()
Get object type with orgunit position permission support.
getLocation($a_obj_name)
get location by type
static getGroupedRepositoryObjectTypes($a_parent_obj_type)
isAdministrationObject($a_obj_name)
Check if administration object.
isSystemObject($a_obj_name)
checks if object type is a system object
getSubObjects($a_obj_type, $a_filter=true)
get all subobjects by type
isActivePluginType($type)
Returns true iff the given type is an active type of a repositoryObject or Organisation Unit Extensio...
static lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
getGroupOfObj($a_obj_name)
Get Group of object type.
getSubobjectsToFilter($a_obj_type="adm")
get all subjects except (rolf) of the adm object This is necessary for filtering these objects in rol...
isInactivePlugin($a_type)
Check whether type belongs to inactive plugin.
allowCopy($a_obj_name)
checks if copying of an object type is allowed
$a_type
Definition: workflow.php:92
parses the objects.xml it handles the xml-description of all ilias objects
getAllRepositoryTypes($a_incl_adm=false)
get all RBAC object types
isOrgUnitPermissionType($a_obj_type)
Check if object type offers orgunit position support.
foreach($_POST as $key=> $value) $res
getGroup($a_id)
Get Group information.
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
getAllRBACObjects()
get all RBAC object types
stopInheritance($a_obj_name)
Does object permits stopping inheritance?
getTranslationType($a_obj_name)
get translation type (sys, db or 0)s
const IL_COMP_MODULE
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
parsePluginData($component, $slotName, $slotId, $isInAdministration)
loads a single plugin definition into the object definition
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
isSideBlock($a_obj_name)
Check, whether object type is a side block.
Create styles array
The data for the language used.
handlerEndTag($a_xml_parser, $a_name)
end tag handler
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...
allowLink($a_obj_name)
checks if linking of an object type is allowed
getSubObjectsRecursively($a_obj_type, $a_include_source_obj=true, $a_add_admin_objects=false)
Get all subobjects by type.
static getGroupedPluginObjectTypes($grouped_obj, $component, $slotName, $slotId)
getAllObjects()
get all object types
isPluginTypeName($a_str)
Check if given type is a plugin type name (starts with an "x")
isPlugin($a_obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type ...
settings()
Definition: settings.php:2
getDevMode($a_obj_name)
get devmode status by type
global $ilSetting
Definition: privfeed.php:17
isRBACObject($a_obj_name)
get RBAC status by type returns true if object type is a RBAC object type
hasLocalRoles($a_obj_type)
Check whether the creation of local roles is allowed Currently disabled for type "root" and "adm"...
getLTIProviderTypes()
Get object types which offer lti provider support.
global $ilDB
$ret
Definition: parser.php:6
static getRepositoryObjectTypesForComponent( $a_component_type, $a_component_name)
Get all repository object types of component.
getClassName($a_obj_name)
get class name by type
isContainer($a_obj_name)
Check if object type is container (&#39;crs&#39;,&#39;fold&#39;,&#39;grp&#39; ...)
readPluginData()
Loads the different plugins into the object definition.
getExplorerContainerTypes()
Get all object types which are defined as container in an explorer context.
isAllowedInWorkspace($a_obj_name)
checks if object type can be used in workspace context
static getComponentForType($a_obj_type)
Get component for object type.
$key
Definition: croninfo.php:18
getDevModeAll()
get all object types in devmode
const IL_COMP_SERVICE
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
getPlugins()
Get plugin object info.