Public Member Functions | Data Fields

ilObjectDefinition Class Reference

Inheritance diagram for ilObjectDefinition:
Collaboration diagram for ilObjectDefinition:

Public Member Functions

 ilObjectDefinition ()
 Constructor.
 getDefinition ($a_obj_name)
 get object definition by type
 getClassName ($a_obj_name)
 get class name by type
 getLocation ($a_obj_name)
 get location by type
 getModule ($a_obj_name)
 get module by 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?
 getProperties ($a_obj_name)
 get properties by type
 getDevMode ($a_obj_name)
 get devmode status 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
 allowLink ($a_obj_name)
 checks if linking of an object type is allowed
 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
 getActions ($a_obj_name)
 get possible actions by type
 getFirstProperty ($a_obj_name)
 get default property by type
 getPropertyName ($a_cmd, $a_obj_name)
 get name of property by type
 getSubObjectsAsString ($a_obj_type)
 get a string of all subobjects by type
 getImportObjects ($a_obj_type)
 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)

Data Fields

 $obj_id
 $parent
 $obj_data

Detailed Description

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


Member Function Documentation

ilObjectDefinition::__filterObjects ( &$  subobjects  ) 

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

References $data, and $type.

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::allowLink ( a_obj_name  ) 

checks if linking of an object type is allowed

Parameters:
string object type public

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

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

ilObjectDefinition::getActions ( a_obj_name  ) 

get possible actions by type

Parameters:
string object type public

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

        {
                $ret = (is_array($this->obj_data[$a_obj_name]["actions"])) ?
                        $this->obj_data[$a_obj_name]["actions"] :
                        array();
                return $ret;
        }

ilObjectDefinition::getAllRBACObjects (  ) 

get all RBAC object types

public

Returns:
array object types set to development

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

References $type, and 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 class name by type

Parameters:
string object type public

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

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

ilObjectDefinition::getCreatableSubObjects ( a_obj_type  ) 

get only creatable subobjects by type

Parameters:
string object type public
Returns:
array list of createable object types

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

References $type, getDevMode(), and getSubObjects().

        {
                $subobjects = $this->getSubObjects($a_obj_type);

                // remove role folder object from list 
                unset($subobjects["rolf"]);
                
                $sub_types = array_keys($subobjects);

                // remove object types in development from list
                foreach ($sub_types as $type)
                {
                        if ($this->getDevMode($type))
                        {
                                unset($subobjects[$type]);
                        }
                }

                return $subobjects;
        }

Here is the call graph for this function:

ilObjectDefinition::getDefinition ( a_obj_name  ) 

get object definition by type

Parameters:
string object type public

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

        {
                return $this->obj_data[$a_obj_name];
        }

ilObjectDefinition::getDevMode ( a_obj_name  ) 

get devmode status by type

Parameters:
string object type public

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

