ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilHelpDataSet.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/DataSet/classes/class.ilDataSet.php");
6 
14 class ilHelpDataSet extends ilDataSet
15 {
16 
23  public function getSupportedVersions()
24  {
25  return array("4.3.0");
26  }
27 
34  public function getXmlNamespace($a_entity, $a_schema_version)
35  {
36  return "http://www.ilias.de/xml/Services/Help/" . $a_entity;
37  }
38 
45  protected function getTypes($a_entity, $a_version)
46  {
47  if ($a_entity == "help_map") {
48  switch ($a_version) {
49  case "4.3.0":
50  return array(
51  "Chap" => "integer",
52  "Component" => "text",
53  "ScreenId" => "text",
54  "ScreenSubId" => "text",
55  "Perm" => "text"
56  );
57  }
58  }
59 
60  if ($a_entity == "help_tooltip") {
61  switch ($a_version) {
62  case "4.3.0":
63  return array(
64  "Id" => "integer",
65  "TtText" => "text",
66  "TtId" => "text",
67  "Comp" => "text",
68  "Lang" => "text"
69  );
70  }
71  }
72  }
73 
80  public function readData($a_entity, $a_version, $a_ids, $a_field = "")
81  {
82  $ilDB = $this->db;
83 
84  if (!is_array($a_ids)) {
85  $a_ids = array($a_ids);
86  }
87 
88  if ($a_entity == "help_map") {
89  switch ($a_version) {
90  case "4.3.0":
91  $this->getDirectDataFromQuery("SELECT chap, component, screen_id, screen_sub_id, perm " .
92  " FROM help_map " .
93  "WHERE " .
94  $ilDB->in("chap", $a_ids, false, "integer"));
95  break;
96  }
97  }
98 
99  if ($a_entity == "help_tooltip") {
100  switch ($a_version) {
101  case "4.3.0":
102  $this->getDirectDataFromQuery("SELECT id, tt_text, tt_id, comp, lang FROM help_tooltip");
103  break;
104  }
105  }
106  }
107 
111  protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
112  {
113  return false;
114  }
115 
116 
123  public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
124  {
125  switch ($a_entity) {
126  case "help_map":
127 
128  include_once("./Services/Help/classes/class.ilHelpMapping.php");
129 
130  // without module ID we do nothing
131  $module_id = $a_mapping->getMapping('Services/Help', 'help_module', 0);
132  $t = $a_mapping->getAllMappings();
133  if ($module_id) {
134  $new_chap = $a_mapping->getMapping(
135  'Services/Help',
136  'help_chap',
137  $a_rec["Chap"]
138  );
139 
140  // new import (5.1): get chapter from learning module import mapping
141  if ($new_chap == 0) {
142  $new_chap = $a_mapping->getMapping(
143  'Modules/LearningModule',
144  'lm_tree',
145  $a_rec["Chap"]
146  );
147  }
148 
149  if ($new_chap > 0) {
151  $new_chap,
152  $a_rec["Component"],
153  $a_rec["ScreenId"],
154  $a_rec["ScreenSubId"],
155  $a_rec["Perm"],
156  $module_id
157  );
158  }
159  }
160  break;
161 
162  case "help_tooltip":
163 
164  include_once("./Services/Help/classes/class.ilHelp.php");
165 
166  // without module ID we do nothing
167  $module_id = $a_mapping->getMapping('Services/Help', 'help_module', 0);
168  if ($module_id) {
169  ilHelp::addTooltip($a_rec["TtId"], $a_rec["TtText"], $module_id);
170  }
171  break;
172  }
173  }
174 }
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
Help system data set class.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getTypes($a_entity, $a_version)
Get field types for entity.
global $ilDB
getSupportedVersions()
Get supported versions.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
static saveMappingEntry( $a_chap, $a_comp, $a_screen_id, $a_screen_sub_id, $a_perm, $a_module_id=0)
Save mapping entry.
static addTooltip($a_tt_id, $a_text, $a_module_id=0)
Add tooltip.