19declare(strict_types=1);
49 $this->component_repository =
$DIC[
"component.repository"];
60 foreach ($global_cache->getIlObjectDef() as $rec) {
61 $this->obj_data[$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),
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']
86 $this->obj_data[$rec[
"id"]][
"subobjects"] = [];
88 $defIds[] = $rec[
"id"];
91 $subobj = $global_cache->lookupSubObjForParent($defIds);
93 foreach ($subobj as $rec2) {
98 $this->obj_data[$rec2[
"parent"]][
"subobjects"][$rec2[
"subobj"]] = [
99 "name" => $rec2[
"subobj"],
101 "lng" => $rec2[
"subobj"]
105 $this->obj_group = $global_cache->getIlObjectGroup();
107 $this->sub_types = $global_cache->getIlObjectSubType();
116 foreach ($plugins as
$plugin) {
118 if (!isset($grouped_obj[$pl_id])) {
119 $grouped_obj[$pl_id] = [
121 "objs" => [0 => $pl_id]
130 return $this->obj_data[$obj_name][
"class_name"] ??
'';
135 return $this->obj_data[$obj_name][
"location"] ??
'';
143 return $this->obj_group[
$id];
151 return $this->obj_data[$obj_name][
"group"] ??
null;
159 return (
bool) ($this->obj_data[$obj_name][
"checkbox"] ??
false);
170 if ($obj_name ==
"root") {
171 if (!isset($this->root_trans_type)) {
173 "SELECT count(obj_id) cnt" . PHP_EOL
174 .
"FROM object_translation" . PHP_EOL
177 $set =
$ilDB->query($sql);
179 if ($rec[
"cnt"] > 0) {
180 $this->root_trans_type =
"db";
182 $this->root_trans_type = $this->obj_data[$obj_name][
"translate"];
188 if (isset($this->obj_data[$obj_name])) {
189 return $this->obj_data[$obj_name][
"translate"];
200 return (
bool) $this->obj_data[$obj_name][
"inherit"];
208 return (
bool) ($this->obj_data[$obj_name][
"devmode"] ??
false);
218 $types = array_keys($this->obj_data);
221 foreach ($types as $type) {
223 $dev_types[] = $type;
236 return (
bool) ($this->obj_data[$obj_name][
"rbac"] ??
false);
245 return isset($this->obj_data[$obj_name][
"plugin"]);
253 return (substr($str, 0, 1) ==
"x");
261 if (!$this->component_repository->hasPluginId($type)) {
264 $plugin_slot = $this->component_repository->getPluginById($type)->getPluginSlot();
265 return $plugin_slot->getId() ===
"robj" || $plugin_slot->getId() ===
"orguext";
270 $types = array_keys($this->obj_data);
273 foreach ($types as $type) {
275 $rbac_types[] = $type;
287 return array_keys($this->obj_data);
295 return (
bool) $this->obj_data[$obj_name][
"allow_link"];
303 return (
bool) $this->obj_data[$obj_name][
"allow_copy"];
308 return (
bool) $this->obj_data[$obj_name][
'export'];
332 if ($subobjects = ($this->obj_data[$obj_type][
"subobjects"] ??
false)) {
337 foreach ($subobjects as
$data => $sub) {
338 if (!isset($sub[
"module"]) || $sub[
"module"] !=
"n") {
343 $pos = (
int) $this->obj_data[
$data][
"default_pos"];
347 $subs[
$data][
"pos"] = $pos;
368 bool $include_source_obj =
true,
369 bool $add_admin_objects =
false
373 $recursive_subs = [];
377 $to_do = [$obj_type];
385 while (count($to_do) > 0) {
386 $type = array_pop($to_do);
390 if ($type ==
'recf') {
395 if (!$add_admin_objects and $type ==
'adm') {
400 foreach ($subs as $subtype =>
$data) {
405 if ($subtype ==
'rolt') {
408 if (!$add_admin_objects and $subtype ==
'adm') {
412 $recursive_subs[$subtype] =
$data;
413 if (!in_array($subtype, $done) && !in_array($subtype, $to_do)) {
419 if ($include_source_obj) {
420 if (!isset($recursive_subs[$obj_type])) {
421 $recursive_subs[$obj_type][
'name'] = $obj_type;
422 $recursive_subs[$obj_type][
'lng'] = $obj_type;
423 $recursive_subs[$obj_type][
'max'] = 0;
424 $recursive_subs[$obj_type][
'pos'] = -1;
438 foreach ($this->obj_data[$obj_type][
"subobjects"] as $key => $value) {
456 int $context = self::MODE_REPOSITORY,
457 ?
int $parent_ref_id =
null
459 $sub_objects = $this->getSubObjects($obj_type);
462 unset($sub_objects[
"rolf"]);
464 $sub_types = array_keys($sub_objects);
467 foreach ($sub_types as $type) {
468 if ($this->getDevMode($type) || $this->isSystemObject($type)) {
469 unset($sub_objects[$type]);
471 if (
$context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type)) {
472 unset($sub_objects[$type]);
474 if (
$context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type)) {
475 unset($sub_objects[$type]);
477 if (
$context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type)) {
478 unset($sub_objects[$type]);
482 if ($obj_type ==
"prg") {
496 if (is_array($this->obj_data[$obj_type][
"subobjects"])) {
497 $data = array_keys($this->obj_data[$obj_type][
"subobjects"]);
498 $string =
"'" . implode(
"','",
$data) .
"'";
509 return (
bool) ($this->obj_data[$obj_name][
'subobjects'] ??
false);
514 xml_set_element_handler($xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
515 xml_set_character_data_handler($xml_parser, $this->handlerCharacterData(...));
522 $this->parent_tag_name = $attribs[
"name"];
525 $this->current_tag =
"property";
526 $this->current_tag_name = $attribs[
"name"];
527 $this->obj_data[$this->parent_tag_name][
"properties"][$this->current_tag_name][
"module"] = $attribs[
"module"];
538 $this->current_tag =
'';
539 $this->current_tag_name =
'';
559 return (
bool) ($this->obj_data[$obj_name][
"system"] ??
false);
567 return (
bool) ($this->obj_data[$obj_name][
"sideblock"] ??
false);
572 $side_block_types = [];
573 foreach (array_keys($this->obj_data) as $type) {
575 $filter_repository_types &&
576 !$this->isAllowedInRepository($type)
580 if ($this->isSideBlock($type)) {
581 $side_block_types[] = $type;
584 return $side_block_types;
601 "SELECT id, class_name, component, location, checkbox, inherit, translate, devmode, allow_link," . PHP_EOL
602 .
"allow_copy, rbac, `system`, sideblock, default_pos, grp, default_pres_pos, `export`, repository," . PHP_EOL
603 .
"workspace, administration, amet, orgunit_permissions, lti_provider, offline_handling" . PHP_EOL
604 .
"FROM il_object_def" . PHP_EOL
605 .
"WHERE component = %s" . PHP_EOL
607 $result =
$ilDB->queryF($sql, [
"text"], [$component_type .
"/" . $component_name]);
610 while ($rec =
$ilDB->fetchAssoc($result)) {
611 if ($rec[
"system"] != 1) {
626 $result =
$ilDB->queryF(
"SELECT component FROM il_object_def WHERE id = %s", [
"text"], [$obj_type]);
628 if ($rec =
$ilDB->fetchAssoc($result)) {
629 return $rec[
"component"];
643 $set =
$ilDB->query(
"SELECT * FROM il_object_group");
646 $groups[$gr_rec[
"id"]] = $gr_rec;
651 $recs = $global_cache->lookupGroupedRepObj($parent_obj_type);
654 foreach ((array) $recs as $rec) {
655 if ($rec[
"grp"] !=
"") {
656 $grouped_obj[$rec[
"grp"]][
"pos"] = (
int) $groups[$rec[
"grp"]][
"default_pres_pos"];
657 $grouped_obj[$rec[
"grp"]][
"objs"][] = $rec[
"id"];
659 $grouped_obj[$rec[
"id"]][
"pos"] = (
int) $rec[
"default_pres_pos"];
660 $grouped_obj[$rec[
"id"]][
"objs"][] = $rec[
"id"];
664 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj,
"robj");
665 $grouped_obj = self::getGroupedPluginObjectTypes($grouped_obj,
"orguext");
675 return (
bool) ($this->obj_data[$obj_name][
"repository"] ??
false);
683 $types = array_keys($this->obj_data);
686 foreach ($types as $type) {
687 if ($this->isAllowedInRepository($type) && (!$this->isAdministrationObject($type) || $incl_adm)) {
688 $rbac_types[] = $type;
700 return (
bool) ($this->obj_data[$obj_name][
"workspace"] ??
false);
708 return (
bool) ($this->obj_data[$obj_name][
'administration'] ??
false);
716 if (substr($type, 0, 1) ==
"x" && !$this->isPlugin($type)) {
728 foreach ($this->obj_data as $k => $v) {
729 if ($v[
"amet"] ??
false) {
730 $amet[] = [
"obj_type" => $k,
"sub_type" =>
""];
734 foreach ($this->sub_types as $type => $sub_types) {
735 foreach ($sub_types as $t) {
737 $amet[] = [
"obj_type" => $type,
"sub_type" => $t[
"sub_type"]];
753 foreach ($this->obj_data as $type => $object_info) {
754 if ($object_info[
'orgunit_permissions']) {
768 foreach ($this->obj_data as $type => $object_info) {
769 if (array_key_exists(
'lti_provider', $object_info) && $object_info[
'lti_provider']) {
781 return in_array($obj_type, $this->getOrgUnitPermissionTypes());
789 if ($this->
settings->get(
"obj_add_new_pos_" . $type) > 0) {
790 return (
int) $this->
settings->get(
"obj_add_new_pos_" . $type);
792 return (
int) $this->obj_data[$type][
"default_pos"];
801 foreach ($this->obj_data as $type => $pl_data) {
802 if ($this->isPlugin($type)) {
803 $plugins[$type] = $pl_data;
814 $res = $grp_map = $cnt_grp = [];
817 foreach ($this->getSubObjectsRecursively(
"root") as $rtype) {
818 $type = $rtype[
"name"];
820 if ($type ==
"rolf") {
825 $type_grp = $this->getGroupOfObj($type);
827 $grp_map[$type_grp][] = $type;
831 if ($this->isContainer($type)) {
833 $cnt_grp[] = $type_grp;
841 foreach ($cnt_grp as $grp) {
842 $res = array_merge(
$res, $grp_map[$grp]);
846 return array_unique(
$res);
854 return (
bool) ($this->obj_data[$obj_type][
'offline_handling'] ??
false);
864 $this->parsePluginData(
"robj",
false);
865 $this->parsePluginData(
"orguext",
true);
875 $plugins = $this->component_repository->getPluginSlotById($slotId)->getActivePlugins();
876 foreach ($plugins as
$plugin) {
878 if ($pl_id !=
"" && !isset($this->obj_data[$pl_id])) {
879 $loc =
$plugin->getPath() .
"/classes";
883 $this->obj_data[$pl_id] = [
885 "class_name" => $pl->getPluginName(),
894 "allow_copy" => $pl->allowCopy() ?
'1' :
'0',
898 "default_pos" =>
"99992000",
901 'administration' => $isInAdministration ?
'1' :
'0',
903 'export' =>
$plugin->supportsExport(),
904 'offline_handling' =>
'0',
905 'orgunit_permissions' => $pl->useOrguPermissions() ?
'1' :
'0'
908 $parent_types = $pl->getParentTypes();
909 foreach ($parent_types as $parent_type) {
910 $this->obj_data[$parent_type][
"subobjects"][$pl_id] = [
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static getCreatableSubObjects(array $subobjects, $ref_id)
Filter the list of possible subobjects for the objects that actually could be created on a concrete n...
parses the objects.xml it handles the xml-description of all ilias objects
isSideBlock(string $obj_name)
Check, whether object type is a side block.
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type
allowLink(string $obj_name)
checks if linking of an object type is allowed
static getGroupedRepositoryObjectTypes($parent_obj_type)
getOrgUnitPermissionTypes()
Get object type with org unit position permission support.
isSystemObject(string $obj_name)
checks if object type is a system object
isAllowedInRepository(string $obj_name)
checks if object type can be used in repository context
static getComponentForType(string $obj_type)
Get component for object type.
readDefinitionData()
Read object definition data.
getDevModeAll()
get all object types in dev mode
getGroup(string $id)
Get Group information.
isActivePluginType(string $type)
Returns true if the given type is an active type of repositoryObject or Organisation Unit Extension p...
supportsOfflineHandling(string $obj_type)
check whether obj_type supports centralised offline handling
isInactivePlugin(string $type)
Check whether type belongs to inactive plugin.
handlerBeginTag($xml_parser, string $name, array $attribs)
isAllowedInWorkspace(string $obj_name)
checks if object type can be used in workspace context
getLTIProviderTypes()
Get object types which offer lti provider support.
readPluginData()
Loads the different plugins into the object definition.
getSubObjects(string $obj_type, bool $filter=true)
get all sub objects by type
allowExport(string $obj_name)
getTranslationType(string $obj_name)
get translation type (sys, db or null)
static getGroupedPluginObjectTypes(array $grouped_obj, string $slotId)
__filterObjects(array &$sub_objects)
stopInheritance(string $obj_name)
Does object permits stopping inheritance?
hasLocalRoles(string $obj_type)
Check whether the creation of local roles is allowed Currently disabled for type "root" and "adm".
getGroupOfObj(string $obj_name)
Get Group of object type.
ilComponentRepository $component_repository
hasCheckbox(string $obj_name)
should the object get a checkbox (needed for 'cut','copy' ...)
getSubobjectsToFilter(string $obj_type="adm")
get all subjects except (rolf) of the adm object This is necessary for filtering these objects in rol...
getCreatableSubObjects(string $obj_type, int $context=self::MODE_REPOSITORY, ?int $parent_ref_id=null)
getDevMode(string $obj_name)
get dev mode status by type
isContainer(string $obj_name)
Check if object type is container ('crs','fold','grp' ...)
isAdministrationObject(string $obj_name)
Check if administration object.
isRBACObject(string $obj_name)
get RBAC status by type returns true if object type is a RBAC object type
static getRepositoryObjectTypesForComponent(string $component_type, string $component_name)
Get all repository object types of component.
isPluginTypeName(string $str)
Check if given type is a plugin type name (starts with an "x")
getAllRepositoryTypes(bool $incl_adm=false)
get all RBAC object types
getPlugins()
Get plugin object info.
getAdvancedMetaDataTypes()
Get advanced meta data objects.
getAllObjects()
get all object types
getPositionByType(string $type)
Get Position By Object Type.
getExplorerContainerTypes()
Get all object types which are defined as container in an explorer context.
getLocation(string $obj_name)
handlerEndTag($xml_parser, string $name)
getClassName(string $obj_name)
allowCopy(string $obj_name)
checks if copying of an object type is allowed
isOrgUnitPermissionType(string $obj_type)
Check if object type offers org unit position support.
getSideBlockTypes(bool $filter_repository_types=true)
const MODE_ADMINISTRATION
handlerCharacterData($xml_parser, string $data)
parsePluginData(string $slotId, bool $isInAdministration)
loads a single plugin definition into the object definition
getSubObjectsRecursively(string $obj_type, bool $include_source_obj=true, bool $add_admin_objects=false)
Get all sub objects by type.
getSubObjectsAsString(string $obj_type)
get a string of all sub objects by type
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
Readable part of repository interface to ilComponentDataDB.
getPluginSlotById(string $id)
Get pluginslot by id.