ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 readDefinitionData ()
 Read object definition data.
 getClassName ($a_obj_name)
 get object definition by type
 getLocation ($a_obj_name)
 get location by type
 getGroup ($a_id)
 get module by type
 getGroupOfObj ($a_obj_name)
 Get Group of object type.
 hasCheckbox ($a_obj_name)
 should the object get a checkbox (needed for 'cut','copy' ...)
 getTranslationType ($a_obj_name)
 get translation type (sys, db or 0)s
 stopInheritance ($a_obj_name)
 Does object permits stopping inheritance?
 getDevMode ($a_obj_name)
 get properties by type
 getDevModeAll ()
 get all object types in devmode
 isRBACObject ($a_obj_name)
 get RBAC status by type returns true if object type is a RBAC object type
 getAllRBACObjects ()
 get all RBAC object types
 getAllObjects ()
 get all object types
 allowLink ($a_obj_name)
 checks if linking of an object type is allowed
 allowCopy ($a_obj_name)
 checks if copying of an object type is allowed
 getContentItemSortingModes ($a_obj_name)
 get content item sorting modes
 getSubObjects ($a_obj_type, $a_filter=true)
 get all subobjects by type
 getSubObjectsRecursively ($a_obj_type)
 Get all subobjects by type.
 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.
 getCreatableSubObjects ($a_obj_type)
 get only creatable subobjects by type
 getSubObjectsAsString ($a_obj_type)
 get possible actions by type
 isContainer ($a_obj_name)
 get all subobjects that may be imported
 setHandlers ($a_xml_parser)
 set event handler
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 start tag handler
 handlerCharacterData ($a_xml_parser, $a_data)
 end tag handler
 handlerEndTag ($a_xml_parser, $a_name)
 end tag handler
 __filterObjects (&$subobjects)
 isSystemObject ($a_obj_name)
 checks if object type is a system object
 isSideBlock ($a_obj_name)
 Check, whether object type is a side block.
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file= '', $throwException=false)
 Constructor setup ILIAS global object public.
 setXMLContent ($a_xml_content)
 getXMLContent ()
 getInputType ()
 startParsing ()
 stores xml data in array
 createParser ()
 create parser
 setOptions ($a_xml_parser)
 set parser options
 openXMLFile ()
 open xml file
 parse ($a_xml_parser, $a_fp=null)
 parse xml file
 freeParser ($a_xml_parser)
 free xml parser handle
 setThrowException ($throwException)
 set error handling

Static Public Member Functions

static getRepositoryObjectTypesForComponent ($a_component_type, $a_component_name)
 Get all repository object types of component.
static getGroupedRepositoryObjectTypes ($a_parent_obj_type)
 Get grouped repository object types.

Data Fields

 $obj_id
 $parent
 $obj_data
- Data Fields inherited from ilSaxParser
 $input_type = null
 $xml_content = ''
 $ilias
 $lng
 $xml_file
 $throwException = false

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

Detailed Description

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

Author
Stefan Meyer <smeyer>
Version
Id:
class.ilObjectDefinition.php 20110 2009-06-03 14:44:55Z wrandels

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

Member Function Documentation

ilObjectDefinition::__filterObjects ( $subobjects)

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

References $data.

Referenced by getSubObjects().

{
foreach($subobjects as $type => $data)
{
switch($type)
{
case "chat":
if(!$this->ilias->getSetting("chat_active"))
{
unset($subobjects[$type]);
}
break;
case "icrs":
if(!$this->ilias->getSetting("ilinc_active"))
{
unset($subobjects[$type]);
}
break;
default:
// DO NOTHING
}
}
}

+ Here is the caller graph for this function:

ilObjectDefinition::allowCopy (   $a_obj_name)

checks if copying of an object type is allowed

Parameters
stringobject type public

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

{
return (bool) $this->obj_data[$a_obj_name]["allow_copy"];
}
ilObjectDefinition::allowLink (   $a_obj_name)

checks if linking of an object type is allowed

Parameters
stringobject type public

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

{
return (bool) $this->obj_data[$a_obj_name]["allow_link"];
}
ilObjectDefinition::getAllObjects ( )

get all object types

public

Returns
array object types

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

{
return array_keys($this->obj_data);
}
ilObjectDefinition::getAllRBACObjects ( )

get all RBAC object types

public

Returns
array object types set to development

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

References isRBACObject().

{
$types = array_keys($this->obj_data);
foreach ($types as $type)
{
if ($this->isRBACObject($type))
{
$rbactypes[] = $type;
}
}
return $rbactypes ? $rbactypes : array();
}

