ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContentPageDataSet.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
12 protected $data = [];
13
17 protected $newMobIds = [];
18
22 public function getSupportedVersions()
23 {
24 return [
25 '5.4.0',
26 ];
27 }
28
32 public function getXmlNamespace($a_entity, $a_schema_version)
33 {
34 return 'http://www.ilias.de/xml/Modules/ContentPage/' . $a_entity;
35 }
36
40 protected function getTypes($a_entity, $a_version)
41 {
42 switch ($a_entity) {
43 case self::OBJ_TYPE:
44 return [
45 'id' => 'integer',
46 'title' => 'text',
47 'description' => 'text',
48 'info-tab' => 'integer',
49 'style-id' => 'integer',
50 ];
51
52 default:
53 return [];
54 }
55 }
56
60 public function readData($a_entity, $a_version, $a_ids)
61 {
62 $this->data = [];
63
64 if (!is_array($a_ids)) {
65 $a_ids = [$a_ids];
66 }
67
68 $this->readEntityData($a_entity, $a_ids);
69 }
70
71
76 protected function readEntityData(string $entity, array $ids) : void
77 {
78 switch ($entity) {
79 case self::OBJ_TYPE:
80 foreach ($ids as $objId) {
81 if (ilObject::_lookupType($objId) == self::OBJ_TYPE) {
84
85 $this->data[] = [
86 'id' => $obj->getId(),
87 'title' => $obj->getTitle(),
88 'description' => $obj->getDescription(),
89 'info-tab' => (int) ilContainer::_lookupContainerSetting(
90 $obj->getId(),
92 true
93 ),
94 'style-id' => $obj->getStyleSheetId(),
95 ];
96 }
97 }
98 break;
99
100 default:
101 break;
102 }
103 }
104
112 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version) : void
113 {
114 switch ($a_entity) {
115 case self::OBJ_TYPE:
116 if ($newObjId = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['id'])) {
117 $newObject = ilObjectFactory::getInstanceByObjId($newObjId, false);
118 } else {
119 $newObject = new ilObjContentPage();
120 }
121
122 $newObject->setTitle(ilUtil::stripSlashes($a_rec['title']));
123 $newObject->setDescription(ilUtil::stripSlashes($a_rec['description']));
124 $newObject->setStyleSheetId((int) ilUtil::stripSlashes($a_rec['style-id']));
125
126 if (!$newObject->getId()) {
127 $newObject->create();
128 }
129
131 $newObject->getId(),
133 (int) $a_rec['info-tab']
134 );
135
136 $a_mapping->addMapping('Modules/ContentPage', self::OBJ_TYPE, $a_rec['id'], $newObject->getId());
137 $a_mapping->addMapping('Modules/ContentPage', 'style', $newObject->getId(), $newObject->getStyleSheetId());
138 $a_mapping->addMapping(
139 'Services/COPage',
140 'pg',
141 self::OBJ_TYPE . ':' . $a_rec['id'],
142 self::OBJ_TYPE . ':' . $newObject->getId()
143 );
144 break;
145 }
146 }
147
151 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids) : array
152 {
153 return [];
154 }
155}
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
Class ilContentPageDataSet.
readData($a_entity, $a_version, $a_ids)
Read data from DB.This should result in the abstract field structure of the version set in the constr...
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
getSupportedVersions()
Get supported version.array array of supported version
getTypes($a_entity, $a_version)
Get (abstract) types for (abstract) field names.Please note that the abstract fields/types only depen...
A dataset contains in data in a common structure that can be shared and transformed for different pur...
Class ilObjContentPage.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Interface ilContentPageObjectConstants.
$objId
Definition: xapitoken.php:39