ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilCOPageDefinitionProcessor.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  protected \ilDBInterface $db;
24  protected ?string $component = null;
25  protected ?string $type = null;
26 
27  public function __construct(\ilDBInterface $db)
28  {
29  $this->db = $db;
30  }
31 
32  public function purge(): void
33  {
34  $this->db->manipulate("DELETE FROM copg_pc_def");
35  $this->db->manipulate("DELETE FROM copg_pobj_def");
36  }
37 
38  public function beginComponent(string $component, string $type): void
39  {
40  $this->component = $component;
41  $this->type = $type;
42  }
43 
44  public function endComponent(string $component, string $type): void
45  {
46  $this->component = null;
47  $this->type = null;
48  }
49 
50  public function beginTag(string $name, array $attributes): void
51  {
52  switch ($name) {
53  case "pagecontent":
54  $this->db->manipulate("INSERT INTO copg_pc_def " .
55  "(pc_type, name, component, directory, int_links, style_classes, xsl, def_enabled, top_item, order_nr) VALUES (" .
56  $this->db->quote($attributes["pc_type"], "text") . "," .
57  $this->db->quote($attributes["name"], "text") . "," .
58  $this->db->quote($this->type . "/" . $this->component, "text") . "," .
59  $this->db->quote($attributes["directory"], "text") . "," .
60  $this->db->quote($attributes["int_links"], "integer") . "," .
61  $this->db->quote($attributes["style_classes"], "integer") . "," .
62  $this->db->quote($attributes["xsl"], "integer") . "," .
63  $this->db->quote($attributes["def_enabled"], "integer") . "," .
64  $this->db->quote($attributes["top_item"], "integer") . "," .
65  $this->db->quote($attributes["order_nr"], "integer") .
66  ")");
67  break;
68 
69  case "pageobject":
70  $this->db->manipulate("INSERT INTO copg_pobj_def " .
71  "(parent_type, class_name, component, directory) VALUES (" .
72  $this->db->quote($attributes["parent_type"], "text") . "," .
73  $this->db->quote($attributes["class_name"], "text") . "," .
74  $this->db->quote($this->type . "/" . $this->component, "text") . "," .
75  $this->db->quote($attributes["directory"], "text") .
76  ")");
77  break;
78  }
79  }
80 
81  public function endTag(string $name): void
82  {
83  }
84 }
endComponent(string $component, string $type)
This method is called when parsing of component.xml for the given component ends. ...
beginTag(string $name, array $attributes)
This is called when a tag starts in the context of the given component.
beginComponent(string $component, string $type)
This method is called when parsing of component.xml for the given component starts.
An ilComponentDefinitionProcessor processes some attributes from a component.xml (i.e.
purge()
This methods is supposed to purge existing data in the provider of the component, so new components c...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
endTag(string $name)
This is called when a tag ends in the context of the given component.