ILIAS  release_4-4 Revision
ilObjectDefinition Class Reference

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

+ Inheritance diagram for ilObjectDefinition:
+ 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...
 
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. 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
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Additional Inherited Members

- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

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

References $data.

Referenced by getSubObjects().

757  {
758  foreach($subobjects as $type => $data)
759  {
760  switch($type)
761  {
762  case "chat":
763  if(!$this->ilias->getSetting("chat_active"))
764  {
765  unset($subobjects[$type]);
766  }
767  break;
768 
769  case "icrs":
770  if(!$this->ilias->getSetting("ilinc_active"))
771  {
772  unset($subobjects[$type]);
773  }
774  break;
775 
776  default:
777  // DO NOTHING
778  }
779  }
780  }
redirection script todo: (a better solution should control the processing via a xml file) ...
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ 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 419 of file class.ilObjectDefinition.php.

420  {
421  return (bool) $this->obj_data[$a_obj_name]["allow_copy"];
422  }

◆ allowExport()

ilObjectDefinition::allowExport (   $a_obj_name)

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

425  {
426  return (bool) $this->obj_data[$a_obj_name]['export'];
427  }

◆ allowLink()

ilObjectDefinition::allowLink (   $a_obj_name)

checks if linking of an object type is allowed

Parameters
stringobject type public

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

409  {
410  return (bool) $this->obj_data[$a_obj_name]["allow_link"];
411  }

◆ getAdvancedMetaDataTypes()

ilObjectDefinition::getAdvancedMetaDataTypes ( )

Get advanced meta data objects.

Parameters

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

References $t.

998  {
999  $amet = array();
1000  foreach ($this->obj_data as $k => $v)
1001  {
1002  if ($v["amet"])
1003  {
1004  $amet[] = array("obj_type" => $k, "sub_type" => "");
1005  }
1006  }
1007 
1008  foreach ($this->sub_types as $type => $sub_types)
1009  {
1010  foreach ($sub_types as $t)
1011  {
1012  if ($t["amet"])
1013  {
1014  $amet[] = array("obj_type" => $type, "sub_type" => $t["sub_type"]);
1015  }
1016  }
1017  }
1018 
1019  return $amet;
1020  }

◆ getAllObjects()

ilObjectDefinition::getAllObjects ( )

get all object types

public

Returns
array object types

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

398  {
399  return array_keys($this->obj_data);
400  }

◆ getAllRBACObjects()

ilObjectDefinition::getAllRBACObjects ( )

get all RBAC object types

public

Returns
array object types set to development

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

References isRBACObject().

377  {
378  $types = array_keys($this->obj_data);
379 
380  foreach ($types as $type)
381  {
382  if ($this->isRBACObject($type))
383  {
384  $rbactypes[] = $type;
385  }
386  }
387 
388  return $rbactypes ? $rbactypes : array();
389  }
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 937 of file class.ilObjectDefinition.php.

References isAdministrationObject(), and isAllowedInRepository().

938  {
939  $types = array_keys($this->obj_data);
940 
941  foreach ($types as $type)
942  {
943  if ($this->isAllowedInRepository($type) &&
944  (!$this->isAdministrationObject($type) || $a_incl_adm))
945  {
946  $rbactypes[] = $type;
947  }
948  }
949 
950  return $rbactypes ? $rbactypes : array();
951  }
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 209 of file class.ilObjectDefinition.php.

210  {
211  return $this->obj_data[$a_obj_name]["class_name"];
212  }

◆ getComponentForType()

static ilObjectDefinition::getComponentForType (   $a_obj_type)
static

Get component for object type.

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

838  {
839  global $ilDB;
840 
841  $set = $ilDB->queryF("SELECT component FROM il_object_def WHERE id = %s",
842  array("text"), array($a_obj_type));
843 
844  if ($rec = $ilDB->fetchAssoc($set))
845  {
846  return $rec["component"];
847  }
848 
849  return "";
850  }

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

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

