ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjectDefinition Class Reference

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

+ Collaboration diagram for ilObjectDefinition:

Public Member Functions

 ilObjectDefinition ()
 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...
 
 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)
 Get grouped repository object types. More...
 

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

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

Member Function Documentation

◆ __filterObjects()

ilObjectDefinition::__filterObjects ( $subobjects)

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

859 {
860 foreach($subobjects as $type => $data)
861 {
862 switch($type)
863 {
864 default:
865 // DO NOTHING
866 }
867 }
868 }
$data

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

513 {
514 return (bool) $this->obj_data[$a_obj_name]["allow_copy"];
515 }

◆ allowExport()

ilObjectDefinition::allowExport (   $a_obj_name)

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

518 {
519 return (bool) $this->obj_data[$a_obj_name]['export'];
520 }

◆ allowLink()

ilObjectDefinition::allowLink (   $a_obj_name)

checks if linking of an object type is allowed

Parameters
stringobject type @access public

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

502 {
503 return (bool) $this->obj_data[$a_obj_name]["allow_link"];
504 }

◆ getAdvancedMetaDataTypes()

ilObjectDefinition::getAdvancedMetaDataTypes ( )

Get advanced meta data objects.

Parameters

return

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

1092 {
1093 $amet = array();
1094 foreach ($this->obj_data as $k => $v)
1095 {
1096 if ($v["amet"])
1097 {
1098 $amet[] = array("obj_type" => $k, "sub_type" => "");
1099 }
1100 }
1101
1102 foreach ($this->sub_types as $type => $sub_types)
1103 {
1104 foreach ($sub_types as $t)
1105 {
1106 if ($t["amet"])
1107 {
1108 $amet[] = array("obj_type" => $type, "sub_type" => $t["sub_type"]);
1109 }
1110 }
1111 }
1112
1113 return $amet;
1114 }

References $sub_types, and $t.

◆ getAllObjects()

ilObjectDefinition::getAllObjects ( )

get all object types

@access public

Returns
array object types

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

491 {
492 return array_keys($this->obj_data);
493 }

◆ getAllRBACObjects()

ilObjectDefinition::getAllRBACObjects ( )

get all RBAC object types

@access public

Returns
array object types set to development

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

470 {
471 $types = array_keys($this->obj_data);
472
473 foreach ($types as $type)
474 {
475 if ($this->isRBACObject($type))
476 {
477 $rbactypes[] = $type;
478 }
479 }
480
481 return $rbactypes ? $rbactypes : array();
482 }
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 1031 of file class.ilObjectDefinition.php.

1032 {
1033 $types = array_keys($this->obj_data);
1034
1035 foreach ($types as $type)
1036 {
1037 if ($this->isAllowedInRepository($type) &&
1038 (!$this->isAdministrationObject($type) || $a_incl_adm))
1039 {
1040 $rbactypes[] = $type;
1041 }
1042 }
1043
1044 return $rbactypes ? $rbactypes : array();
1045 }
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 302 of file class.ilObjectDefinition.php.

303 {
304 return $this->obj_data[$a_obj_name]["class_name"];
305 }

◆ getComponentForType()

static ilObjectDefinition::getComponentForType (   $a_obj_type)
static

Get component for object type.

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

926 {
927 global $ilDB;
928
929 $set = $ilDB->queryF("SELECT component FROM il_object_def WHERE id = %s",
930 array("text"), array($a_obj_type));
931
932 if ($rec = $ilDB->fetchAssoc($set))
933 {
934 return $rec["component"];
935 }
936
937 return "";
938 }
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 717 of file class.ilObjectDefinition.php.

