ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor Class Reference
+ Inheritance diagram for ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor:
+ Collaboration diagram for ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor:

Public Member Functions

 __construct (private readonly \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

string $component
 
string $current_object
 

Detailed Description

Definition at line 23 of file ObjectDefinitionProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::__construct ( private readonly \ilDBInterface  $db)

Definition at line 28 of file ObjectDefinitionProcessor.php.

30  {
31  }

Member Function Documentation

◆ beginComponent()

ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::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 41 of file ObjectDefinitionProcessor.php.

References ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor\$component, and null.

41  : void
42  {
43  $this->component = $type . "/" . $component;
44  $this->current_object = null;
45  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ beginTag()

ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::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 53 of file ObjectDefinitionProcessor.php.

References ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor\$component, ILIAS\Repository\int(), and null.

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

◆ endComponent()

ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::endComponent ( string  $component,
string  $type 
)

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

Implements ilComponentDefinitionProcessor.

Definition at line 47 of file ObjectDefinitionProcessor.php.

References null.

47  : void
48  {
49  $this->component = null;
50  $this->current_object = null;
51  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ endTag()

ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::endTag ( string  $name)

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

Implements ilComponentDefinitionProcessor.

Definition at line 139 of file ObjectDefinitionProcessor.php.

139  : void
140  {
141  }

◆ purge()

ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::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 33 of file ObjectDefinitionProcessor.php.

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

Field Documentation

◆ $component

string ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::$component
protected

◆ $current_object

string ILIAS\ILIASObject\Setup\ObjectDefinitionProcessor::$current_object
protected

Definition at line 26 of file ObjectDefinitionProcessor.php.


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