Referenced by getCreatableSubObjects(), and getDevModeAll().

        {
                // always return false if devmode is enabled
                if (DEVMODE)
                {
                        return false;
                }
                
                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 217 of file class.ilObjectDefinition.php.

References $type, and getDevMode().

        {
                // always return empty array if devmode is enabled
                if (DEVMODE)
                {
                        return array();
                }

                $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::getFirstProperty ( a_obj_name  ) 

get default property by type

Parameters:
string object type public

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

References $data.

        {
                if (defined("ILIAS_MODULE"))
                {
                        foreach ($this->obj_data[$a_obj_name]["properties"] as $data => $prop)
                        {
                                if($prop["module"] != "n")
                                {
                                        return $data;
                                }
                        }
                }
                else
                {
                        foreach ($this->obj_data[$a_obj_name]["properties"] as $data => $prop)
                        {
                                if ($prop["module"] != 1)
                                {
                                        return $data;
                                }
                        }
                }
        }

ilObjectDefinition::getImportObjects ( a_obj_type  ) 

get all subobjects that may be imported

Parameters:
string object type public

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

        {
                $imp = array();

                if (is_array($this->obj_data[$a_obj_type]["subobjects"]))
                {
                        foreach ($this->obj_data[$a_obj_type]["subobjects"] as $sub)
                        {
                                if ($sub["import"] == 1)
                                {
                                        $imp[] = $sub["name"];
                                }
                        }
                }

                return $imp;
        }

ilObjectDefinition::getLocation ( a_obj_name  ) 

get location by type

Parameters:
string object type public

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

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

ilObjectDefinition::getModule ( a_obj_name  ) 

get module by type

Parameters:
string object type public

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

        {
                return $this->obj_data[$a_obj_name]["module"];
        }

ilObjectDefinition::getProperties ( a_obj_name  ) 

get properties by type

Parameters:
string object type public

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

References $_GET, and $data.

        {
                // dirty hack, has to be implemented better, if ilias.php
                // is established
                if (defined("ILIAS_MODULE") || $_GET["baseClass"] != "")
                {
                        $props = array();
                        if (is_array($this->obj_data[$a_obj_name]["properties"]))
                        {
                                foreach ($this->obj_data[$a_obj_name]["properties"] as $data => $prop)
                                {
                                        if ($prop["module"] != "n")
                                        {
                                                $props[$data] = $prop;
                                        }
                                }
                        }
                        return $props;
                }
                else
                {
                        $props = array();
                        if (is_array($this->obj_data[$a_obj_name]["properties"]))
                        {
                                foreach ($this->obj_data[$a_obj_name]["properties"] as $data => $prop)
                                {
                                        if ($prop["module"] != 1)
                                        {
                                                $props[$data] = $prop;
                                        }
                                }
                        }
                        return $props;
                }
        }

ilObjectDefinition::getPropertyName ( a_cmd,
a_obj_name 
)

get name of property by type

Parameters:
string object type public

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

        {
                return $this->obj_data[$a_obj_name]["properties"][$a_cmd]["lng"];
        }

ilObjectDefinition::getSubObjects ( a_obj_type,
a_filter = true 
)

get all subobjects by type

Parameters:
string object type
boolean filter disabled objects? (default: true) public
Returns:
array list of allowed object types

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

References $data, and __filterObjects().

Referenced by getCreatableSubObjects(), and getSubObjectsRecursively().

        {
                $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")
                                {
                                        $subs[$data] = $sub;
                                }
                        }

                        return $subs;
                }

                return $subs;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjectDefinition::getSubObjectsAsString ( a_obj_type  ) 

get a string of all subobjects by type

Parameters:
string object type public

Definition at line 483 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:
string object type public
Returns:
array list of allowed object types

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

References $data, $type, 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:
string object type public
Returns:
array list of object types to filter

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

References $key.

        {
                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:
string object type public

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

        {
                return $this->obj_data[$a_obj_name]["translate"];
        }

ilObjectDefinition::handlerBeginTag ( a_xml_parser,
a_name,
a_attribs 
)

start tag handler

Parameters:
ressouce internal xml_parser_handler
string element tag name
array element attributes private

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

        {
                switch ($a_name)
                {
                        case 'objects':
                                $this->current_tag = '';
                                break;
                        case 'object':
                                $this->parent_tag_name = $a_attribs["name"];
                                $this->current_tag = '';
                                $this->obj_data["$a_attribs[name]"]["name"] = $a_attribs["name"];
                                $this->obj_data["$a_attribs[name]"]["class_name"] = $a_attribs["class_name"];
                                $this->obj_data["$a_attribs[name]"]["location"] = $a_attribs["location"];
                                $this->obj_data["$a_attribs[name]"]["checkbox"] = $a_attribs["checkbox"];
                                $this->obj_data["$a_attribs[name]"]["inherit"] = $a_attribs["inherit"];
                                $this->obj_data["$a_attribs[name]"]["module"] = $a_attribs["module"];
                                $this->obj_data["$a_attribs[name]"]["translate"] = $a_attribs["translate"];
                                $this->obj_data["$a_attribs[name]"]["devmode"] = $a_attribs["devmode"];
                                $this->obj_data["$a_attribs[name]"]["allow_link"] = $a_attribs["allow_link"];
                                $this->obj_data["$a_attribs[name]"]["rbac"] = $a_attribs["rbac"];
                                break;
                        case 'subobj':
                                $this->current_tag = "subobj";
                                $this->current_tag_name = $a_attribs["name"];
                                $this->obj_data[$this->parent_tag_name]["subobjects"][$this->current_tag_name]["name"] = $a_attribs["name"];
                                // NUMBER OF ALLOWED SUBOBJECTS (NULL means no limit)
                                $this->obj_data[$this->parent_tag_name]["subobjects"][$this->current_tag_name]["max"] = $a_attribs["max"];
                                // also allow import ("1" means yes)
                                $this->obj_data[$this->parent_tag_name]["subobjects"][$this->current_tag_name]["import"] = $a_attribs["import"];
                                $this->obj_data[$this->parent_tag_name]["subobjects"][$this->current_tag_name]["module"] = $a_attribs["module"];
                                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"];
                                break;
                        case 'action':
                                $this->current_tag = "action";
                                $this->current_tag_name = $a_attribs["name"];
                                $this->obj_data[$this->parent_tag_name]["actions"][$this->current_tag_name]["name"] = $a_attribs["name"];
                                break;
                }
        }

ilObjectDefinition::handlerCharacterData ( a_xml_parser,
a_data 
)

end tag handler

Parameters:
ressouce internal xml_parser_handler
string data private

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

        {
                // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
                $a_data = preg_replace("/\n/","",$a_data);
                $a_data = preg_replace("/\t+/","",$a_data);

                if (!empty($a_data))
                {
                        switch ($this->current_tag)
                        {
                                case "subobj":
                                        $this->obj_data[$this->parent_tag_name]["subobjects"][$this->current_tag_name]["lng"] .= $a_data;
                                        break;
                                case "action" :
                                        $this->obj_data[$this->parent_tag_name]["actions"][$this->current_tag_name]["lng"] .= $a_data;
                                        break;
                                case "property" :
                                        $this->obj_data[$this->parent_tag_name]["properties"][$this->current_tag_name]["lng"] .= $a_data;
                                        break;
                                default:
                                        break;
                        }
                }
        }

ilObjectDefinition::handlerEndTag ( a_xml_parser,
a_name 
)

end tag handler

Parameters:
ressouce internal xml_parser_handler
string element tag name private

Definition at line 628 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:
string object type public

Definition at line 125 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::ilSaxParser().

Here is the call graph for this function:

ilObjectDefinition::isRBACObject ( a_obj_name  ) 

get RBAC status by type returns true if object type is a RBAC object type

Parameters:
string object type public

Definition at line 245 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::setHandlers ( a_xml_parser  ) 

set event handler

Parameters:
ressouce internal xml_parser_handler private

Reimplemented from ilSaxParser.

Definition at line 529 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:
string object type public

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