718 {
719 $subobjects = $this->getSubObjects($a_obj_type);
720
721 // remove role folder object from list
722 unset($subobjects["rolf"]);
723
724 $sub_types = array_keys($subobjects);
725
726 // remove object types in development from list
727 foreach ($sub_types as $type)
728 {
729 if ($this->getDevMode($type) || $this->isSystemObject($type))
730 {
731 unset($subobjects[$type]);
732 }
733 if ($a_context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type))
734 {
735 unset($subobjects[$type]);
736 }
737 if ($a_context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type))
738 {
739 unset($subobjects[$type]);
740 }
741 if ($a_context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type))
742 {
743 unset($subobjects[$type]);
744 }
745 }
746
747 if ($a_obj_type == "prg") {
748 // ask study program which objects are allowed to create on the concrete node.
749 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
750 return ilObjStudyProgramme::getCreatableSubObjects($subobjects, $a_parent_ref_id);
751 }
752
753 return $subobjects;
754 }
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 402 of file class.ilObjectDefinition.php.

403 {
404 return (bool) $this->obj_data[$a_obj_name]["devmode"];
405 }

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

414 {
415 $types = array_keys($this->obj_data);
416
417 foreach ($types as $type)
418 {
419 if ($this->getDevMode($type))
420 {
421 $devtypes[] = $type;
422 }
423 }
424
425 return $devtypes ? $devtypes : array();
426 }

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

1154 {
1155 $res = $grp_map = $cnt_grp = array();
1156
1157 // all repository object types
1158 foreach ($this->getSubObjectsRecursively("root") as $rtype)
1159 {
1160 $type = $rtype["name"];
1161
1162 // obsolete
1163 if($type == "rolf")
1164 {
1165 continue;
1166 }
1167
1168 // gather group data
1169 $type_grp = $this->getGroupOfObj($type);
1170 if($type_grp)
1171 {
1172 $grp_map[$type_grp][] = $type;
1173 }
1174
1175 // add basic container types
1176 if($this->isContainer($type))
1177 {
1178 // add to cnt_grp
1179 if($type_grp)
1180 {
1181 $cnt_grp[] = $type_grp;
1182 }
1183
1184 $res[] = $type;
1185 }
1186 }
1187
1188 // add complete groups (cat => rcat, catr; crs => rcrs, crsr; ...)
1189 foreach($cnt_grp as $grp)
1190 {
1191 $res = array_merge($res, $grp_map[$grp]);
1192 }
1193
1194 // add very special case
1195 $res[] = "itgr";
1196
1197 return array_unique($res);
1198 }
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 322 of file class.ilObjectDefinition.php.

323 {
324 return $this->obj_group[$a_id];
325 }

◆ getGroupedRepositoryObjectTypes()

static ilObjectDefinition::getGroupedRepositoryObjectTypes (   $a_parent_obj_type)
static

Get grouped repository object types.

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

944 {
945 global $ilDB, $ilPluginAdmin;
946
947 $set = $ilDB->query("SELECT * FROM il_object_group");
948 $groups = array();
949 while ($gr_rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
950 {
951 $groups[$gr_rec["id"]] = $gr_rec;
952 }
953
954 $global_cache = ilCachedComponentData::getInstance();
955
956
957// if (!is_array($a_parent_obj_type))
958// {
959// $set = $ilDB->queryF("SELECT il_object_def.* FROM il_object_def, il_object_subobj ".
960// " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
961// " parent = %s ".
962// " AND subobj = id ", array("text"), array($a_parent_obj_type));
963// }
964// else
965// {
966// $q = "SELECT DISTINCT (id) as sid, il_object_def.* FROM il_object_def, il_object_subobj ".
967// " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
968// $ilDB->in("parent", $a_parent_obj_type, false, "text").
969// " AND subobj = id ";
970// $set = $ilDB->query($q);
971// }
972
973 $recs = $global_cache->lookupGroupedRepObj($a_parent_obj_type);
974
975 $grouped_obj = array();
976// while($rec = $ilDB->fetchAssoc($set))
977 foreach((array)$recs as $rec)
978 {
979 if ($rec["grp"] != "")
980 {
981 $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
982 $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
983 }
984 else
985 {
986 $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
987 $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
988 }
989 }
990//var_dump($grouped_obj);
991 // now get objects from repository plugin
992 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj");
993 foreach ($pl_names as $pl_name)
994 {
995 include_once("./Services/Component/classes/class.ilPlugin.php");
996 $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name);
997 if (!isset($grouped_obj[$pl_id]))
998 {
999 $grouped_obj[$pl_id] = array(
1000 "pos" => "99992000", // "unassigned" group
1001 "objs" => array(0 => $pl_id)
1002 );
1003 }
1004 }
1005
1006//var_dump($grouped_obj);
1007
1008 $ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true);
1009//var_dump($ret);
1010 return $ret;
1011 }
const IL_COMP_SERVICE
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

