ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilWikiDataSet Class Reference

Wiki Data set class. More...

+ Inheritance diagram for ilWikiDataSet:
+ Collaboration diagram for ilWikiDataSet:

Public Member Functions

 __construct ()
 construct More...
 
 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 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 fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 getXmlRepresentation ( $a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $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 ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=null)
 Parse export id. More...
 

Protected Attributes

 $wiki_log
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
 
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
 

Detailed Description

Wiki Data set class.

This class implements the following entities:

  • wiki: data from il_wiki_data
  • wpg: data from il_wiki_page
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilWikiDataSet::__construct ( )

construct

Parameters

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

References $DIC, and ilLoggerFactory\getLogger().

31  {
32  global $DIC;
33 
34  $this->db = $DIC->database();
35  parent::__construct();
36  $this->wiki_log = ilLoggerFactory::getLogger('wiki');
37  }
global $DIC
Definition: saml.php:7
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ getDependencies()

ilWikiDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

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

References array.

252  {
253  switch ($a_entity) {
254  case "wiki":
255  return array(
256  "wpg" => array("ids" => $a_rec["Id"]),
257  "wiki_imp_page" => array("ids" => $a_rec["Id"])
258  );
259  }
260 
261  return false;
262  }
Create styles array
The data for the language used.

◆ getSupportedVersions()

ilWikiDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

References array.

47  {
48  return array("4.1.0", "4.3.0", "4.4.0", "5.1.0");
49  }
Create styles array
The data for the language used.

◆ getTypes()

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

Get field types for entity.

Parameters

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

References array.

69  {
70  if ($a_entity == "wiki") {
71  switch ($a_version) {
72  case "4.1.0":
73  return array(
74  "Id" => "integer",
75  "Title" => "text",
76  "Description" => "text",
77  "StartPage" => "text",
78  "Short" => "text",
79  "Introduction" => "text",
80  "Rating" => "integer");
81 
82  case "4.3.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 
98  case "4.4.0":
99  return array(
100  "Id" => "integer",
101  "Title" => "text",
102  "Description" => "text",
103  "StartPage" => "text",
104  "Short" => "text",
105  "Introduction" => "text",
106  "Rating" => "integer",
107  "PublicNotes" => "integer",
108  // "ImpPages" => "integer",
109  "PageToc" => "integer",
110  "RatingSide" => "integer",
111  "RatingNew" => "integer",
112  "RatingExt" => "integer",
113  "RatingOverall" => "integer");
114 
115  case "5.1.0":
116  return array(
117  "Id" => "integer",
118  "Title" => "text",
119  "Description" => "text",
120  "StartPage" => "text",
121  "Short" => "text",
122  "Introduction" => "text",
123  "Rating" => "integer",
124  "PublicNotes" => "integer",
125  // "ImpPages" => "integer",
126  "PageToc" => "integer",
127  "RatingSide" => "integer",
128  "RatingNew" => "integer",
129  "RatingExt" => "integer",
130  "RatingOverall" => "integer",
131  "LinkMdValues" => "integer"
132  );
133  }
134  }
135 
136  if ($a_entity == "wpg") {
137  switch ($a_version) {
138  case "4.1.0":
139  return array(
140  "Id" => "integer",
141  "Title" => "text",
142  "WikiId" => "integer");
143 
144  case "4.3.0":
145  case "4.4.0":
146  case "5.1.0":
147  return array(
148  "Id" => "integer",
149  "Title" => "text",
150  "WikiId" => "integer",
151  "Blocked" => "integer",
152  "Rating" => "integer");
153  }
154  }
155 
156  if ($a_entity == "wiki_imp_page") {
157  switch ($a_version) {
158  case "5.1.0":
159  return array(
160  "WikiId" => "integer",
161  "PageId" => "integer",
162  "Ord" => "integer",
163  "Indent" => "integer");
164  }
165  }
166  return array();
167  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilWikiDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

58  {
59  return "http://www.ilias.de/xml/Modules/Wiki/" . $a_entity;
60  }

◆ importRecord()

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

Import record.

Parameters

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

References ilObjectFactory\getInstanceByObjId().

272  {
273  //echo $a_entity;
274  //var_dump($a_rec);
275 
276  switch ($a_entity) {
277  case "wiki":
278 
279  include_once("./Modules/Wiki/classes/class.ilObjWiki.php");
280  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
281  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
282  } else {
283  $newObj = new ilObjWiki();
284  $newObj->setType("wiki");
285  $newObj->create(true);
286  }
287 
288  $newObj->setTitle($a_rec["Title"]);
289  $newObj->setDescription($a_rec["Description"]);
290  $newObj->setShortTitle($a_rec["Short"]);
291  $newObj->setStartPage($a_rec["StartPage"]);
292  $newObj->setRatingOverall($a_rec["RatingOverall"]);
293  $newObj->setRating($a_rec["Rating"]);
294  $newObj->setIntroduction($a_rec["Introduction"]);
295  $newObj->setPublicNotes($a_rec["PublicNotes"]);
296 
297  // >= 4.3
298  if (isset($a_rec["PageToc"])) {
299  // $newObj->setImportantPages($a_rec["ImpPages"]);
300  $newObj->setPageToc($a_rec["PageToc"]);
301  $newObj->setRatingAsBlock($a_rec["RatingSide"]);
302  $newObj->setRatingForNewPages($a_rec["RatingNew"]);
303  $newObj->setRatingCategories($a_rec["RatingExt"]);
304  }
305  $newObj->setLinkMetadataValues($a_rec["LinkMdValues"]);
306 
307  $newObj->update(true);
308  $this->current_obj = $newObj;
309  $a_mapping->addMapping("Modules/Wiki", "wiki", $a_rec["Id"], $newObj->getId());
310  $a_mapping->addMapping("Services/Object", "obj", $a_rec["Id"], $newObj->getId());
311  $a_mapping->addMapping("Services/Rating", "rating_category_parent_id", $a_rec["Id"], $newObj->getId());
312  $a_mapping->addMapping("Services/AdvancedMetaData", "parent", $a_rec["Id"], $newObj->getId());
313  break;
314 
315  case "wpg":
316  $wiki_id = $a_mapping->getMapping("Modules/Wiki", "wiki", $a_rec["WikiId"]);
317  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
318  $wpage = new ilWikiPage();
319  $wpage->setWikiId($wiki_id);
320  $wpage->setTitle($a_rec["Title"]);
321 
322  // >= 4.3
323  if (isset($a_rec["Blocked"])) {
324  $wpage->setBlocked($a_rec["Blocked"]);
325  $wpage->setRating($a_rec["Rating"]);
326  }
327 
328  $wpage->create(true);
329 
330  $a_mapping->addMapping("Modules/Wiki", "wpg", $a_rec["Id"], $wpage->getId());
331  $a_mapping->addMapping("Services/COPage", "pg", "wpg:" . $a_rec["Id"], "wpg:" . $wpage->getId());
332  $a_mapping->addMapping("Services/AdvancedMetaData", "advmd_sub_item", "advmd:wpg:" . $a_rec["Id"], $wpage->getId());
333  break;
334 
335  case "wiki_imp_page":
336  $wiki_id = $a_mapping->getMapping("Modules/Wiki", "wiki", $a_rec["WikiId"]);
337  $page_id = $a_mapping->getMapping("Modules/Wiki", "wpg", $a_rec["PageId"]);
338  if ($wiki_id > 0 && $page_id > 0 && is_object($this->current_obj) && $this->current_obj->getId() == $wiki_id) {
339  $this->current_obj->addImportantPage($page_id, $a_rec["Ord"], $a_rec["Indent"]);
340  }
341  break;
342  }
343  }
Class ilObjWiki.
Class ilWikiPage.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

◆ readData()

ilWikiDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters

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

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

176  {
177  $ilDB = $this->db;
178 
179  if (!is_array($a_ids)) {
180  $a_ids = array($a_ids);
181  }
182 
183  if ($a_entity == "wiki") {
184  switch ($a_version) {
185  case "4.1.0":
186  $this->getDirectDataFromQuery("SELECT id, title, description," .
187  " startpage start_page, short, rating, introduction" .
188  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
189  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
190  break;
191 
192  case "4.3.0":
193  $this->getDirectDataFromQuery("SELECT id, title, description," .
194  " startpage start_page, short, rating, introduction," . // imp_pages,
195  " public_notes, page_toc, rating_side, rating_new, rating_ext" .
196  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
197  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
198  break;
199 
200  case "4.4.0":
201  $this->getDirectDataFromQuery("SELECT id, title, description," .
202  " startpage start_page, short, rating, rating_overall, introduction," . // imp_pages,
203  " public_notes, page_toc, rating_side, rating_new, rating_ext" .
204  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
205  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
206  break;
207 
208  case "5.1.0":
209  $this->getDirectDataFromQuery("SELECT id, title, description," .
210  " startpage start_page, short, rating, rating_overall, introduction," . // imp_pages,
211  " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values" .
212  " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
213  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
214  break;
215  }
216  }
217 
218  if ($a_entity == "wpg") {
219  switch ($a_version) {
220  case "4.1.0":
221  $this->getDirectDataFromQuery("SELECT id, title, wiki_id" .
222  " FROM il_wiki_page" .
223  " WHERE " . $ilDB->in("wiki_id", $a_ids, false, "integer"));
224  break;
225 
226  case "4.3.0":
227  case "4.4.0":
228  case "5.1.0":
229  $this->getDirectDataFromQuery("SELECT id, title, wiki_id," .
230  " blocked, rating" .
231  " FROM il_wiki_page" .
232  " WHERE " . $ilDB->in("wiki_id", $a_ids, false, "integer"));
233  break;
234  }
235  }
236 
237  if ($a_entity == "wiki_imp_page") {
238  switch ($a_version) {
239  case "5.1.0":
240  $this->getDirectDataFromQuery("SELECT wiki_id, page_id, ord, indent " .
241  " FROM il_wiki_imp_pages " .
242  " WHERE " . $ilDB->in("wiki_id", $a_ids, false, "integer"));
243  break;
244  }
245  }
246  }
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 ...
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $wiki_log

ilWikiDataSet::$wiki_log
protected

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


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