ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjectDefinition Class Reference

parses the objects.xml it handles the xml-description of all ilias objects More...

+ Collaboration diagram for ilObjectDefinition:

Public Member Functions

 __construct ()
 
 readDefinitionData ()
 Read object definition data. More...
 
 getClassName (string $obj_name)
 
 getLocation (string $obj_name)
 
 getGroup (string $id)
 Get Group information. More...
 
 getGroupOfObj (string $obj_name)
 Get Group of object type. More...
 
 hasCheckbox (string $obj_name)
 should the object get a checkbox (needed for 'cut','copy' ...) More...
 
 getTranslationType (string $obj_name)
 get translation type (sys, db or null) More...
 
 stopInheritance (string $obj_name)
 Does object permits stopping inheritance? More...
 
 getDevMode (string $obj_name)
 get dev mode status by type More...
 
 getDevModeAll ()
 get all object types in dev mode More...
 
 isRBACObject (string $obj_name)
 get RBAC status by type returns true if object type is a RBAC object type More...
 
 isPlugin (string $obj_name)
 get RBAC status by type returns true if object type is an (activated) plugin type More...
 
 isPluginTypeName (string $str)
 Check if given type is a plugin type name (starts with an "x") More...
 
 isActivePluginType (string $type)
 Returns true if the given type is an active type of repositoryObject or Organisation Unit Extension plugin. More...
 
 getAllRBACObjects ()
 
 getAllObjects ()
 get all object types More...
 
 allowLink (string $obj_name)
 checks if linking of an object type is allowed More...
 
 allowCopy (string $obj_name)
 checks if copying of an object type is allowed More...
 
 allowExport (string $obj_name)
 
 hasLocalRoles (string $obj_type)
 Check whether the creation of local roles is allowed Currently disabled for type "root" and "adm". More...
 
 getSubObjects (string $obj_type, bool $filter=true)
 get all sub objects by type More...
 
 getSubObjectsRecursively (string $obj_type, bool $include_source_obj=true, bool $add_admin_objects=false)
 Get all sub objects by type. More...
 
 getSubobjectsToFilter (string $obj_type="adm")
 get all subjects except (rolf) of the adm object This is necessary for filtering these objects in role perm view. More...
 
 getCreatableSubObjects (string $obj_type, int $context=self::MODE_REPOSITORY, ?int $parent_ref_id=null)
 
 getSubObjectsAsString (string $obj_type)
 get a string of all sub objects by type More...
 
 isContainer (string $obj_name)
 Check if object type is container ('crs','fold','grp' ...) More...
 
 setHandlers ($xml_parser)
 
 handlerBeginTag ($xml_parser, string $name, array $attribs)
 
 handlerCharacterData ($xml_parser, string $data)
 
 handlerEndTag ($xml_parser, string $name)
 
 __filterObjects (array &$sub_objects)
 
 isSystemObject (string $obj_name)
 checks if object type is a system object More...
 
 isSideBlock (string $obj_name)
 Check, whether object type is a side block. More...
 
 getSideBlockTypes (bool $filter_repository_types=true)
 
 isAllowedInRepository (string $obj_name)
 checks if object type can be used in repository context More...
 
 getAllRepositoryTypes (bool $incl_adm=false)
 get all RBAC object types More...
 
 isAllowedInWorkspace (string $obj_name)
 checks if object type can be used in workspace context More...
 
 isAdministrationObject (string $obj_name)
 Check if administration object. More...
 
 isInactivePlugin (string $type)
 Check whether type belongs to inactive plugin. More...
 
 getAdvancedMetaDataTypes ()
 Get advanced meta data objects. More...
 
 getOrgUnitPermissionTypes ()
 Get object type with org unit position permission support. More...
 
 getLTIProviderTypes ()
 Get object types which offer lti provider support. More...
 
 isOrgUnitPermissionType (string $obj_type)
 Check if object type offers org unit position support. More...
 
 getPositionByType (string $type)
 Get Position By Object Type. More...
 
 getPlugins ()
 Get plugin object info. More...
 
 getExplorerContainerTypes ()
 Get all object types which are defined as container in an explorer context. More...
 
 supportsOfflineHandling (string $obj_type)
 check whether obj_type supports centralised offline handling More...
 

Static Public Member Functions

static getRepositoryObjectTypesForComponent (string $component_type, string $component_name)
 Get all repository object types of component. More...
 
static getComponentForType (string $obj_type)
 Get component for object type. More...
 
static getGroupedRepositoryObjectTypes ($parent_obj_type)
 

Data Fields

const MODE_REPOSITORY = 1
 
const MODE_WORKSPACE = 2
 
const MODE_ADMINISTRATION = 3
 

Protected Member Functions

 readPluginData ()
 Loads the different plugins into the object definition. More...
 
 parsePluginData (string $slotId, bool $isInAdministration)
 loads a single plugin definition into the object definition More...
 

Static Protected Member Functions

static getGroupedPluginObjectTypes (array $grouped_obj, string $slotId)
 

Protected Attributes

ilSetting $settings
 
ilComponentRepository $component_repository
 
array $obj_data = []
 
array $obj_group = []
 
array $sub_types = []
 
string $parent_tag_name
 
string $current_tag
 
string $current_tag_name
 
string $root_trans_type = null
 

Detailed Description

parses the objects.xml it handles the xml-description of all ilias objects

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e ilObjDefReader on il_object_def, il_object_subobj, il_object_group

Definition at line 28 of file class.ilObjectDefinition.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectDefinition::__construct ( )

Definition at line 45 of file class.ilObjectDefinition.php.

References $DIC, readDefinitionData(), and ILIAS\Repository\settings().