References $ilDB, $ret, DB_FETCHMODE_ASSOC, ilCachedComponentData\getInstance(), IL_COMP_SERVICE, ilPlugin\lookupIdForName(), 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 330 of file class.ilObjectDefinition.php.

331 {
332 return $this->obj_data[$a_obj_name]["group"];
333 }

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

315 {
316 return $this->obj_data[$a_obj_name]["location"];
317 }

◆ getPlugins()

ilObjectDefinition::getPlugins ( )

Get plugin object info.

Returns
type

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

1136 {
1137 $plugins = array();
1138 foreach((array) $this->obj_data as $type => $pl_data)
1139 {
1140 if($this->isPlugin($type))
1141 {
1142 $plugins[$type] = $pl_data;
1143 }
1144 }
1145 return $plugins;
1146 }
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 1122 of file class.ilObjectDefinition.php.

1123 {
1124 global $ilSetting;
1125
1126 return ($ilSetting->get("obj_add_new_pos_".$a_type) > 0)
1127 ? (int) $ilSetting->get("obj_add_new_pos_".$a_type)
1128 : (int) $this->obj_data[$a_type]["default_pos"];
1129 }
global $ilSetting
Definition: privfeed.php:40

References $ilSetting.

◆ getRepositoryObjectTypesForComponent()

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

Get all repository object types of component.

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

904 {
905 global $ilDB;
906
907 $set = $ilDB->queryF("SELECT * FROM il_object_def WHERE component = %s",
908 array("text"), array($a_component_type."/".$a_component_name));
909
910 $types = array();
911 while($rec = $ilDB->fetchAssoc($set))
912 {
913 if ($rec["system"] != 1)
914 {
915 $types[] = $rec;
916 }
917 }
918
919 return $types;
920 }

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

548 {
549 global $ilSetting;
550
551 $subs = array();
552
553 if ($subobjects = $this->obj_data[$a_obj_type]["subobjects"])
554 {
555 // Filter some objects e.g chat object are creatable if chat is active
556 if ($a_filter)
557 {
558 $this->__filterObjects($subobjects);
559 }
560 foreach ($subobjects as $data => $sub)
561 {
562 if ($sub["module"] != "n")
563 {
564 if (!($ilSetting->get("obj_dis_creation_".$data)))
565 {
566 $subs[$data] = $sub;
567
568 // determine position
569 $pos = ($ilSetting->get("obj_add_new_pos_".$data) > 0)
570 ? (int) $ilSetting->get("obj_add_new_pos_".$data)
571 : (int) $this->obj_data[$data]["default_pos"];
572 $subs[$data]["pos"] = $pos;
573 }
574 }
575 }
576
577 $subs2 = ilUtil::sortArray($subs, "pos", ASC, true, true);
578
579 return $subs2;
580 }
581
582 return $subs;
583 }

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

763 {
764 $string = "";
765
766 if (is_array($this->obj_data[$a_obj_type]["subobjects"]))
767 {
768 $data = array_keys($this->obj_data[$a_obj_type]["subobjects"]);
769
770 $string = "'".implode("','", $data)."'";
771 }
772
773 return $string;
774 }

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

599 {
600 global $ilSetting;
601
602 // This associative array is used to collect all subobject types.
603 // key=>type, value=data
604 $recursivesubs = array();
605
606 // This array is used to keep track of the object types, we
607 // need to call function getSubobjects() for.
608 $to_do = array($a_obj_type);
609
610 // This array is used to keep track of the object types, we
611 // have called function getSubobjects() already. This is to
612 // prevent endless loops, for object types that support
613 // themselves as subobject types either directly or indirectly.
614 $done = array();
615
616 while (count($to_do) > 0)
617 {
618 $type = array_pop($to_do);
619 $done[] = $type;
620
621 // no recovery folder subitems
622 if($type == 'recf')
623 {
624 continue;
625 }
626
627 // Hide administration if desired
628 if(!$a_add_admin_objects and $type == 'adm')
629 {
630 $subs = array();
631 }
632 else
633 {
634 $subs = $this->getSubObjects($type);
635 }
636 #vd('xxxxxxxxxxxxx'.$type);
637 foreach ($subs as $subtype => $data)
638 {
639 #vd('------------------------->'.$subtype);
640
641 // Hide role templates and folder from view
642 if($this->getDevMode($subtype) or !$this->isRBACObject($subtype))
643 {
644 continue;
645 }
646 if($subtype == 'rolt')
647 {
648 continue;
649 }
650 if(!$a_add_admin_objects and $subtype == 'adm')
651 {
652 continue;
653 }
654
655 $recursivesubs[$subtype] = $data;
656 if (! in_array($subtype, $done)
657 && ! in_array($subtype, $to_do))
658 {
659 $to_do[] = $subtype;
660 }
661 }
662 }
663
664 if($a_include_source_obj)
665 {
666 if(!isset($recursivesubs[$a_obj_type]))
667 {
668 $recursivesubs[$a_obj_type]['name'] = $a_obj_type;
669 $recursivesubs[$a_obj_type]['lng'] = $a_obj_type;
670 $recursivesubs[$a_obj_type]['max'] = 0;
671 $recursivesubs[$a_obj_type]['pos'] = -1;
672 }
673 }
674 return ilUtil::sortArray($recursivesubs, "pos", ASC, true, true);
675 }

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

688 {
689 foreach($this->obj_data[$a_obj_type]["subobjects"] as $key => $value)
690 {
691 switch($key)
692 {
693 case "rolf":
694 // DO NOTHING
695 break;
696
697 default:
698 $tmp_subs[] = $key;
699 }
700 }
701 // ADD adm and root object
702 $tmp_subs[] = "adm";
703 #$tmp_subs[] = "root";
704
705 return $tmp_subs ? $tmp_subs : array();
706 }

◆ getTranslationType()

ilObjectDefinition::getTranslationType (   $a_obj_name)

get translation type (sys, db or 0)s

Parameters
stringobject type @access public

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

353 {
354 global $ilDB;
355
356 if ($a_obj_name == "root")
357 {
358 if (!isset($this->root_trans_type))
359 {
360 $q = "SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = ".
361 $ilDB->quote(ROOT_FOLDER_ID,'integer')." ";
362 $set = $ilDB->query($q);
363 $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
364 if($rec["cnt"] > 0)
365 {
366 $this->root_trans_type = "db";
367 }
368 else
369 {
370 $this->root_trans_type = $this->obj_data[$a_obj_name]["translate"];
371 }
372 }
373 return $this->root_trans_type;
374 }
375
376 if (isset($this->obj_data[$a_obj_name]))
377 {
378 return $this->obj_data[$a_obj_name]["translate"];
379 }
380
381 return "";
382 }

References $ilDB, and DB_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 816 of file class.ilObjectDefinition.php.

817 {
818 switch ($a_name)
819 {
820 case 'object':
821 $this->parent_tag_name = $a_attribs["name"];
822 break;
823 case 'property':
824 $this->current_tag = "property";
825 $this->current_tag_name = $a_attribs["name"];
826// $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["name"] = $a_attribs["name"];
827 $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $a_attribs["module"];
828//echo '<br>$this->obj_data["'.$this->parent_tag_name.'"]["properties"]["'.$this->current_tag_name.'"]["module"] = "'.$a_attribs["module"].'";';
829 break;
830 }
831 }

◆ handlerCharacterData()

ilObjectDefinition::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringdata @access private

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

841 {
842 }

◆ handlerEndTag()

