ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCOPageDataSet.php
Go to the documentation of this file.
1<?php
2
29{
31 protected bool $master_lang_only = false;
32
33 public function setMasterLanguageOnly(bool $a_val): void
34 {
35 $this->master_lang_only = $a_val;
36 }
37
38 public function getMasterLanguageOnly(): bool
39 {
41 }
42
43 public function getSupportedVersions(): array
44 {
45 return array("4.2.0");
46 }
47
48 protected function getXmlNamespace(string $a_entity, string $a_schema_version): string
49 {
50 return "https://www.ilias.de/xml/Services/COPage/" . $a_entity;
51 }
52
53 protected function getTypes(string $a_entity, string $a_version): array
54 {
55 // pgtp: page layout template
56 if ($a_entity == "pgtp") {
57 switch ($a_version) {
58 case "4.2.0":
59 return array(
60 "Id" => "integer",
61 "Title" => "text",
62 "Description" => "text",
63 "SpecialPage" => "integer",
64 "StyleId" => "integer");
65 }
66 }
67 return [];
68 }
69
70 public function readData(string $a_entity, string $a_version, array $a_ids): void
71 {
72 $db = $this->db;
73
74 if (!is_array($a_ids)) {
75 $a_ids = array($a_ids);
76 }
77
78 // mep_data
79 if ($a_entity == "pgtp") {
80 switch ($a_version) {
81 case "4.2.0":
82 $this->getDirectDataFromQuery("SELECT layout_id id, title, description, " .
83 " style_id, special_page " .
84 " FROM page_layout " .
85 "WHERE " .
86 $db->in("layout_id", $a_ids, false, "integer"));
87 break;
88 }
89 }
90 }
91
95 protected function getDependencies(
96 string $a_entity,
97 string $a_version,
98 ?array $a_rec = null,
99 ?array $a_ids = null
100 ): array {
101 return [];
102 }
103
104 public function importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version): void
105 {
106 $a_rec = $this->stripTags($a_rec);
107 switch ($a_entity) {
108 case "pgtp":
109 $pt = new ilPageLayout();
110 $pt->setTitle($a_rec["Title"]);
111 $pt->setDescription($a_rec["Description"]);
112 $pt->update();
113
114 $this->current_obj = $pt;
115 $a_mapping->addMapping(
116 "components/ILIAS/COPage",
117 "pgtp",
118 $a_rec["Id"],
119 $pt->getId()
120 );
121 $a_mapping->addMapping(
122 "components/ILIAS/COPage",
123 "pg",
124 "stys:" . $a_rec["Id"],
125 "stys:" . $pt->getId()
126 );
127 break;
128 }
129 }
130}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlNamespace(string $a_entity, string $a_schema_version)
getTypes(string $a_entity, string $a_version)
Get (abstract) types for (abstract) field names.
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.
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
Determine the dependent sets of data.
readData(string $a_entity, string $a_version, array $a_ids)
Read data from DB.
setMasterLanguageOnly(bool $a_val)
A dataset contains in data in a common structure that can be shared and transformed for different pur...
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
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...
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
in(string $field, array $values, bool $negate=false, string $type="")