ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 @externalTableAccess 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.

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:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __filterObjects()

ilObjectDefinition::__filterObjects ( array &  $sub_objects)

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

543 : void
544 {
545 // DO NOTHING
546 }

Referenced by getSubObjects().

+ 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 302 of file class.ilObjectDefinition.php.

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

◆ allowExport()

ilObjectDefinition::allowExport ( string  $obj_name)

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

307 : bool
308 {
309 return (bool) $this->obj_data[$obj_name]['export'];
310 }

Referenced by ilExportOptions\addOptions().

+ 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 294 of file class.ilObjectDefinition.php.

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

◆ 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 286 of file class.ilObjectDefinition.php.

286 : array
287 {
288 return array_keys($this->obj_data);
289 }

Referenced by ilAbstractSearch\getValidObjectTypes().

+ Here is the caller graph for this function:

◆ getAllRBACObjects()

ilObjectDefinition::getAllRBACObjects ( )

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

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

References isRBACObject().

+ 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.

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 }
isAllowedInRepository(string $obj_name)
checks if object type can be used in repository context
isAdministrationObject(string $obj_name)
Check if administration object.

◆ 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.

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 }

References $DIC, and $ilDB.

◆ getCreatableSubObjects()

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

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

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

◆ getDevMode()

ilObjectDefinition::getDevMode ( string  $obj_name)

get dev mode status by type

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

207 : bool
208 {
209 return (bool) ($this->obj_data[$obj_name]["devmode"] ?? false);
210 }

Referenced by getDevModeAll(), and getSubObjectsRecursively().

+ 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 217 of file class.ilObjectDefinition.php.

217 : array
218 {
219 $types = array_keys($this->obj_data);
220
221 $dev_types = [];
222 foreach ($types as $type) {
223 if ($this->getDevMode($type)) {
224 $dev_types[] = $type;
225 }
226 }
227
228 return $dev_types;
229 }

References getDevMode().

+ 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.

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 }
getGroupOfObj(string $obj_name)
Get Group of object type.
isContainer(string $obj_name)
Check if object type is container ('crs','fold','grp' ...)
getSubObjectsRecursively(string $obj_type, bool $include_source_obj=true, bool $add_admin_objects=false)
Get all sub objects by type.
$res
Definition: ltiservices.php:69

References $res.

◆ getGroup()

ilObjectDefinition::getGroup ( string  $id)

Get Group information.

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

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

References $id.

◆ getGroupedPluginObjectTypes()

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

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

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

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

+ 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.

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
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 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
const FETCHMODE_ASSOC
static getGroupedPluginObjectTypes(array $grouped_obj, string $slotId)

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

Referenced by ILIAS\Container\Content\ItemBlock\ItemBlockSequenceGenerator\getGroupedObjTypes().

+ 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 150 of file class.ilObjectDefinition.php.

150 : ?string
151 {
152 return $this->obj_data[$obj_name]["group"] ?? null;
153 }

Referenced by ilAbstractSearch\getValidObjectTypes().

+ Here is the caller graph for this function:

◆ getLocation()

ilObjectDefinition::getLocation ( string  $obj_name)

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

134 : string
135 {
136 return $this->obj_data[$obj_name]["location"] ?? '';
137 }

◆ 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.

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 }

◆ getPlugins()

ilObjectDefinition::getPlugins ( )

Get plugin object info.

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

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

◆ getPositionByType()

ilObjectDefinition::getPositionByType ( string  $type)

Get Position By Object Type.

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

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 }

References ILIAS\Repository\settings().

+ 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 596 of file class.ilObjectDefinition.php.

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

References $DIC, and $ilDB.

◆ getSideBlockTypes()

ilObjectDefinition::getSideBlockTypes ( bool  $filter_repository_types = true)

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

571 : array
572 {
573 $side_block_types = [];
574 foreach (array_keys($this->obj_data) as $type) {
575 if (
576 $filter_repository_types &&
577 !$this->isAllowedInRepository($type)
578 ) {
579 continue;
580 }
581 if ($this->isSideBlock($type)) {
582 $side_block_types[] = $type;
583 }
584 }
585 return $side_block_types;
586 }
isSideBlock(string $obj_name)
Check, whether object type is a side block.

◆ getSubObjects()

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

get all sub objects by type

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

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

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

Referenced by getSubObjectsRecursively().

+ 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 494 of file class.ilObjectDefinition.php.

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

References $data.

◆ 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 367 of file class.ilObjectDefinition.php.

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

References $data, getDevMode(), getSubObjects(), and isRBACObject().

Referenced by ilObject\getAllOwnedRepositoryObjects().

+ 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 437 of file class.ilObjectDefinition.php.

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

◆ getTranslationType()

ilObjectDefinition::getTranslationType ( string  $obj_name)

get translation type (sys, db or null)

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

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

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

◆ handlerBeginTag()

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

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

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

◆ handlerCharacterData()

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

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

533 : void
534 {
535 }

◆ handlerEndTag()

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

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

537 : void
538 {
539 $this->current_tag = '';
540 $this->current_tag_name = '';
541 }

◆ hasCheckbox()

ilObjectDefinition::hasCheckbox ( string  $obj_name)

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

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

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

◆ 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 316 of file class.ilObjectDefinition.php.

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

◆ 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 260 of file class.ilObjectDefinition.php.

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

◆ isAdministrationObject()

ilObjectDefinition::isAdministrationObject ( string  $obj_name)

Check if administration object.

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

707 : bool
708 {
709 return (bool) ($this->obj_data[$obj_name]['administration'] ?? false);
710 }

Referenced by ilAbstractSearch\getValidObjectTypes().

+ 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.

674 : bool
675 {
676 return (bool) ($this->obj_data[$obj_name]["repository"] ?? false);
677 }

Referenced by ilAbstractSearch\getValidObjectTypes().

+ 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.

699 : bool
700 {
701 return (bool) ($this->obj_data[$obj_name]["workspace"] ?? false);
702 }

◆ isContainer()

ilObjectDefinition::isContainer ( string  $obj_name)

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

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

508 : bool
509 {
510 return (bool) ($this->obj_data[$obj_name]['subobjects'] ?? false);
511 }

Referenced by ilDidacticTemplateSetting\hasIconSupport().

+ 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.

715 : bool
716 {
717 if (substr($type, 0, 1) == "x" && !$this->isPlugin($type)) {
718 return true;
719 }
720 return false;
721 }

◆ isOrgUnitPermissionType()

ilObjectDefinition::isOrgUnitPermissionType ( string  $obj_type)

Check if object type offers org unit position support.

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

780 : bool
781 {
782 return in_array($obj_type, $this->getOrgUnitPermissionTypes());
783 }
getOrgUnitPermissionTypes()
Get object type with org unit position permission support.

◆ isPlugin()

ilObjectDefinition::isPlugin ( string  $obj_name)

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

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

244 : bool
245 {
246 return isset($this->obj_data[$obj_name]["plugin"]);
247 }

Referenced by ilPCResourcesGUI\insertResourcesIntoPageContent().

+ 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 252 of file class.ilObjectDefinition.php.

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

◆ isRBACObject()

ilObjectDefinition::isRBACObject ( string  $obj_name)

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

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

235 : bool
236 {
237 return (bool) ($this->obj_data[$obj_name]["rbac"] ?? false);
238 }

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

+ 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 566 of file class.ilObjectDefinition.php.

566 : bool
567 {
568 return (bool) ($this->obj_data[$obj_name]["sideblock"] ?? false);
569 }

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

+ 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 558 of file class.ilObjectDefinition.php.

558 : bool
559 {
560 return (bool) ($this->obj_data[$obj_name]["system"] ?? false);
561 }

Referenced by ilAbstractSearch\getValidObjectTypes().

+ 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.

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

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

+ Here is the call graph for this function:

◆ readDefinitionData()

ilObjectDefinition::readDefinitionData ( )

Read object definition data.

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

57 : void
58 {
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.

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

Referenced by __construct().

+ 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.

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

Referenced by readDefinitionData().

+ Here is the caller graph for this function:

◆ setHandlers()

ilObjectDefinition::setHandlers (   $xml_parser)

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

513 : void
514 {
515 xml_set_element_handler($xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
516 xml_set_character_data_handler($xml_parser, $this->handlerCharacterData(...));
517 }
handlerBeginTag($xml_parser, string $name, array $attribs)
handlerEndTag($xml_parser, string $name)
handlerCharacterData($xml_parser, string $data)

◆ stopInheritance()

ilObjectDefinition::stopInheritance ( string  $obj_name)

Does object permits stopping inheritance?

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

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

◆ 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.

Referenced by getGroupedPluginObjectTypes().

◆ $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.

◆ $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.

◆ $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

◆ MODE_WORKSPACE

const ilObjectDefinition::MODE_WORKSPACE = 2

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