+ Here is the call graph for this function:

ilObjectDefinition::getClassName (   $a_obj_name)

get object definition by type

Parameters
stringobject type public get class name by type
stringobject type public

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

{
return $this->obj_data[$a_obj_name]["class_name"];
}
ilObjectDefinition::getContentItemSortingModes (   $a_obj_name)

get content item sorting modes

public

Parameters

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

{
if(isset($this->obj_data[$a_obj_name]['sorting']))
{
return $this->obj_data[$a_obj_name]['sorting']['modes'] ? $this->obj_data[$a_obj_name]['sorting']['modes'] : array();
}
return array();
}
ilObjectDefinition::getCreatableSubObjects (   $a_obj_type)

get only creatable subobjects by type

Parameters
stringobject type public
Returns
array list of createable object types

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

References getDevMode(), getSubObjects(), and isSystemObject().

{
$subobjects = $this->getSubObjects($a_obj_type);
// remove role folder object from list
unset($subobjects["rolf"]);
unset($subobjects['rcrs']);
$sub_types = array_keys($subobjects);
// remove object types in development from list
foreach ($sub_types as $type)
{
if ($this->getDevMode($type) || $this->isSystemObject($type))
{
unset($subobjects[$type]);
}
}
return $subobjects;
}

+ Here is the call graph for this function:

ilObjectDefinition::getDevMode (   $a_obj_name)

get properties by type

Parameters
stringobject type public get devmode status by type
stringobject type public

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

Referenced by getCreatableSubObjects(), and getDevModeAll().

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

+ Here is the caller graph for this function:

ilObjectDefinition::getDevModeAll ( )

get all object types in devmode

public

Returns
array object types set to development

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

References getDevMode().

{
$types = array_keys($this->obj_data);
foreach ($types as $type)
{
if ($this->getDevMode($type))
{
$devtypes[] = $type;
}
}
return $devtypes ? $devtypes : array();
}

+ Here is the call graph for this function:

ilObjectDefinition::getGroup (   $a_id)

get module by type

Parameters
stringobject type public Get Group information

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

{
return $this->obj_group[$a_id];
}
static ilObjectDefinition::getGroupedRepositoryObjectTypes (   $a_parent_obj_type)
static

Get grouped repository object types.

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

References $ret, DB_FETCHMODE_ASSOC, ilUtil\quoteArray(), and ilUtil\sortArray().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM il_object_group");
$groups = array();
while ($gr_rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$groups[$gr_rec["id"]] = $gr_rec;
}
if (!is_array($a_parent_obj_type))
{
$set = $ilDB->query("SELECT il_object_def.* FROM il_object_def, il_object_subobj ".
" WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
" parent = ".$ilDB->quote($a_parent_obj_type).
" AND subobj = id ");
}
else
{
$set = $ilDB->query("SELECT DISTINCT (id) as sid, il_object_def.* FROM il_object_def, il_object_subobj ".
" WHERE NOT (system = 1) AND NOT (sideblock = 1) AND ".
" parent IN (".implode(",",ilUtil::quoteArray($a_parent_obj_type)).") ".
" AND subobj = id ");
}
$grouped_obj = array();
while($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($rec["grp"] != "")
{
$grouped_obj[$rec["grp"]]["pos"] = (int) $groups[$rec["grp"]]["default_pres_pos"];
$grouped_obj[$rec["grp"]]["objs"][] = $rec["id"];
}
else
{
$grouped_obj[$rec["id"]]["pos"] = (int) $rec["default_pres_pos"];
$grouped_obj[$rec["id"]]["objs"][] = $rec["id"];
}
}
//var_dump($grouped_obj);
$ret = ilUtil::sortArray($grouped_obj, "pos", "asc", true, true);
//var_dump($ret);
return $ret;
}

+ Here is the call graph for this function:

ilObjectDefinition::getGroupOfObj (   $a_obj_name)

Get Group of object type.

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

{
return $this->obj_data[$a_obj_name]["group"];
}
ilObjectDefinition::getLocation (   $a_obj_name)

get location by type

Parameters
stringobject type public

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

{
return $this->obj_data[$a_obj_name]["location"];
}
static ilObjectDefinition::getRepositoryObjectTypesForComponent (   $a_component_type,
  $a_component_name 
)
static

Get all repository object types of component.

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

