ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilHelpDataSet 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 ilHelpDataSet:
+ Collaboration diagram for ilHelpDataSet:

Public Member Functions

 __construct ()
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 
 init (string $a_entity, string $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 initByExporter (ilXmlExporter $xml_exporter)
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setDSPrefix (string $a_val)
 
 getDSPrefix ()
 
 getDSPrefixString ()
 
 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 fields. More...
 
 convertToLeadingUpper (string $a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, ?array $a_ids, string $a_field="", bool $a_omit_header=false, bool $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text" > <ftype name="field_2" type="date" > <ftype name="field_3" type="integer" > </types> <types ...> ... </types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset> More...
 
 addRecordsXml (ilXmlWriter $a_writer, array $a_prefixes, string $a_entity, string $a_schema_version, array $a_ids, ?string $a_field="")
 
 afterXmlRecordWriting (string $a_entity, string $a_version, array $a_set)
 
 getNamespaces (array &$namespaces, string $a_entity, string $a_schema_version)
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 Get xml record for version. More...
 
 getXmlTypes (string $a_entity, string $a_version)
 Get xml types. More...
 
 getXMLEntityName (string $a_entity, string $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag (string $a_entity, string $a_schema_version)
 Get entity tag. More...
 
 setImport (ilSurveyImporter $a_val)
 
 getImport ()
 
 setCurrentInstallationId (string $a_val)
 
 getCurrentInstallationId ()
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 
 getCollection (array $record, string $entity, string $schema_version, string $field, string $value)
 
 getContainerExportConfig (array $record, string $entity, string $schema_version, string $field, string $value)
 

Protected Member Functions

 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getExportDirInContainer (string $exp_dir)
 
 getIRSSContainerExportConfig (StorableResource $source_container, string $source_path, string $target_path="")
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
 createObjectExportId (string $a_type, string $a_id)
 Build ilias export id. More...
 
 parseObjectExportId (string $a_id, ?string $a_fallback_id=null)
 Parse export id. More...
 
 stripTags (array $rec, array $omit_keys=[])
 

Protected Attributes

ILIAS Help InternalDomainService $help_domain
 
ILIAS Help InternalDataService $help_data
 
ILIAS Help Tooltips TooltipsManager $help_tooltips
 
ILIAS Help Map MapManager $help_map
 
- Protected Attributes inherited from ilDataSet
ILIAS ResourceStorage Services $irss
 
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $component_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 
ilExport $export
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
const DATASET_NS = 'http://www.ilias.de/Services/DataSet/ds/4_3'
 
const DATASET_NS_PREFIX = 'ds'
 
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 
int $dircnt = 0
 

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 19 of file class.ilHelpDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilHelpDataSet::__construct ( )

Reimplemented from ilDataSet.

Definition at line 26 of file class.ilHelpDataSet.php.

27 {
28 global $DIC;
29
30 $this->help_domain = $DIC->help()->internal()->domain();
31 $this->help_data = $DIC->help()->internal()->data();
32
34
35 $this->help_map = $this->help_domain->map();
36 $this->help_tooltips = $this->help_domain->tooltips();
37 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getSupportedVersions()

ilHelpDataSet::getSupportedVersions ( )

Reimplemented from ilDataSet.

Definition at line 39 of file class.ilHelpDataSet.php.

39 : array
40 {
41 return array("10.0", "4.3.0");
42 }

◆ getTypes()

ilHelpDataSet::getTypes ( string  $a_entity,
string  $a_version 
)
protected

Get (abstract) types for (abstract) field names.

Please note that the abstract fields/types only depend on the version! Not on a choosen representation!

Returns
array types array, e.g. array("field_1" => "text", "field_2" => "integer", ...)

Reimplemented from ilDataSet.

Definition at line 49 of file class.ilHelpDataSet.php.

49 : array
50 {
51 if ($a_entity === "help_map") {
52 switch ($a_version) {
53 case "4.3.0":
54 return array(
55 "Chap" => "integer",
56 "Component" => "text",
57 "ScreenId" => "text",
58 "ScreenSubId" => "text",
59 "Perm" => "text"
60 );
61 case "10.0":
62 return array(
63 "Chap" => "integer",
64 "Component" => "text",
65 "ScreenId" => "text",
66 "ScreenSubId" => "text",
67 "Perm" => "text",
68 "FullId" => "text"
69 );
70 }
71 }
72
73 if ($a_entity === "help_tooltip") {
74 switch ($a_version) {
75 case "4.3.0":
76 case "10.0":
77 return array(
78 "Id" => "integer",
79 "TtText" => "text",
80 "TtId" => "text",
81 "Comp" => "text",
82 "Lang" => "text"
83 );
84 }
85 }
86
87 if ($a_entity === "gdtr") {
88 switch ($a_version) {
89 case "10.0":
90 return [
91 "ObjId" => "integer",
92 "Title" => "text",
93 "Description" => "text",
94 "Permission" => "integer",
95 "ScreenIds" => "text",
96 "Lang" => "text"
97 ];
98 }
99 }
100
101 if ($a_entity === "gdtr_step") {
102 switch ($a_version) {
103 case "10.0":
104 return [
105 "Id" => "integer",
106 "TourId" => "integer",
107 "OrderNr" => "integer",
108 "Type" => "integer",
109 "ElementId" => "text"
110 ];
111 }
112 }
113
114 return [];
115 }

◆ getXmlNamespace()

ilHelpDataSet::getXmlNamespace ( string  $a_entity,
string  $a_schema_version 
)
protected

Reimplemented from ilDataSet.

Definition at line 44 of file class.ilHelpDataSet.php.

44 : string
45 {
46 return "https://www.ilias.de/xml/Services/Help/" . $a_entity;
47 }

◆ importRecord()

ilHelpDataSet::importRecord ( string  $a_entity,
array  $a_types,
array  $a_rec,
ilImportMapping  $a_mapping,
string  $a_schema_version 
)

Needs to be overwritten for import use case.

Reimplemented from ilDataSet.

Definition at line 172 of file class.ilHelpDataSet.php.

178 : void {
179 $a_rec = $this->stripTags($a_rec);
180 switch ($a_entity) {
181 case "help_map":
182
183 // without module ID we do nothing
184 $module_id = $a_mapping->getMapping('components/ILIAS/Help', 'help_module', 0);
185 $t = $a_mapping->getAllMappings();
186 if ($module_id) {
187 $new_chap = $a_mapping->getMapping(
188 'components/ILIAS/Help',
189 'help_chap',
190 $a_rec["Chap"]
191 );
192
193 // new import (5.1): get chapter from learning module import mapping
194 if ((int) $new_chap === 0) {
195 $new_chap = $a_mapping->getMapping(
196 'components/ILIAS/LearningModule',
197 'lm_tree',
198 $a_rec["Chap"]
199 );
200 }
201
202 if ($new_chap > 0) {
203 $this->help_map->saveMappingEntry(
204 $new_chap,
205 $a_rec["Component"],
206 $a_rec["ScreenId"],
207 $a_rec["ScreenSubId"],
208 $a_rec["Perm"],
209 $module_id,
210 $a_rec["FullId"] ?? ""
211 );
212 }
213 }
214 break;
215
216 case "help_tooltip":
217
218 // without module ID we do nothing
219 $module_id = $a_mapping->getMapping('components/ILIAS/Help', 'help_module', 0);
220 if ($module_id) {
221 $this->help_tooltips->addTooltip($a_rec["TtId"], $a_rec["TtText"], $module_id);
222 }
223 break;
224
225 case "gdtr":
226 $newObj = new ilObjGuidedTour();
227 $newObj->create(0, true);
228
229 $newObj->setTitle($a_rec["Title"]);
230 $newObj->setDescription($a_rec["Description"]);
231 $newObj->update(true);
232
233 //$this->current_obj = $newObj;
234 $a_mapping->addMapping("components/ILIAS/Help", "gdtr", $a_rec["ObjId"], $newObj->getId());
235 $a_mapping->addMapping("components/ILIAS/ILIASObject", "obj", $a_rec["ObjId"], $newObj->getId());
236
237 $this->help_domain->guidedTour()->tourSettings()->save(
238 $this->help_data->guidedTour()->settings(
239 $newObj->getId(),
240 false,
241 $a_rec["ScreenIds"],
242 \ILIAS\Help\GuidedTour\Settings\PermissionType::from((int) $a_rec["Permission"]),
243 $a_rec["Lang"],
244 )
245 );
246 break;
247
248 case "gdtr_step":
249 $tour_id = (int) $a_mapping->getMapping("components/ILIAS/Help", "gdtr", $a_rec["TourId"]);
250 if ($tour_id > 0) {
251 $step_id = $this->help_domain->guidedTour()->step()->create(
252 $this->help_data->guidedTour()->step(
253 0,
254 $tour_id,
255 (int) $a_rec["OrderNr"],
256 \ILIAS\Help\GuidedTour\Step\StepType::from((int) $a_rec["Type"]),
257 $a_rec["ElementId"],
258 )
259 );
260 $a_mapping->addMapping(
261 "components/ILIAS/COPage",
262 "pg",
263 "gdtr:" . $a_rec["Id"],
264 "gdtr:" . $step_id
265 );
266 }
267 break;
268 }
269 }
stripTags(array $rec, array $omit_keys=[])
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ilImportMapping\addMapping(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), ilImportMapping\getAllMappings(), ilImportMapping\getMapping(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ readData()

ilHelpDataSet::readData ( string  $a_entity,
string  $a_version,
array  $a_ids 
)

Read data from DB.

This should result in the abstract field structure of the version set in the constructor.

Reimplemented from ilDataSet.

Definition at line 117 of file class.ilHelpDataSet.php.

117 : void
118 {
120
121 if ($a_entity === "help_map") {
122 switch ($a_version) {
123 case "4.3.0":
124 $this->getDirectDataFromQuery("SELECT chap, component, screen_id, screen_sub_id, perm " .
125 " FROM help_map " .
126 "WHERE " .
127 $ilDB->in("chap", $a_ids, false, "integer"));
128 break;
129 case "10.0":
130 $this->getDirectDataFromQuery("SELECT chap, component, screen_id, screen_sub_id, perm, full_id " .
131 " FROM help_map " .
132 "WHERE " .
133 $ilDB->in("chap", $a_ids, false, "integer"));
134 break;
135 }
136 }
137
138 if ($a_entity === "help_tooltip") {
139 switch ($a_version) {
140 case "4.3.0":
141 case "10.0":
142 $this->getDirectDataFromQuery("SELECT id, tt_text, tt_id, comp, lang FROM help_tooltip " .
143 " WHERE module_id = " . $ilDB->quote(0, "integer"));
144 break;
145 }
146 }
147
148 if ($a_entity === "gdtr") {
149 switch ($a_version) {
150 case "10.0":
151 $this->getDirectDataFromQuery("SELECT hs.obj_id, title, description, permission, screen_ids, lang " .
152 " FROM help_gt_settings hs JOIN object_data od ON (hs.obj_id = od.obj_id)" .
153 "WHERE " .
154 $ilDB->in("hs.obj_id", $a_ids, false, "integer"));
155 break;
156 }
157 }
158
159 if ($a_entity === "gdtr_step") {
160 switch ($a_version) {
161 case "10.0":
162 $this->getDirectDataFromQuery("SELECT id, tour_id, order_nr, type, element_id " .
163 " FROM help_gt_step " .
164 "WHERE " .
165 $ilDB->in("id", $a_ids, false, "integer"));
166 break;
167 }
168 }
169
170 }
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 ...
ilDBInterface $db

References ilDataSet\$db, $ilDB, and ilDataSet\getDirectDataFromQuery().

+ Here is the call graph for this function:

Field Documentation

◆ $help_data

ILIAS Help InternalDataService ilHelpDataSet::$help_data
protected

Definition at line 22 of file class.ilHelpDataSet.php.

◆ $help_domain

ILIAS Help InternalDomainService ilHelpDataSet::$help_domain
protected

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

◆ $help_map

ILIAS Help Map MapManager ilHelpDataSet::$help_map
protected

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

◆ $help_tooltips

ILIAS Help Tooltips TooltipsManager ilHelpDataSet::$help_tooltips
protected

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


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