4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
34 $this->db = $DIC->database();
35 parent::__construct();
48 return array(
"4.1.0",
"4.3.0",
"4.4.0",
"5.1.0",
"5.4.0");
59 return "http://www.ilias.de/xml/Modules/Wiki/" . $a_entity;
68 protected function getTypes($a_entity, $a_version)
70 if ($a_entity ==
"wiki") {
76 "Description" =>
"text",
77 "StartPage" =>
"text",
79 "Introduction" =>
"text",
80 "Rating" =>
"integer");
86 "Description" =>
"text",
87 "StartPage" =>
"text",
89 "Introduction" =>
"text",
90 "Rating" =>
"integer",
91 "PublicNotes" =>
"integer",
93 "PageToc" =>
"integer",
94 "RatingSide" =>
"integer",
95 "RatingNew" =>
"integer",
96 "RatingExt" =>
"integer");
102 "Description" =>
"text",
103 "StartPage" =>
"text",
105 "Introduction" =>
"text",
106 "Rating" =>
"integer",
107 "PublicNotes" =>
"integer",
109 "PageToc" =>
"integer",
110 "RatingSide" =>
"integer",
111 "RatingNew" =>
"integer",
112 "RatingExt" =>
"integer",
113 "RatingOverall" =>
"integer");
119 "Description" =>
"text",
120 "StartPage" =>
"text",
122 "Introduction" =>
"text",
123 "Rating" =>
"integer",
124 "PublicNotes" =>
"integer",
126 "PageToc" =>
"integer",
127 "RatingSide" =>
"integer",
128 "RatingNew" =>
"integer",
129 "RatingExt" =>
"integer",
130 "RatingOverall" =>
"integer",
131 "LinkMdValues" =>
"integer" 138 "Description" =>
"text",
139 "StartPage" =>
"text",
141 "Introduction" =>
"text",
142 "Rating" =>
"integer",
143 "PublicNotes" =>
"integer",
145 "PageToc" =>
"integer",
146 "RatingSide" =>
"integer",
147 "RatingNew" =>
"integer",
148 "RatingExt" =>
"integer",
149 "RatingOverall" =>
"integer",
150 "LinkMdValues" =>
"integer",
151 "EmptyPageTempl" =>
"integer" 156 if ($a_entity ==
"wpg") {
157 switch ($a_version) {
162 "WikiId" =>
"integer");
170 "WikiId" =>
"integer",
171 "Blocked" =>
"integer",
172 "Rating" =>
"integer");
178 "WikiId" =>
"integer",
179 "Blocked" =>
"integer",
180 "Rating" =>
"integer",
181 "TemplateNewPages" =>
"integer",
182 "TemplateAddToPage" =>
"integer" 187 if ($a_entity ==
"wiki_imp_page") {
188 switch ($a_version) {
192 "WikiId" =>
"integer",
193 "PageId" =>
"integer",
195 "Indent" =>
"integer");
207 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
211 if (!is_array($a_ids)) {
212 $a_ids = array($a_ids);
215 if ($a_entity ==
"wiki") {
216 switch ($a_version) {
219 " startpage start_page, short, rating, introduction" .
220 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
221 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
226 " startpage start_page, short, rating, introduction," .
227 " public_notes, page_toc, rating_side, rating_new, rating_ext" .
228 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
229 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
234 " startpage start_page, short, rating, rating_overall, introduction," .
235 " public_notes, page_toc, rating_side, rating_new, rating_ext" .
236 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
237 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
242 " startpage start_page, short, rating, rating_overall, introduction," .
243 " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values" .
244 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
245 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
250 " startpage start_page, short, rating, rating_overall, introduction," .
251 " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values, empty_page_templ" .
252 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
253 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
258 if ($a_entity ==
"wpg") {
259 switch ($a_version) {
262 " FROM il_wiki_page" .
263 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
271 " FROM il_wiki_page" .
272 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
278 " FROM il_wiki_page" .
279 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
280 foreach ($this->
data as $k => $v) {
281 $set =
$ilDB->queryF(
282 "SELECT * FROM wiki_page_template " .
283 " WHERE wiki_id = %s " .
284 " AND wpage_id = %s ",
285 [
"integer",
"integer"],
286 [$v[
"WikiId"], $v[
"Id"]]
288 if ($rec =
$ilDB->fetchAssoc($set)) {
289 $this->
data[$k][
"TemplateNewPages"] = $rec[
"new_pages"];
290 $this->
data[$k][
"TemplateAddToPage"] = $rec[
"add_to_page"];
297 if ($a_entity ==
"wiki_imp_page") {
298 switch ($a_version) {
302 " FROM il_wiki_imp_pages " .
303 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
317 "wpg" => array(
"ids" => $a_rec[
"Id"]),
318 "wiki_imp_page" => array(
"ids" => $a_rec[
"Id"])
332 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
340 include_once(
"./Modules/Wiki/classes/class.ilObjWiki.php");
341 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
345 $newObj->setType(
"wiki");
346 $newObj->create(
true);
349 $newObj->setTitle($a_rec[
"Title"]);
350 $newObj->setDescription($a_rec[
"Description"]);
351 $newObj->setShortTitle($a_rec[
"Short"]);
352 $newObj->setStartPage($a_rec[
"StartPage"]);
353 $newObj->setRatingOverall($a_rec[
"RatingOverall"]);
354 $newObj->setRating($a_rec[
"Rating"]);
355 $newObj->setIntroduction($a_rec[
"Introduction"]);
356 $newObj->setPublicNotes($a_rec[
"PublicNotes"]);
359 if (isset($a_rec[
"PageToc"])) {
361 $newObj->setPageToc($a_rec[
"PageToc"]);
362 $newObj->setRatingAsBlock($a_rec[
"RatingSide"]);
363 $newObj->setRatingForNewPages($a_rec[
"RatingNew"]);
364 $newObj->setRatingCategories($a_rec[
"RatingExt"]);
366 $newObj->setLinkMetadataValues($a_rec[
"LinkMdValues"]);
367 $newObj->setEmptyPageTemplate((
int) $a_rec[
"EmptyPageTempl"]);
369 $newObj->update(
true);
370 $this->current_obj = $newObj;
371 $a_mapping->addMapping(
"Modules/Wiki",
"wiki", $a_rec[
"Id"], $newObj->getId());
372 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
373 $a_mapping->addMapping(
"Services/Rating",
"rating_category_parent_id", $a_rec[
"Id"], $newObj->getId());
374 $a_mapping->addMapping(
"Services/AdvancedMetaData",
"parent", $a_rec[
"Id"], $newObj->getId());
378 $wiki_id = $a_mapping->getMapping(
"Modules/Wiki",
"wiki", $a_rec[
"WikiId"]);
379 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
381 $wpage->setWikiId($wiki_id);
382 $wpage->setTitle($a_rec[
"Title"]);
385 if (isset($a_rec[
"Blocked"])) {
386 $wpage->setBlocked($a_rec[
"Blocked"]);
387 $wpage->setRating($a_rec[
"Rating"]);
390 $wpage->create(
true);
392 if (isset($a_rec[
"TemplateNewPages"]) || isset($a_rec[
"TemplateAddToPage"])) {
394 $wtpl->save($wpage->getId(), (int) $a_rec[
"TemplateNewPages"], (
int) $a_rec[
"TemplateAddToPage"]);
397 $a_mapping->addMapping(
"Modules/Wiki",
"wpg", $a_rec[
"Id"], $wpage->getId());
398 $a_mapping->addMapping(
"Services/COPage",
"pg",
"wpg:" . $a_rec[
"Id"],
"wpg:" . $wpage->getId());
399 $a_mapping->addMapping(
"Services/AdvancedMetaData",
"advmd_sub_item",
"advmd:wpg:" . $a_rec[
"Id"], $wpage->getId());
402 case "wiki_imp_page":
403 $wiki_id = $a_mapping->getMapping(
"Modules/Wiki",
"wiki", $a_rec[
"WikiId"]);
404 $page_id = $a_mapping->getMapping(
"Modules/Wiki",
"wpg", $a_rec[
"PageId"]);
405 if ($wiki_id > 0 && $page_id > 0 && is_object($this->current_obj) && $this->current_obj->getId() == $wiki_id) {
406 $this->current_obj->addImportantPage($page_id, $a_rec[
"Ord"], $a_rec[
"Indent"]);
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 ...
getSupportedVersions()
Get supported versions.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getTypes($a_entity, $a_version)
Get field types for entity.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getLogger($a_component_id)
Get component logger.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.