19declare(strict_types=1);
48 $this->service =
$DIC->blog()->internal();
50 $this->content_style_domain =
$DIC
53 $this->notes =
$DIC->notes();
54 $this->reading_time = $this->service->domain()->readingTime();
55 $this->blog_settings = $this->service->domain()->blogSettings();
60 return array(
"4.3.0",
"5.0.0",
"5.3.0",
"8.0");
65 string $a_schema_version
68 if ($a_entity ===
'blog' || $a_entity ==
'blog_posting') {
70 return "http://www.ilias.de/xml/Modules/Blog/blog";
72 return "http://www.ilias.de/xml/Modules/Blog/" . $a_entity;
79 if ($a_entity ===
"blog") {
85 "Description" =>
"text",
88 "FontColor" =>
"text",
91 "RssActive" =>
"integer",
92 "Approval" =>
"integer",
100 "Description" =>
"text",
101 "Notes" =>
"integer",
103 "FontColor" =>
"text",
106 "RssActive" =>
"integer",
107 "Approval" =>
"integer",
108 "Dir" =>
"directory",
109 "AbsShorten" =>
"integer",
110 "AbsShortenLen" =>
"integer",
111 "AbsImage" =>
"integer",
112 "AbsImgWidth" =>
"integer",
113 "AbsImgHeight" =>
"integer",
114 "NavMode" =>
"integer",
115 "NavListPost" =>
"integer",
116 "NavListMon" =>
"integer",
117 "Keywords" =>
"integer",
118 "Authors" =>
"integer",
119 "NavOrder" =>
"text",
120 "OvPost" =>
"integer",
128 "Description" =>
"text",
129 "Notes" =>
"integer",
131 "FontColor" =>
"text",
134 "RssActive" =>
"integer",
135 "Approval" =>
"integer",
136 "Dir" =>
"directory",
137 "AbsShorten" =>
"integer",
138 "AbsShortenLen" =>
"integer",
139 "AbsImage" =>
"integer",
140 "AbsImgWidth" =>
"integer",
141 "AbsImgHeight" =>
"integer",
142 "NavMode" =>
"integer",
143 "NavListMonWithPost" =>
"integer",
144 "NavListMon" =>
"integer",
145 "Keywords" =>
"integer",
146 "Authors" =>
"integer",
147 "NavOrder" =>
"text",
148 "OvPost" =>
"integer",
156 "Description" =>
"text",
157 "Notes" =>
"integer",
159 "FontColor" =>
"text",
162 "RssActive" =>
"integer",
163 "Approval" =>
"integer",
164 "Dir" =>
"directory",
165 "AbsShorten" =>
"integer",
166 "AbsShortenLen" =>
"integer",
167 "AbsImage" =>
"integer",
168 "AbsImgWidth" =>
"integer",
169 "AbsImgHeight" =>
"integer",
170 "NavMode" =>
"integer",
171 "NavListMonWithPost" =>
"integer",
172 "NavListMon" =>
"integer",
173 "Keywords" =>
"integer",
174 "Authors" =>
"integer",
175 "NavOrder" =>
"text",
176 "OvPost" =>
"integer",
177 "Style" =>
"integer",
178 "ReadingTime" =>
"integer"
183 if ($a_entity ===
"blog_posting") {
184 switch ($a_version) {
191 "BlogId" =>
"integer",
192 "Title" =>
"integer",
195 "Approved" =>
"integer",
196 "LastWithdrawn" =>
"text"
210 if ($a_entity ===
"blog") {
211 switch ($a_version) {
213 $this->getDirectDataFromQuery(
214 "SELECT bl.id,od.title,od.description," .
215 "bl.notes,bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval" .
217 " JOIN object_data od ON (od.obj_id = bl.id)" .
218 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
219 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
224 $this->getDirectDataFromQuery(
225 "SELECT bl.id,od.title,od.description," .
226 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
227 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
228 "bl.nav_mode,bl.nav_list_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
231 " JOIN object_data od ON (od.obj_id = bl.id)" .
232 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
233 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
238 $this->getDirectDataFromQuery(
239 "SELECT bl.id,od.title,od.description," .
240 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
241 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
242 "bl.nav_mode,bl.nav_list_mon_with_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
245 " JOIN object_data od ON (od.obj_id = bl.id)" .
246 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
247 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
252 $this->getDirectDataFromQuery(
253 "SELECT bl.id,od.title,od.description," .
254 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
255 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
256 "bl.nav_mode,bl.nav_list_mon_with_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
259 " JOIN object_data od ON (od.obj_id = bl.id)" .
260 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
261 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
263 foreach ($this->data as $idx => $item) {
264 $this->data[$idx][
"ReadingTime"] = (
int) $this->reading_time->isActivated((
int) $item[
"Id"]);
270 if ($a_entity ===
"blog_posting") {
271 switch ($a_version) {
276 $this->getDirectDataFromQuery(
277 "SELECT id,blog_id,title,created,author,approved,last_withdrawn" .
278 " FROM il_blog_posting WHERE " .
279 $ilDB->in(
"blog_id", $a_ids,
false,
"integer")
281 foreach ($this->data as $idx => $item) {
283 $this->data[$idx][
"Author"] = $this->createObjectExportId(
"usr", (
string) $item[
"Author"]);
289 foreach ($this->data as $idx => $item) {
290 $blog_id = $this->service->domain()->posting()->lookupBlogId((
int) $item[
"Id"]);
291 $keywords = $this->service->domain()->posting()->getKeywords((
int) $blog_id, (
int) $item[
"Id"]);
293 foreach ($keywords as $kidx => $keyword) {
294 $this->data[$idx][
"Keyword" . $kidx] = $keyword;
304 ?array $a_rec =
null,
307 if ($a_entity ===
"blog") {
309 "blog_posting" => array(
"ids" => $a_rec[
"Id"] ??
null)
320 if ($a_entity ===
"blog") {
321 $style = $this->content_style_domain->styleForObjId((
int) $a_set[
"Id"]);
323 $a_set[
"Style"] = $style->getStyleId();
326 $a_set[
"Notes"] = $this->notes->domain()->commentsActive((
int) $a_set[
"Id"]);
337 string $a_schema_version
339 $data = $this->service->data();
340 $a_rec = $this->stripTags($a_rec);
345 if ($new_id = $a_mapping->
getMapping(
"components/ILIAS/Container",
"objs", $a_rec[
"Id"])) {
352 $newObj->setTitle($a_rec[
"Title"] ??
"");
353 $newObj->setDescription($a_rec[
"Description"] ??
"");
354 $newObj->setNotesStatus((
bool) ($a_rec[
"Notes"] ??
false));
357 $blog_settings =
$data->settings(
359 (
bool) ($a_rec[
"Ppic"] ??
false),
360 $a_rec[
"BgColor"] ??
"",
361 $a_rec[
"FontColor"] ??
"",
362 (
bool) ($a_rec[
"RssActive"] ??
false),
363 (
bool) ($a_rec[
"Approval"] ??
false),
364 (
bool) ($a_rec[
"AbsShorten"] ??
false),
365 (
int) ($a_rec[
"AbsShortenLen"] ?? 0),
366 (
bool) ($a_rec[
"AbsImage"] ?? 0),
367 (
int) ($a_rec[
"AbsImgWidth"] ?? 0),
368 (
int) ($a_rec[
"AbsImgHeight"] ?? 0),
369 (
bool) ($a_rec[
"Keywords"] ??
false),
370 (
bool) ($a_rec[
"Authors"] ??
false),
371 (
int) ($a_rec[
"NavMode"] ?? 0),
372 (($a_rec[
"NavListMonWithPost"] ?? 0) == 0)
374 : (
int) $a_rec[
"NavListMonWithPost"],
375 (
int) ($a_rec[
"NavListMon"] ?? 3),
376 (
int) ($a_rec[
"OvPost"] ??
null),
377 trim($a_rec[
"NavOrder"])
378 ? explode(
";", $a_rec[
"NavOrder"])
381 $this->blog_settings->update($blog_settings);
383 if ($a_rec[
"Style"] ??
false) {
384 self::$style_map[$a_rec[
"Style"]][] = $newObj->getId();
388 $this->reading_time->activate($newObj->getId(), (
bool) ($a_rec[
"ReadingTime"] ??
false));
390 $a_mapping->
addMapping(
"components/ILIAS/Blog",
"blog", $a_rec[
"Id"], (
string) $newObj->getId());
392 'components/ILIAS/MetaData',
394 $a_rec[
"Id"] .
':0:blog',
395 $newObj->getId() .
':0:blog'
400 $blog_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/Blog",
"blog", $a_rec[
"BlogId"]);
403 $newObj->setBlogId($blog_id);
404 $newObj->setTitle($a_rec[
"Title"] ??
"");
406 $newObj->setApproved((
bool) ($a_rec[
"Approved"] ??
null));
410 $author = $this->parseObjectExportId($a_rec[
"Author"] ??
"",
"-1");
411 $newObj->setAuthor((
int) $author[
"id"]);
413 $newObj->create(
true);
417 for ($loop = 0; $loop < 1000; $loop++) {
418 $idx =
"Keyword" . $loop;
419 if (isset($a_rec[$idx])) {
420 $keyword = trim($a_rec[$idx]);
421 if ($keyword !==
'') {
422 $keywords[] = $keyword;
426 if (count($keywords)) {
427 $newObj->updateKeywords($keywords);
431 "components/ILIAS/COPage",
433 "blp:" . $a_rec[
"Id"],
434 "blp:" . $newObj->getId()
Blog Data set class This class implements the following entities:
ILIAS Style Content DomainService $content_style_domain
readData(string $a_entity, string $a_version, array $a_ids)
Read data from DB.
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.
getXmlNamespace(string $a_entity, string $a_schema_version)
ReadingTimeManager $reading_time
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
getXmlRecord(string $a_entity, string $a_version, array $a_set)
Get xml record for version.
SettingsManager $blog_settings
A dataset contains in data in a common structure that can be shared and transformed for different pur...
@classDescription Date and time handling
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))