ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 Constructor. More...
 
 readDefinitionData ()
 Read object definition data. More...
 
 getClassName ($a_obj_name)
 get class name by type More...
 
 getLocation ($a_obj_name)
 get location by type More...
 
 getGroup ($a_id)
 Get Group information. More...
 
 getGroupOfObj ($a_obj_name)
 Get Group of object type. More...
 
 hasCheckbox ($a_obj_name)
 should the object get a checkbox (needed for 'cut','copy' ...) More...
 
 getTranslationType ($a_obj_name)
 get translation type (sys, db or 0)s More...
 
 stopInheritance ($a_obj_name)
 Does object permits stopping inheritance? More...
 
 getDevMode ($a_obj_name)
 get devmode status by type More...
 
 getDevModeAll ()
 get all object types in devmode More...
 
 isRBACObject ($a_obj_name)
 get RBAC status by type returns true if object type is a RBAC object type More...
 
 isPlugin ($a_obj_name)
 get RBAC status by type returns true if object type is an (activated) plugin type More...
 
 isPluginTypeName ($a_str)
 Check if given type is a plugin type name (starts with an "x") More...
 
 isActivePluginType ($type)
 Returns true iff the given type is an active type of a repositoryObject or Organisation Unit Extension plugin. More...
 
 getAllRBACObjects ()
 get all RBAC object types More...
 
 getAllObjects ()
 get all object types More...
 
 allowLink ($a_obj_name)
 checks if linking of an object type is allowed More...
 
 allowCopy ($a_obj_name)
 checks if copying of an object type is allowed More...
 
 allowExport ($a_obj_name)
 
 hasLocalRoles ($a_obj_type)
 Check whether the creation of local roles is allowed Currently disabled for type "root" and "adm". More...
 
 getSubObjects ($a_obj_type, $a_filter=true)
 get all subobjects by type More...
 
 getSubObjectsRecursively ($a_obj_type, $a_include_source_obj=true, $a_add_admin_objects=false)
 Get all subobjects by type. More...
 
 getSubobjectsToFilter ($a_obj_type="adm")
 get all subjects except (rolf) of the adm object This is neceesary for filtering these objects in role perm view. More...
 
 getCreatableSubObjects ($a_obj_type, $a_context=self::MODE_REPOSITORY, $a_parent_ref_id=null)
 get only creatable subobjects by type More...
 
 getSubObjectsAsString ($a_obj_type)
 get a string of all subobjects by type More...
 
 isContainer ($a_obj_name)
 Check if object type is container ('crs','fold','grp' ...) More...
 
 setHandlers ($a_xml_parser)
 set event handler More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 start tag handler More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 end tag handler More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 end tag handler More...
 
 __filterObjects (&$subobjects)
 
 isSystemObject ($a_obj_name)
 checks if object type is a system object More...
 
 isSideBlock ($a_obj_name)
 Check, whether object type is a side block. More...
 
 isAllowedInRepository ($a_obj_name)
 checks if object type can be used in repository context More...
 
 getAllRepositoryTypes ($a_incl_adm=false)
 get all RBAC object types More...
 
 isAllowedInWorkspace ($a_obj_name)
 checks if object type can be used in workspace context More...
 
 isAdministrationObject ($a_obj_name)
 Check if administration object. More...
 
 isInactivePlugin ($a_type)
 Check whether type belongs to inactive plugin. More...
 
 getAdvancedMetaDataTypes ()
 Get advanced meta data objects. More...
 
 getPositionByType ($a_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...
 

Static Public Member Functions

static getRepositoryObjectTypesForComponent ($a_component_type, $a_component_name)
 Get all repository object types of component. More...
 
static getComponentForType ($a_obj_type)
 Get component for object type. More...
 
static getGroupedRepositoryObjectTypes ($a_parent_obj_type)
 

Data Fields

 $obj_id
 
 $parent
 
 $obj_data
 
 $sub_types = array()
 
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 ($component, $slotName, $slotId, $isInAdministration)
 loads a single plugin definition into the object definition More...
 

Static Protected Member Functions

static getGroupedPluginObjectTypes ($grouped_obj, $component, $slotName, $slotId)
 

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
Version
$Id$

@externalTableAccess ilObjDefReader on il_object_def, il_object_subobj, il_object_group

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

Constructor & Destructor Documentation

◆ __construct()

ilObjectDefinition::__construct ( )

Constructor.

setup ILIAS global object @access public

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

52 {
53 global $ilias;
54
55 $this->readDefinitionData();
56 $this->ilias = $ilias;
57
58 //parent::__construct(ILIAS_ABSOLUTE_PATH."/objects.xml");
59
60 // removing this line leads to segmentation faults in
61 // learning module editor with
62 // - PHP 5.2.1, libxml 2.6.22, libxslt 1.1.15 (MacOsX)
63 // - PHP 5.2.1, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
64 // - PHP 5.2.5, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
65 // - PHP 5.2.0-8+etch7, libxml 2.6.27, libxslt 1.1.19
66 // - PHP 5.2.0, libxml, libxml 2.6.26, libxslt 1.1.17 (OpenSuse 10.2)
67 // (needs further investigation)
68 // OK with:
69 // - PHP 5.1.2, libxml 2.6.24, libxslt 1.1.15
70
71 //
72 // Replacing all "=&" with "=" in xml5compliance seems to solve the problem
73 //
74
75// $this->startParsing();
76 }
readDefinitionData()
Read object definition data.
redirection script todo: (a better solution should control the processing via a xml file)

References readDefinitionData().

+ Here is the call graph for this function:

Member Function Documentation

◆ __filterObjects()

ilObjectDefinition::__filterObjects ( $subobjects)

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

818 {
819 foreach($subobjects as $type => $data)
820 {
821 switch($type)
822 {
823 default:
824 // DO NOTHING
825 }
826 }
827 }

References $data.

Referenced by getSubObjects().

+ Here is the caller graph for this function:

◆ allowCopy()

ilObjectDefinition::allowCopy (   $a_obj_name)

checks if copying of an object type is allowed

Parameters
stringobject type @access public

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

472 {
473 return (bool) $this->obj_data[$a_obj_name]["allow_copy"];
474 }

◆ allowExport()

ilObjectDefinition::allowExport (   $a_obj_name)

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

477 {
478 return (bool) $this->obj_data[$a_obj_name]['export'];
479 }

◆ allowLink()

ilObjectDefinition::allowLink (   $a_obj_name)

checks if linking of an object type is allowed

Parameters
stringobject type @access public

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

461 {
462 return (bool) $this->obj_data[$a_obj_name]["allow_link"];
463 }

◆ getAdvancedMetaDataTypes()

ilObjectDefinition::getAdvancedMetaDataTypes ( )

Get advanced meta data objects.

Parameters

return

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

1019 {
1020 $amet = array();
1021 foreach ($this->obj_data as $k => $v)
1022 {
1023 if ($v["amet"])
1024 {
1025 $amet[] = array("obj_type" => $k, "sub_type" => "");
1026 }
1027 }
1028
1029 foreach ($this->sub_types as $type => $sub_types)
1030 {
1031 foreach ($sub_types as $t)
1032 {
1033 if ($t["amet"])
1034 {
1035 $amet[] = array("obj_type" => $type, "sub_type" => $t["sub_type"]);
1036 }
1037 }
1038 }
1039
1040 return $amet;
1041 }

References $sub_types, and $t.

◆ getAllObjects()

ilObjectDefinition::getAllObjects ( )

get all object types

@access public

Returns
array object types

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

450 {
451 return array_keys($this->obj_data);
452 }

◆ getAllRBACObjects()

ilObjectDefinition::getAllRBACObjects ( )

get all RBAC object types

@access public

Returns
array object types set to development

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

429 {
430 $types = array_keys($this->obj_data);
431
432 foreach ($types as $type)
433 {
434 if ($this->isRBACObject($type))
435 {
436 $rbactypes[] = $type;
437 }
438 }
439
440 return $rbactypes ? $rbactypes : array();
441 }
isRBACObject($a_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 (   $a_incl_adm = false)

get all RBAC object types

@access public

Returns
array object types set to development

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

959 {
960 $types = array_keys($this->obj_data);
961
962 foreach ($types as $type)
963 {
964 if ($this->isAllowedInRepository($type) &&
965 (!$this->isAdministrationObject($type) || $a_incl_adm))
966 {
967 $rbactypes[] = $type;
968 }
969 }
970
971 return $rbactypes ? $rbactypes : array();
972 }
isAllowedInRepository($a_obj_name)
checks if object type can be used in repository context
isAdministrationObject($a_obj_name)
Check if administration object.

References isAdministrationObject(), and isAllowedInRepository().

+ Here is the call graph for this function:

◆ getClassName()

ilObjectDefinition::getClassName (   $a_obj_name)

get class name by type

Parameters
stringobject type @access public

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

248 {
249 return $this->obj_data[$a_obj_name]["class_name"];
250 }

◆ getComponentForType()

static ilObjectDefinition::getComponentForType (   $a_obj_type)
static

Get component for object type.

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

885 {
886 global $ilDB;
887
888 $set = $ilDB->queryF("SELECT component FROM il_object_def WHERE id = %s",
889 array("text"), array($a_obj_type));
890
891 if ($rec = $ilDB->fetchAssoc($set))
892 {
893 return $rec["component"];
894 }
895
896 return "";
897 }
global $ilDB

References $ilDB.

◆ getCreatableSubObjects()

ilObjectDefinition::getCreatableSubObjects (   $a_obj_type,
  $a_context = self::MODE_REPOSITORY,
  $a_parent_ref_id = null 
)

get only creatable subobjects by type

Parameters
stringobject type
integercontext
integerparent_ref_id @access public
Returns
array list of createable object types

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

677 {
678 $subobjects = $this->getSubObjects($a_obj_type);
679
680 // remove role folder object from list
681 unset($subobjects["rolf"]);
682
683 $sub_types = array_keys($subobjects);
684
685 // remove object types in development from list
686 foreach ($sub_types as $type)
687 {
688 if ($this->getDevMode($type) || $this->isSystemObject($type))
689 {
690 unset($subobjects[$type]);
691 }
692 if ($a_context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type))
693 {
694 unset($subobjects[$type]);
695 }
696 if ($a_context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type))
697 {
698 unset($subobjects[$type]);
699 }
700 if ($a_context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type))
701 {
702 unset($subobjects[$type]);
703 }
704 }
705
706 if ($a_obj_type == "prg") {
707 // ask study program which objects are allowed to create on the concrete node.
708 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
709 return ilObjStudyProgramme::getCreatableSubObjects($subobjects, $a_parent_ref_id);
710 }
711
712 return $subobjects;
713 }
static getCreatableSubObjects($a_subobjects, $a_ref_id)
Filter the list of possible subobjects for the objects that actually could be created on a concrete n...
getDevMode($a_obj_name)
get devmode status by type
isSystemObject($a_obj_name)
checks if object type is a system object
isAllowedInWorkspace($a_obj_name)
checks if object type can be used in workspace context
getSubObjects($a_obj_type, $a_filter=true)
get all subobjects by type

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

+ Here is the call graph for this function:

◆ getDevMode()

ilObjectDefinition::getDevMode (   $a_obj_name)

get devmode status by type

Parameters
stringobject type @access public

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

348 {
349 return (bool) $this->obj_data[$a_obj_name]["devmode"];
350 }

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

+ Here is the caller graph for this function:

◆ getDevModeAll()

ilObjectDefinition::getDevModeAll ( )

get all object types in devmode

@access public

Returns
array object types set to development

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

359 {
360 $types = array_keys($this->obj_data);
361
362 foreach ($types as $type)
363 {
364 if ($this->getDevMode($type))
365 {
366 $devtypes[] = $type;
367 }
368 }
369
370 return $devtypes ? $devtypes : array();
371 }

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.

Returns
array

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

1081 {
1082 $res = $grp_map = $cnt_grp = array();
1083
1084 // all repository object types
1085 foreach ($this->getSubObjectsRecursively("root") as $rtype)
1086 {
1087 $type = $rtype["name"];
1088
1089 // obsolete
1090 if($type == "rolf")
1091 {
1092 continue;
1093 }
1094
1095 // gather group data
1096 $type_grp = $this->getGroupOfObj($type);
1097 if($type_grp)
1098 {
1099 $grp_map[$type_grp][] = $type;
1100 }
1101
1102 // add basic container types
1103 if($this->isContainer($type))
1104 {
1105 // add to cnt_grp
1106 if($type_grp)
1107 {
1108 $cnt_grp[] = $type_grp;
1109 }
1110
1111 $res[] = $type;
1112 }
1113 }
1114
1115 // add complete groups (cat => rcat, catr; crs => rcrs, crsr; ...)
1116 foreach($cnt_grp as $grp)
1117 {
1118 $res = array_merge($res, $grp_map[$grp]);
1119 }
1120
1121 // add very special case
1122 $res[] = "itgr";
1123
1124 return array_unique($res);
1125 }
getSubObjectsRecursively($a_obj_type, $a_include_source_obj=true, $a_add_admin_objects=false)
Get all subobjects by type.
getGroupOfObj($a_obj_name)
Get Group of object type.
isContainer($a_obj_name)
Check if object type is container ('crs','fold','grp' ...)

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

+ Here is the call graph for this function:

◆ getGroup()

ilObjectDefinition::getGroup (   $a_id)

Get Group information.

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

268 {
269 return $this->obj_group[$a_id];
270 }

◆ getGroupedPluginObjectTypes()

static ilObjectDefinition::getGroupedPluginObjectTypes (   $grouped_obj,
  $component,
  $slotName,
  $slotId 
)
staticprotected
Parameters
$grouped_obj
$component
$slotName
$slotId
$plugin_id
Returns
mixed

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

222 {
223 global $ilPluginAdmin;
224 $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
225 foreach ($pl_names as $pl_name) {
226 include_once("./Services/Component/classes/class.ilPlugin.php");
227 $pl_id = ilPlugin::lookupIdForName($component, $slotName, $slotId,$pl_name);
228 if (!isset($grouped_obj[$pl_id])) {
229 $grouped_obj[$pl_id] = array(
230 "pos" => "99992000", // "unassigned" group
231 "objs" => array(0 => $pl_id)
232 );
233 }
234 }
235 return $grouped_obj;
236 }
static lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.

References ilPlugin\lookupIdForName().

Referenced by getGroupedRepositoryObjectTypes().

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

◆ getGroupedRepositoryObjectTypes()

static ilObjectDefinition::getGroupedRepositoryObjectTypes (   $a_parent_obj_type)
static
Parameters
$a_parent_obj_type
Returns
array

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

904 {
905 global $ilDB;
906
907 $set = $ilDB->query("SELECT * FROM il_object_group");
908 $groups = array();
909 while ($gr_rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
910 {
911 $groups[$gr_rec["id"]] = $gr_rec;
912 }
913
914 $global_cache = ilCachedComponentData::getInstance();
915
916 $recs = $global_cache->lookupGroupedRepObj($a_parent_obj_type);
917
918 $grouped_obj = array();
919 foreach((array)$recs as $rec)
920 {
921 if ($rec["grp"] != "")
922 {
923 $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
924 $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
925 }
926 else
927 {
928 $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
929 $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
930 }
931 }
932 // now get objects from repository plugin
933 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_SERVICE, "Repository", "robj");
934 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj, IL_COMP_MODULE, "OrgUnit", "orguext");
935
936 $ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true);
937 return $ret;
938 }
const IL_COMP_SERVICE
const IL_COMP_MODULE
static getGroupedPluginObjectTypes($grouped_obj, $component, $slotName, $slotId)
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
$ret
Definition: parser.php:6

References $ilDB, $ret, ilDBConstants\FETCHMODE_ASSOC, getGroupedPluginObjectTypes(), ilCachedComponentData\getInstance(), IL_COMP_MODULE, IL_COMP_SERVICE, and ilUtil\sortArray().

+ Here is the call graph for this function:

◆ getGroupOfObj()

ilObjectDefinition::getGroupOfObj (   $a_obj_name)

Get Group of object type.

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

276 {
277 return $this->obj_data[$a_obj_name]["group"];
278 }

Referenced by getExplorerContainerTypes().

+ Here is the caller graph for this function:

◆ getLocation()

ilObjectDefinition::getLocation (   $a_obj_name)

get location by type

Parameters
stringobject type @access public

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

260 {
261 return $this->obj_data[$a_obj_name]["location"];
262 }

◆ getPlugins()

ilObjectDefinition::getPlugins ( )

Get plugin object info.

Returns
type

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

1063 {
1064 $plugins = array();
1065 foreach((array) $this->obj_data as $type => $pl_data)
1066 {
1067 if($this->isPlugin($type))
1068 {
1069 $plugins[$type] = $pl_data;
1070 }
1071 }
1072 return $plugins;
1073 }
isPlugin($a_obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type

References isPlugin().

+ Here is the call graph for this function:

◆ getPositionByType()

ilObjectDefinition::getPositionByType (   $a_type)

Get Position By Object Type.

Parameters
$a_type
Returns
int

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

1050 {
1051 global $ilSetting;
1052
1053 return ($ilSetting->get("obj_add_new_pos_".$a_type) > 0)
1054 ? (int) $ilSetting->get("obj_add_new_pos_".$a_type)
1055 : (int) $this->obj_data[$a_type]["default_pos"];
1056 }
global $ilSetting
Definition: privfeed.php:17
$a_type
Definition: workflow.php:93

References $a_type, and $ilSetting.

◆ getRepositoryObjectTypesForComponent()

static ilObjectDefinition::getRepositoryObjectTypesForComponent (   $a_component_type,
  $a_component_name 
)
static

Get all repository object types of component.

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

863 {
864 global $ilDB;
865
866 $set = $ilDB->queryF("SELECT * FROM il_object_def WHERE component = %s",
867 array("text"), array($a_component_type."/".$a_component_name));
868
869 $types = array();
870 while($rec = $ilDB->fetchAssoc($set))
871 {
872 if ($rec["system"] != 1)
873 {
874 $types[] = $rec;
875 }
876 }
877
878 return $types;
879 }

References $ilDB.

◆ getSubObjects()

ilObjectDefinition::getSubObjects (   $a_obj_type,
  $a_filter = true 
)

get all subobjects by type

Parameters
stringobject type
booleanfilter disabled objects? (default: true) @access public
Returns
array list of allowed object types

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

507 {
508 global $ilSetting;
509
510 $subs = array();
511
512 if ($subobjects = $this->obj_data[$a_obj_type]["subobjects"])
513 {
514 // Filter some objects e.g chat object are creatable if chat is active
515 if ($a_filter)
516 {
517 $this->__filterObjects($subobjects);
518 }
519 foreach ($subobjects as $data => $sub)
520 {
521 if ($sub["module"] != "n")
522 {
523 if (!($ilSetting->get("obj_dis_creation_".$data)))
524 {
525 $subs[$data] = $sub;
526
527 // determine position
528 $pos = ($ilSetting->get("obj_add_new_pos_".$data) > 0)
529 ? (int) $ilSetting->get("obj_add_new_pos_".$data)
530 : (int) $this->obj_data[$data]["default_pos"];
531 $subs[$data]["pos"] = $pos;
532 }
533 }
534 }
535
536 $subs2 = ilUtil::sortArray($subs, "pos", ASC, true, true);
537
538 return $subs2;
539 }
540
541 return $subs;
542 }

References $data, $ilSetting, __filterObjects(), and ilUtil\sortArray().

Referenced by getCreatableSubObjects(), and getSubObjectsRecursively().

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

◆ getSubObjectsAsString()

ilObjectDefinition::getSubObjectsAsString (   $a_obj_type)

get a string of all subobjects by type

Parameters
stringobject type @access public

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

722 {
723 $string = "";
724
725 if (is_array($this->obj_data[$a_obj_type]["subobjects"]))
726 {
727 $data = array_keys($this->obj_data[$a_obj_type]["subobjects"]);
728
729 $string = "'".implode("','", $data)."'";
730 }
731
732 return $string;
733 }

References $data.

◆ getSubObjectsRecursively()

ilObjectDefinition::getSubObjectsRecursively (   $a_obj_type,
  $a_include_source_obj = true,
  $a_add_admin_objects = false 
)

Get all subobjects by type.

This function returns all subobjects allowed by the provided object type and all its subobject types recursively.

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

Parameters
stringobject type @access public
Returns
array list of allowed object types

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

558 {
559 global $ilSetting;
560
561 // This associative array is used to collect all subobject types.
562 // key=>type, value=data
563 $recursivesubs = array();
564
565 // This array is used to keep track of the object types, we
566 // need to call function getSubobjects() for.
567 $to_do = array($a_obj_type);
568
569 // This array is used to keep track of the object types, we
570 // have called function getSubobjects() already. This is to
571 // prevent endless loops, for object types that support
572 // themselves as subobject types either directly or indirectly.
573 $done = array();
574
575 while (count($to_do) > 0)
576 {
577 $type = array_pop($to_do);
578 $done[] = $type;
579
580 // no recovery folder subitems
581 if($type == 'recf')
582 {
583 continue;
584 }
585
586 // Hide administration if desired
587 if(!$a_add_admin_objects and $type == 'adm')
588 {
589 $subs = array();
590 }
591 else
592 {
593 $subs = $this->getSubObjects($type);
594 }
595 #vd('xxxxxxxxxxxxx'.$type);
596 foreach ($subs as $subtype => $data)
597 {
598 #vd('------------------------->'.$subtype);
599
600 // Hide role templates and folder from view
601 if($this->getDevMode($subtype) or !$this->isRBACObject($subtype))
602 {
603 continue;
604 }
605 if($subtype == 'rolt')
606 {
607 continue;
608 }
609 if(!$a_add_admin_objects and $subtype == 'adm')
610 {
611 continue;
612 }
613
614 $recursivesubs[$subtype] = $data;
615 if (! in_array($subtype, $done)
616 && ! in_array($subtype, $to_do))
617 {
618 $to_do[] = $subtype;
619 }
620 }
621 }
622
623 if($a_include_source_obj)
624 {
625 if(!isset($recursivesubs[$a_obj_type]))
626 {
627 $recursivesubs[$a_obj_type]['name'] = $a_obj_type;
628 $recursivesubs[$a_obj_type]['lng'] = $a_obj_type;
629 $recursivesubs[$a_obj_type]['max'] = 0;
630 $recursivesubs[$a_obj_type]['pos'] = -1;
631 }
632 }
633 return ilUtil::sortArray($recursivesubs, "pos", ASC, true, true);
634 }

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

Referenced by getExplorerContainerTypes().

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

◆ getSubobjectsToFilter()

ilObjectDefinition::getSubobjectsToFilter (   $a_obj_type = "adm")

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

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

Parameters
stringobject type @access public
Returns
array list of object types to filter

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

647 {
648 foreach($this->obj_data[$a_obj_type]["subobjects"] as $key => $value)
649 {
650 switch($key)
651 {
652 case "rolf":
653 // DO NOTHING
654 break;
655
656 default:
657 $tmp_subs[] = $key;
658 }
659 }
660 // ADD adm and root object
661 $tmp_subs[] = "adm";
662 #$tmp_subs[] = "root";
663
664 return $tmp_subs ? $tmp_subs : array();
665 }

◆ getTranslationType()

ilObjectDefinition::getTranslationType (   $a_obj_name)

get translation type (sys, db or 0)s

Parameters
stringobject type @access public

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

298 {
299 global $ilDB;
300
301 if ($a_obj_name == "root")
302 {
303 if (!isset($this->root_trans_type))
304 {
305 $q = "SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = ".
306 $ilDB->quote(ROOT_FOLDER_ID,'integer')." ";
307 $set = $ilDB->query($q);
308 $rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
309 if($rec["cnt"] > 0)
310 {
311 $this->root_trans_type = "db";
312 }
313 else
314 {
315 $this->root_trans_type = $this->obj_data[$a_obj_name]["translate"];
316 }
317 }
318 return $this->root_trans_type;
319 }
320
321 if (isset($this->obj_data[$a_obj_name]))
322 {
323 return $this->obj_data[$a_obj_name]["translate"];
324 }
325
326 return "";
327 }

References $ilDB, and ilDBConstants\FETCHMODE_ASSOC.

◆ handlerBeginTag()

ilObjectDefinition::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

start tag handler

Parameters
ressouceinternal xml_parser_handler
stringelement tag name
arrayelement attributes @access private

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

776 {
777 switch ($a_name)
778 {
779 case 'object':
780 $this->parent_tag_name = $a_attribs["name"];
781 break;
782 case 'property':
783 $this->current_tag = "property";
784 $this->current_tag_name = $a_attribs["name"];
785// $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["name"] = $a_attribs["name"];
786 $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $a_attribs["module"];
787//echo '<br>$this->obj_data["'.$this->parent_tag_name.'"]["properties"]["'.$this->current_tag_name.'"]["module"] = "'.$a_attribs["module"].'";';
788 break;
789 }
790 }

◆ handlerCharacterData()

ilObjectDefinition::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringdata @access private

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

800 {
801 }

◆ handlerEndTag()

ilObjectDefinition::handlerEndTag (   $a_xml_parser,
  $a_name 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringelement tag name @access private

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

811 {
812 $this->current_tag = '';
813 $this->current_tag_name = '';
814 }

◆ hasCheckbox()

ilObjectDefinition::hasCheckbox (   $a_obj_name)

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

Parameters
stringobject type @access public

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

287 {
288 return (bool) $this->obj_data[$a_obj_name]["checkbox"];
289 }

◆ hasLocalRoles()

ilObjectDefinition::hasLocalRoles (   $a_obj_type)

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

Returns

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

487 {
488 switch($a_obj_type)
489 {
490 case 'root':
491 return FALSE;
492
493 default:
494 return TRUE;
495 }
496 }

◆ isActivePluginType()

ilObjectDefinition::isActivePluginType (   $type)

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

Parameters
$type
Returns
bool

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

413 {
414 global $ilPluginAdmin;
415 $isRepoPlugin = $ilPluginAdmin->isActive(IL_COMP_SERVICE, "Repository", "robj",
416 ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $type));
417 $isOrguPlugin = $ilPluginAdmin->isActive(IL_COMP_MODULE, "OrgUnit", "orguext",
418 ilPlugin::lookupNameForId(IL_COMP_MODULE, "OrgUnit", "orguext", $type));
419 return $isRepoPlugin || $isOrguPlugin;
420 }
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.

References IL_COMP_MODULE, IL_COMP_SERVICE, and ilPlugin\lookupNameForId().

+ Here is the call graph for this function:

◆ isAdministrationObject()

ilObjectDefinition::isAdministrationObject (   $a_obj_name)

Check if administration object.

Parameters
string$a_obj_name
Returns
bool

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

993 {
994 return (bool) $this->obj_data[$a_obj_name]['administration'];
995 }

Referenced by getAllRepositoryTypes(), and getCreatableSubObjects().

+ Here is the caller graph for this function:

◆ isAllowedInRepository()

ilObjectDefinition::isAllowedInRepository (   $a_obj_name)

checks if object type can be used in repository context

Parameters
stringobject type @access public
Returns
bool

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

948 {
949 return (bool) $this->obj_data[$a_obj_name]["repository"];
950 }

Referenced by getAllRepositoryTypes(), and getCreatableSubObjects().

+ Here is the caller graph for this function:

◆ isAllowedInWorkspace()

ilObjectDefinition::isAllowedInWorkspace (   $a_obj_name)

checks if object type can be used in workspace context

Parameters
stringobject type @access public
Returns
bool

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

983 {
984 return (bool) $this->obj_data[$a_obj_name]["workspace"];
985 }

Referenced by getCreatableSubObjects().

+ Here is the caller graph for this function:

◆ isContainer()

ilObjectDefinition::isContainer (   $a_obj_name)

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

@access public

Parameters
stringobject type
Returns
bool

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

744 {
745 if(!is_array($this->obj_data[$a_obj_name]['subobjects']))
746 {
747 return false;
748 }
749 return count($this->obj_data[$a_obj_name]['subobjects']) >= 1 ? true : false;
750 }

Referenced by getExplorerContainerTypes().

+ Here is the caller graph for this function:

◆ isInactivePlugin()

ilObjectDefinition::isInactivePlugin (   $a_type)

Check whether type belongs to inactive plugin.

Parameters

return

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

1004 {
1005 if (substr($a_type, 0, 1) == "x" && !$this->isPlugin($a_type))
1006 {
1007 return true;
1008 }
1009 return false;
1010 }

References $a_type, and isPlugin().

+ Here is the call graph for this function:

◆ isPlugin()

ilObjectDefinition::isPlugin (   $a_obj_name)

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

Parameters
stringobject type @access public

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

393 {
394 return (bool) isset($this->obj_data[$a_obj_name]["plugin"]);
395 }

Referenced by getPlugins(), and isInactivePlugin().

+ Here is the caller graph for this function:

◆ isPluginTypeName()

ilObjectDefinition::isPluginTypeName (   $a_str)

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

Parameters
stringobject type @access public

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

404 {
405 return (substr($a_str, 0, 1) == "x");
406 }

◆ isRBACObject()

ilObjectDefinition::isRBACObject (   $a_obj_name)

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

Parameters
stringobject type @access public

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

381 {
382 return (bool) $this->obj_data[$a_obj_name]["rbac"];
383 }

Referenced by getAllRBACObjects(), and getSubObjectsRecursively().

+ Here is the caller graph for this function:

◆ isSideBlock()

ilObjectDefinition::isSideBlock (   $a_obj_name)

Check, whether object type is a side block.

Parameters
stringobject type
Returns
boolean side block true/false

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

854 {
855 return (bool) $this->obj_data[$a_obj_name]["sideblock"];
856 }

◆ isSystemObject()

ilObjectDefinition::isSystemObject (   $a_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 administation, 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

Parameters
stringobject type @access public

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

843 {
844 return (bool) $this->obj_data[$a_obj_name]["system"];
845 }

Referenced by getCreatableSubObjects().

+ Here is the caller graph for this function:

◆ parsePluginData()

ilObjectDefinition::parsePluginData (   $component,
  $slotName,
  $slotId,
  $isInAdministration 
)
protected

loads a single plugin definition into the object definition

Parameters
$componentThe component e.g. IL_COMP_SERVICE
$slotNameThe Slot name, e.g. Repository
$slotIdthe slot id, e.g. robj
$isInAdministration,canthe object be created in the administration?

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

1144 {
1145 global $ilPluginAdmin;
1146 $pl_names = $ilPluginAdmin->getActivePluginsForSlot($component, $slotName, $slotId);
1147 foreach ($pl_names as $pl_name) {
1148 include_once("./Services/Component/classes/class.ilPlugin.php");
1149 $pl_id = ilPlugin::lookupIdForName($component, $slotName, $slotId, $pl_name);
1150 if ($pl_id != "" && !isset($this->obj_data[$pl_id])) {
1151 include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
1152 $loc = ilPlugin::_getDirectory($component, $slotName, $slotId, $pl_name) . "/classes";
1153 // The plugin_id is the same as the type_id in repository object plugins.
1155
1156 $this->obj_data[$pl_id] = array(
1157 "name" => $pl_id,
1158 "class_name" => $pl_name,
1159 "plugin" => "1",
1160 "location" => $loc,
1161 "checkbox" => "1",
1162 "inherit" => "0",
1163 "component" => "",
1164 "translate" => "0",
1165 "devmode" => "0",
1166 "allow_link" => "1",
1167 "allow_copy" => $pl->allowCopy() ? '1' : '0',
1168 "rbac" => "1",
1169 "group" => NULL,
1170 "system" => "0",
1171 "default_pos" => "99992000", // "unassigned" group
1172 'repository' => '1',
1173 'workspace' => '0',
1174 'administration' => $isInAdministration?'1':'0',
1175 "sideblock" => "0",
1176 'export' => $ilPluginAdmin->supportsExport($component, $slotName, $slotId, $pl_name)
1177 );
1178 $parent_types = $pl->getParentTypes();
1179 foreach($parent_types as $parent_type) {
1180 $this->obj_data[$parent_type]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
1181 }
1182 }
1183 }
1184 }
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.

References ilPlugin\_getDirectory(), ilObjectPlugin\getRepoPluginObjectByType(), and ilPlugin\lookupIdForName().

Referenced by readPluginData().

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

205 {
208 } else {
210 }
211 }
static getInstance($component)

References ilGlobalCache\COMP_COMPONENT, 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 79 of file class.ilObjectDefinition.php.

79 {
80 $this->obj_data = array();
81 $defIds = array();
82 $global_cache = ilCachedComponentData::getInstance();
83 foreach ($global_cache->getIlobjectDef() as $rec) {
84 $this->obj_data[$rec["id"]] = array(
85 "name" => $rec["id"],
86 "class_name" => $rec["class_name"],
87 "location" => $rec["location"],
88 "checkbox" => $rec["checkbox"],
89 "inherit" => $rec["inherit"],
90 "component" => $rec["component"],
91 "translate" => $rec["translate"],
92 "devmode" => $rec["devmode"],
93 "allow_link" => $rec["allow_link"],
94 "allow_copy" => $rec["allow_copy"],
95 "rbac" => $rec["rbac"],
96 "group" => $rec["grp"],
97 "system" => $rec["system"],
98 "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
99 "sideblock" => $rec["sideblock"],
100 'export' => $rec['export'],
101 'repository' => $rec['repository'],
102 'workspace' => $rec['workspace'],
103 'administration' => $rec['administration'],
104 'amet' => $rec['amet']
105 );
106 $this->obj_data[$rec["id"]]["subobjects"] = array();
107
108 $defIds[] = $rec["id"];
109 }
110
111 $subobj = $global_cache->lookupSubObjForParent($defIds);
112
113 foreach ($subobj as $rec2) {
114
115 $max = $rec2["mmax"];
116 if ($max <= 0) {
117 $max = "";
118 }
119 $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
120 "name" => $rec2["subobj"],
121 "max" => $max,
122 "lng" => $rec2["subobj"]
123 );
124 }
125 $this->obj_group = $global_cache->getIlObjectGroup();
126
127 $this->readPluginData();
128
129 $this->sub_types = $global_cache->getIlObjectSubType();
130 }
readPluginData()
Loads the different plugins into the object definition.

References ilCachedComponentData\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 133 of file class.ilObjectDefinition.php.

133 {
134 global $ilDB;
135
136 $this->obj_data = array();
137
138 // Select all object_definitions and collect the definition id's in
139 // this array.
140 $defIds = array();
141 $set = $ilDB->query("SELECT * FROM il_object_def");
142 while ($rec = $ilDB->fetchAssoc($set)) {
143 $this->obj_data[$rec["id"]] = array(
144 "name" => $rec["id"],
145 "class_name" => $rec["class_name"],
146 "location" => $rec["location"],
147 "checkbox" => $rec["checkbox"],
148 "inherit" => $rec["inherit"],
149 "component" => $rec["component"],
150 "translate" => $rec["translate"],
151 "devmode" => $rec["devmode"],
152 "allow_link" => $rec["allow_link"],
153 "allow_copy" => $rec["allow_copy"],
154 "rbac" => $rec["rbac"],
155 "group" => $rec["grp"],
156 "system" => $rec["system"],
157 "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
158 "sideblock" => $rec["sideblock"],
159 'export' => $rec['export'],
160 'repository' => $rec['repository'],
161 'workspace' => $rec['workspace'],
162 'administration' => $rec['administration'],
163 'amet' => $rec['amet']
164 );
165 $this->obj_data[$rec["id"]]["subobjects"] = array();
166
167 $defIds[] = $rec["id"];
168 }
169
170 // get all subobject definitions in a single query
171 $set2 = $ilDB->query("SELECT * FROM il_object_subobj WHERE " . $ilDB->in('parent', $defIds, false, 'text'));
172 while ($rec2 = $ilDB->fetchAssoc($set2)) {
173 $max = $rec2["mmax"];
174 if ($max <= 0) // for backward compliance
175 {
176 $max = "";
177 }
178 $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
179 "name" => $rec2["subobj"],
180 "max" => $max,
181 "lng" => $rec2["subobj"]
182 );
183 }
184
185 $set = $ilDB->query("SELECT * FROM il_object_group");
186 $this->obj_group = array();
187 while ($rec = $ilDB->fetchAssoc($set)) {
188 $this->obj_group[$rec["id"]] = $rec;
189 }
190
191 $this->readPluginData();
192
193 $set = $ilDB->query("SELECT * FROM il_object_sub_type ");
194 $this->sub_types = array();
195 while ($rec = $ilDB->fetchAssoc($set)) {
196 $this->sub_types[$rec["obj_type"]][] = $rec;
197 }
198 }

References $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 1132 of file class.ilObjectDefinition.php.

1132 {
1133 $this->parsePluginData(IL_COMP_SERVICE, "Repository", "robj", false);
1134 $this->parsePluginData(IL_COMP_MODULE, "OrgUnit", "orguext", true);
1135 }
parsePluginData($component, $slotName, $slotId, $isInAdministration)
loads a single plugin definition into the object definition

References IL_COMP_MODULE, IL_COMP_SERVICE, and parsePluginData().

Referenced by readDefinitionDataFromCache(), and readDefinitionDataFromDB().

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

◆ setHandlers()

ilObjectDefinition::setHandlers (   $a_xml_parser)

set event handler

Parameters
ressouceinternal xml_parser_handler @access private

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

761 {
762 xml_set_object($a_xml_parser,$this);
763 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
764 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
765 }

◆ stopInheritance()

ilObjectDefinition::stopInheritance (   $a_obj_name)

Does object permits stopping inheritance?

Parameters
stringobject type @access public

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

337 {
338 return (bool) $this->obj_data[$a_obj_name]["inherit"];
339 }

Field Documentation

◆ $obj_data

ilObjectDefinition::$obj_data

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

◆ $obj_id

ilObjectDefinition::$obj_id

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

◆ $parent

ilObjectDefinition::$parent

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

◆ $sub_types

ilObjectDefinition::$sub_types = array()

◆ MODE_ADMINISTRATION

const ilObjectDefinition::MODE_ADMINISTRATION = 3

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

Referenced by ilObjOrgUnitGUI\showPossibleSubObjects().

◆ MODE_REPOSITORY

const ilObjectDefinition::MODE_REPOSITORY = 1

◆ MODE_WORKSPACE


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