ILIAS  release_8 Revision v8.23
ilObjectDefinitionProcessor Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjectDefinitionProcessor:
+ Collaboration diagram for ilObjectDefinitionProcessor:

Public Member Functions

 __construct (ilDBInterface $db)
 
 purge ()
 This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate. More...
 
 beginComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component starts. More...
 
 endComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component ends. More...
 
 beginTag (string $name, array $attributes)
 This is called when a tag starts in the context of the given component. More...
 
 endTag (string $name)
 This is called when a tag ends in the context of the given component. More...
 

Protected Attributes

ilDBInterface $db
 
string $component
 
string $current_object
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 21 of file class.ilObjectDefinitionProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectDefinitionProcessor::__construct ( ilDBInterface  $db)

Definition at line 27 of file class.ilObjectDefinitionProcessor.php.

References $db.

28  {
29  $this->db = $db;
30  }

Member Function Documentation

◆ beginComponent()

ilObjectDefinitionProcessor::beginComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component starts.

This is supposed to reset any internal parsing state.

Implements ilComponentDefinitionProcessor.

Definition at line 40 of file class.ilObjectDefinitionProcessor.php.

References $component.

40  : void
41  {
42  $this->component = $type . "/" . $component;
43  $this->current_object = null;
44  }
$type

◆ beginTag()

ilObjectDefinitionProcessor::beginTag ( string  $name,
array  $attributes 
)

This is called when a tag starts in the context of the given component.

Parameters
string[]$attributes

Implements ilComponentDefinitionProcessor.

Definition at line 52 of file class.ilObjectDefinitionProcessor.php.

52  : void
53  {
54  switch ($name) {
55  case 'object':
56 
57  // if attributes are not given, set default (repository only)
58  if (($attributes["repository"] ?? null) === null) {
59  $attributes["repository"] = true;
60  }
61  if (($attributes["workspace"] ?? null) === null) {
62  $attributes["workspace"] = false;
63  }
64 
65  $this->current_object = $attributes["id"];
66  $this->db->manipulateF(
67  "INSERT INTO il_object_def (id, class_name, component,location," .
68  "checkbox,inherit,translate,devmode,allow_link,allow_copy,rbac,default_pos," .
69  "default_pres_pos,sideblock,grp," . $this->db->quoteIdentifier("system") . ",export,repository,workspace,administration," .
70  "amet,orgunit_permissions,lti_provider,offline_handling) VALUES " .
71  "(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
72  array("text", "text", "text", "text", "integer", "integer", "text", "integer","integer","integer",
73  "integer","integer","integer","integer", "text", "integer", "integer", "integer", "integer",
74  'integer','integer','integer','integer','integer'),
75  array(
76  $attributes["id"],
77  $attributes["class_name"],
78  $this->component,
79  $this->component . "/" . $attributes["dir"],
80  (int) ($attributes["checkbox"] ?? null),
81  (int) ($attributes["inherit"] ?? null),
82  $attributes["translate"] ?? null,
83  (int) ($attributes["devmode"] ?? null),
84  (int) ($attributes["allow_link"] ?? null),
85  (int) ($attributes["allow_copy"] ?? null),
86  (int) ($attributes["rbac"] ?? null),
87  (int) ($attributes["default_pos"] ?? null),
88  (int) ($attributes["default_pres_pos"] ?? null),
89  (int) ($attributes["sideblock"] ?? null),
90  $attributes["group"] ?? null,
91  (int) ($attributes["system"] ?? null),
92  (int) ($attributes["export"] ?? null),
93  (int) ($attributes["repository"] ?? null),
94  (int) ($attributes["workspace"] ?? null),
95  (int) ($attributes['administration'] ?? null),
96  (int) ($attributes['amet'] ?? null),
97  (int) ($attributes['orgunit_permissions'] ?? null),
98  (int) ($attributes['lti_provider'] ?? null),
99  (int) ($attributes['offline_handling'] ?? null)
100  )
101  );
102  break;
103 
104  case "subobj":
105  $this->db->manipulateF(
106  "INSERT INTO il_object_subobj (parent, subobj, mmax) VALUES (%s,%s,%s)",
107  array("text", "text", "integer"),
108  array($this->current_object, $attributes["id"], (int) ($attributes["max"] ?? null))
109  );
110  break;
111 
112  case "parent":
113  $this->db->manipulateF(
114  "INSERT INTO il_object_subobj (parent, subobj, mmax) VALUES (%s,%s,%s)",
115  array("text", "text", "integer"),
116  array($attributes["id"], $this->current_object, (int) ($attributes["max"] ?? null))
117  );
118  break;
119 
120  case "objectgroup":
121  $this->db->manipulateF(
122  "INSERT INTO il_object_group (id, name, default_pres_pos) VALUES (%s,%s,%s)",
123  array("text", "text", "integer"),
124  array($attributes["id"], $attributes["name"], $attributes["default_pres_pos"])
125  );
126  break;
127  case "sub_type":
128  $this->db->manipulate("INSERT INTO il_object_sub_type " .
129  "(obj_type, sub_type, amet) VALUES (" .
130  $this->db->quote($this->current_object, "text") . "," .
131  $this->db->quote($attributes["id"], "text") . "," .
132  $this->db->quote($attributes["amet"], "integer") .
133  ")");
134  break;
135  }
136  }
$attributes
Definition: metadata.php:248
if($format !==null) $name
Definition: metadata.php:247

◆ endComponent()

ilObjectDefinitionProcessor::endComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component ends.

Implements ilComponentDefinitionProcessor.

Definition at line 46 of file class.ilObjectDefinitionProcessor.php.

46  : void
47  {
48  $this->component = null;
49  $this->current_object = null;
50  }

◆ endTag()

ilObjectDefinitionProcessor::endTag ( string  $name)

This is called when a tag ends in the context of the given component.

Implements ilComponentDefinitionProcessor.

Definition at line 138 of file class.ilObjectDefinitionProcessor.php.

138  : void
139  {
140  }

◆ purge()

ilObjectDefinitionProcessor::purge ( )

This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate.

Implements ilComponentDefinitionProcessor.

Definition at line 32 of file class.ilObjectDefinitionProcessor.php.

32  : void
33  {
34  $this->db->manipulate("DELETE FROM il_object_def");
35  $this->db->manipulate("DELETE FROM il_object_subobj");
36  $this->db->manipulate("DELETE FROM il_object_group");
37  $this->db->manipulate("DELETE FROM il_object_sub_type");
38  }

Field Documentation

◆ $component

string ilObjectDefinitionProcessor::$component
protected

Definition at line 24 of file class.ilObjectDefinitionProcessor.php.

Referenced by beginComponent().

◆ $current_object

string ilObjectDefinitionProcessor::$current_object
protected

Definition at line 25 of file class.ilObjectDefinitionProcessor.php.

◆ $db

ilDBInterface ilObjectDefinitionProcessor::$db
protected

Definition at line 23 of file class.ilObjectDefinitionProcessor.php.

Referenced by __construct().


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