ilObjectDefinition::handlerEndTag (   $a_xml_parser,
  $a_name 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringelement tag name @access private

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

852 {
853 $this->current_tag = '';
854 $this->current_tag_name = '';
855 }

◆ hasCheckbox()

ilObjectDefinition::hasCheckbox (   $a_obj_name)

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

Parameters
stringobject type @access public

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

342 {
343 return (bool) $this->obj_data[$a_obj_name]["checkbox"];
344 }

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

528 {
529 switch($a_obj_type)
530 {
531 case 'root':
532 return FALSE;
533
534 default:
535 return TRUE;
536 }
537 }

◆ ilObjectDefinition()

ilObjectDefinition::ilObjectDefinition ( )

Constructor.

setup ILIAS global object @access public

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

51 {
52 global $ilias;
53
54 $this->readDefinitionData();
55 $this->ilias = $ilias;
56
57 //parent::ilSaxParser(ILIAS_ABSOLUTE_PATH."/objects.xml");
58
59 // removing this line leads to segmentation faults in
60 // learning module editor with
61 // - PHP 5.2.1, libxml 2.6.22, libxslt 1.1.15 (MacOsX)
62 // - PHP 5.2.1, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
63 // - PHP 5.2.5, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
64 // - PHP 5.2.0-8+etch7, libxml 2.6.27, libxslt 1.1.19
65 // - PHP 5.2.0, libxml, libxml 2.6.26, libxslt 1.1.17 (OpenSuse 10.2)
66 // (needs further investigation)
67 // OK with:
68 // - PHP 5.1.2, libxml 2.6.24, libxslt 1.1.15
69
70 //
71 // Replacing all "=&" with "=" in xml5compliance seems to solve the problem
72 //
73
74// $this->startParsing();
75 }
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:

◆ isAdministrationObject()

ilObjectDefinition::isAdministrationObject (   $a_obj_name)

Check if administration object.

Parameters
string$a_obj_name
Returns
bool

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

1066 {
1067 return (bool) $this->obj_data[$a_obj_name]['administration'];
1068 }

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

1021 {
1022 return (bool) $this->obj_data[$a_obj_name]["repository"];
1023 }

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

1056 {
1057 return (bool) $this->obj_data[$a_obj_name]["workspace"];
1058 }

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

785 {
786 if(!is_array($this->obj_data[$a_obj_name]['subobjects']))
787 {
788 return false;
789 }
790 return count($this->obj_data[$a_obj_name]['subobjects']) >= 1 ? true : false;
791 }

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

1077 {
1078 if (substr($a_type, 0, 1) == "x" && !$this->isPlugin($a_type))
1079 {
1080 return true;
1081 }
1082 return false;
1083 }

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

448 {
449 return (bool) isset($this->obj_data[$a_obj_name]["plugin"]);
450 }

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

459 {
460 return (substr($a_str, 0, 1) == "x");
461 }

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

436 {
437 return (bool) $this->obj_data[$a_obj_name]["rbac"];
438 }

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

895 {
896 return (bool) $this->obj_data[$a_obj_name]["sideblock"];
897 }

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

884 {
885 return (bool) $this->obj_data[$a_obj_name]["system"];
886 }

Referenced by getCreatableSubObjects().

+ Here is the caller graph for this function:

◆ readDefinitionData()

ilObjectDefinition::readDefinitionData ( )

Read object definition data.

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

285 {
288 } else {
290 }
291 }
static getInstance($component)

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

Referenced by ilObjectDefinition().

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

◆ readDefinitionDataFromCache()

ilObjectDefinition::readDefinitionDataFromCache ( )
protected

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

