ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWikiDataSet 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 ilWikiDataSet:
+ Collaboration diagram for ilWikiDataSet:

Public Member Functions

 __construct ()
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 
- 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...
 
 setExportDirectories (string $a_relative, string $a_absolute)
 
 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 ...> ... 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...
 

Protected Member Functions

 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getTypes (string $a_entity, string $a_version)
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
- 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)
 
 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

ilObjWiki $current_obj = null
 
ilLogger $wiki_log
 
- Protected Attributes inherited from ilDataSet
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $relative_export_dir = ""
 
string $absolute_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
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 Wiki Data set class

This class implements the following entities:

  • wiki: data from il_wiki_data
  • wpg: data from il_wiki_page
Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 28 of file class.ilWikiDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilWikiDataSet::__construct ( )

Definition at line 33 of file class.ilWikiDataSet.php.

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

34  {
35  global $DIC;
36 
37  $this->db = $DIC->database();
39  $this->wiki_log = ilLoggerFactory::getLogger('wiki');
40  }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getDependencies()

ilWikiDataSet::getDependencies ( string  $a_entity,
string  $a_version,
?array  $a_rec = null,
?array  $a_ids = null 
)
protected

Definition at line 287 of file class.ilWikiDataSet.php.

292  : array {
293  switch ($a_entity) {
294  case "wiki":
295  return array(
296  "wpg" => array("ids" => $a_rec["Id"] ?? null),
297  "wiki_imp_page" => array("ids" => $a_rec["Id"] ?? null)
298  );
299  }
300 
301  return [];
302  }

◆ getSupportedVersions()

ilWikiDataSet::getSupportedVersions ( )

Definition at line 42 of file class.ilWikiDataSet.php.

42  : array
43  {
44  return array("4.1.0", "4.3.0", "4.4.0", "5.1.0", "5.4.0");
45  }

◆ getTypes()

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

Definition at line 52 of file class.ilWikiDataSet.php.

52  : array
53  {
54  if ($a_entity === "wiki") {
55  switch ($a_version) {
56  case "4.1.0":
57  return array(
58  "Id" => "integer",
59  "Title" => "text",
60  "Description" => "text",
61  "StartPage" => "text",
62  "Short" => "text",
63  "Introduction" => "text",
64  "Rating" => "integer");
65 
66  case "4.3.0":
67  return array(
68  "Id" => "integer",
69  "Title" => "text",
70  "Description" => "text",
71  "StartPage" => "text",
72  "Short" => "text",
73  "Introduction" => "text",
74  "Rating" => "integer",
75  "PublicNotes" => "integer",
76  // "ImpPages" => "integer",
77  "PageToc" => "integer",
78  "RatingSide" => "integer",
79  "RatingNew" => "integer",
80  "RatingExt" => "integer");
81 
82  case "4.4.0":
83  return array(
84  "Id" => "integer",
85  "Title" => "text",
86  "Description" => "text",
87  "StartPage" => "text",
88  "Short" => "text",
89  "Introduction" => "text",
90  "Rating" => "integer",
91  "PublicNotes" => "integer",
92  // "ImpPages" => "integer",
93  "PageToc" => "integer",
94  "RatingSide" => "integer",
95  "RatingNew" => "integer",
96  "RatingExt" => "integer",
97  "RatingOverall" => "integer");
98 
99  case "5.1.0":
100  return array(
101  "Id" => "integer",
102  "Title" => "text",
103  "Description" => "text",
104  "StartPage" => "text",
105  "Short" => "text",
106  "Introduction" => "text",
107  "Rating" => "integer",
108  "PublicNotes" => "integer",
109  // "ImpPages" => "integer",
110  "PageToc" => "integer",
111  "RatingSide" => "integer",
112  "RatingNew" => "integer",
113  "RatingExt" => "integer",
114  "RatingOverall" => "integer",
115  "LinkMdValues" => "integer"
116  );
117 
118  case "5.4.0":
119  return array(
120  "Id" => "integer",
121  "Title" => "text",
122  "Description" => "text",
123  "StartPage" => "text",
124  "Short" => "text",
125  "Introduction" => "text",
126  "Rating" => "integer",
127  "PublicNotes" => "integer",
128  // "ImpPages" => "integer",
129  "PageToc" => "integer",
130  "RatingSide" => "integer",
131  "RatingNew" => "integer",
132  "RatingExt" => "integer",
133  "RatingOverall" => "integer",
134  "LinkMdValues" => "integer",
135  "EmptyPageTempl" => "integer"
136  );
137  }
138  }
139 
140  if ($a_entity === "wpg") {
141  switch ($a_version) {
142  case "4.1.0":
143  return array(
144  "Id" => "integer",
145  "Title" => "text",
146  "WikiId" => "integer");
147 
148  case "4.3.0":
149  case "4.4.0":
150  case "5.1.0":
151  return array(
152  "Id" => "integer",
153  "Title" => "text",
154  "WikiId" => "integer",
155  "Blocked" => "integer",
156  "Rating" => "integer");
157 
158  case "5.4.0":
159  return array(
160  "Id" => "integer",
161  "Title" => "text",
162  "WikiId" => "integer",
163  "Blocked" => "integer",
164  "Rating" => "integer",
165  "TemplateNewPages" => "integer",
166  "TemplateAddToPage" => "integer"
167  );
168  }
169  }
170 
171  if ($a_entity === "wiki_imp_page") {
172  switch ($a_version) {
173  case "5.1.0":
174  case "5.4.0":
175  return array(
176  "WikiId" => "integer",
177  "PageId" => "integer",
178  "Ord" => "integer",
179  "Indent" => "integer");
180  }
181  }
182  return array();
183  }