617  {
618  $subobjects = $this->getSubObjects($a_obj_type);
619 
620  // remove role folder object from list
621  unset($subobjects["rolf"]);
622 
623  $sub_types = array_keys($subobjects);
624 
625  // remove object types in development from list
626  foreach ($sub_types as $type)
627  {
628  if ($this->getDevMode($type) || $this->isSystemObject($type))
629  {
630  unset($subobjects[$type]);
631  }
632  if ($a_context == self::MODE_REPOSITORY && !$this->isAllowedInRepository($type))
633  {
634  unset($subobjects[$type]);
635  }
636  if ($a_context == self::MODE_WORKSPACE && !$this->isAllowedInWorkspace($type))
637  {
638  unset($subobjects[$type]);
639  }
640  if ($a_context == self::MODE_ADMINISTRATION && !$this->isAdministrationObject($type))
641  {
642  unset($subobjects[$type]);
643  }
644  // Filter for iLinc: Delete the following lines after we completely removed the iLinc object in ILIAS 4.5.x
645  if(in_array($type, array('icrs', 'icla')))
646  {
647  unset($subobjects[$type]);
648  }
649  }
650 
651  return $subobjects;
652  }
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 309 of file class.ilObjectDefinition.php.

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

310  {
311  return (bool) $this->obj_data[$a_obj_name]["devmode"];
312  }
+ 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 320 of file class.ilObjectDefinition.php.

References getDevMode().

321  {
322  $types = array_keys($this->obj_data);
323 
324  foreach ($types as $type)
325  {
326  if ($this->getDevMode($type))
327  {
328  $devtypes[] = $type;
329  }
330  }
331 
332  return $devtypes ? $devtypes : array();
333  }
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 229 of file class.ilObjectDefinition.php.

230  {
231  return $this->obj_group[$a_id];
232  }

◆ getGroupedRepositoryObjectTypes()

static ilObjectDefinition::getGroupedRepositoryObjectTypes (   $a_parent_obj_type)
static

Get grouped repository object types.

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

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

856  {
857  global $ilDB, $ilPluginAdmin;
858 
859  $set = $ilDB->query("SELECT * FROM il_object_group");
860  $groups = array();
861  while ($gr_rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
862  {
863  $groups[$gr_rec["id"]] = $gr_rec;
864  }
865 
866  if (!is_array($a_parent_obj_type))
867  {
868  $set = $ilDB->queryF("SELECT il_object_def.* FROM il_object_def, il_object_subobj ".
869  " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
870  " parent = %s ".
871  " AND subobj = id ", array("text"), array($a_parent_obj_type));
872  }
873  else
874  {
875  $q = "SELECT DISTINCT (id) as sid, il_object_def.* FROM il_object_def, il_object_subobj ".
876  " WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
877  $ilDB->in("parent", $a_parent_obj_type, false, "text").
878  " AND subobj = id ";
879  $set = $ilDB->query($q);
880  }
881 
882  $grouped_obj = array();
883  while($rec = $ilDB->fetchAssoc($set))
884  {
885  if ($rec["grp"] != "")
886  {
887  $grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
888  $grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
889  }
890  else
891  {
892  $grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
893  $grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
894  }
895  }
896 //var_dump($grouped_obj);
897  // now get objects from repository plugin
898  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj");
899  foreach ($pl_names as $pl_name)
900  {
901  include_once("./Services/Component/classes/class.ilPlugin.php");
902  $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name);
903  if (!isset($grouped_obj[$pl_id]))
904  {
905  $grouped_obj[$pl_id] = array(
906  "pos" => "99992000", // "unassigned" group
907  "objs" => array(0 => $pl_id)
908  );
909  }
910  }
911 
912 //var_dump($grouped_obj);
913 
914  $ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true);
915 //var_dump($ret);
916  return $ret;
917  }
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
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 237 of file class.ilObjectDefinition.php.

238  {
239  return $this->obj_data[$a_obj_name]["group"];
240  }

◆ getLocation()

ilObjectDefinition::getLocation (   $a_obj_name)

get location by type

Parameters
stringobject type public

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

222  {
223  return $this->obj_data[$a_obj_name]["location"];
224  }

◆ getRepositoryObjectTypesForComponent()

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

Get all repository object types of component.

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

816  {
817  global $ilDB;
818 
819  $set = $ilDB->queryF("SELECT * FROM il_object_def WHERE component = %s",
820  array("text"), array($a_component_type."/".$a_component_name));
821 
822  $types = array();
823  while($rec = $ilDB->fetchAssoc($set))
824  {
825  if ($rec["system"] != 1)
826  {
827  $types[] = $rec;
828  }
829  }
830 
831  return $types;
832  }

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

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

Referenced by getCreatableSubObjects(), and getSubObjectsRecursively().

