ILIAS  release_8 Revision v8.24
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

 readDefinitionDataFromCache ()
 
 readDefinitionDataFromDB ()
 
 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
 

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

45 {
46 global $DIC;
47
48 $this->component_repository = $DIC["component.repository"];
49 $this->settings = $DIC->settings();
50 $this->readDefinitionData();
51 }
readDefinitionData()
Read object definition data.
global $DIC
Definition: feed.php:28

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

645 : void
646 {
647 // DO NOTHING
648 }

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

403 : bool
404 {
405 return (bool) $this->obj_data[$obj_name]["allow_copy"];
406 }

◆ allowExport()

ilObjectDefinition::allowExport ( string  $obj_name)

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

408 : bool
409 {
410 return (bool) $this->obj_data[$obj_name]['export'];
411 }

◆ allowLink()

ilObjectDefinition::allowLink ( string  $obj_name)

checks if linking of an object type is allowed

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

395 : bool
396 {
397 return (bool) $this->obj_data[$obj_name]["allow_link"];
398 }

◆ getAdvancedMetaDataTypes()

ilObjectDefinition::getAdvancedMetaDataTypes ( )

Get advanced meta data objects.

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

829 : array
830 {
831 $amet = [];
832 foreach ($this->obj_data as $k => $v) {
833 if ($v["amet"] ?? false) {
834 $amet[] = ["obj_type" => $k, "sub_type" => ""];
835 }
836 }
837
838 foreach ($this->sub_types as $type => $sub_types) {
839 foreach ($sub_types as $t) {
840 if ($t["amet"]) {
841 $amet[] = ["obj_type" => $type, "sub_type" => $t["sub_type"]];
842 }
843 }
844 }
845
846 return $amet;
847 }
$type

References $type.

◆ getAllObjects()

ilObjectDefinition::getAllObjects ( )

get all object types

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

387 : array
388 {
389 return array_keys($this->obj_data);
390 }

◆ getAllRBACObjects()

ilObjectDefinition::getAllRBACObjects ( )

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

370 : array
371 {
372 $types = array_keys($this->obj_data);
373
374 $rbac_types = [];
375 foreach ($types as $type) {
376 if ($this->isRBACObject($type)) {
377 $rbac_types[] = $type;
378 }
379 }
380
381 return $rbac_types;
382 }
isRBACObject(string $obj_name)
get RBAC status by type returns true if object type is a RBAC object type

References $type, and isRBACObject().

+ Here is the call graph for this function:

◆ getAllRepositoryTypes()

ilObjectDefinition::getAllRepositoryTypes ( bool  $incl_adm = false)

get all RBAC object types

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

785 : array
786 {
787 $types = array_keys($this->obj_data);
788
789 $rbac_types = [];
790 foreach ($types as $type) {
791 if ($this->isAllowedInRepository($type) && (!$this->isAdministrationObject($type) || $incl_adm)) {
792 $rbac_types[] = $type;
793 }
794 }
795
796 return $rbac_types;
797 }
isAllowedInRepository(string $obj_name)
checks if object type can be used in repository context
isAdministrationObject(string $obj_name)
Check if administration object.

References $type.

◆ getClassName()

ilObjectDefinition::getClassName ( string  $obj_name)

◆ getComponentForType()

static ilObjectDefinition::getComponentForType ( string  $obj_type)
static

Get component for object type.

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

725 : string
726 {
727 global $DIC;
728 $ilDB = $DIC->database();
729
730 $result = $ilDB->queryF("SELECT component FROM il_object_def WHERE id = %s", ["text"], [$obj_type]);
731
732 if ($rec = $ilDB->fetchAssoc($result)) {
733 return $rec["component"];
734 }
735
736 return "";
737 }

References $DIC, and $ilDB.

◆ getCreatableSubObjects()

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

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

560 : array {
561 $sub_objects = $this->getSubObjects($obj_type);
562
563 // remove role folder object from list
564 unset($sub_objects["rolf"]);
565
566 $sub_types = array_keys($sub_objects);
567
568 // remove object types in development from list
569 foreach ($sub_types as $type) {
570 if ($this->getDevMode($type) || $this->isSystemObject($type)) {
571 unset($sub_objects[$type]);
572 }
573 if ($context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type)) {
574 unset($sub_objects[$type]);
575 }
576 if ($context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type)) {
577 unset($sub_objects[$type]);
578 }
579 if ($context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type)) {
580 unset($sub_objects[$type]);
581 }
582 }
583
584 if ($obj_type == "prg") {
585 // ask study program which objects are allowed to create on the concrete node.
586 return ilObjStudyProgramme::getCreatableSubObjects($sub_objects, $parent_ref_id);
587 }
588
589 return $sub_objects;
590 }
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
$context
Definition: webdav.php:29

Referenced by ilPermissionGUI\savePermissions().

+ Here is the caller graph for this function:

◆ getDevMode()

ilObjectDefinition::getDevMode ( string  $obj_name)

get dev mode status by type

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

308 : bool
309 {
310 return (bool) ($this->obj_data[$obj_name]["devmode"] ?? false);
311 }

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

318 : array
319 {
320 $types = array_keys($this->obj_data);
321
322 $dev_types = [];
323 foreach ($types as $type) {
324 if ($this->getDevMode($type)) {
325 $dev_types[] = $type;
326 }
327 }
328
329 return $dev_types;
330 }

References $type, and 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 916 of file class.ilObjectDefinition.php.

916 : array
917 {
918 $res = $grp_map = $cnt_grp = [];
919
920 // all repository object types
921 foreach ($this->getSubObjectsRecursively("root") as $rtype) {
922 $type = $rtype["name"];
923
924 if ($type == "rolf") {
925 continue;
926 }
927
928 // gather group data
929 $type_grp = $this->getGroupOfObj($type);
930 if ($type_grp) {
931 $grp_map[$type_grp][] = $type;
932 }
933
934 // add basic container types
935 if ($this->isContainer($type)) {
936 if ($type_grp) {
937 $cnt_grp[] = $type_grp;
938 }
939
940 $res[] = $type;
941 }
942 }
943
944 // add complete groups (cat => rcat, catr; crs => rcrs, crsr; ...)
945 foreach ($cnt_grp as $grp) {
946 $res = array_merge($res, $grp_map[$grp]);
947 }
948 $res[] = "itgr";
949
950 return array_unique($res);
951 }
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, and $type.

◆ getGroup()

ilObjectDefinition::getGroup ( string  $id)

Get Group information.

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

243 : array
244 {
245 return $this->obj_group[$id];
246 }
$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 212 of file class.ilObjectDefinition.php.

212 : array
213 {
214 global $DIC;
215
216 $component_repository = $DIC["component.repository"];
217 $plugins = $component_repository->getPluginSlotById($slotId)->getActivePlugins();
218 foreach ($plugins as $plugin) {
219 $pl_id = $plugin->getId();
220 if (!isset($grouped_obj[$pl_id])) {
221 $grouped_obj[$pl_id] = array(
222 "pos" => "99992000", // "unassigned" group
223 "objs" => array(0 => $pl_id)
224 );
225 }
226 }
227 return $grouped_obj;
228 }
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 742 of file class.ilObjectDefinition.php.

742 : array
743 {
744 global $DIC;
745 $ilDB = $DIC->database();
746
747 $set = $ilDB->query("SELECT * FROM il_object_group");
748 $groups = array();
749 while ($gr_rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
750 $groups[$gr_rec["id"]] = $gr_rec;
751 }
752
754
755 $recs = $global_cache->lookupGroupedRepObj($parent_obj_type);
756
757 $grouped_obj = array();
758 foreach ((array) $recs as $rec) {
759 if ($rec["grp"] != "") {
760 $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
761 $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
762 } else {
763 $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
764 $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
765 }
766 }
767 // now get objects from repository plugin
768 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, "robj");
769 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, "orguext");
770
771 return ilArrayUtil::sortArray($grouped_obj, "pos", "asc", true, true);
772 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static getGroupedPluginObjectTypes(array $grouped_obj, string $slotId)

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

+ Here is the call graph for this function:

◆ getGroupOfObj()

ilObjectDefinition::getGroupOfObj ( string  $obj_name)

Get Group of object type.

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

251 : ?string
252 {
253 return $this->obj_data[$obj_name]["group"] ?? null;
254 }

◆ getLocation()

ilObjectDefinition::getLocation ( string  $obj_name)

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

235 : string
236 {
237 return $this->obj_data[$obj_name]["location"] ?? '';
238 }

Referenced by ilConditionHandler\_checkCondition(), ilConditionHandler\getOperatorsByTriggerType(), and ilObjectFactory\includeClassIfNotExists().

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

869 : array
870 {
871 $types = [];
872 foreach ($this->obj_data as $type => $object_info) {
873 if (array_key_exists('lti_provider', $object_info) && $object_info['lti_provider']) {
874 $types[] = $type;
875 }
876 }
877 return $types;
878 }

References $type.

◆ getOrgUnitPermissionTypes()

ilObjectDefinition::getOrgUnitPermissionTypes ( )

Get object type with org unit position permission support.

Returns
string[] $types

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

854 : array
855 {
856 $types = [];
857 foreach ($this->obj_data as $type => $object_info) {
858 if ($object_info['orgunit_permissions']) {
859 $types[] = $type;
860 }
861 }
862 return $types;
863 }

References $type.

◆ getPlugins()

ilObjectDefinition::getPlugins ( )

Get plugin object info.

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

902 : array
903 {
904 $plugins = [];
905 foreach ($this->obj_data as $type => $pl_data) {
906 if ($this->isPlugin($type)) {
907 $plugins[$type] = $pl_data;
908 }
909 }
910 return $plugins;
911 }
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type

References $type.

◆ getPositionByType()

ilObjectDefinition::getPositionByType ( string  $type)

Get Position By Object Type.

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

891 : int
892 {
893 if ($this->settings->get("obj_add_new_pos_" . $type) > 0) {
894 return (int) $this->settings->get("obj_add_new_pos_" . $type);
895 }
896 return (int) $this->obj_data[$type]["default_pos"];
897 }

References $type, and 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 = "Modules". This is only used in two locations:

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

698 : array
699 {
700 global $DIC;
701 $ilDB = $DIC->database();
702
703 $sql =
704 "SELECT id, class_name, component, location, checkbox, inherit, translate, devmode, allow_link," . PHP_EOL
705 . "allow_copy, rbac, `system`, sideblock, default_pos, grp, default_pres_pos, `export`, repository," . PHP_EOL
706 . "workspace, administration, amet, orgunit_permissions, lti_provider, offline_handling" . PHP_EOL
707 . "FROM il_object_def" . PHP_EOL
708 . "WHERE component = %s" . PHP_EOL
709 ;
710 $result = $ilDB->queryF($sql, ["text"], [$component_type . "/" . $component_name]);
711
712 $types = [];
713 while ($rec = $ilDB->fetchAssoc($result)) {
714 if ($rec["system"] != 1) {
715 $types[] = $rec;
716 }
717 }
718
719 return $types;
720 }

References $DIC, and $ilDB.

◆ getSideBlockTypes()

ilObjectDefinition::getSideBlockTypes ( bool  $filter_repository_types = true)

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

673 : array
674 {
675 $side_block_types = [];
676 foreach (array_keys($this->obj_data) as $type) {
677 if (
678 $filter_repository_types &&
679 !$this->isAllowedInRepository($type)
680 ) {
681 continue;
682 }
683 if ($this->isSideBlock($type)) {
684 $side_block_types[] = $type;
685 }
686 }
687 return $side_block_types;
688 }
isSideBlock(string $obj_name)
Check, whether object type is a side block.

References $type.

Referenced by ilObjSessionGUI\materialsObject().

+ Here is the caller graph for this function:

◆ getSubObjects()

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

get all sub objects by type

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

431 : array
432 {
433 $subs = [];
434 if ($subobjects = ($this->obj_data[$obj_type]["subobjects"] ?? false)) {
435 // Filter some objects e.g. chat object are creatable if chat is active
436 if ($filter) {
437 $this->__filterObjects($subobjects);
438 }
439 foreach ($subobjects as $data => $sub) {
440 if (!isset($sub["module"]) || $sub["module"] != "n") {
441 if (!($this->settings->get("obj_dis_creation_" . $data))) {
442 $subs[$data] = $sub;
443
444 // determine position
445 $pos = (int) $this->obj_data[$data]["default_pos"];
446 if ($this->settings->get("obj_add_new_pos_" . $data) > 0) {
447 $pos = (int) $this->settings->get("obj_add_new_pos_" . $data);
448 }
449 $subs[$data]["pos"] = $pos;
450 }
451 }
452 }
453
454 return ilArrayUtil::sortArray($subs, "pos", 'ASC', true, true);
455 }
456
457 return $subs;
458 }
__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 595 of file class.ilObjectDefinition.php.

595 : string
596 {
597 $string = "";
598 if (is_array($this->obj_data[$obj_type]["subobjects"])) {
599 $data = array_keys($this->obj_data[$obj_type]["subobjects"]);
600 $string = "'" . implode("','", $data) . "'";
601 }
602
603 return $string;
604 }

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

472 : array {
473 // This associative array is used to collect all sub object types.
474 // key=>type, value=data
475 $recursive_subs = [];
476
477 // This array is used to keep track of the object types, we
478 // need to call function getSubobjects() for.
479 $to_do = [$obj_type];
480
481 // This array is used to keep track of the object types, we
482 // have called function getSubobjects() already. This is to
483 // prevent endless loops, for object types that support
484 // themselves as subobject types either directly or indirectly.
485 $done = [];
486
487 while (count($to_do) > 0) {
488 $type = array_pop($to_do);
489 $done[] = $type;
490
491 // no recovery folder subitems
492 if ($type == 'recf') {
493 continue;
494 }
495
496 // Hide administration if desired
497 if (!$add_admin_objects and $type == 'adm') {
498 $subs = [];
499 } else {
500 $subs = $this->getSubObjects($type);
501 }
502 foreach ($subs as $subtype => $data) {
503 // Hide role templates and folder from view
504 if ($this->getDevMode($subtype) or !$this->isRBACObject($subtype)) {
505 continue;
506 }
507 if ($subtype == 'rolt') {
508 continue;
509 }
510 if (!$add_admin_objects and $subtype == 'adm') {
511 continue;
512 }
513
514 $recursive_subs[$subtype] = $data;
515 if (!in_array($subtype, $done) && !in_array($subtype, $to_do)) {
516 $to_do[] = $subtype;
517 }
518 }
519 }
520
521 if ($include_source_obj) {
522 if (!isset($recursive_subs[$obj_type])) {
523 $recursive_subs[$obj_type]['name'] = $obj_type;
524 $recursive_subs[$obj_type]['lng'] = $obj_type;
525 $recursive_subs[$obj_type]['max'] = 0;
526 $recursive_subs[$obj_type]['pos'] = -1;
527 }
528 }
529 return ilArrayUtil::sortArray($recursive_subs, "pos", 'ASC', true, true);
530 }

References $data, $type, 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 538 of file class.ilObjectDefinition.php.

538 : array
539 {
540 foreach ($this->obj_data[$obj_type]["subobjects"] as $key => $value) {
541 switch ($key) {
542 case "rolf":
543 case "orgu":
544 // DO NOTHING
545 break;
546
547 default:
548 $tmp_subs[] = $key;
549 }
550 }
551 $tmp_subs[] = "adm";
552
553 return $tmp_subs;
554 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key.

◆ getTranslationType()

ilObjectDefinition::getTranslationType ( string  $obj_name)

get translation type (sys, db or null)

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

267 : ?string
268 {
269 global $DIC;
270 $ilDB = $DIC->database();
271
272 if ($obj_name == "root") {
273 if (!isset($this->root_trans_type)) {
274 $sql =
275 "SELECT count(obj_id) cnt" . PHP_EOL
276 . "FROM object_translation" . PHP_EOL
277 . "WHERE obj_id = " . $ilDB->quote(ROOT_FOLDER_ID, 'integer') . PHP_EOL
278 ;
279 $set = $ilDB->query($sql);
280 $rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
281 if ($rec["cnt"] > 0) {
282 $this->root_trans_type = "db";
283 } else {
284 $this->root_trans_type = $this->obj_data[$obj_name]["translate"];
285 }
286 }
287 return $this->root_trans_type;
288 }
289
290 if (isset($this->obj_data[$obj_name])) {
291 return $this->obj_data[$obj_name]["translate"];
292 }
293
294 return "";
295 }
const ROOT_FOLDER_ID
Definition: constants.php:32

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

◆ handlerBeginTag()

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

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

621 : void
622 {
623 switch ($name) {
624 case 'object':
625 $this->parent_tag_name = $attribs["name"];
626 break;
627 case 'property':
628 $this->current_tag = "property";
629 $this->current_tag_name = $attribs["name"];
630 $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $attribs["module"];
631 break;
632 }
633 }
if($format !==null) $name
Definition: metadata.php:247

References $name.

◆ handlerCharacterData()

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

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

635 : void
636 {
637 }

◆ handlerEndTag()

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

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

639 : void
640 {
641 $this->current_tag = '';
642 $this->current_tag_name = '';
643 }

◆ hasCheckbox()

ilObjectDefinition::hasCheckbox ( string  $obj_name)

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

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

259 : bool
260 {
261 return (bool) ($this->obj_data[$obj_name]["checkbox"] ?? false);
262 }

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

417 : bool
418 {
419 switch ($obj_type) {
420 case 'root':
421 return false;
422
423 default:
424 return true;
425 }
426 }

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

361 : bool
362 {
363 if (!$this->component_repository->hasPluginId($type)) {
364 return false;
365 }
366 $plugin_slot = $this->component_repository->getPluginById($type)->getPluginSlot();
367 return $plugin_slot->getId() === "robj" || $plugin_slot->getId() === "orguext";
368 }

References $type.

◆ isAdministrationObject()

ilObjectDefinition::isAdministrationObject ( string  $obj_name)

Check if administration object.

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

810 : bool
811 {
812 return (bool) ($this->obj_data[$obj_name]['administration'] ?? false);
813 }

◆ isAllowedInRepository()

ilObjectDefinition::isAllowedInRepository ( string  $obj_name)

checks if object type can be used in repository context

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

777 : bool
778 {
779 return (bool) ($this->obj_data[$obj_name]["repository"] ?? false);
780 }

◆ isAllowedInWorkspace()

ilObjectDefinition::isAllowedInWorkspace ( string  $obj_name)

checks if object type can be used in workspace context

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

802 : bool
803 {
804 return (bool) ($this->obj_data[$obj_name]["workspace"] ?? false);
805 }

◆ isContainer()

ilObjectDefinition::isContainer ( string  $obj_name)

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

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

609 : bool
610 {
611 return (bool) ($this->obj_data[$obj_name]['subobjects'] ?? false);
612 }

Referenced by ilPermissionGUI\hasContainerCommands(), and 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 818 of file class.ilObjectDefinition.php.

818 : bool
819 {
820 if (substr($type, 0, 1) == "x" && !$this->isPlugin($type)) {
821 return true;
822 }
823 return false;
824 }

References $type.

◆ isOrgUnitPermissionType()

ilObjectDefinition::isOrgUnitPermissionType ( string  $obj_type)

Check if object type offers org unit position support.

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

883 : bool
884 {
885 return in_array($obj_type, $this->getOrgUnitPermissionTypes());
886 }
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 345 of file class.ilObjectDefinition.php.

345 : bool
346 {
347 return isset($this->obj_data[$obj_name]["plugin"]);
348 }

Referenced by ilAdministrationGUI\executeCommand(), and ilNewsForContextBlockGUI\getInfoForData().

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

353 : bool
354 {
355 return (substr($str, 0, 1) == "x");
356 }

◆ isRBACObject()

ilObjectDefinition::isRBACObject ( string  $obj_name)

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

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

336 : bool
337 {
338 return (bool) ($this->obj_data[$obj_name]["rbac"] ?? false);
339 }

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

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

668 : bool
669 {
670 return (bool) ($this->obj_data[$obj_name]["sideblock"] ?? false);
671 }

Referenced by ilSessionMaterialsTableGUI\getDataFromDb().

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

660 : bool
661 {
662 return (bool) ($this->obj_data[$obj_name]["system"] ?? false);
663 }

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

977 : void
978 {
979 $plugins = $this->component_repository->getPluginSlotById($slotId)->getActivePlugins();
980 foreach ($plugins as $plugin) {
981 $pl_id = $plugin->getId();
982 if ($pl_id != "" && !isset($this->obj_data[$pl_id])) {
983 $loc = $plugin->getPath() . "/classes";
984 // The plugin_id is the same as the type_id in repository object plugins.
986
987 $this->obj_data[$pl_id] = [
988 "name" => $pl_id,
989 "class_name" => $pl->getPluginName(),
990 "plugin" => "1",
991 "location" => $loc,
992 "checkbox" => "1",
993 "inherit" => "0",
994 "component" => "",
995 "translate" => "0",
996 "devmode" => "0",
997 "allow_link" => "1",
998 "allow_copy" => $pl->allowCopy() ? '1' : '0',
999 "rbac" => "1",
1000 "group" => null,
1001 "system" => "0",
1002 "default_pos" => "99992000", // "unassigned" group
1003 'repository' => '1',
1004 'workspace' => '0',
1005 'administration' => $isInAdministration ? '1' : '0',
1006 "sideblock" => "0",
1007 'export' => $plugin->supportsExport(),
1008 'offline_handling' => '0',
1009 'orgunit_permissions' => $pl->useOrguPermissions() ? '1' : '0'
1010 ];
1011
1012 $parent_types = $pl->getParentTypes();
1013 foreach ($parent_types as $parent_type) {
1014 $this->obj_data[$parent_type]["subobjects"][$pl_id] = [
1015 "name" => $pl_id,
1016 "max" => "",
1017 "lng" => $pl_id,
1018 "plugin" => true
1019 ];
1020 }
1021 }
1022 }
1023 }
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 203 of file class.ilObjectDefinition.php.

203 : void
204 {
207 } else {
209 }
210 }
static getInstance(?string $component)

References ilGlobalCache\COMP_OBJ_DEF, ilGlobalCache\getInstance(), readDefinitionDataFromCache(), and readDefinitionDataFromDB().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDefinitionDataFromCache()

ilObjectDefinition::readDefinitionDataFromCache ( )
protected

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

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

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

Referenced by readDefinitionData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDefinitionDataFromDB()

ilObjectDefinition::readDefinitionDataFromDB ( )
protected

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

110 : void
111 {
112 global $DIC;
113 $ilDB = $DIC->database();
114
115 $this->obj_data = [];
116
117 // Select all object_definitions and collect the definition id's in this array.
118 $defIds = [];
119
120 $sql =
121 "SELECT id, class_name, component, location, checkbox, inherit, translate, devmode, allow_link," . PHP_EOL
122 . "allow_copy, rbac, `system`, sideblock, default_pos, grp, default_pres_pos, `export`, repository," . PHP_EOL
123 . "workspace, administration, amet, orgunit_permissions, lti_provider, offline_handling" . PHP_EOL
124 . "FROM il_object_def" . PHP_EOL
125 ;
126 $result = $ilDB->query($sql);
127 while ($rec = $ilDB->fetchAssoc($result)) {
128 $this->obj_data[$rec["id"]] = [
129 "name" => $rec["id"],
130 "class_name" => $rec["class_name"],
131 "location" => $rec["location"],
132 "checkbox" => $rec["checkbox"],
133 "inherit" => $rec["inherit"],
134 "component" => $rec["component"],
135 "translate" => $rec["translate"],
136 "devmode" => $rec["devmode"],
137 "allow_link" => $rec["allow_link"],
138 "allow_copy" => $rec["allow_copy"],
139 "rbac" => $rec["rbac"],
140 "group" => $rec["grp"],
141 "system" => $rec["system"],
142 "default_pos" => "9999" . str_pad((string) $rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
143 "sideblock" => $rec["sideblock"],
144 'export' => $rec['export'],
145 'repository' => $rec['repository'],
146 'workspace' => $rec['workspace'],
147 'administration' => $rec['administration'],
148 'amet' => $rec['amet'],
149 'orgunit_permissions' => $rec['orgunit_permissions'],
150 'lti_provider' => $rec['lti_provider'],
151 'offline_handling' => $rec['offline_handling']
152 ];
153 $this->obj_data[$rec["id"]]["subobjects"] = [];
154
155 $defIds[] = $rec["id"];
156 }
157
158 // get all sub object definitions in a single query
159 $sql =
160 "SELECT parent, subobj, mmax" . PHP_EOL
161 . "FROM il_object_subobj" . PHP_EOL
162 . "WHERE " . $ilDB->in('parent', $defIds, false, 'text') . PHP_EOL
163 ;
164 $result = $ilDB->query($sql);
165 while ($rec2 = $ilDB->fetchAssoc($result)) {
166 $max = $rec2["mmax"];
167 if ($max <= 0) { // for backward compliance
168 $max = "";
169 }
170 $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = [
171 "name" => $rec2["subobj"],
172 "max" => $max,
173 "lng" => $rec2["subobj"]
174 ];
175 }
176
177 $sql =
178 "SELECT id, name, default_pres_pos" . PHP_EOL
179 . "FROM il_object_group" . PHP_EOL
180 ;
181 $result = $ilDB->query($sql);
182 $this->obj_group = array();
183 while ($rec = $ilDB->fetchAssoc($result)) {
184 $this->obj_group[$rec["id"]] = $rec;
185 }
186
187 $this->readPluginData();
188
189 $sql =
190 "SELECT obj_type, sub_type, amet" . PHP_EOL
191 . "FROM il_object_sub_type" . PHP_EOL
192 ;
193 $result = $ilDB->query($sql);
194 $this->sub_types = array();
195 while ($rec = $ilDB->fetchAssoc($result)) {
196 $this->sub_types[$rec["obj_type"]][] = $rec;
197 }
198 }

References $DIC, $ilDB, and readPluginData().

Referenced by readDefinitionData().

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

966 : void
967 {
968 $this->parsePluginData("robj", false);
969 $this->parsePluginData("orguext", true);
970 }
parsePluginData(string $slotId, bool $isInAdministration)
loads a single plugin definition into the object definition

Referenced by readDefinitionDataFromCache(), and readDefinitionDataFromDB().

+ Here is the caller graph for this function:

◆ setHandlers()

ilObjectDefinition::setHandlers (   $xml_parser)

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

614 : void
615 {
616 xml_set_object($xml_parser, $this);
617 xml_set_element_handler($xml_parser, 'handlerBeginTag', 'handlerEndTag');
618 xml_set_character_data_handler($xml_parser, 'handlerCharacterData');
619 }

◆ stopInheritance()

ilObjectDefinition::stopInheritance ( string  $obj_name)

Does object permits stopping inheritance?

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

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

◆ supportsOfflineHandling()

ilObjectDefinition::supportsOfflineHandling ( string  $obj_type)

check whether obj_type supports centralised offline handling

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

956 : bool
957 {
958 return (bool) ($this->obj_data[$obj_type]['offline_handling'] ?? false);
959 }

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.

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


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