References DB_FETCHMODE_ASSOC.

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM il_object_def WHERE component = ".
$ilDB->quote($a_component_type."/".$a_component_name));
$types = array();
while($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($rec["system"] != 1)
{
$types[] = $rec;
}
}
return $types;
}
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 475 of file class.ilObjectDefinition.php.

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

Referenced by getCreatableSubObjects(), and getSubObjectsRecursively().

{
global $ilSetting;
$subs = array();
if ($subobjects = $this->obj_data[$a_obj_type]["subobjects"])
{
// Filter some objects e.g chat object are creatable if chat is active
if ($a_filter)
{
$this->__filterObjects($subobjects);
}
foreach ($subobjects as $data => $sub)
{
if ($sub["module"] != "n")
{
if (!($ilSetting->get("obj_dis_creation_".$data)))
{
$subs[$data] = $sub;
// determine position
$pos = ($ilSetting->get("obj_add_new_pos_".$data) > 0)
? (int) $ilSetting->get("obj_add_new_pos_".$data)
: (int) $this->obj_data[$data]["default_pos"];
$subs[$data]["pos"] = $pos;
}
}
}
$subs2 = ilUtil::sortArray($subs, "pos", ASC, true, true);
return $subs2;
}
return $subs;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectDefinition::getSubObjectsAsString (   $a_obj_type)

get possible actions by type

Parameters
stringobject type public get default property by type
stringobject type public get name of property by type
stringobject type public get a string of all subobjects by type
stringobject type public

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

References $data.

{
$string = "";
if (is_array($this->obj_data[$a_obj_type]["subobjects"]))
{
$data = array_keys($this->obj_data[$a_obj_type]["subobjects"]);
$string = "'".implode("','", $data)."'";
}
return $string;
}
ilObjectDefinition::getSubObjectsRecursively (   $a_obj_type)

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

References $data, and getSubObjects().

{
// This associative array is used to collect all subobject types.
// key=>type, value=data
$recursivesubs = array();
// This array is used to keep track of the object types, we
// need to call function getSubobjects() for.
$to_do = array($a_obj_type);
// This array is used to keep track of the object types, we
// have called function getSubobjects() already. This is to
// prevent endless loops, for object types that support
// themselves as subobject types either directly or indirectly.
$done = array();
while (count($to_do) > 0)
{
$type = array_pop($to_do);
$done[] = $type;
$subs = $this->getSubObjects($type);
foreach ($subs as $subtype => $data)
{
$recursivesubs[$subtype] = $data;
if (! in_array($subtype, $done)
&& ! in_array($subtype, $to_do))
{
$to_do[] = $subtype;
}
}
}
return $recursivesubs;
}

+ Here is the call graph for this function:

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

{
foreach($this->obj_data[$a_obj_type]["subobjects"] as $key => $value)
{
switch($key)
{
case "rolf":
// DO NOTHING
break;
default:
$tmp_subs[] = $key;
}
}
// ADD adm and root object
$tmp_subs[] = "adm";
#$tmp_subs[] = "root";
return $tmp_subs ? $tmp_subs : array();
}
ilObjectDefinition::getTranslationType (   $a_obj_name)

get translation type (sys, db or 0)s

Parameters
stringobject type public

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

References DB_FETCHMODE_ASSOC.

{
global $ilDB;
if ($a_obj_name == "root")
{
if (!isset($this->root_trans_type))
{
$q = "SELECT count(*) as cnt FROM object_translation WHERE obj_id = ".
$ilDB->quote(ROOT_FOLDER_ID);
$set = $ilDB->query($q);
$rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
if($rec["cnt"] > 0)
{
$this->root_trans_type = "db";
}
else
{
$this->root_trans_type = $this->obj_data[$a_obj_name]["translate"];
}
}
return $this->root_trans_type;
}
return $this->obj_data[$a_obj_name]["translate"];
}
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 779 of file class.ilObjectDefinition.php.

{
switch ($a_name)
{
case 'object':
$this->parent_tag_name = $a_attribs["name"];
break;
case 'property':
$this->current_tag = "property";
$this->current_tag_name = $a_attribs["name"];
// $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["name"] = $a_attribs["name"];
$this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["module"] = $a_attribs["module"];
//echo '<br>$this->obj_data["'.$this->parent_tag_name.'"]["properties"]["'.$this->current_tag_name.'"]["module"] = "'.$a_attribs["module"].'";';
break;
}
}
ilObjectDefinition::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringdata private

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

{
}
ilObjectDefinition::handlerEndTag (   $a_xml_parser,
  $a_name 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringelement tag name private

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

{
$this->current_tag = '';
$this->current_tag_name = '';
}
ilObjectDefinition::hasCheckbox (   $a_obj_name)

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

Parameters
stringobject type public

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

{
return (bool) $this->obj_data[$a_obj_name]["checkbox"];
}
ilObjectDefinition::ilObjectDefinition ( )

Constructor.

setup ILIAS global object public

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

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

{
global $ilias;
$this->ilias = $ilias;
// removing this line leads to segmentation faults in
// learning module editor with
// - PHP 5.2.1, libxml 2.6.22, libxslt 1.1.15 (MacOsX)
// - PHP 5.2.1, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
// - PHP 5.2.5, libxml 2.6.31, libxslt 1.1.22 (MacOsX)
// - PHP 5.2.0-8+etch7, libxml 2.6.27, libxslt 1.1.19
// - PHP 5.2.0, libxml, libxml 2.6.26, libxslt 1.1.17 (OpenSuse 10.2)
// (needs further investigation)
// OK with:
// - PHP 5.1.2, libxml 2.6.24, libxslt 1.1.15
//
// Replacing all "=&" with "=" in xml5compliance seems to solve the problem
//
// $this->startParsing();
}

+ Here is the call graph for this function:

ilObjectDefinition::isContainer (   $a_obj_name)

get all subobjects that may be imported

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

public

Parameters
stringobject type
Returns
bool

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

{
if(!is_array($this->obj_data[$a_obj_name]['subobjects']))
{
return false;
}
return count($this->obj_data[$a_obj_name]['subobjects']) > 1 ? true : false;
}
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 391 of file class.ilObjectDefinition.php.

Referenced by getAllRBACObjects().

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

+ Here is the caller graph for this function:

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

{
return (bool) $this->obj_data[$a_obj_name]["sideblock"];
}
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 860 of file class.ilObjectDefinition.php.

Referenced by getCreatableSubObjects().

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

+ Here is the caller graph for this function:

ilObjectDefinition::readDefinitionData ( )

Read object definition data.

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

References DB_FETCHMODE_ASSOC.

Referenced by ilObjectDefinition().

{
global $ilDB;
$this->obj_data = array();
// Select all object_definitions and collect the definition id's in
// this array.
$defIds = array();
$set = $ilDB->query("SELECT * FROM il_object_def");
while ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->obj_data[$rec["id"]] = array(
"name" => $rec["id"],
"class_name" => $rec["class_name"],
"location" => $rec["location"],
"checkbox" => $rec["checkbox"],
"inherit" => $rec["inherit"],
"component" => $rec["component"],
"translate" => $rec["translate"],
"devmode" => $rec["devmode"],
"allow_link" => $rec["allow_link"],
"allow_copy" => $rec["allow_copy"],
"rbac" => $rec["rbac"],
"group" => $rec["grp"],
"system" => $rec["system"],
"default_pos" => $rec["default_pos"],
"sideblock" => $rec["sideblock"]);
$this->obj_data[$rec["id"]]["subobjects"] = array();
$defIds[] = $rec["id"];
}
// get all subobject definitions in a single query
$set2 = $ilDB->query("SELECT * FROM il_object_subobj WHERE ".
"parent IN ('".implode("','",$defIds)."')");
while ($rec2 = $set2->fetchRow(DB_FETCHMODE_ASSOC))
{
$max = $rec2["max"];
if ($max <= 0) // for backward compliance
{
$max = "";
}
$this->obj_data[$rec2["parent"]]["subobjects"][$rec2["subobj"]] = array(
"name" => $rec2["subobj"],
"max" => $max,
"lng" => $rec2["subobj"]
);
}
$set = $ilDB->query("SELECT * FROM il_object_group");
$this->obj_group = array();
while ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->obj_group[$rec["id"]] = $rec;
}
//var_dump($this->obj_data["root"]);
//var_dump($this->obj_data2["root"]);
}

+ Here is the caller graph for this function:

ilObjectDefinition::setHandlers (   $a_xml_parser)

set event handler

Parameters
ressouceinternal xml_parser_handler private

Reimplemented from ilSaxParser.

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

{
xml_set_object($a_xml_parser,$this);
xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
}
ilObjectDefinition::stopInheritance (   $a_obj_name)

Does object permits stopping inheritance?

Parameters
stringobject type public

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

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

Field Documentation

ilObjectDefinition::$obj_data

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

ilObjectDefinition::$obj_id

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

ilObjectDefinition::$parent

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


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