448  {
449  global $ilSetting;
450 
451  $subs = array();
452 
453  if ($subobjects = $this->obj_data[$a_obj_type]["subobjects"])
454  {
455  // Filter some objects e.g chat object are creatable if chat is active
456  if ($a_filter)
457  {
458  $this->__filterObjects($subobjects);
459  }
460  foreach ($subobjects as $data => $sub)
461  {
462  if ($sub["module"] != "n")
463  {
464  if (!($ilSetting->get("obj_dis_creation_".$data)))
465  {
466  $subs[$data] = $sub;
467 
468  // determine position
469  $pos = ($ilSetting->get("obj_add_new_pos_".$data) > 0)
470  ? (int) $ilSetting->get("obj_add_new_pos_".$data)
471  : (int) $this->obj_data[$data]["default_pos"];
472  $subs[$data]["pos"] = $pos;
473  }
474  }
475  }
476 
477  $subs2 = ilUtil::sortArray($subs, "pos", ASC, true, true);
478 
479  return $subs2;
480  }
481 
482  return $subs;
483  }
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
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 660 of file class.ilObjectDefinition.php.

References $data.

661  {
662  $string = "";
663 
664  if (is_array($this->obj_data[$a_obj_type]["subobjects"]))
665  {
666  $data = array_keys($this->obj_data[$a_obj_type]["subobjects"]);
667 
668  $string = "'".implode("','", $data)."'";
669  }
670 
671  return $string;
672  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $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 public
Returns
array list of allowed object types

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

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

499  {
500  global $ilSetting;
501 
502  // This associative array is used to collect all subobject types.
503  // key=>type, value=data
504  $recursivesubs = array();
505 
506  // This array is used to keep track of the object types, we
507  // need to call function getSubobjects() for.
508  $to_do = array($a_obj_type);
509 
510  // This array is used to keep track of the object types, we
511  // have called function getSubobjects() already. This is to
512  // prevent endless loops, for object types that support
513  // themselves as subobject types either directly or indirectly.
514  $done = array();
515 
516  while (count($to_do) > 0)
517  {
518  $type = array_pop($to_do);
519  $done[] = $type;
520 
521  // no recovery folder subitems
522  if($type == 'recf')
523  {
524  continue;
525  }
526 
527  // Hide administration if desired
528  if(!$a_add_admin_objects and $type == 'adm')
529  {
530  $subs = array();
531  }
532  else
533  {
534  $subs = $this->getSubObjects($type);
535  }
536  #vd('xxxxxxxxxxxxx'.$type);
537  foreach ($subs as $subtype => $data)
538  {
539  #vd('------------------------->'.$subtype);
540 
541  // Hide role templates and folder from view
542  if($this->getDevMode($subtype) or !$this->isRBACObject($subtype))
543  {
544  continue;
545  }
546  if($subtype == 'rolf' or $subtype == 'rolt')
547  {
548  continue;
549  }
550  if(!$a_add_admin_objects and $subtype == 'adm')
551  {
552  continue;
553  }
554 
555  $recursivesubs[$subtype] = $data;
556  if (! in_array($subtype, $done)
557  && ! in_array($subtype, $to_do))
558  {
559  $to_do[] = $subtype;
560  }
561  }
562  }
563 
564  if($a_include_source_obj)
565  {
566  if(!isset($recursivesubs[$a_obj_type]))
567  {
568  $recursivesubs[$a_obj_type]['name'] = $a_obj_type;
569  $recursivesubs[$a_obj_type]['lng'] = $a_obj_type;
570  $recursivesubs[$a_obj_type]['max'] = 0;
571  $recursivesubs[$a_obj_type]['pos'] = -1;
572  }
573  }
574  return ilUtil::sortArray($recursivesubs, "pos", ASC, true, true);
575  }
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
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
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 587 of file class.ilObjectDefinition.php.

588  {
589  foreach($this->obj_data[$a_obj_type]["subobjects"] as $key => $value)
590  {
591  switch($key)
592  {
593  case "rolf":
594  // DO NOTHING
595  break;
596 
597  default:
598  $tmp_subs[] = $key;
599  }
600  }
601  // ADD adm and root object
602  $tmp_subs[] = "adm";
603  #$tmp_subs[] = "root";
604 
605  return $tmp_subs ? $tmp_subs : array();
606  }

◆ getTranslationType()

ilObjectDefinition::getTranslationType (   $a_obj_name)

get translation type (sys, db or 0)s

Parameters
stringobject type public

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

References DB_FETCHMODE_ASSOC.

260  {
261  global $ilDB;
262 
263  if ($a_obj_name == "root")
264  {
265  if (!isset($this->root_trans_type))
266  {
267  $q = "SELECT count(obj_id) cnt FROM object_translation WHERE obj_id = ".
268  $ilDB->quote(ROOT_FOLDER_ID,'integer')." ";
269  $set = $ilDB->query($q);
270  $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
271  if($rec["cnt"] > 0)
272  {
273  $this->root_trans_type = "db";
274  }
275  else
276  {
277  $this->root_trans_type = $this->obj_data[$a_obj_name]["translate"];
278  }
279  }
280  return $this->root_trans_type;
281  }
282 
283  if (isset($this->obj_data[$a_obj_name]))
284  {
285  return $this->obj_data[$a_obj_name]["translate"];
286  }
287 
288  return "";
289  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10

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

715  {
716  switch ($a_name)
717  {
718  case 'object':
719  $this->parent_tag_name = $a_attribs["name"];
720  break;
721  case 'property':
722  $this->current_tag = "property";
723  $this->current_tag_name = $a_attribs["name"];
724 // $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["name"] = $a_attribs["name"];
725  $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $a_attribs["module"];
726 //echo '<br>$this->obj_data["'.$this->parent_tag_name.'"]["properties"]["'.$this->current_tag_name.'"]["module"] = "'.$a_attribs["module"].'";';
727  break;
728  }
729  }

◆ handlerCharacterData()

ilObjectDefinition::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringdata private

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

739  {
740  }

◆ handlerEndTag()

ilObjectDefinition::handlerEndTag (   $a_xml_parser,
  $a_name 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringelement tag name private

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

750  {
751  $this->current_tag = '';
752  $this->current_tag_name = '';
753  }

◆ hasCheckbox()

ilObjectDefinition::hasCheckbox (   $a_obj_name)

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

Parameters
stringobject type public

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

249  {
250  return (bool) $this->obj_data[$a_obj_name]["checkbox"];
251  }

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

435  {
436  return isset($this->obj_data[$a_obj_type]['subobjects']['rolf']);
437  }

◆ ilObjectDefinition()

ilObjectDefinition::ilObjectDefinition ( )

Constructor.

setup ILIAS global object public

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

References ilSaxParser\$ilias, ILIAS_ABSOLUTE_PATH, and readDefinitionData().

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

Referenced by getAllRepositoryTypes(), and getCreatableSubObjects().

972  {
973  return (bool) $this->obj_data[$a_obj_name]['administration'];
974  }
+ 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 926 of file class.ilObjectDefinition.php.

Referenced by getAllRepositoryTypes(), and getCreatableSubObjects().

927  {
928  return (bool) $this->obj_data[$a_obj_name]["repository"];
929  }
+ 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 961 of file class.ilObjectDefinition.php.

Referenced by getCreatableSubObjects().

962  {
963  return (bool) $this->obj_data[$a_obj_name]["workspace"];
964  }
+ 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 682 of file class.ilObjectDefinition.php.

683  {
684  if(!is_array($this->obj_data[$a_obj_name]['subobjects']))
685  {
686  return false;
687  }
688  return count($this->obj_data[$a_obj_name]['subobjects']) > 1 ? true : false;
689  }

◆ isInactivePlugin()

ilObjectDefinition::isInactivePlugin (   $a_type)

Check whether type belongs to inactive plugin.

Parameters

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

References isPlugin().

983  {
984  if (substr($a_type, 0, 1) == "x" && !$this->isPlugin($a_type))
985  {
986  return true;
987  }
988  return false;
989  }
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 354 of file class.ilObjectDefinition.php.

Referenced by isInactivePlugin().

355  {
356  return (bool) isset($this->obj_data[$a_obj_name]["plugin"]);
357  }
+ 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 365 of file class.ilObjectDefinition.php.

366  {
367  return (substr($a_str, 0, 1) == "x");
368  }

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

Referenced by getAllRBACObjects(), and getSubObjectsRecursively().

343  {
344  return (bool) $this->obj_data[$a_obj_name]["rbac"];
345  }
+ 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 806 of file class.ilObjectDefinition.php.

807  {
808  return (bool) $this->obj_data[$a_obj_name]["sideblock"];
809  }

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

Referenced by getCreatableSubObjects().

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

◆ readDefinitionData()

ilObjectDefinition::readDefinitionData ( )

Read object definition data.

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

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

Referenced by ilObjectDefinition().

83  {
84  global $ilDB, $ilPluginAdmin;
85 
86  $this->obj_data = array();
87 
88 
89  // Select all object_definitions and collect the definition id's in
90  // this array.
91  $defIds = array();
92  $set = $ilDB->query("SELECT * FROM il_object_def");
93  while ($rec = $ilDB->fetchAssoc($set))
94  {
95  $this->obj_data[$rec["id"]] = array(
96  "name" => $rec["id"],
97  "class_name" => $rec["class_name"],
98  "location" => $rec["location"],
99  "checkbox" => $rec["checkbox"],
100  "inherit" => $rec["inherit"],
101  "component" => $rec["component"],
102  "translate" => $rec["translate"],
103  "devmode" => $rec["devmode"],
104  "allow_link" => $rec["allow_link"],
105  "allow_copy" => $rec["allow_copy"],
106  "rbac" => $rec["rbac"],
107  "group" => $rec["grp"],
108  "system" => $rec["system"],
109  "default_pos" => "9999".str_pad($rec["default_pos"], 4, "0", STR_PAD_LEFT), // "unassigned" group
110  "sideblock" => $rec["sideblock"],
111  'export' => $rec['export'],
112  'repository' => $rec['repository'],
113  'workspace' => $rec['workspace'],
114  'administration' => $rec['administration'],
115  'amet' => $rec['amet']
116  );
117  $this->obj_data[$rec["id"]]["subobjects"] = array();
118 
119  $defIds[] = $rec["id"];
120  }
121 
122  // get all subobject definitions in a single query
123  $set2 = $ilDB->query("SELECT * FROM il_object_subobj WHERE ".
124  $ilDB->in('parent', $defIds, false, 'text'));
125  while ($rec2 = $ilDB->fetchAssoc($set2))
126  {
127  $max = $rec2["mmax"];
128  if ($max <= 0) // for backward compliance
129  {
130  $max = "";
131  }
132  $this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
133  "name" => $rec2["subobj"],
134  "max" => $max,
135  "lng" => $rec2["subobj"]
136  );
137  }
138 
139  $set = $ilDB->query("SELECT * FROM il_object_group");
140  $this->obj_group = array();
141  while ($rec = $ilDB->fetchAssoc($set))
142  {
143  $this->obj_group[$rec["id"]] = $rec;
144  }
145 
146  // now get objects from repository plugin
147  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj");
148  foreach ($pl_names as $pl_name)
149  {
150  include_once("./Services/Component/classes/class.ilPlugin.php");
151  $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name);
152  if ($pl_id != "" && !isset($this->obj_data[$pl_id]))
153  {
154  include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
155  $loc = ilPlugin::_getDirectory(IL_COMP_SERVICE, "Repository", "robj",
156  $pl_name)."/classes";
157 
158  $this->obj_data[$pl_id] = array(
159  "name" => $pl_id,
160  "class_name" => $pl_name,
161  "plugin" => "1",
162  "location" => $loc,
163  "checkbox" => "1",
164  "inherit" => "0",
165  "component" => "",
166  "translate" => "0",
167  "devmode" => "0",
168  "allow_link" => "1",
169  "allow_copy" => "0",
170  "rbac" => "1",
171  "group" => null,
172  "system" => "0",
173  "default_pos" => "99992000", // "unassigned" group
174  'repository' => '1',
175  'workspace' => '0',
176  'administration' => '0',
177  "sideblock" => "0");
178  $this->obj_data[$rec["id"]]["subobjects"] = array();
179 
180  // plugins have to be marked as such - see ilContainerGUI::showPossibleSubObjects()
181  $this->obj_data["crs"]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
182  $this->obj_data["fold"]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
183  $this->obj_data["grp"]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
184  $this->obj_data["cat"]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
185  $this->obj_data["root"]["subobjects"][$pl_id] = array("name" => $pl_id, "max" => "", "lng" => $pl_id, "plugin" => true);
186  }
187  }
188 //var_dump($this->obj_data["root"]["subobjects"]);
189 //var_dump($this->obj_data2["root"]);
190 
191  $set = $ilDB->query("SELECT * FROM il_object_sub_type ");
192  $this->sub_types = array();
193  while ($rec = $ilDB->fetchAssoc($set))
194  {
195  $this->sub_types[$rec["obj_type"]][] = $rec;
196  }
197 
198  }
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:

◆ setHandlers()

ilObjectDefinition::setHandlers (   $a_xml_parser)

set event handler

Parameters
ressouceinternal xml_parser_handler private

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

700  {
701  xml_set_object($a_xml_parser,$this);
702  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
703  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
704  }

◆ stopInheritance()

ilObjectDefinition::stopInheritance (   $a_obj_name)

Does object permits stopping inheritance?

Parameters
stringobject type public

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

299  {
300  return (bool) $this->obj_data[$a_obj_name]["inherit"];
301  }

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: