ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilHelpDataSet.php
Go to the documentation of this file.
1 <?php
2 
24 class ilHelpDataSet extends ilDataSet
25 {
26  protected \ILIAS\Help\Tooltips\TooltipsManager $help_tooltips;
27  protected \ILIAS\Help\Map\MapManager $help_map;
28 
29  public function __construct()
30  {
31  global $DIC;
32 
33  $help_domain = $DIC->help()->internal()->domain();
34 
36 
37  $this->help_map = $help_domain->map();
38  $this->help_tooltips = $help_domain->tooltips();
39  }
40 
41  public function getSupportedVersions(): array
42  {
43  return array("4.3.0");
44  }
45 
46  protected function getXmlNamespace(string $a_entity, string $a_schema_version): string
47  {
48  return "https://www.ilias.de/xml/Services/Help/" . $a_entity;
49  }
50 
51  protected function getTypes(string $a_entity, string $a_version): array
52  {
53  if ($a_entity === "help_map") {
54  switch ($a_version) {
55  case "4.3.0":
56  return array(
57  "Chap" => "integer",
58  "Component" => "text",
59  "ScreenId" => "text",
60  "ScreenSubId" => "text",
61  "Perm" => "text"
62  );
63  }
64  }
65 
66  if ($a_entity === "help_tooltip") {
67  switch ($a_version) {
68  case "4.3.0":
69  return array(
70  "Id" => "integer",
71  "TtText" => "text",
72  "TtId" => "text",
73  "Comp" => "text",
74  "Lang" => "text"
75  );
76  }
77  }
78  return [];
79  }
80 
81  public function readData(string $a_entity, string $a_version, array $a_ids): void
82  {
83  $ilDB = $this->db;
84 
85  if ($a_entity === "help_map") {
86  switch ($a_version) {
87  case "4.3.0":
88  $this->getDirectDataFromQuery("SELECT chap, component, screen_id, screen_sub_id, perm " .
89  " FROM help_map " .
90  "WHERE " .
91  $ilDB->in("chap", $a_ids, false, "integer"));
92  break;
93  }
94  }
95 
96  if ($a_entity === "help_tooltip") {
97  switch ($a_version) {
98  case "4.3.0":
99  $this->getDirectDataFromQuery("SELECT id, tt_text, tt_id, comp, lang FROM help_tooltip " .
100  " WHERE module_id = " . $ilDB->quote(0, "integer"));
101  break;
102  }
103  }
104  }
105 
106  public function importRecord(
107  string $a_entity,
108  array $a_types,
109  array $a_rec,
110  ilImportMapping $a_mapping,
111  string $a_schema_version
112  ): void {
113  $a_rec = $this->stripTags($a_rec);
114  switch ($a_entity) {
115  case "help_map":
116 
117  // without module ID we do nothing
118  $module_id = $a_mapping->getMapping('Services/Help', 'help_module', 0);
119  $t = $a_mapping->getAllMappings();
120  if ($module_id) {
121  $new_chap = $a_mapping->getMapping(
122  'Services/Help',
123  'help_chap',
124  $a_rec["Chap"]
125  );
126 
127  // new import (5.1): get chapter from learning module import mapping
128  if ((int) $new_chap === 0) {
129  $new_chap = $a_mapping->getMapping(
130  'Modules/LearningModule',
131  'lm_tree',
132  $a_rec["Chap"]
133  );
134  }
135 
136  if ($new_chap > 0) {
137  $this->help_map->saveMappingEntry(
138  $new_chap,
139  $a_rec["Component"],
140  $a_rec["ScreenId"],
141  $a_rec["ScreenSubId"],
142  $a_rec["Perm"],
143  $module_id
144  );
145  }
146  }
147  break;
148 
149  case "help_tooltip":
150 
151  // without module ID we do nothing
152  $module_id = $a_mapping->getMapping('Services/Help', 'help_module', 0);
153  if ($module_id) {
154  $this->help_tooltips->addTooltip($a_rec["TtId"], $a_rec["TtText"], $module_id);
155  }
156  break;
157  }
158  }
159 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTypes(string $a_entity, string $a_version)
readData(string $a_entity, string $a_version, array $a_ids)
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
ilDBInterface $db
ILIAS Help Map MapManager $help_map
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
ILIAS Help Tooltips TooltipsManager $help_tooltips
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
stripTags(array $rec, array $omit_keys=[])
getXmlNamespace(string $a_entity, string $a_schema_version)