46  {
47  global $DIC;
48 
49  $this->component_repository = $DIC["component.repository"];
50  $this->settings = $DIC->settings();
51  $this->readDefinitionData();
52  }
readDefinitionData()
Read object definition data.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ __filterObjects()

ilObjectDefinition::__filterObjects ( array &  $sub_objects)

Definition at line 542 of file class.ilObjectDefinition.php.

Referenced by getSubObjects().

542  : void
543  {
544  // DO NOTHING
545  }
+ Here is the caller graph for this function:

◆ allowCopy()

ilObjectDefinition::allowCopy ( string  $obj_name)

checks if copying of an object type is allowed

Definition at line 301 of file class.ilObjectDefinition.php.

301  : bool
302  {
303  return (bool) $this->obj_data[$obj_name]["allow_copy"];
304  }

◆ allowExport()

ilObjectDefinition::allowExport ( string  $obj_name)

Definition at line 306 of file class.ilObjectDefinition.php.

Referenced by ilExportOptions\addOptions().

306  : bool
307  {
308  return (bool) $this->obj_data[$obj_name]['export'];
309  }
+ Here is the caller graph for this function:

◆ allowLink()

ilObjectDefinition::allowLink ( string  $obj_name)

checks if linking of an object type is allowed

Definition at line 293 of file class.ilObjectDefinition.php.

293  : bool
294  {
295  return (bool) $this->obj_data[$obj_name]["allow_link"];
296  }

◆ getAdvancedMetaDataTypes()

ilObjectDefinition::getAdvancedMetaDataTypes ( )

Get advanced meta data objects.

Definition at line 726 of file class.ilObjectDefinition.php.

726  : array
727  {
728  $amet = [];
729  foreach ($this->obj_data as $k => $v) {
730  if ($v["amet"] ?? false) {
731  $amet[] = ["obj_type" => $k, "sub_type" => ""];
732  }
733  }
734 
735  foreach ($this->sub_types as $type => $sub_types) {
736  foreach ($sub_types as $t) {
737  if ($t["amet"]) {
738  $amet[] = ["obj_type" => $type, "sub_type" => $t["sub_type"]];
739  }
740  }
741  }
742 
743  return $amet;
744  }

◆ getAllObjects()

ilObjectDefinition::getAllObjects ( )

get all object types

Definition at line 285 of file class.ilObjectDefinition.php.

Referenced by ilAbstractSearch\getValidObjectTypes().

285  : array
286  {
287  return array_keys($this->obj_data);
288  }
+ Here is the caller graph for this function:

◆ getAllRBACObjects()

ilObjectDefinition::getAllRBACObjects ( )

Definition at line 268 of file class.ilObjectDefinition.php.

References isRBACObject().

268  : array
269  {
270  $types = array_keys($this->obj_data);
271 
272  $rbac_types = [];
273  foreach ($types as $type) {
274  if ($this->isRBACObject($type)) {
275  $rbac_types[] = $type;
276  }
277  }
278 
279  return $rbac_types;
280  }
isRBACObject(string $obj_name)
get RBAC status by type returns true if object type is a RBAC object type
+ Here is the call graph for this function:

◆ getAllRepositoryTypes()

ilObjectDefinition::getAllRepositoryTypes ( bool  $incl_adm = false)

get all RBAC object types

Definition at line 682 of file class.ilObjectDefinition.php.

References isAdministrationObject(), and isAllowedInRepository().

682  : array
683  {
684  $types = array_keys($this->obj_data);
685 
686  $rbac_types = [];
687  foreach ($types as $type) {
688  if ($this->isAllowedInRepository($type) && (!$this->isAdministrationObject($type) || $incl_adm)) {
689  $rbac_types[] = $type;
690  }
691  }
692 
693  return $rbac_types;
694  }
isAdministrationObject(string $obj_name)
Check if administration object.
isAllowedInRepository(string $obj_name)
checks if object type can be used in repository context
+ Here is the call graph for this function:

◆ getClassName()

ilObjectDefinition::getClassName ( string  $obj_name)

◆ getComponentForType()

static ilObjectDefinition::getComponentForType ( string  $obj_type)
static

Get component for object type.

Definition at line 622 of file class.ilObjectDefinition.php.

References $DIC, and $ilDB.

622  : string
623  {
624  global $DIC;
625  $ilDB = $DIC->database();
626 
627  $result = $ilDB->queryF("SELECT component FROM il_object_def WHERE id = %s", ["text"], [$obj_type]);
628 
629  if ($rec = $ilDB->fetchAssoc($result)) {
630  return $rec["component"];
631  }
632 
633  return "";
634  }
global $DIC
Definition: shib_login.php:22

◆ getCreatableSubObjects()

ilObjectDefinition::getCreatableSubObjects ( string  $obj_type,
int  $context = self::MODE_REPOSITORY,
?int  $parent_ref_id = null 
)

Definition at line 454 of file class.ilObjectDefinition.php.

References $context, ilObjStudyProgramme\getCreatableSubObjects(), getDevMode(), getSubObjects(), isAdministrationObject(), isAllowedInRepository(), isAllowedInWorkspace(), and isSystemObject().