78 {
79 global $ilPluginAdmin;
80
81 $this->obj_data = array();
82 $defIds = array();
83 $global_cache = ilCachedComponentData::getInstance();
84 foreach ($global_cache->getIlobjectDef() as $rec) {
85 $this->obj_data[$rec["id"]] = array(
86 "name" => $rec["id"],
87 "class_name" => $rec["class_name"],
88 "location" => $rec["location"],
89 "checkbox" => $rec["checkbox"],
90 "inherit" => $rec["inherit"],
91 "component" => $rec["component"],
92 "translate" => $rec["translate"],
93 "devmode" => $rec["devmode"],
94 "allow_link" => $rec["allow_link"],
95 "allow_copy" => $rec["allow_copy"],
96 "rbac" => $rec["rbac"],
97 "group" => $rec["grp"],
98 "system" => $rec["system"],
99 "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
100 "sideblock" => $rec["sideblock"],
101 'export' => $rec['export'],
102 'repository' => $rec['repository'],
103 'workspace' => $rec['workspace'],
104 'administration' => $rec['administration'],
105 'amet' => $rec['amet']
106 );
107 $this->obj_data[$rec["id"]]["subobjects"] = array();
108
109 $defIds[] = $rec["id"];
110 }
111
112 $subobj = $global_cache->lookupSubObjForParent($defIds);
113
114 foreach ($subobj as $rec2) {
115
116 $max = $rec2["mmax"];
117 if ($max <= 0) {
118 $max = "";
119 }
120 $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
121 "name" => $rec2["subobj"],
122 "max" => $max,
123 "lng" => $rec2["subobj"]
124 );
125 }
126 $this->obj_group = $global_cache->getIlObjectGroup();
127
128 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj");
129 foreach ($pl_names as $pl_name) {
130 include_once("./Services/Component/classes/class.ilPlugin.php");
131 $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name);
132 if ($pl_id != "" && ! isset($this->obj_data[$pl_id])) {
133 include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
134 $loc = ilPlugin::_getDirectory(IL_COMP_SERVICE, "Repository", "robj", $pl_name) . "/classes";
135
136 $this->obj_data[$pl_id] = array(
137 "name" => $pl_id,
138 "class_name" => $pl_name,
139 "plugin" => "1",
140 "location" => $loc,
141 "checkbox" => "1",
142 "inherit" => "0",
143 "component" => "",
144 "translate" => "0",
145 "devmode" => "0",
146 "allow_link" => "1",
147 "allow_copy" => "0",
148 "rbac" => "1",
149 "group" => NULL,
150 "system" => "0",
151 "default_pos" => "99992000", // "unassigned" group
152 'repository' => '1',
153 'workspace' => '0',
154 'administration' => '0',
155 "sideblock" => "0"
156 );
157 $this->obj_data[$rec["id"]]["subobjects"] = array();
158
159 // plugins have to be marked as such - see ilContainerGUI::showPossibleSubObjects()
160 $this->obj_data["crs"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
161 $this->obj_data["fold"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
162 $this->obj_data["grp"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
163 $this->obj_data["cat"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
164 $this->obj_data["root"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
165 }
166 }
167
168 $this->sub_types = $global_cache->getIlObjectSubType();
169 }
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.

References ilPlugin\_getDirectory(), ilCachedComponentData\getInstance(), IL_COMP_SERVICE, and ilPlugin\lookupIdForName().

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

172 {
173 global $ilDB, $ilPluginAdmin;
174
175 $this->obj_data = array();
176
177 // Select all object_definitions and collect the definition id's in
178 // this array.
179 $defIds = array();
180 $set = $ilDB->query("SELECT * FROM il_object_def");
181 while ($rec = $ilDB->fetchAssoc($set)) {
182 $this->obj_data[$rec["id"]] = array(
183 "name" => $rec["id"],
184 "class_name" => $rec["class_name"],
185 "location" => $rec["location"],
186 "checkbox" => $rec["checkbox"],
187 "inherit" => $rec["inherit"],
188 "component" => $rec["component"],
189 "translate" => $rec["translate"],
190 "devmode" => $rec["devmode"],
191 "allow_link" => $rec["allow_link"],
192 "allow_copy" => $rec["allow_copy"],
193 "rbac" => $rec["rbac"],
194 "group" => $rec["grp"],
195 "system" => $rec["system"],
196 "default_pos" => "9999" . str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
197 "sideblock" => $rec["sideblock"],
198 'export' => $rec['export'],
199 'repository' => $rec['repository'],
200 'workspace' => $rec['workspace'],
201 'administration' => $rec['administration'],
202 'amet' => $rec['amet']
203 );
204 $this->obj_data[$rec["id"]]["subobjects"] = array();
205
206 $defIds[] = $rec["id"];
207 }
208
209 // get all subobject definitions in a single query
210 $set2 = $ilDB->query("SELECT * FROM il_object_subobj WHERE " . $ilDB->in('parent', $defIds, false, 'text'));
211 while ($rec2 = $ilDB->fetchAssoc($set2)) {
212 $max = $rec2["mmax"];
213 if ($max <= 0) // for backward compliance
214 {
215 $max = "";
216 }
217 $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
218 "name" => $rec2["subobj"],
219 "max" => $max,
220 "lng" => $rec2["subobj"]
221 );
222 }
223
224 $set = $ilDB->query("SELECT * FROM il_object_group");
225 $this->obj_group = array();
226 while ($rec = $ilDB->fetchAssoc($set)) {
227 $this->obj_group[$rec["id"]] = $rec;
228 }
229
230 // now get objects from repository plugin
231 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj");
232 foreach ($pl_names as $pl_name) {
233 include_once("./Services/Component/classes/class.ilPlugin.php");
234 $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name);
235 if ($pl_id != "" && ! isset($this->obj_data[$pl_id])) {
236 include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
237 $loc = ilPlugin::_getDirectory(IL_COMP_SERVICE, "Repository", "robj", $pl_name) . "/classes";
238
239 $this->obj_data[$pl_id] = array(
240 "name" => $pl_id,
241 "class_name" => $pl_name,
242 "plugin" => "1",
243 "location" => $loc,
244 "checkbox" => "1",
245 "inherit" => "0",
246 "component" => "",
247 "translate" => "0",
248 "devmode" => "0",
249 "allow_link" => "1",
250 "allow_copy" => "0",
251 "rbac" => "1",
252 "group" => NULL,
253 "system" => "0",
254 "default_pos" => "99992000", // "unassigned" group
255 'repository' => '1',
256 'workspace' => '0',
257 'administration' => '0',
258 "sideblock" => "0"
259 );
260 $this->obj_data[$rec["id"]]["subobjects"] = array();
261
262 // plugins have to be marked as such - see ilContainerGUI::showPossibleSubObjects()
263 $this->obj_data["crs"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
264 $this->obj_data["fold"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
265 $this->obj_data["grp"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
266 $this->obj_data["cat"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
267 $this->obj_data["root"]["subobjects"][$pl_id] = array( "name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true );
268 }
269 }
270 //var_dump($this->obj_data["root"]["subobjects"]);
271 //var_dump($this->obj_data2["root"]);
272
273 $set = $ilDB->query("SELECT * FROM il_object_sub_type ");
274 $this->sub_types = array();
275 while ($rec = $ilDB->fetchAssoc($set)) {
276 $this->sub_types[$rec["obj_type"]][] = $rec;
277 }
278 }

References $ilDB, ilPlugin\_getDirectory(), IL_COMP_SERVICE, and ilPlugin\lookupIdForName().

Referenced by readDefinitionData().

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

802 {
803 xml_set_object($a_xml_parser,$this);
804 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
805 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
806 }

◆ stopInheritance()

ilObjectDefinition::stopInheritance (   $a_obj_name)

Does object permits stopping inheritance?

Parameters
stringobject type @access public

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

392 {
393 return (bool) $this->obj_data[$a_obj_name]["inherit"];
394 }

Field Documentation

◆ $obj_data

ilObjectDefinition::$obj_data

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

◆ $obj_id

ilObjectDefinition::$obj_id

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

◆ $parent

ilObjectDefinition::$parent

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

◆ $sub_types

ilObjectDefinition::$sub_types = array()

◆ MODE_ADMINISTRATION

const ilObjectDefinition::MODE_ADMINISTRATION = 3

Definition at line 42 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: