ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
23  var $obj_id;
24 
30  var $parent;
31 
37  var $obj_data;
38 
39  var $sub_types = array();
40 
41  const MODE_REPOSITORY = 1;
42  const MODE_WORKSPACE = 2;
44 
51  function __construct()
52  {
53  global $ilias;
54 
55  $this->readDefinitionData();
56  $this->ilias = $ilias;
57 
58  //parent::__construct(ILIAS_ABSOLUTE_PATH."/objects.xml");
59 
60  // removing this line leads to segmentation faults in
61  // learning module editor with
62  // - PHP 5.2.1, libxml 2.6.22, libxslt 1.1.15 (MacOsX)
63  // - PHP 5.2.1, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
64  // - PHP 5.2.5, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
65  // - PHP 5.2.0-8+etch7, libxml 2.6.27, libxslt 1.1.19
66  // - PHP 5.2.0, libxml, libxml 2.6.26, libxslt 1.1.17 (OpenSuse 10.2)
67  // (needs further investigation)
68  // OK with:
69  // - PHP 5.1.2, libxml 2.6.24, libxslt 1.1.15
70 
71  //
72  // Replacing all "=&" with "=" in xml5compliance seems to solve the problem
73  //
74 
75 // $this->startParsing();
76  }
77 
78 
79  protected function readDefinitionDataFromCache() {
80  $this->obj_data = array();
81  $defIds = array();
82  $global_cache = ilCachedComponentData::getInstance();
83  foreach ($global_cache->getIlobjectDef() as $rec) {
84  $this->obj_data[$rec["id"]] = array(
85  "name" => $rec["id"],
86  "class_name" => $rec["class_name"],
87  "location" => $rec["location"],
88  "checkbox" => $rec["checkbox"],
89  "inherit" => $rec["inherit"],
90  "component" => $rec["component"],
91  "translate" => $rec["translate"],
92  "devmode" => $rec["devmode"],
93  "allow_link" => $rec["allow_link"],
94  "allow_copy" => $rec["allow_copy"],
95  "rbac" => $rec["rbac"],
96  "group" => $rec["grp"],
97  "system" => $rec["system"],
98  "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
99  "sideblock" => $rec["sideblock"],
100  'export' => $rec['export'],
101  'repository' => $rec['repository'],
102  'workspace' => $rec['workspace'],
103  'administration' => $rec['administration'],
104  'amet' => $rec['amet']
105  );
106  $this->obj_data[$rec["id"]]["subobjects"] = array();
107 
108  $defIds[] = $rec["id"];
109  }
110 
111  $subobj = $global_cache->lookupSubObjForParent($defIds);
112 
113  foreach ($subobj as $rec2) {
114 
115  $max = $rec2["mmax"];
116  if ($max <= 0) {
117  $max = "";
118  }
119  $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
120  "name" => $rec2["subobj"],
121  "max" => $max,
122  "lng" => $rec2["subobj"]
123  );
124  }
125  $this->obj_group = $global_cache->getIlObjectGroup();
126 
127  $this->readPluginData();
128 
129  $this->sub_types = $global_cache->getIlObjectSubType();
130  }
131 
132 
133  protected function readDefinitionDataFromDB() {
134  global $ilDB;
135 
136  $this->obj_data = array();
137 
138  // Select all object_definitions and collect the definition id's in
139  // this array.
140  $defIds = array();
141  $set = $ilDB->query("SELECT * FROM il_object_def");
142  while ($rec = $ilDB->fetchAssoc($set)) {
143  $this->obj_data[$rec["id"]] = array(
144  "name" => $rec["id"],
145  "class_name" => $rec["class_name"],
146  "location" => $rec["location"],
147  "checkbox" => $rec["checkbox"],
148  "inherit" => $rec["inherit"],
149  "component" => $rec["component"],
150  "translate" => $rec["translate"],
151  "devmode" => $rec["devmode"],
152  "allow_link" => $rec["allow_link"],
153  "allow_copy" => $rec["allow_copy"],
154  "rbac" => $rec["rbac"],
155  "group" => $rec["grp"],
156  "system" => $rec["system"],
157  "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
158  "sideblock" => $rec["sideblock"],
159  'export' => $rec['export'],
160  'repository' => $rec['repository'],
161  'workspace' => $rec['workspace'],
162  'administration' => $rec['administration'],
163  'amet' => $rec['amet']
164  );
165  $this->obj_data[$rec["id"]]["subobjects"] = array();
166 
167  $defIds[] = $rec["id"];
168  }
169 
170  // get all subobject definitions in a single query
171  $set2 = $ilDB->query("SELECT * FROM il_object_subobj WHERE " . $ilDB->in('parent', $defIds, false, 'text'));
172  while ($rec2 = $ilDB->fetchAssoc($set2)) {
173  $max = $rec2["mmax"];
174  if ($max <= 0) // for backward compliance
175  {
176  $max = "";
177  }
178  $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
179  "name" => $rec2["subobj"],
180  "max" => $max,
181  "lng" => $rec2["subobj"]
182  );
183  }
184 
185  $set = $ilDB->query("SELECT * FROM il_object_group");
186  $this->obj_group = array();
187  while ($rec = $ilDB->fetchAssoc($set)) {
188  $this->obj_group[$rec["id"]] = $rec;
189  }
190 
191  $this->readPluginData();
192 
193  $set = $ilDB->query("SELECT * FROM il_object_sub_type ");
194  $this->sub_types = array();
195  while ($rec = $ilDB->fetchAssoc($set)) {
196  $this->sub_types[$rec["obj_type"]][] = $rec;
197  }
198  }
199 
200 
205  {
208  } else {
209  $this->readDefinitionDataFromDB();
210  }
211  }
212 
222  protected static function getGroupedPluginObjectTypes($grouped_obj, $component, $slotName, $slotId) {
223  global $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  function getClassName($a_obj_name)
248  {
249  return $this->obj_data[$a_obj_name]["class_name"];
250  }
251 
252 
259  function getLocation($a_obj_name)
260  {
261  return $this->obj_data[$a_obj_name]["location"];
262  }
263 
267  function getGroup($a_id)
268  {
269  return $this->obj_group[$a_id];
270  }
271 
275  function getGroupOfObj($a_obj_name)
276  {
277  return $this->obj_data[$a_obj_name]["group"];
278  }
279 
286  function hasCheckbox($a_obj_name)
287  {
288  return (bool) $this->obj_data[$a_obj_name]["checkbox"];
289  }
290 
297  function getTranslationType($a_obj_name)
298  {
299  global $ilDB;
300 
301  if ($a_obj_name == "root")
302  {
303  if (!isset($this->root_trans_type))
304  {
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  {
311  $this->root_trans_type = "db";
312  }
313  else
314  {
315  $this->root_trans_type = $this->obj_data[$a_obj_name]["translate"];
316  }
317  }
318  return $this->root_trans_type;
319  }
320 
321  if (isset($this->obj_data[$a_obj_name]))
322  {
323  return $this->obj_data[$a_obj_name]["translate"];
324  }
325 
326  return "";
327  }
328 
329 
336  function stopInheritance($a_obj_name)
337  {
338  return (bool) $this->obj_data[$a_obj_name]["inherit"];
339  }
340 
347  function getDevMode($a_obj_name)
348  {
349  return (bool) $this->obj_data[$a_obj_name]["devmode"];
350  }
351 
358  function getDevModeAll()
359  {
360  $types = array_keys($this->obj_data);
361 
362  foreach ($types as $type)
363  {
364  if ($this->getDevMode($type))
365  {
366  $devtypes[] = $type;
367  }
368  }
369 
370  return $devtypes ? $devtypes : array();
371  }
372 
380  function isRBACObject($a_obj_name)
381  {
382  return (bool) $this->obj_data[$a_obj_name]["rbac"];
383  }
384 
392  function isPlugin($a_obj_name)
393  {
394  return (bool) isset($this->obj_data[$a_obj_name]["plugin"]);
395  }
396 
403  function isPluginTypeName($a_str)
404  {
405  return (substr($a_str, 0, 1) == "x");
406  }
407 
413  public function isActivePluginType($type) {
414  global $ilPluginAdmin;
415  $isRepoPlugin = $ilPluginAdmin->isActive(IL_COMP_SERVICE, "Repository", "robj",
416  ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $type));
417  $isOrguPlugin = $ilPluginAdmin->isActive(IL_COMP_MODULE, "OrgUnit", "orguext",
418  ilPlugin::lookupNameForId(IL_COMP_MODULE, "OrgUnit", "orguext", $type));
419  return $isRepoPlugin || $isOrguPlugin;
420  }
421 
428  function getAllRBACObjects()
429  {
430  $types = array_keys($this->obj_data);
431 
432  foreach ($types as $type)
433  {
434  if ($this->isRBACObject($type))
435  {
436  $rbactypes[] = $type;
437  }
438  }
439 
440  return $rbactypes ? $rbactypes : array();
441  }
442 
449  function getAllObjects()
450  {
451  return array_keys($this->obj_data);
452  }
453 
460  public function allowLink($a_obj_name)
461  {
462  return (bool) $this->obj_data[$a_obj_name]["allow_link"];
463  }
464 
471  public function allowCopy($a_obj_name)
472  {
473  return (bool) $this->obj_data[$a_obj_name]["allow_copy"];
474  }
475 
476  public function allowExport($a_obj_name)
477  {
478  return (bool) $this->obj_data[$a_obj_name]['export'];
479  }
480 
486  public function hasLocalRoles($a_obj_type)
487  {
488  switch($a_obj_type)
489  {
490  case 'root':
491  return FALSE;
492 
493  default:
494  return TRUE;
495  }
496  }
497 
506  function getSubObjects($a_obj_type,$a_filter = true)
507  {
508  global $ilSetting;
509 
510  $subs = array();
511 
512  if ($subobjects = $this->obj_data[$a_obj_type]["subobjects"])
513  {
514  // Filter some objects e.g chat object are creatable if chat is active
515  if ($a_filter)
516  {
517  $this->__filterObjects($subobjects);
518  }
519  foreach ($subobjects as $data => $sub)
520  {
521  if ($sub["module"] != "n")
522  {
523  if (!($ilSetting->get("obj_dis_creation_".$data)))
524  {
525  $subs[$data] = $sub;
526 
527  // determine position
528  $pos = ($ilSetting->get("obj_add_new_pos_".$data) > 0)
529  ? (int) $ilSetting->get("obj_add_new_pos_".$data)
530  : (int) $this->obj_data[$data]["default_pos"];
531  $subs[$data]["pos"] = $pos;
532  }
533  }
534  }
535 
536  $subs2 = ilUtil::sortArray($subs, "pos", ASC, true, true);
537 
538  return $subs2;
539  }
540 
541  return $subs;
542  }
543 
557  function getSubObjectsRecursively($a_obj_type,$a_include_source_obj = true, $a_add_admin_objects = false)
558  {
559  global $ilSetting;
560 
561  // This associative array is used to collect all subobject types.
562  // key=>type, value=data
563  $recursivesubs = array();
564 
565  // This array is used to keep track of the object types, we
566  // need to call function getSubobjects() for.
567  $to_do = array($a_obj_type);
568 
569  // This array is used to keep track of the object types, we
570  // have called function getSubobjects() already. This is to
571  // prevent endless loops, for object types that support
572  // themselves as subobject types either directly or indirectly.
573  $done = array();
574 
575  while (count($to_do) > 0)
576  {
577  $type = array_pop($to_do);
578  $done[] = $type;
579 
580  // no recovery folder subitems
581  if($type == 'recf')
582  {
583  continue;
584  }
585 
586  // Hide administration if desired
587  if(!$a_add_admin_objects and $type == 'adm')
588  {
589  $subs = array();
590  }
591  else
592  {
593  $subs = $this->getSubObjects($type);
594  }
595  #vd('xxxxxxxxxxxxx'.$type);
596  foreach ($subs as $subtype => $data)
597  {
598  #vd('------------------------->'.$subtype);
599 
600  // Hide role templates and folder from view
601  if($this->getDevMode($subtype) or !$this->isRBACObject($subtype))
602  {
603  continue;
604  }
605  if($subtype == 'rolt')
606  {
607  continue;
608  }
609  if(!$a_add_admin_objects and $subtype == 'adm')
610  {
611  continue;
612  }
613 
614  $recursivesubs[$subtype] = $data;
615  if (! in_array($subtype, $done)
616  && ! in_array($subtype, $to_do))
617  {
618  $to_do[] = $subtype;
619  }
620  }
621  }
622 
623  if($a_include_source_obj)
624  {
625  if(!isset($recursivesubs[$a_obj_type]))
626  {
627  $recursivesubs[$a_obj_type]['name'] = $a_obj_type;
628  $recursivesubs[$a_obj_type]['lng'] = $a_obj_type;
629  $recursivesubs[$a_obj_type]['max'] = 0;
630  $recursivesubs[$a_obj_type]['pos'] = -1;
631  }
632  }
633  return ilUtil::sortArray($recursivesubs, "pos", ASC, true, true);
634  }
635 
636 
646  function getSubobjectsToFilter($a_obj_type = "adm")
647  {
648  foreach($this->obj_data[$a_obj_type]["subobjects"] as $key => $value)
649  {
650  switch($key)
651  {
652  case "rolf":
653  // DO NOTHING
654  break;
655 
656  default:
657  $tmp_subs[] = $key;
658  }
659  }
660  // ADD adm and root object
661  $tmp_subs[] = "adm";
662  #$tmp_subs[] = "root";
663 
664  return $tmp_subs ? $tmp_subs : array();
665  }
666 
676  function getCreatableSubObjects($a_obj_type, $a_context = self::MODE_REPOSITORY, $a_parent_ref_id = null)
677  {
678  $subobjects = $this->getSubObjects($a_obj_type);
679 
680  // remove role folder object from list
681  unset($subobjects["rolf"]);
682 
683  $sub_types = array_keys($subobjects);
684 
685  // remove object types in development from list
686  foreach ($sub_types as $type)
687  {
688  if ($this->getDevMode($type) || $this->isSystemObject($type))
689  {
690  unset($subobjects[$type]);
691  }
692  if ($a_context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type))
693  {
694  unset($subobjects[$type]);
695  }
696  if ($a_context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type))
697  {
698  unset($subobjects[$type]);
699  }
700  if ($a_context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type))
701  {
702  unset($subobjects[$type]);
703  }
704  }
705 
706  if ($a_obj_type == "prg") {
707  // ask study program which objects are allowed to create on the concrete node.
708  require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
709  return ilObjStudyProgramme::getCreatableSubObjects($subobjects, $a_parent_ref_id);
710  }
711 
712  return $subobjects;
713  }
714 
721  function getSubObjectsAsString($a_obj_type)
722  {
723  $string = "";
724 
725  if (is_array($this->obj_data[$a_obj_type]["subobjects"]))
726  {
727  $data = array_keys($this->obj_data[$a_obj_type]["subobjects"]);
728 
729  $string = "'".implode("','", $data)."'";
730  }
731 
732  return $string;
733  }
734 
743  public function isContainer($a_obj_name)
744  {
745  if(!is_array($this->obj_data[$a_obj_name]['subobjects']))
746  {
747  return false;
748  }
749  return count($this->obj_data[$a_obj_name]['subobjects']) >= 1 ? true : false;
750  }
751 
752 // PRIVATE METHODS
753 
760  function setHandlers($a_xml_parser)
761  {
762  xml_set_object($a_xml_parser,$this);
763  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
764  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
765  }
766 
775  function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
776  {
777  switch ($a_name)
778  {
779  case 'object':
780  $this->parent_tag_name = $a_attribs["name"];
781  break;
782  case 'property':
783  $this->current_tag = "property";
784  $this->current_tag_name = $a_attribs["name"];
785 // $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["name"] = $a_attribs["name"];
786  $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $a_attribs["module"];
787 //echo '<br>$this->obj_data["'.$this->parent_tag_name.'"]["properties"]["'.$this->current_tag_name.'"]["module"] = "'.$a_attribs["module"].'";';
788  break;
789  }
790  }
791 
799  function handlerCharacterData($a_xml_parser,$a_data)
800  {
801  }
802 
810  function handlerEndTag($a_xml_parser,$a_name)
811  {
812  $this->current_tag = '';
813  $this->current_tag_name = '';
814  }
815 
816 
817  function __filterObjects(&$subobjects)
818  {
819  foreach($subobjects as $type => $data)
820  {
821  switch($type)
822  {
823  default:
824  // DO NOTHING
825  }
826  }
827  }
828 
842  function isSystemObject($a_obj_name)
843  {
844  return (bool) $this->obj_data[$a_obj_name]["system"];
845  }
846 
853  function isSideBlock($a_obj_name)
854  {
855  return (bool) $this->obj_data[$a_obj_name]["sideblock"];
856  }
857 
861  static function getRepositoryObjectTypesForComponent($a_component_type,
862  $a_component_name)
863  {
864  global $ilDB;
865 
866  $set = $ilDB->queryF("SELECT * FROM il_object_def WHERE component = %s",
867  array("text"), array($a_component_type."/".$a_component_name));
868 
869  $types = array();
870  while($rec = $ilDB->fetchAssoc($set))
871  {
872  if ($rec["system"] != 1)
873  {
874  $types[] = $rec;
875  }
876  }
877 
878  return $types;
879  }
880 
884  static function getComponentForType($a_obj_type)
885  {
886  global $ilDB;
887 
888  $set = $ilDB->queryF("SELECT component FROM il_object_def WHERE id = %s",
889  array("text"), array($a_obj_type));
890 
891  if ($rec = $ilDB->fetchAssoc($set))
892  {
893  return $rec["component"];
894  }
895 
896  return "";
897  }
898 
903  static function getGroupedRepositoryObjectTypes($a_parent_obj_type)
904  {
905  global $ilDB;
906 
907  $set = $ilDB->query("SELECT * FROM il_object_group");
908  $groups = array();
909  while ($gr_rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
910  {
911  $groups[$gr_rec["id"]] = $gr_rec;
912  }
913 
914  $global_cache = ilCachedComponentData::getInstance();
915 
916  $recs = $global_cache->lookupGroupedRepObj($a_parent_obj_type);
917 
918  $grouped_obj = array();
919  foreach((array)$recs as $rec)
920  {
921  if ($rec["grp"] != "")
922  {
923  $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
924  $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
925  }
926  else
927  {
928  $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
929  $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
930  }
931  }
932  // now get objects from repository plugin
933  $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_SERVICE, "Repository", "robj");
934  $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_MODULE, "OrgUnit", "orguext");
935 
936  $ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true);
937  return $ret;
938  }
939 
947  function isAllowedInRepository($a_obj_name)
948  {
949  return (bool) $this->obj_data[$a_obj_name]["repository"];
950  }
951 
958  function getAllRepositoryTypes($a_incl_adm = false)
959  {
960  $types = array_keys($this->obj_data);
961 
962  foreach ($types as $type)
963  {
964  if ($this->isAllowedInRepository($type) &&
965  (!$this->isAdministrationObject($type) || $a_incl_adm))
966  {
967  $rbactypes[] = $type;
968  }
969  }
970 
971  return $rbactypes ? $rbactypes : array();
972  }
973 
974 
982  function isAllowedInWorkspace($a_obj_name)
983  {
984  return (bool) $this->obj_data[$a_obj_name]["workspace"];
985  }
986 
992  public function isAdministrationObject($a_obj_name)
993  {
994  return (bool) $this->obj_data[$a_obj_name]['administration'];
995  }
996 
1003  public function isInactivePlugin($a_type)
1004  {
1005  if (substr($a_type, 0, 1) == "x" && !$this->isPlugin($a_type))
1006  {
1007  return true;
1008  }
1009  return false;
1010  }
1011 
1019  {
1020  $amet = array();
1021  foreach ($this->obj_data as $k => $v)
1022  {
1023  if ($v["amet"])
1024  {
1025  $amet[] = array("obj_type" => $k, "sub_type" => "");
1026  }
1027  }
1028 
1029  foreach ($this->sub_types as $type => $sub_types)
1030  {
1031  foreach ($sub_types as $t)
1032  {
1033  if ($t["amet"])
1034  {
1035  $amet[] = array("obj_type" => $type, "sub_type" => $t["sub_type"]);
1036  }
1037  }
1038  }
1039 
1040  return $amet;
1041  }
1042 
1050  {
1051  global $ilSetting;
1052 
1053  return ($ilSetting->get("obj_add_new_pos_".$a_type) > 0)
1054  ? (int) $ilSetting->get("obj_add_new_pos_".$a_type)
1055  : (int) $this->obj_data[$a_type]["default_pos"];
1056  }
1057 
1062  public function getPlugins()
1063  {
1064  $plugins = array();
1065  foreach((array) $this->obj_data as $type => $pl_data)
1066  {
1067  if($this->isPlugin($type))
1068  {
1069  $plugins[$type] = $pl_data;
1070  }
1071  }
1072  return $plugins;
1073  }
1074 
1080  public function getExplorerContainerTypes()
1081  {
1082  $res = $grp_map = $cnt_grp = array();
1083 
1084  // all repository object types
1085  foreach ($this->getSubObjectsRecursively("root") as $rtype)
1086  {
1087  $type = $rtype["name"];
1088 
1089  // obsolete
1090  if($type == "rolf")
1091  {
1092  continue;
1093  }
1094 
1095  // gather group data
1096  $type_grp = $this->getGroupOfObj($type);
1097  if($type_grp)
1098  {
1099  $grp_map[$type_grp][] = $type;
1100  }
1101 
1102  // add basic container types
1103  if($this->isContainer($type))
1104  {
1105  // add to cnt_grp
1106  if($type_grp)
1107  {
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  {
1118  $res = array_merge($res, $grp_map[$grp]);
1119  }
1120 
1121  // add very special case
1122  $res[] = "itgr";
1123 
1124  return array_unique($res);
1125  }
1126 
1132  protected function readPluginData() {
1133  $this->parsePluginData(IL_COMP_SERVICE, "Repository", "robj", false);
1134  $this->parsePluginData(IL_COMP_MODULE, "OrgUnit", "orguext", true);
1135  }
1136 
1144  protected function parsePluginData($component, $slotName, $slotId, $isInAdministration) {
1145  global $ilPluginAdmin;
1146  $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
1147  foreach ($pl_names as $pl_name) {
1148  include_once("./Services/Component/classes/class.ilPlugin.php");
1149  $pl_id = ilPlugin::lookupIdForName($component, $slotName, $slotId, $pl_name);
1150  if ($pl_id != "" && !isset($this->obj_data[$pl_id])) {
1151  include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
1152  $loc = ilPlugin::_getDirectory($component, $slotName, $slotId, $pl_name) . "/classes";
1153  // The plugin_id is the same as the type_id in repository object plugins.
1155 
1156  $this->obj_data[$pl_id] = array(
1157  "name" => $pl_id,
1158  "class_name" => $pl_name,
1159  "plugin" => "1",
1160  "location" => $loc,
1161  "checkbox" => "1",
1162  "inherit" => "0",
1163  "component" => "",
1164  "translate" => "0",
1165  "devmode" => "0",
1166  "allow_link" => "1",
1167  "allow_copy" => $pl->allowCopy() ? '1' : '0',
1168  "rbac" => "1",
1169  "group" => NULL,
1170  "system" => "0",
1171  "default_pos" => "99992000", // "unassigned" group
1172  'repository' => '1',
1173  'workspace' => '0',
1174  'administration' => $isInAdministration?'1':'0',
1175  "sideblock" => "0",
1176  'export' => $ilPluginAdmin->supportsExport($component, $slotName, $slotId, $pl_name)
1177  );
1178  $parent_types = $pl->getParentTypes();
1179  foreach($parent_types as $parent_type) {
1180  $this->obj_data[$parent_type]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
1181  }
1182  }
1183  }
1184  }
1185 
1186 }
1187 ?>
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
setHandlers($a_xml_parser)
set event handler
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
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
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
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 neceesary 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:93
parses the objects.xml it handles the xml-description of all ilias objects
static getRepositoryObjectTypesForComponent($a_component_type, $a_component_name)
Get all repository object types of component.
getAllRepositoryTypes($a_incl_adm=false)
get all RBAC object types
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
redirection script todo: (a better solution should control the processing via a xml file) ...
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 ...
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"...
global $ilDB
$ret
Definition: parser.php:6
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.
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.