458  : array {
459  $sub_objects = $this->getSubObjects($obj_type);
460 
461  // remove role folder object from list
462  unset($sub_objects["rolf"]);
463 
464  $sub_types = array_keys($sub_objects);
465 
466  // remove object types in development from list
467  foreach ($sub_types as $type) {
468  if ($this->getDevMode($type) || $this->isSystemObject($type)) {
469  unset($sub_objects[$type]);
470  }
471  if ($context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type)) {
472  unset($sub_objects[$type]);
473  }
474  if ($context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type)) {
475  unset($sub_objects[$type]);
476  }
477  if ($context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type)) {
478  unset($sub_objects[$type]);
479  }
480  }
481 
482  if ($obj_type == "prg") {
483  // ask study program which objects are allowed to create on the concrete node.
484  return ilObjStudyProgramme::getCreatableSubObjects($sub_objects, $parent_ref_id);
485  }
486 
487  return $sub_objects;
488  }
getSubObjects(string $obj_type, bool $filter=true)
get all sub objects by type
$context
Definition: webdav.php:31
isSystemObject(string $obj_name)
checks if object type is a system object
isAdministrationObject(string $obj_name)
Check if administration object.
static getCreatableSubObjects(array $subobjects, $ref_id)
Filter the list of possible subobjects for the objects that actually could be created on a concrete n...
isAllowedInWorkspace(string $obj_name)
checks if object type can be used in workspace context
getDevMode(string $obj_name)
get dev mode status by type
isAllowedInRepository(string $obj_name)
checks if object type can be used in repository context
+ Here is the call graph for this function:

◆ getDevMode()

ilObjectDefinition::getDevMode ( string  $obj_name)

get dev mode status by type

Definition at line 206 of file class.ilObjectDefinition.php.

Referenced by getCreatableSubObjects(), getDevModeAll(), and getSubObjectsRecursively().

206  : bool
207  {
208  return (bool) ($this->obj_data[$obj_name]["devmode"] ?? false);
209  }
+ Here is the caller graph for this function:

◆ getDevModeAll()

ilObjectDefinition::getDevModeAll ( )

get all object types in dev mode

Returns
array object types set to development

Definition at line 216 of file class.ilObjectDefinition.php.

References getDevMode().

216  : array
217  {
218  $types = array_keys($this->obj_data);
219 
220  $dev_types = [];
221  foreach ($types as $type) {
222  if ($this->getDevMode($type)) {
223  $dev_types[] = $type;
224  }
225  }
226 
227  return $dev_types;
228  }
getDevMode(string $obj_name)
get dev mode status by type
+ Here is the call graph for this function:

◆ getExplorerContainerTypes()

ilObjectDefinition::getExplorerContainerTypes ( )

Get all object types which are defined as container in an explorer context.

Definition at line 813 of file class.ilObjectDefinition.php.

References $res, getGroupOfObj(), getSubObjectsRecursively(), and isContainer().

813  : array
814  {
815  $res = $grp_map = $cnt_grp = [];
816 
817  // all repository object types
818  foreach ($this->getSubObjectsRecursively("root") as $rtype) {
819  $type = $rtype["name"];
820 
821  if ($type == "rolf") {
822  continue;
823  }
824 
825  // gather group data
826  $type_grp = $this->getGroupOfObj($type);
827  if ($type_grp) {
828  $grp_map[$type_grp][] = $type;
829  }
830 
831  // add basic container types
832  if ($this->isContainer($type)) {
833  if ($type_grp) {
834  $cnt_grp[] = $type_grp;
835  }
836 
837  $res[] = $type;
838  }
839  }
840 
841  // add complete groups (cat => rcat, catr; crs => rcrs, crsr; ...)
842  foreach ($cnt_grp as $grp) {
843  $res = array_merge($res, $grp_map[$grp]);
844  }
845  $res[] = "itgr";
846 
847  return array_unique($res);
848  }
$res
Definition: ltiservices.php:66
isContainer(string $obj_name)
Check if object type is container ('crs','fold','grp' ...)
getGroupOfObj(string $obj_name)
Get Group of object type.
getSubObjectsRecursively(string $obj_type, bool $include_source_obj=true, bool $add_admin_objects=false)
Get all sub objects by type.
+ Here is the call graph for this function:

◆ getGroup()

ilObjectDefinition::getGroup ( string  $id)

Get Group information.

Definition at line 141 of file class.ilObjectDefinition.php.

References $id.

141  : array
142  {
143  return $this->obj_group[$id];
144  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getGroupedPluginObjectTypes()

static ilObjectDefinition::getGroupedPluginObjectTypes ( array  $grouped_obj,
string  $slotId 
)
staticprotected

Definition at line 110 of file class.ilObjectDefinition.php.

References $DIC, XapiProxy\$plugin, and ilComponentRepository\getPluginSlotById().

110  : array
111  {
112  global $DIC;
113 
114  $component_repository = $DIC["component.repository"];
115  $plugins = $component_repository->getPluginSlotById($slotId)->getActivePlugins();
116  foreach ($plugins as $plugin) {
117  $pl_id = $plugin->getId();
118  if (!isset($grouped_obj[$pl_id])) {
119  $grouped_obj[$pl_id] = [
120  "pos" => "99992000", // "unassigned" group
121  "objs" => [0 => $pl_id]
122  ];
123  }
124  }
125  return $grouped_obj;
126  }
ilComponentRepository $component_repository
getPluginSlotById(string $id)
Get pluginslot by id.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getGroupedRepositoryObjectTypes()

static ilObjectDefinition::getGroupedRepositoryObjectTypes (   $parent_obj_type)
static
Parameters
mixed$parent_obj_type

Definition at line 639 of file class.ilObjectDefinition.php.

References $DIC, $ilDB, ilDBConstants\FETCHMODE_ASSOC, ilCachedObjectDefinition\getInstance(), ILIAS\Repository\int(), and ilArrayUtil\sortArray().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemBlock\ItemBlockSequenceGenerator\getGroupedObjTypes().

639  : array
640  {
641  global $DIC;
642  $ilDB = $DIC->database();
643 
644  $set = $ilDB->query("SELECT * FROM il_object_group");
645  $groups = [];
646  while ($gr_rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
647  $groups[$gr_rec["id"]] = $gr_rec;
648  }
649 
650  $global_cache = ilCachedObjectDefinition::getInstance();
651 
652  $recs = $global_cache->lookupGroupedRepObj($parent_obj_type);
653 
654  $grouped_obj = [];
655  foreach ((array) $recs as $rec) {
656  if ($rec["grp"] != "") {
657  $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
658  $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
659  } else {
660  $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
661  $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
662  }
663  }
664  // now get objects from repository plugin
665  $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, "robj");
666  $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, "orguext");
667 
668  return ilArrayUtil::sortArray($grouped_obj, "pos", "asc", true, true);
669  }
global $DIC
Definition: shib_login.php:22
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroupOfObj()

ilObjectDefinition::getGroupOfObj ( string  $obj_name)

Get Group of object type.

Definition at line 149 of file class.ilObjectDefinition.php.

References null.

Referenced by getExplorerContainerTypes(), and ilAbstractSearch\getValidObjectTypes().

149  : ?string
150  {
151  return $this->obj_data[$obj_name]["group"] ?? null;
152  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getLocation()

ilObjectDefinition::getLocation ( string  $obj_name)

Definition at line 133 of file class.ilObjectDefinition.php.

Referenced by ilConditionHandler\_checkCondition(), ilContainer\getCompleteDescriptions(), and ilConditionHandler\getOperatorsByTriggerType().

133  : string
134  {
135  return $this->obj_data[$obj_name]["location"] ?? '';
136  }
+ Here is the caller graph for this function:

◆ getLTIProviderTypes()

ilObjectDefinition::getLTIProviderTypes ( )

Get object types which offer lti provider support.

Returns
string[] $types

Definition at line 766 of file class.ilObjectDefinition.php.

766  : array
767  {
768  $types = [];
769  foreach ($this->obj_data as $type => $object_info) {
770  if (array_key_exists('lti_provider', $object_info) && $object_info['lti_provider']) {
771  $types[] = $type;
772  }
773  }
774  return $types;
775  }

◆ getOrgUnitPermissionTypes()

ilObjectDefinition::getOrgUnitPermissionTypes ( )

Get object type with org unit position permission support.

Returns
string[] $types

Definition at line 751 of file class.ilObjectDefinition.php.

Referenced by isOrgUnitPermissionType().

751  : array
752  {
753  $types = [];
754  foreach ($this->obj_data as $type => $object_info) {
755  if ($object_info['orgunit_permissions']) {
756  $types[] = $type;
757  }
758  }
759  return $types;
760  }
+ Here is the caller graph for this function:

◆ getPlugins()

ilObjectDefinition::getPlugins ( )

Get plugin object info.

Definition at line 799 of file class.ilObjectDefinition.php.

References isPlugin().

799  : array
800  {
801  $plugins = [];
802  foreach ($this->obj_data as $type => $pl_data) {
803  if ($this->isPlugin($type)) {
804  $plugins[$type] = $pl_data;
805  }
806  }
807  return $plugins;
808  }
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type ...
+ Here is the call graph for this function:

◆ getPositionByType()

ilObjectDefinition::getPositionByType ( string  $type)

Get Position By Object Type.

Definition at line 788 of file class.ilObjectDefinition.php.

References ILIAS\Repository\settings().

788  : int
789  {
790  if ($this->settings->get("obj_add_new_pos_" . $type) > 0) {
791  return (int) $this->settings->get("obj_add_new_pos_" . $type);
792  }
793  return (int) $this->obj_data[$type]["default_pos"];
794  }
+ Here is the call graph for this function:

◆ getRepositoryObjectTypesForComponent()

static ilObjectDefinition::getRepositoryObjectTypesForComponent ( string  $component_type,
string  $component_name 
)
static

Get all repository object types of component.

This is only every called with $a_component_type = "components/ILIAS". This is only used in two locations:

  • Services/Repository/Administration/class.ilModulesTableGUI.php
  • Services/Repository/Administration/class.ilObjRepositorySettings.php

Definition at line 595 of file class.ilObjectDefinition.php.

References $DIC, and $ilDB.

595  : array
596  {
597  global $DIC;
598  $ilDB = $DIC->database();
599 
600  $sql =
601  "SELECT id, class_name, component, location, checkbox, inherit, translate, devmode, allow_link," . PHP_EOL
602  . "allow_copy, rbac, `system`, sideblock, default_pos, grp, default_pres_pos, `export`, repository," . PHP_EOL
603  . "workspace, administration, amet, orgunit_permissions, lti_provider, offline_handling" . PHP_EOL
604  . "FROM il_object_def" . PHP_EOL
605  . "WHERE component = %s" . PHP_EOL
606  ;
607  $result = $ilDB->queryF($sql, ["text"], [$component_type . "/" . $component_name]);
608 
609  $types = [];
610  while ($rec = $ilDB->fetchAssoc($result)) {
611  if ($rec["system"] != 1) {
612  $types[] = $rec;
613  }
614  }
615 
616  return $types;
617  }
global $DIC
Definition: shib_login.php:22

◆ getSideBlockTypes()

ilObjectDefinition::getSideBlockTypes ( bool  $filter_repository_types = true)

Definition at line 570 of file class.ilObjectDefinition.php.

References isAllowedInRepository(), and isSideBlock().

570  : array
571  {
572  $side_block_types = [];
573  foreach (array_keys($this->obj_data) as $type) {
574  if (
575  $filter_repository_types &&
576  !$this->isAllowedInRepository($type)
577  ) {
578  continue;
579  }
580  if ($this->isSideBlock($type)) {
581  $side_block_types[] = $type;
582  }
583  }
584  return $side_block_types;
585  }
isAllowedInRepository(string $obj_name)
checks if object type can be used in repository context
isSideBlock(string $obj_name)
Check, whether object type is a side block.
+ Here is the call graph for this function:

◆ getSubObjects()

ilObjectDefinition::getSubObjects ( string  $obj_type,
bool  $filter = true 
)

get all sub objects by type

Definition at line 329 of file class.ilObjectDefinition.php.

References $data, __filterObjects(), ILIAS\Repository\int(), ILIAS\Repository\settings(), and ilArrayUtil\sortArray().

Referenced by getCreatableSubObjects(), and getSubObjectsRecursively().

329  : array
330  {
331  $subs = [];
332  if ($subobjects = ($this->obj_data[$obj_type]["subobjects"] ?? false)) {
333  // Filter some objects e.g. chat object are creatable if chat is active
334  if ($filter) {
335  $this->__filterObjects($subobjects);
336  }
337  foreach ($subobjects as $data => $sub) {
338  if (!isset($sub["module"]) || $sub["module"] != "n") {
339  if (!($this->settings->get("obj_dis_creation_" . $data))) {
340  $subs[$data] = $sub;
341 
342  // determine position
343  $pos = (int) $this->obj_data[$data]["default_pos"];
344  if ($this->settings->get("obj_add_new_pos_" . $data) > 0) {
345  $pos = (int) $this->settings->get("obj_add_new_pos_" . $data);
346  }
347  $subs[$data]["pos"] = $pos;
348  }
349  }
350  }
351 
352  return ilArrayUtil::sortArray($subs, "pos", 'ASC', true, true);
353  }
354 
355  return $subs;
356  }
__filterObjects(array &$sub_objects)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubObjectsAsString()

ilObjectDefinition::getSubObjectsAsString ( string  $obj_type)

get a string of all sub objects by type

Definition at line 493 of file class.ilObjectDefinition.php.

References $data.

493  : string
494  {
495  $string = "";
496  if (is_array($this->obj_data[$obj_type]["subobjects"])) {
497  $data = array_keys($this->obj_data[$obj_type]["subobjects"]);
498  $string = "'" . implode("','", $data) . "'";
499  }
500 
501  return $string;
502  }

◆ getSubObjectsRecursively()

ilObjectDefinition::getSubObjectsRecursively ( string  $obj_type,
bool  $include_source_obj = true,
bool  $add_admin_objects = false 
)

Get all sub objects by type.

This function returns all sub objects allowed by the provided object type and all its sub object types recursively.

This function is used to create local role templates. It is important, that we do not filter out any objects here!

Definition at line 366 of file class.ilObjectDefinition.php.

References $data, getDevMode(), getSubObjects(), isRBACObject(), and ilArrayUtil\sortArray().

Referenced by ilObject\getAllOwnedRepositoryObjects(), and getExplorerContainerTypes().

370  : array {
371  // This associative array is used to collect all sub object types.
372  // key=>type, value=data
373  $recursive_subs = [];
374 
375  // This array is used to keep track of the object types, we
376  // need to call function getSubobjects() for.
377  $to_do = [$obj_type];
378 
379  // This array is used to keep track of the object types, we
380  // have called function getSubobjects() already. This is to
381  // prevent endless loops, for object types that support
382  // themselves as subobject types either directly or indirectly.
383  $done = [];
384 
385  while (count($to_do) > 0) {
386  $type = array_pop($to_do);
387  $done[] = $type;
388 
389  // no recovery folder subitems
390  if ($type == 'recf') {
391  continue;
392  }
393 
394  // Hide administration if desired
395  if (!$add_admin_objects and $type == 'adm') {
396  $subs = [];
397  } else {
398  $subs = $this->getSubObjects($type);
399  }
400  foreach ($subs as $subtype => $data) {
401  // Hide role templates and folder from view
402  if ($this->getDevMode($subtype) or !$this->isRBACObject($subtype)) {
403  continue;
404  }
405  if ($subtype == 'rolt') {
406  continue;
407  }
408  if (!$add_admin_objects and $subtype == 'adm') {
409  continue;
410  }
411 
412  $recursive_subs[$subtype] = $data;
413  if (!in_array($subtype, $done) && !in_array($subtype, $to_do)) {
414  $to_do[] = $subtype;
415  }
416  }
417  }
418 
419  if ($include_source_obj) {
420  if (!isset($recursive_subs[$obj_type])) {
421  $recursive_subs[$obj_type]['name'] = $obj_type;
422  $recursive_subs[$obj_type]['lng'] = $obj_type;
423  $recursive_subs[$obj_type]['max'] = 0;
424  $recursive_subs[$obj_type]['pos'] = -1;
425  }
426  }
427  return ilArrayUtil::sortArray($recursive_subs, "pos", 'ASC', true, true);
428  }
getSubObjects(string $obj_type, bool $filter=true)
get all sub objects by type
isRBACObject(string $obj_name)
get RBAC status by type returns true if object type is a RBAC object type
getDevMode(string $obj_name)
get dev mode status by type
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubobjectsToFilter()

ilObjectDefinition::getSubobjectsToFilter ( string  $obj_type = "adm")

get all subjects except (rolf) of the adm object This is necessary for filtering these objects in role perm view.

e.g. it is not necessary to view/edit role permission for the usr object since it's not possible to create a new one

Definition at line 436 of file class.ilObjectDefinition.php.

436  : array
437  {
438  foreach ($this->obj_data[$obj_type]["subobjects"] as $key => $value) {
439  switch ($key) {
440  case "rolf":
441  case "orgu":
442  // DO NOTHING
443  break;
444 
445  default:
446  $tmp_subs[] = $key;
447  }
448  }
449  $tmp_subs[] = "adm";
450 
451  return $tmp_subs;
452  }

◆ getTranslationType()

ilObjectDefinition::getTranslationType ( string  $obj_name)

get translation type (sys, db or null)

Definition at line 165 of file class.ilObjectDefinition.php.

References $DIC, $ilDB, $root_trans_type, ilDBConstants\FETCHMODE_ASSOC, and ROOT_FOLDER_ID.

165  : ?string
166  {
167  global $DIC;
168  $ilDB = $DIC->database();
169 
170  if ($obj_name == "root") {
171  if (!isset($this->root_trans_type)) {
172  $sql =
173  "SELECT count(obj_id) cnt" . PHP_EOL
174  . "FROM object_translation" . PHP_EOL
175  . "WHERE obj_id = " . $ilDB->quote(ROOT_FOLDER_ID, 'integer') . PHP_EOL
176  ;
177  $set = $ilDB->query($sql);
178  $rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
179  if ($rec["cnt"] > 0) {
180  $this->root_trans_type = "db";
181  } else {
182  $this->root_trans_type = $this->obj_data[$obj_name]["translate"];
183  }
184  }
185  return $this->root_trans_type;
186  }
187 
188  if (isset($this->obj_data[$obj_name])) {
189  return $this->obj_data[$obj_name]["translate"];
190  }
191 
192  return "";
193  }
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: shib_login.php:22

◆ handlerBeginTag()

ilObjectDefinition::handlerBeginTag (   $xml_parser,
string  $name,
array  $attribs 
)

Definition at line 518 of file class.ilObjectDefinition.php.

References $current_tag_name, and $parent_tag_name.

Referenced by setHandlers().

518  : void
519  {
520  switch ($name) {
521  case 'object':
522  $this->parent_tag_name = $attribs["name"];
523  break;
524  case 'property':
525  $this->current_tag = "property";
526  $this->current_tag_name = $attribs["name"];
527  $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $attribs["module"];
528  break;
529  }
530  }
+ Here is the caller graph for this function:

◆ handlerCharacterData()

ilObjectDefinition::handlerCharacterData (   $xml_parser,
string  $data 
)

Definition at line 532 of file class.ilObjectDefinition.php.

Referenced by setHandlers().

532  : void
533  {
534  }
+ Here is the caller graph for this function:

◆ handlerEndTag()

ilObjectDefinition::handlerEndTag (   $xml_parser,
string  $name 
)

Definition at line 536 of file class.ilObjectDefinition.php.

Referenced by setHandlers().

536  : void
537  {
538  $this->current_tag = '';
539  $this->current_tag_name = '';
540  }
+ Here is the caller graph for this function:

◆ hasCheckbox()

ilObjectDefinition::hasCheckbox ( string  $obj_name)

should the object get a checkbox (needed for 'cut','copy' ...)

Definition at line 157 of file class.ilObjectDefinition.php.

157  : bool
158  {
159  return (bool) ($this->obj_data[$obj_name]["checkbox"] ?? false);
160  }

◆ hasLocalRoles()

ilObjectDefinition::hasLocalRoles ( string  $obj_type)

Check whether the creation of local roles is allowed Currently disabled for type "root" and "adm".

Definition at line 315 of file class.ilObjectDefinition.php.

315  : bool
316  {
317  switch ($obj_type) {
318  case 'root':
319  return false;
320 
321  default:
322  return true;
323  }
324  }

◆ isActivePluginType()

ilObjectDefinition::isActivePluginType ( string  $type)

Returns true if the given type is an active type of repositoryObject or Organisation Unit Extension plugin.

Definition at line 259 of file class.ilObjectDefinition.php.

259  : bool
260  {
261  if (!$this->component_repository->hasPluginId($type)) {
262  return false;
263  }
264  $plugin_slot = $this->component_repository->getPluginById($type)->getPluginSlot();
265  return $plugin_slot->getId() === "robj" || $plugin_slot->getId() === "orguext";
266  }

◆ isAdministrationObject()

ilObjectDefinition::isAdministrationObject ( string  $obj_name)

Check if administration object.

Definition at line 707 of file class.ilObjectDefinition.php.

Referenced by getAllRepositoryTypes(), getCreatableSubObjects(), and ilAbstractSearch\getValidObjectTypes().

707  : bool
708  {
709  return (bool) ($this->obj_data[$obj_name]['administration'] ?? false);
710  }
+ Here is the caller graph for this function:

◆ isAllowedInRepository()

ilObjectDefinition::isAllowedInRepository ( string  $obj_name)

checks if object type can be used in repository context

Definition at line 674 of file class.ilObjectDefinition.php.

Referenced by getAllRepositoryTypes(), getCreatableSubObjects(), getSideBlockTypes(), and ilAbstractSearch\getValidObjectTypes().

674  : bool
675  {
676  return (bool) ($this->obj_data[$obj_name]["repository"] ?? false);
677  }
+ Here is the caller graph for this function:

◆ isAllowedInWorkspace()

ilObjectDefinition::isAllowedInWorkspace ( string  $obj_name)

checks if object type can be used in workspace context

Definition at line 699 of file class.ilObjectDefinition.php.

Referenced by getCreatableSubObjects().

699  : bool
700  {
701  return (bool) ($this->obj_data[$obj_name]["workspace"] ?? false);
702  }
+ Here is the caller graph for this function:

◆ isContainer()

ilObjectDefinition::isContainer ( string  $obj_name)

Check if object type is container ('crs','fold','grp' ...)

Definition at line 507 of file class.ilObjectDefinition.php.

Referenced by getExplorerContainerTypes(), and ilDidacticTemplateSetting\hasIconSupport().

507  : bool
508  {
509  return (bool) ($this->obj_data[$obj_name]['subobjects'] ?? false);
510  }
+ Here is the caller graph for this function:

◆ isInactivePlugin()

ilObjectDefinition::isInactivePlugin ( string  $type)

Check whether type belongs to inactive plugin.

Definition at line 715 of file class.ilObjectDefinition.php.

References isPlugin().

715  : bool
716  {
717  if (substr($type, 0, 1) == "x" && !$this->isPlugin($type)) {
718  return true;
719  }
720  return false;
721  }
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type ...
+ Here is the call graph for this function:

◆ isOrgUnitPermissionType()

ilObjectDefinition::isOrgUnitPermissionType ( string  $obj_type)

Check if object type offers org unit position support.

Definition at line 780 of file class.ilObjectDefinition.php.

References getOrgUnitPermissionTypes().

780  : bool
781  {
782  return in_array($obj_type, $this->getOrgUnitPermissionTypes());
783  }
getOrgUnitPermissionTypes()
Get object type with org unit position permission support.
+ Here is the call graph for this function:

◆ isPlugin()

ilObjectDefinition::isPlugin ( string  $obj_name)

get RBAC status by type returns true if object type is an (activated) plugin type

Definition at line 243 of file class.ilObjectDefinition.php.

Referenced by ilObject\_prepareCloneSelection(), ilAdministrationGUI\executeCommand(), ilNewsForContextBlockGUI\getInfoForData(), getPlugins(), and isInactivePlugin().

243  : bool
244  {
245  return isset($this->obj_data[$obj_name]["plugin"]);
246  }
+ Here is the caller graph for this function:

◆ isPluginTypeName()

ilObjectDefinition::isPluginTypeName ( string  $str)

Check if given type is a plugin type name (starts with an "x")

Definition at line 251 of file class.ilObjectDefinition.php.

251  : bool
252  {
253  return (substr($str, 0, 1) == "x");
254  }

◆ isRBACObject()

ilObjectDefinition::isRBACObject ( string  $obj_name)

get RBAC status by type returns true if object type is a RBAC object type

Definition at line 234 of file class.ilObjectDefinition.php.

Referenced by ilObject\_writeDescription(), getAllRBACObjects(), getSubObjectsRecursively(), and ilAbstractSearch\getValidObjectTypes().

234  : bool
235  {
236  return (bool) ($this->obj_data[$obj_name]["rbac"] ?? false);
237  }
+ Here is the caller graph for this function:

◆ isSideBlock()

ilObjectDefinition::isSideBlock ( string  $obj_name)

Check, whether object type is a side block.

Definition at line 565 of file class.ilObjectDefinition.php.

Referenced by ilSessionMaterialsTableGUI\getDataFromDb(), getSideBlockTypes(), and ilAbstractSearch\getValidObjectTypes().

565  : bool
566  {
567  return (bool) ($this->obj_data[$obj_name]["sideblock"] ?? false);
568  }
+ Here is the caller graph for this function:

◆ isSystemObject()

ilObjectDefinition::isSystemObject ( string  $obj_name)

checks if object type is a system object

system objects are those object types that are only used for internal purposes and to keep the object type model consistent. Typically, they are used in the administration, exist only once and may contain only specific object types. To mark an object type as a system object type, use 'system=1' in the object definition in objects.xml

Definition at line 557 of file class.ilObjectDefinition.php.

Referenced by getCreatableSubObjects(), and ilAbstractSearch\getValidObjectTypes().

557  : bool
558  {
559  return (bool) ($this->obj_data[$obj_name]["system"] ?? false);
560  }
+ Here is the caller graph for this function:

◆ parsePluginData()

ilObjectDefinition::parsePluginData ( string  $slotId,
bool  $isInAdministration 
)
protected

loads a single plugin definition into the object definition

Parameters
$slotIdstring slot id, e.g. robj
$isInAdministrationbool can the object be created in the administration?

Definition at line 874 of file class.ilObjectDefinition.php.

References XapiProxy\$plugin, ilObjectPlugin\getPluginObjectByType(), and null.

Referenced by readPluginData().

874  : void
875  {
876  $plugins = $this->component_repository->getPluginSlotById($slotId)->getActivePlugins();
877  foreach ($plugins as $plugin) {
878  $pl_id = $plugin->getId();
879  if ($pl_id != "" && !isset($this->obj_data[$pl_id])) {
880  $loc = $plugin->getPath() . "/classes";
881  // The plugin_id is the same as the type_id in repository object plugins.
883 
884  $this->obj_data[$pl_id] = [
885  "name" => $pl_id,
886  "class_name" => $pl->getPluginName(),
887  "plugin" => "1",
888  "location" => $loc,
889  "checkbox" => "1",
890  "inherit" => "0",
891  "component" => "",
892  "translate" => "0",
893  "devmode" => "0",
894  "allow_link" => "1",
895  "allow_copy" => $pl->allowCopy() ? '1' : '0',
896  "rbac" => "1",
897  "group" => null,
898  "system" => "0",
899  "default_pos" => "99992000", // "unassigned" group
900  'repository' => '1',
901  'workspace' => '0',
902  'administration' => $isInAdministration ? '1' : '0',
903  "sideblock" => "0",
904  'export' => $plugin->supportsExport(),
905  'offline_handling' => '0',
906  'orgunit_permissions' => $pl->useOrguPermissions() ? '1' : '0'
907  ];
908 
909  $parent_types = $pl->getParentTypes();
910  foreach ($parent_types as $parent_type) {
911  $this->obj_data[$parent_type]["subobjects"][$pl_id] = [
912  "name" => $pl_id,
913  "max" => "",
914  "lng" => $pl_id,
915  "plugin" => true
916  ];
917  }
918  }
919  }
920  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDefinitionData()

ilObjectDefinition::readDefinitionData ( )

Read object definition data.

Definition at line 57 of file class.ilObjectDefinition.php.

References ilCachedObjectDefinition\getInstance(), and readPluginData().

Referenced by __construct().

57  : void
58  {
59  $global_cache = ilCachedObjectDefinition::getInstance();
60  foreach ($global_cache->getIlObjectDef() as $rec) {
61  $this->obj_data[$rec["id"]] = [
62  "name" => $rec["id"],
63  "class_name" => $rec["class_name"],
64  "location" => $rec["location"],
65  "checkbox" => $rec["checkbox"],
66  "inherit" => $rec["inherit"],
67  "component" => $rec["component"],
68  "translate" => $rec["translate"],
69  "devmode" => $rec["devmode"],
70  "allow_link" => $rec["allow_link"],
71  "allow_copy" => $rec["allow_copy"],
72  "rbac" => $rec["rbac"],
73  "group" => $rec["grp"],
74  "system" => $rec["system"],
75  "default_pos" => "9999" . str_pad((string) $rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
76  "sideblock" => $rec["sideblock"],
77  'export' => $rec['export'],
78  'repository' => $rec['repository'],
79  'workspace' => $rec['workspace'],
80  'administration' => $rec['administration'],
81  'amet' => $rec['amet'],
82  'orgunit_permissions' => $rec['orgunit_permissions'],
83  'lti_provider' => $rec['lti_provider'],
84  'offline_handling' => $rec['offline_handling']
85  ];
86  $this->obj_data[$rec["id"]]["subobjects"] = [];
87 
88  $defIds[] = $rec["id"];
89  }
90 
91  $subobj = $global_cache->lookupSubObjForParent($defIds);
92 
93  foreach ($subobj as $rec2) {
94  $max = $rec2["mmax"];
95  if ($max <= 0) {
96  $max = "";
97  }
98  $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = [
99  "name" => $rec2["subobj"],
100  "max" => $max,
101  "lng" => $rec2["subobj"]
102  ];
103  }
104 
105  $this->obj_group = $global_cache->getIlObjectGroup();
106  $this->readPluginData();
107  $this->sub_types = $global_cache->getIlObjectSubType();
108  }
readPluginData()
Loads the different plugins into the object definition.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPluginData()

ilObjectDefinition::readPluginData ( )
protected

Loads the different plugins into the object definition.

Definition at line 863 of file class.ilObjectDefinition.php.

References parsePluginData().

Referenced by readDefinitionData().

863  : void
864  {
865  $this->parsePluginData("robj", false);
866  $this->parsePluginData("orguext", true);
867  }
parsePluginData(string $slotId, bool $isInAdministration)
loads a single plugin definition into the object definition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHandlers()

ilObjectDefinition::setHandlers (   $xml_parser)

Definition at line 512 of file class.ilObjectDefinition.php.

References handlerBeginTag(), handlerCharacterData(), and handlerEndTag().

512  : void
513  {
514  xml_set_element_handler($xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
515  xml_set_character_data_handler($xml_parser, $this->handlerCharacterData(...));
516  }
handlerCharacterData($xml_parser, string $data)
handlerEndTag($xml_parser, string $name)
handlerBeginTag($xml_parser, string $name, array $attribs)
+ Here is the call graph for this function:

◆ stopInheritance()

ilObjectDefinition::stopInheritance ( string  $obj_name)

Does object permits stopping inheritance?

Definition at line 198 of file class.ilObjectDefinition.php.

198  : bool
199  {
200  return (bool) $this->obj_data[$obj_name]["inherit"];
201  }

◆ supportsOfflineHandling()

ilObjectDefinition::supportsOfflineHandling ( string  $obj_type)

check whether obj_type supports centralised offline handling

Definition at line 853 of file class.ilObjectDefinition.php.

853  : bool
854  {
855  return (bool) ($this->obj_data[$obj_type]['offline_handling'] ?? false);
856  }

Field Documentation

◆ $component_repository

ilComponentRepository ilObjectDefinition::$component_repository
protected

Definition at line 35 of file class.ilObjectDefinition.php.

◆ $current_tag

string ilObjectDefinition::$current_tag
protected

Definition at line 41 of file class.ilObjectDefinition.php.

◆ $current_tag_name

string ilObjectDefinition::$current_tag_name
protected

Definition at line 42 of file class.ilObjectDefinition.php.

Referenced by handlerBeginTag().

◆ $obj_data

array ilObjectDefinition::$obj_data = []
protected

Definition at line 37 of file class.ilObjectDefinition.php.

◆ $obj_group

array ilObjectDefinition::$obj_group = []
protected

Definition at line 38 of file class.ilObjectDefinition.php.

◆ $parent_tag_name

string ilObjectDefinition::$parent_tag_name
protected

Definition at line 40 of file class.ilObjectDefinition.php.

Referenced by handlerBeginTag().

◆ $root_trans_type

string ilObjectDefinition::$root_trans_type = null
protected

Definition at line 43 of file class.ilObjectDefinition.php.

Referenced by getTranslationType().

◆ $settings

ilSetting ilObjectDefinition::$settings
protected

Definition at line 34 of file class.ilObjectDefinition.php.

◆ $sub_types

array ilObjectDefinition::$sub_types = []
protected

Definition at line 39 of file class.ilObjectDefinition.php.

◆ MODE_ADMINISTRATION

const ilObjectDefinition::MODE_ADMINISTRATION = 3

◆ MODE_REPOSITORY

const ilObjectDefinition::MODE_REPOSITORY = 1

◆ MODE_WORKSPACE

const ilObjectDefinition::MODE_WORKSPACE = 2

The documentation for this class was generated from the following file: