19 declare(strict_types=1);
43 $this->content_style_domain = $DIC
46 $this->notes = $DIC->notes();
47 $this->reading_time = $DIC->blog()->internal()->domain()->readingTime();
52 return array(
"4.3.0",
"5.0.0",
"5.3.0",
"8.0");
57 string $a_schema_version
60 if ($a_entity ===
'blog' || $a_entity ==
'blog_posting') {
62 return "http://www.ilias.de/xml/Modules/Blog/blog";
64 return "http://www.ilias.de/xml/Modules/Blog/" . $a_entity;
71 if ($a_entity ===
"blog") {
77 "Description" =>
"text",
80 "FontColor" =>
"text",
83 "RssActive" =>
"integer",
84 "Approval" =>
"integer",
92 "Description" =>
"text",
95 "FontColor" =>
"text",
98 "RssActive" =>
"integer",
99 "Approval" =>
"integer",
100 "Dir" =>
"directory",
101 "AbsShorten" =>
"integer",
102 "AbsShortenLen" =>
"integer",
103 "AbsImage" =>
"integer",
104 "AbsImgWidth" =>
"integer",
105 "AbsImgHeight" =>
"integer",
106 "NavMode" =>
"integer",
107 "NavListPost" =>
"integer",
108 "NavListMon" =>
"integer",
109 "Keywords" =>
"integer",
110 "Authors" =>
"integer",
111 "NavOrder" =>
"text",
112 "OvPost" =>
"integer",
120 "Description" =>
"text",
121 "Notes" =>
"integer",
123 "FontColor" =>
"text",
126 "RssActive" =>
"integer",
127 "Approval" =>
"integer",
128 "Dir" =>
"directory",
129 "AbsShorten" =>
"integer",
130 "AbsShortenLen" =>
"integer",
131 "AbsImage" =>
"integer",
132 "AbsImgWidth" =>
"integer",
133 "AbsImgHeight" =>
"integer",
134 "NavMode" =>
"integer",
135 "NavListMonWithPost" =>
"integer",
136 "NavListMon" =>
"integer",
137 "Keywords" =>
"integer",
138 "Authors" =>
"integer",
139 "NavOrder" =>
"text",
140 "OvPost" =>
"integer",
148 "Description" =>
"text",
149 "Notes" =>
"integer",
151 "FontColor" =>
"text",
154 "RssActive" =>
"integer",
155 "Approval" =>
"integer",
156 "Dir" =>
"directory",
157 "AbsShorten" =>
"integer",
158 "AbsShortenLen" =>
"integer",
159 "AbsImage" =>
"integer",
160 "AbsImgWidth" =>
"integer",
161 "AbsImgHeight" =>
"integer",
162 "NavMode" =>
"integer",
163 "NavListMonWithPost" =>
"integer",
164 "NavListMon" =>
"integer",
165 "Keywords" =>
"integer",
166 "Authors" =>
"integer",
167 "NavOrder" =>
"text",
168 "OvPost" =>
"integer",
169 "Style" =>
"integer",
170 "ReadingTime" =>
"integer" 175 if ($a_entity ===
"blog_posting") {
176 switch ($a_version) {
183 "BlogId" =>
"integer",
184 "Title" =>
"integer",
187 "Approved" =>
"integer",
188 "LastWithdrawn" =>
"text" 202 if ($a_entity ===
"blog") {
203 switch ($a_version) {
206 "SELECT bl.id,od.title,od.description," .
207 "bl.notes,bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval" .
209 " JOIN object_data od ON (od.obj_id = bl.id)" .
210 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
211 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
217 "SELECT bl.id,od.title,od.description," .
218 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
219 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
220 "bl.nav_mode,bl.nav_list_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
223 " JOIN object_data od ON (od.obj_id = bl.id)" .
224 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
225 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
231 "SELECT bl.id,od.title,od.description," .
232 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
233 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
234 "bl.nav_mode,bl.nav_list_mon_with_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
237 " JOIN object_data od ON (od.obj_id = bl.id)" .
238 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
239 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
245 "SELECT bl.id,od.title,od.description," .
246 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
247 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
248 "bl.nav_mode,bl.nav_list_mon_with_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
251 " JOIN object_data od ON (od.obj_id = bl.id)" .
252 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
253 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
255 foreach ($this->data as $idx => $item) {
256 $this->data[$idx][
"ReadingTime"] = (
int) $this->reading_time->isActivated((
int) $item[
"Id"]);
262 if ($a_entity ===
"blog_posting") {
263 switch ($a_version) {
269 "SELECT id,blog_id,title,created,author,approved,last_withdrawn" .
270 " FROM il_blog_posting WHERE " .
271 $ilDB->in(
"blog_id", $a_ids,
false,
"integer")
273 foreach ($this->data as $idx => $item) {
281 foreach ($this->data as $idx => $item) {
285 foreach ($keywords as $kidx => $keyword) {
286 $this->data[$idx][
"Keyword" . $kidx] = $keyword;
296 ?array $a_rec = null,
299 if ($a_entity ===
"blog") {
301 "blog_posting" => array(
"ids" => $a_rec[
"Id"] ?? null)
312 if ($a_entity ===
"blog") {
313 $style = $this->content_style_domain->styleForObjId((
int) $a_set[
"Id"]);
316 $a_set[
"Dir"] = $dir;
318 $a_set[
"Style"] = $style->getStyleId();
321 $a_set[
"Notes"] = $this->notes->domain()->commentsActive((
int) $a_set[
"Id"]);
332 string $a_schema_version
339 if ($new_id = $a_mapping->
getMapping(
"Services/Container",
"objs", $a_rec[
"Id"])) {
346 $newObj->setTitle($a_rec[
"Title"] ??
"");
347 $newObj->setDescription($a_rec[
"Description"] ??
"");
348 $newObj->setNotesStatus((
bool) ($a_rec[
"Notes"] ??
false));
349 $newObj->setBackgroundColor($a_rec[
"BgColor"] ??
"");
350 $newObj->setFontColor($a_rec[
"FontColor"] ??
"");
351 $newObj->setProfilePicture((
bool) ($a_rec[
"Ppic"] ??
false));
352 $newObj->setRSS((
bool) ($a_rec[
"RssActive"] ??
false));
353 $newObj->setApproval((
bool) ($a_rec[
"Approval"] ??
false));
354 $newObj->setImage($a_rec[
"Img"] ??
"");
356 $newObj->setAbstractShorten((
bool) ($a_rec[
"AbsShorten"] ??
false));
357 $newObj->setAbstractShortenLength((
int) ($a_rec[
"AbsShortenLen"] ?? 0));
358 $newObj->setAbstractImage((
bool) ($a_rec[
"AbsImage"] ?? 0));
359 $newObj->setAbstractImageWidth((
int) ($a_rec[
"AbsImgWidth"] ?? 0));
360 $newObj->setAbstractImageHeight((
int) ($a_rec[
"AbsImgHeight"] ?? 0));
361 $newObj->setNavMode((
int) ($a_rec[
"NavMode"] ?? 0));
362 if (($a_rec[
"NavListMonWithPost"] ?? 0) == 0) {
363 $newObj->setNavModeListMonthsWithPostings(3);
365 $newObj->setNavModeListMonthsWithPostings((
int) $a_rec[
"NavListMonWithPost"]);
368 if (($nav_list_months = $a_rec[
"NavListMon"] ?? null) !== null) {
369 $nav_list_months = (
int) $nav_list_months;
371 $newObj->setNavModeListMonths($nav_list_months);
372 $newObj->setKeywords((
bool) ($a_rec[
"Keywords"] ??
false));
373 $newObj->setAuthors((
bool) ($a_rec[
"Authors"] ??
false));
375 trim($a_rec[
"NavOrder"])
376 ? explode(
";", $a_rec[
"NavOrder"])
379 if (($ov_post = $a_rec[
"OvPost"] ?? null) !== null) {
380 $ov_post = (
int) $ov_post;
382 $newObj->setOverviewPostings($ov_post);
387 if ($a_rec[
"Img"] ??
false) {
388 $dir = str_replace(
"..",
"", $a_rec[
"Dir"]);
396 if ($a_rec[
"Style"] ??
false) {
397 self::$style_map[$a_rec[
"Style"]][] = $newObj->getId();
401 $this->reading_time->activate($newObj->getId(), (bool) ($a_rec[
"ReadingTime"] ??
false));
403 $a_mapping->
addMapping(
"Modules/Blog",
"blog", $a_rec[
"Id"], (
string) $newObj->getId());
407 $blog_id = (
int) $a_mapping->
getMapping(
"Modules/Blog",
"blog", $a_rec[
"BlogId"]);
410 $newObj->setBlogId($blog_id);
411 $newObj->setTitle($a_rec[
"Title"] ??
"");
413 $newObj->setApproved((
bool) ($a_rec[
"Approved"] ?? null));
418 $newObj->setAuthor((
int) $author[
"id"]);
420 $newObj->create(
true);
424 for ($loop = 0; $loop < 1000; $loop++) {
425 $idx =
"Keyword" . $loop;
426 if (isset($a_rec[$idx])) {
427 $keyword = trim($a_rec[$idx]);
428 if ($keyword !==
'') {
429 $keywords[] = $keyword;
433 if (count($keywords)) {
434 $newObj->updateKeywords($keywords);
437 $a_mapping->
addMapping(
"Services/COPage",
"pg",
"blp:" . $a_rec[
"Id"],
"blp:" . $newObj->getId());
getXmlNamespace(string $a_entity, string $a_schema_version)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ReadingTimeManager $reading_time
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
parseObjectExportId(string $a_id, ?string $a_fallback_id=null)
Parse export id.
ILIAS Style Content DomainService $content_style_domain
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
Blog Data set class This class implements the following entities:
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
createObjectExportId(string $a_type, string $a_id)
Build ilias export id.
getMapping(string $a_comp, string $a_entity, string $a_old_id)
static initStorage(int $a_id, string $a_subdir=null)
Init file system storage.
readData(string $a_entity, string $a_version, array $a_ids)
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 ...
static lookupBlogId(int $a_posting_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
getXmlRecord(string $a_entity, string $a_version, array $a_set)
static getKeywords(int $a_obj_id, int $a_posting_id)
getTypes(string $a_entity, string $a_version)
stripTags(array $rec, array $omit_keys=[])
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)