ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 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...
 

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$

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

References $data.

Referenced by getSubObjects().

857  {
858  foreach($subobjects as $type => $data)
859  {
860  switch($type)
861  {
862  case "chat":
863  if(!$this->ilias->getSetting("chat_active"))
864  {
865  unset($subobjects[$type]);
866  }
867  break;
868 
869  case "icrs":
870  if(!$this->ilias->getSetting("ilinc_active"))
871  {
872  unset($subobjects[$type]);
873  }
874  break;
875 
876  default:
877  // DO NOTHING
878  }
879  }
880  }
redirection script todo: (a better solution should control the processing via a xml file) ...
+ 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 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 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

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

References $t.

1104  {
1105  $amet = array();
1106  foreach ($this->obj_data as $k => $v)
1107  {
1108  if ($v["amet"])
1109  {
1110  $amet[] = array("obj_type" => $k, "sub_type" => "");
1111  }
1112  }
1113 
1114  foreach ($this->sub_types as $type => $sub_types)
1115  {
1116  foreach ($sub_types as $t)
1117  {
1118  if ($t["amet"])
1119  {
1120  $amet[] = array("obj_type" => $type, "sub_type" => $t["sub_type"]);
1121  }
1122  }
1123  }
1124 
1125  return $amet;
1126  }

◆ getAllObjects()

ilObjectDefinition::getAllObjects ( )

get all object types

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

public

Returns
array object types set to development

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

References isRBACObject().

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
+ Here is the call graph for this function:

◆ getAllRepositoryTypes()

ilObjectDefinition::getAllRepositoryTypes (   $a_incl_adm = false)

get all RBAC object types

public

Returns
array object types set to development

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

References isAdministrationObject(), and isAllowedInRepository().

1044  {
1045  $types = array_keys($this->obj_data);
1046 
1047  foreach ($types as $type)
1048  {
1049  if ($this->isAllowedInRepository($type) &&
1050  (!$this->isAdministrationObject($type) || $a_incl_adm))
1051  {
1052  $rbactypes[] = $type;
1053  }
1054  }
1055 
1056  return $rbactypes ? $rbactypes : array();
1057  }
isAllowedInRepository($a_obj_name)
checks if object type can be used in repository context
isAdministrationObject($a_obj_name)
Check if administration object.
+ Here is the call graph for this function:

◆ getClassName()

ilObjectDefinition::getClassName (   $a_obj_name)

get class name by type

Parameters
stringobject type 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 937 of file class.ilObjectDefinition.php.

References $ilDB.

938  {
939  global $ilDB;
940 
941  $set = $ilDB->queryF("SELECT component FROM il_object_def WHERE id = %s",
942  array("text"), array($a_obj_type));
943 
944  if ($rec = $ilDB->fetchAssoc($set))
945  {
946  return $rec["component"];
947  }
948 
949  return "";
950  }
global $ilDB

◆ getCreatableSubObjects()

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

get only creatable subobjects by type

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

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

References getDevMode(), getSubObjects(), isAdministrationObject(), isAllowedInRepository(), isAllowedInWorkspace(), and isSystemObject().

717  {
718  $subobjects = $this->getSubObjects($a_obj_type);
719 
720  // remove role folder object from list
721  unset($subobjects["rolf"]);
722 
723  $sub_types = array_keys($subobjects);
724 
725  // remove object types in development from list
726  foreach ($sub_types as $type)
727  {
728  if ($this->getDevMode($type) || $this->isSystemObject($type))
729  {
730  unset($subobjects[$type]);
731  }
732  if ($a_context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type))
733  {
734  unset($subobjects[$type]);
735  }
736  if ($a_context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type))
737  {
738  unset($subobjects[$type]);
739  }
740  if ($a_context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type))
741  {
742  unset($subobjects[$type]);
743  }
744  // Filter for iLinc: Delete the following lines after we completely removed the iLinc object in ILIAS 4.5.x
745  if(in_array($type, array('icrs', 'icla')))
746  {
747  unset($subobjects[$type]);
748  }
749  }
750 
751  return $subobjects;
752  }
isAllowedInRepository($a_obj_name)
checks if object type can be used in repository context
isAdministrationObject($a_obj_name)
Check if administration object.
isSystemObject($a_obj_name)
checks if object type is a system object
getSubObjects($a_obj_type, $a_filter=true)
get all subobjects by type
getDevMode($a_obj_name)
get devmode status by type
isAllowedInWorkspace($a_obj_name)
checks if object type can be used in workspace context
+ Here is the call graph for this function:

◆ getDevMode()

ilObjectDefinition::getDevMode (   $a_obj_name)

get devmode status by type

Parameters
stringobject type public

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

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

403  {
404  return (bool) $this->obj_data[$a_obj_name]["devmode"];
405  }
+ Here is the caller graph for this function:

◆ getDevModeAll()

ilObjectDefinition::getDevModeAll ( )

get all object types in devmode

public

Returns
array object types set to development

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

References getDevMode().

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  }
getDevMode($a_obj_name)
get devmode status by type
+ 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 955 of file class.ilObjectDefinition.php.

References $ilDB, $ret, DB_FETCHMODE_ASSOC, ilCachedComponentData\getInstance(), IL_COMP_SERVICE, ilPlugin\lookupIdForName(), and ilUtil\sortArray().

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

◆ getLocation()

ilObjectDefinition::getLocation (   $a_obj_name)

get location by type

Parameters
stringobject type 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 1147 of file class.ilObjectDefinition.php.

References isPlugin().

1148  {
1149  $plugins = array();
1150  foreach((array) $this->obj_data as $type => $pl_data)
1151  {
1152  if($this->isPlugin($type))
1153  {
1154  $plugins[$type] = $pl_data;
1155  }
1156  }
1157  return $plugins;
1158  }
isPlugin($a_obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type ...
+ 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 1134 of file class.ilObjectDefinition.php.

References $ilSetting.

1135  {
1136  global $ilSetting;
1137 
1138  return ($ilSetting->get("obj_add_new_pos_".$a_type) > 0)
1139  ? (int) $ilSetting->get("obj_add_new_pos_".$a_type)
1140  : (int) $this->obj_data[$a_type]["default_pos"];
1141  }
global $ilSetting
Definition: privfeed.php:40

◆ getRepositoryObjectTypesForComponent()

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

Get all repository object types of component.

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

References $ilDB.

916  {
917  global $ilDB;
918 
919  $set = $ilDB->queryF("SELECT * FROM il_object_def WHERE component = %s",
920  array("text"), array($a_component_type."/".$a_component_name));
921 
922  $types = array();
923  while($rec = $ilDB->fetchAssoc($set))
924  {
925  if ($rec["system"] != 1)
926  {
927  $types[] = $rec;
928  }
929  }
930 
931  return $types;
932  }
global $ilDB

◆ getSubObjects()

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

get all subobjects by type

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

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

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

Referenced by getCreatableSubObjects(), and getSubObjectsRecursively().

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  }
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $ilSetting
Definition: privfeed.php:40
+ 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 public

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

References $data.

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

◆ 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 public
Returns
array list of allowed object types

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

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

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  }
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getSubObjects($a_obj_type, $a_filter=true)
get all subobjects by type
getDevMode($a_obj_name)
get devmode status by type
global $ilSetting
Definition: privfeed.php:40
isRBACObject($a_obj_name)
get RBAC status by type returns true if object type is a RBAC object type
+ Here is the call 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 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 public

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

References $ilDB, and DB_FETCHMODE_ASSOC.

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  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
global $ilDB

◆ handlerBeginTag()

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

start tag handler

Parameters
ressouceinternal xml_parser_handler
stringelement tag name
arrayelement attributes private

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

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

◆ handlerCharacterData()

ilObjectDefinition::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringdata private

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

839  {
840  }

◆ handlerEndTag()

ilObjectDefinition::handlerEndTag (   $a_xml_parser,
  $a_name 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringelement tag name private

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

850  {
851  $this->current_tag = '';
852  $this->current_tag_name = '';
853  }

◆ hasCheckbox()

ilObjectDefinition::hasCheckbox (   $a_obj_name)

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

Parameters
stringobject type 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 public

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

References readDefinitionData().

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

Referenced by getAllRepositoryTypes(), and getCreatableSubObjects().

1078  {
1079  return (bool) $this->obj_data[$a_obj_name]['administration'];
1080  }
+ 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 public
Returns
bool

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

Referenced by getAllRepositoryTypes(), and getCreatableSubObjects().

1033  {
1034  return (bool) $this->obj_data[$a_obj_name]["repository"];
1035  }
+ 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 public
Returns
bool

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

Referenced by getCreatableSubObjects().

1068  {
1069  return (bool) $this->obj_data[$a_obj_name]["workspace"];
1070  }
+ Here is the caller graph for this function:

◆ isContainer()

ilObjectDefinition::isContainer (   $a_obj_name)

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

public

Parameters
stringobject type
Returns
bool

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

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

◆ isInactivePlugin()

ilObjectDefinition::isInactivePlugin (   $a_type)

Check whether type belongs to inactive plugin.

Parameters

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

References isPlugin().

1089  {
1090  if (substr($a_type, 0, 1) == "x" && !$this->isPlugin($a_type))
1091  {
1092  return true;
1093  }
1094  return false;
1095  }
isPlugin($a_obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type ...
+ 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 public

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

Referenced by getPlugins(), and isInactivePlugin().

448  {
449  return (bool) isset($this->obj_data[$a_obj_name]["plugin"]);
450  }
+ 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 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 public

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

Referenced by getAllRBACObjects(), and getSubObjectsRecursively().

436  {
437  return (bool) $this->obj_data[$a_obj_name]["rbac"];
438  }
+ 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 906 of file class.ilObjectDefinition.php.

907  {
908  return (bool) $this->obj_data[$a_obj_name]["sideblock"];
909  }

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

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

Referenced by getCreatableSubObjects().

896  {
897  return (bool) $this->obj_data[$a_obj_name]["system"];
898  }
+ Here is the caller graph for this function:

◆ readDefinitionData()

ilObjectDefinition::readDefinitionData ( )

Read object definition data.

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

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

Referenced by ilObjectDefinition().

285  {
288  } else {
289  $this->readDefinitionDataFromDB();
290  }
291  }
static getInstance($component)
+ 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.

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

Referenced by readDefinitionData().

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  }
lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
const IL_COMP_SERVICE
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
+ 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.

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

Referenced by readDefinitionData().

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  }
lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
global $ilDB
const IL_COMP_SERVICE
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.
+ 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 private

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

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

◆ stopInheritance()

ilObjectDefinition::stopInheritance (   $a_obj_name)

Does object permits stopping inheritance?

Parameters
stringobject type 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()

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

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