ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 = ""
 

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 ilLoggerFactory\getLogger().

31  {
32  parent::__construct();
33  $this->wiki_log = ilLoggerFactory::getLogger('wiki');
34  }
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 261 of file class.ilWikiDataSet.php.

References array.

262  {
263  switch ($a_entity)
264  {
265  case "wiki":
266  return array (
267  "wpg" => array("ids" => $a_rec["Id"]),
268  "wiki_imp_page" => array("ids" => $a_rec["Id"])
269  );
270  }
271 
272  return false;
273  }
Create styles array
The data for the language used.

◆ getSupportedVersions()

ilWikiDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

References array.

44  {
45  return array("4.1.0", "4.3.0", "4.4.0", "5.1.0");
46  }
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 65 of file class.ilWikiDataSet.php.

References array.

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

◆ getXmlNamespace()

ilWikiDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

55  {
56  return "http://www.ilias.de/xml/Modules/Wiki/".$a_entity;
57  }

◆ importRecord()

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

Import record.

Parameters

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

References ilObjectFactory\getInstanceByObjId().

283  {
284 //echo $a_entity;
285 //var_dump($a_rec);
286 
287  switch ($a_entity)
288  {
289  case "wiki":
290 
291  include_once("./Modules/Wiki/classes/class.ilObjWiki.php");
292  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
293  {
294  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
295  }
296  else
297  {
298  $newObj = new ilObjWiki();
299  $newObj->setType("wiki");
300  $newObj->create(true);
301  }
302 
303  $newObj->setTitle($a_rec["Title"]);
304  $newObj->setDescription($a_rec["Description"]);
305  $newObj->setShortTitle($a_rec["Short"]);
306  $newObj->setStartPage($a_rec["StartPage"]);
307  $newObj->setRatingOverall($a_rec["RatingOverall"]);
308  $newObj->setRating($a_rec["Rating"]);
309  $newObj->setIntroduction($a_rec["Introduction"]);
310  $newObj->setPublicNotes($a_rec["PublicNotes"]);
311 
312  // >= 4.3
313  if(isset($a_rec["PageToc"]))
314  {
315  // $newObj->setImportantPages($a_rec["ImpPages"]);
316  $newObj->setPageToc($a_rec["PageToc"]);
317  $newObj->setRatingAsBlock($a_rec["RatingSide"]);
318  $newObj->setRatingForNewPages($a_rec["RatingNew"]);
319  $newObj->setRatingCategories($a_rec["RatingExt"]);
320  }
321  $newObj->setLinkMetadataValues($a_rec["LinkMdValues"]);
322 
323  $newObj->update(true);
324  $this->current_obj = $newObj;
325  $a_mapping->addMapping("Modules/Wiki", "wiki", $a_rec["Id"], $newObj->getId());
326  $a_mapping->addMapping("Services/Object", "obj", $a_rec["Id"], $newObj->getId());
327  $a_mapping->addMapping("Services/Rating", "rating_category_parent_id", $a_rec["Id"], $newObj->getId());
328  $a_mapping->addMapping("Services/AdvancedMetaData", "parent", $a_rec["Id"], $newObj->getId());
329  break;
330 
331  case "wpg":
332  $wiki_id = $a_mapping->getMapping("Modules/Wiki", "wiki", $a_rec["WikiId"]);
333  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
334  $wpage = new ilWikiPage();
335  $wpage->setWikiId($wiki_id);
336  $wpage->setTitle($a_rec["Title"]);
337 
338  // >= 4.3
339  if(isset($a_rec["Blocked"]))
340  {
341  $wpage->setBlocked($a_rec["Blocked"]);
342  $wpage->setRating($a_rec["Rating"]);
343  }
344 
345  $wpage->create(true);
346 
347  $a_mapping->addMapping("Modules/Wiki", "wpg", $a_rec["Id"], $wpage->getId());
348  $a_mapping->addMapping("Services/COPage", "pg", "wpg:".$a_rec["Id"], "wpg:".$wpage->getId());
349  $a_mapping->addMapping("Services/AdvancedMetaData", "advmd_sub_item", "advmd:wpg:".$a_rec["Id"], $wpage->getId());
350  break;
351 
352  case "wiki_imp_page":
353  $wiki_id = $a_mapping->getMapping("Modules/Wiki", "wiki", $a_rec["WikiId"]);
354  $page_id = $a_mapping->getMapping("Modules/Wiki", "wpg", $a_rec["PageId"]);
355  if ($wiki_id > 0 && $page_id > 0 && is_object($this->current_obj) && $this->current_obj->getId() == $wiki_id)
356  {
357  $this->current_obj->addImportantPage($page_id, $a_rec["Ord"], $a_rec["Indent"]);
358  }
359  break;
360  }
361  }
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 178 of file class.ilWikiDataSet.php.

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

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