◆ getXmlNamespace()

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

Definition at line 47 of file class.ilWikiDataSet.php.

47  : string
48  {
49  return "https://www.ilias.de/xml/Modules/Wiki/" . $a_entity;
50  }

◆ importRecord()

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

Definition at line 304 of file class.ilWikiDataSet.php.

References ilImportMapping\addMapping(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), ILIAS\Repository\int(), and ilDataSet\stripTags().

310  : void {
311  $a_rec = $this->stripTags($a_rec);
312  switch ($a_entity) {
313  case "wiki":
314 
315  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
316  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
317  } else {
318  $newObj = new ilObjWiki();
319  $newObj->setType("wiki");
320  $newObj->create(true);
321  }
322 
323  $newObj->setTitle($a_rec["Title"]);
324  $newObj->setDescription($a_rec["Description"]);
325  $newObj->setShortTitle($a_rec["Short"]);
326  $newObj->setStartPage($a_rec["StartPage"]);
327  $newObj->setRatingOverall($a_rec["RatingOverall"]);
328  $newObj->setRating($a_rec["Rating"]);
329  $newObj->setIntroduction($a_rec["Introduction"]);
330  $newObj->setPublicNotes($a_rec["PublicNotes"]);
331 
332  // >= 4.3
333  if (isset($a_rec["PageToc"])) {
334  $newObj->setPageToc($a_rec["PageToc"]);
335  $newObj->setRatingAsBlock($a_rec["RatingSide"]);
336  $newObj->setRatingForNewPages($a_rec["RatingNew"]);
337  $newObj->setRatingCategories($a_rec["RatingExt"]);
338  }
339  $newObj->setLinkMetadataValues($a_rec["LinkMdValues"]);
340  $newObj->setEmptyPageTemplate((int) $a_rec["EmptyPageTempl"]);
341 
342  $newObj->update(true);
343  $this->current_obj = $newObj;
344  $a_mapping->addMapping("Modules/Wiki", "wiki", $a_rec["Id"], $newObj->getId());
345  $a_mapping->addMapping("Services/Object", "obj", $a_rec["Id"], $newObj->getId());
346  $a_mapping->addMapping("Services/Rating", "rating_category_parent_id", $a_rec["Id"], $newObj->getId());
347  $a_mapping->addMapping("Services/AdvancedMetaData", "parent", $a_rec["Id"], $newObj->getId());
348  break;
349 
350  case "wpg":
351  $wiki_id = $a_mapping->getMapping("Modules/Wiki", "wiki", $a_rec["WikiId"]);
352  $wpage = new ilWikiPage();
353  $wpage->setWikiId($wiki_id);
354  $wpage->setTitle($a_rec["Title"]);
355 
356  // >= 4.3
357  if (isset($a_rec["Blocked"])) {
358  $wpage->setBlocked($a_rec["Blocked"]);
359  $wpage->setRating($a_rec["Rating"]);
360  }
361 
362  $wpage->create(true);
363 
364  if (isset($a_rec["TemplateNewPages"]) || isset($a_rec["TemplateAddToPage"])) {
365  $wtpl = new ilWikiPageTemplate($wiki_id);
366  $wtpl->save($wpage->getId(), (int) $a_rec["TemplateNewPages"], (int) $a_rec["TemplateAddToPage"]);
367  }
368 
369  $a_mapping->addMapping("Modules/Wiki", "wpg", $a_rec["Id"], $wpage->getId());
370  $a_mapping->addMapping("Services/COPage", "pg", "wpg:" . $a_rec["Id"], "wpg:" . $wpage->getId());
371  $a_mapping->addMapping("Services/AdvancedMetaData", "advmd_sub_item", "advmd:wpg:" . $a_rec["Id"], $wpage->getId());
372  break;
373 
374  case "wiki_imp_page":
375  $wiki_id = $a_mapping->getMapping("Modules/Wiki", "wiki", $a_rec["WikiId"]);
376  $page_id = $a_mapping->getMapping("Modules/Wiki", "wpg", $a_rec["PageId"]);
377  if ($wiki_id > 0 && $page_id > 0 && is_object($this->current_obj) && $this->current_obj->getId() === (int) $wiki_id) {
378  $this->current_obj->addImportantPage((int) $page_id, (int) $a_rec["Ord"], (int) $a_rec["Indent"]);
379  }
380  break;
381  }
382  }
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getMapping(string $a_comp, string $a_entity, string $a_old_id)
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...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
stripTags(array $rec, array $omit_keys=[])
+ Here is the call graph for this function:

◆ readData()

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

Definition at line 185 of file class.ilWikiDataSet.php.

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

185  : void
186  {
187  $ilDB = $this->db;
188 
189  if (!is_array($a_ids)) {
190  $a_ids = array($a_ids);
191  }
192 
193  if ($a_entity === "wiki") {
194  switch ($a_version) {
195  case "4.1.0":
196  $this->getDirectDataFromQuery("SELECT id, title, description," .
197  " startpage start_page, short, rating, introduction" .
198  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
199  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
200  break;
201 
202  case "4.3.0":
203  $this->getDirectDataFromQuery("SELECT id, title, description," .
204  " startpage start_page, short, rating, introduction," . // imp_pages,
205  " public_notes, page_toc, rating_side, rating_new, rating_ext" .
206  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
207  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
208  break;
209 
210  case "4.4.0":
211  $this->getDirectDataFromQuery("SELECT id, title, description," .
212  " startpage start_page, short, rating, rating_overall, introduction," . // imp_pages,
213  " public_notes, page_toc, rating_side, rating_new, rating_ext" .
214  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
215  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
216  break;
217 
218  case "5.1.0":
219  $this->getDirectDataFromQuery("SELECT id, title, description," .
220  " startpage start_page, short, rating, rating_overall, introduction," . // imp_pages,
221  " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values" .
222  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
223  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
224  break;
225 
226  case "5.4.0":
227  $this->getDirectDataFromQuery("SELECT id, title, description," .
228  " startpage start_page, short, rating, rating_overall, introduction," . // imp_pages,
229  " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values, empty_page_templ" .
230  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
231  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
232  break;
233  }
234  }
235 
236  if ($a_entity === "wpg") {
237  switch ($a_version) {
238  case "4.1.0":
239  $this->getDirectDataFromQuery("SELECT id, title, wiki_id" .
240  " FROM il_wiki_page" .
241  " WHERE " . $ilDB->in("wiki_id", $a_ids, false, "integer"));
242  break;
243 
244  case "4.3.0":
245  case "4.4.0":
246  case "5.1.0":
247  $this->getDirectDataFromQuery("SELECT id, title, wiki_id," .
248  " blocked, rating" .
249  " FROM il_wiki_page" .
250  " WHERE " . $ilDB->in("wiki_id", $a_ids, false, "integer"));
251  break;
252 
253  case "5.4.0":
254  $this->getDirectDataFromQuery("SELECT id, title, wiki_id," .
255  " blocked, rating" .
256  " FROM il_wiki_page" .
257  " WHERE " . $ilDB->in("wiki_id", $a_ids, false, "integer"));
258  foreach ($this->data as $k => $v) {
259  $set = $ilDB->queryF(
260  "SELECT * FROM wiki_page_template " .
261  " WHERE wiki_id = %s " .
262  " AND wpage_id = %s ",
263  ["integer", "integer"],
264  [$v["WikiId"], $v["Id"]]
265  );
266  if ($rec = $ilDB->fetchAssoc($set)) {
267  $this->data[$k]["TemplateNewPages"] = $rec["new_pages"];
268  $this->data[$k]["TemplateAddToPage"] = $rec["add_to_page"];
269  }
270  }
271  break;
272  }
273  }
274 
275  if ($a_entity === "wiki_imp_page") {
276  switch ($a_version) {
277  case "5.1.0":
278  case "5.4.0":
279  $this->getDirectDataFromQuery("SELECT wiki_id, page_id, ord, indent " .
280  " FROM il_wiki_imp_pages " .
281  " WHERE " . $ilDB->in("wiki_id", $a_ids, false, "integer"));
282  break;
283  }
284  }
285  }
ilDBInterface $db
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 ...
+ Here is the call graph for this function:

Field Documentation

◆ $current_obj

ilObjWiki ilWikiDataSet::$current_obj = null
protected

Definition at line 30 of file class.ilWikiDataSet.php.

◆ $wiki_log

ilLogger ilWikiDataSet::$wiki_log
protected

Definition at line 31 of file class.ilWikiDataSet.php.


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