19 declare(strict_types=1);
47 $this->content_style_domain = $DIC
50 $this->notes = $DIC->notes();
51 $this->reading_time = $DIC->blog()->internal()->domain()->readingTime();
52 $this->blog_settings = $DIC->blog()->internal()->domain()->blogSettings();
53 $this->service = $DIC->blog()->internal();
58 return array(
"4.3.0",
"5.0.0",
"5.3.0",
"8.0");
63 string $a_schema_version
66 if ($a_entity ===
'blog' || $a_entity ==
'blog_posting') {
68 return "http://www.ilias.de/xml/Modules/Blog/blog";
70 return "http://www.ilias.de/xml/Modules/Blog/" . $a_entity;
77 if ($a_entity ===
"blog") {
83 "Description" =>
"text",
86 "FontColor" =>
"text",
89 "RssActive" =>
"integer",
90 "Approval" =>
"integer",
98 "Description" =>
"text",
101 "FontColor" =>
"text",
104 "RssActive" =>
"integer",
105 "Approval" =>
"integer",
106 "Dir" =>
"directory",
107 "AbsShorten" =>
"integer",
108 "AbsShortenLen" =>
"integer",
109 "AbsImage" =>
"integer",
110 "AbsImgWidth" =>
"integer",
111 "AbsImgHeight" =>
"integer",
112 "NavMode" =>
"integer",
113 "NavListPost" =>
"integer",
114 "NavListMon" =>
"integer",
115 "Keywords" =>
"integer",
116 "Authors" =>
"integer",
117 "NavOrder" =>
"text",
118 "OvPost" =>
"integer",
126 "Description" =>
"text",
127 "Notes" =>
"integer",
129 "FontColor" =>
"text",
132 "RssActive" =>
"integer",
133 "Approval" =>
"integer",
134 "Dir" =>
"directory",
135 "AbsShorten" =>
"integer",
136 "AbsShortenLen" =>
"integer",
137 "AbsImage" =>
"integer",
138 "AbsImgWidth" =>
"integer",
139 "AbsImgHeight" =>
"integer",
140 "NavMode" =>
"integer",
141 "NavListMonWithPost" =>
"integer",
142 "NavListMon" =>
"integer",
143 "Keywords" =>
"integer",
144 "Authors" =>
"integer",
145 "NavOrder" =>
"text",
146 "OvPost" =>
"integer",
154 "Description" =>
"text",
155 "Notes" =>
"integer",
157 "FontColor" =>
"text",
160 "RssActive" =>
"integer",
161 "Approval" =>
"integer",
162 "Dir" =>
"directory",
163 "AbsShorten" =>
"integer",
164 "AbsShortenLen" =>
"integer",
165 "AbsImage" =>
"integer",
166 "AbsImgWidth" =>
"integer",
167 "AbsImgHeight" =>
"integer",
168 "NavMode" =>
"integer",
169 "NavListMonWithPost" =>
"integer",
170 "NavListMon" =>
"integer",
171 "Keywords" =>
"integer",
172 "Authors" =>
"integer",
173 "NavOrder" =>
"text",
174 "OvPost" =>
"integer",
175 "Style" =>
"integer",
176 "ReadingTime" =>
"integer" 181 if ($a_entity ===
"blog_posting") {
182 switch ($a_version) {
189 "BlogId" =>
"integer",
190 "Title" =>
"integer",
193 "Approved" =>
"integer",
194 "LastWithdrawn" =>
"text" 208 if ($a_entity ===
"blog") {
209 switch ($a_version) {
212 "SELECT bl.id,od.title,od.description," .
213 "bl.notes,bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval" .
215 " JOIN object_data od ON (od.obj_id = bl.id)" .
216 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
217 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
223 "SELECT bl.id,od.title,od.description," .
224 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
225 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
226 "bl.nav_mode,bl.nav_list_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
229 " JOIN object_data od ON (od.obj_id = bl.id)" .
230 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
231 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
237 "SELECT bl.id,od.title,od.description," .
238 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
239 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
240 "bl.nav_mode,bl.nav_list_mon_with_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
243 " JOIN object_data od ON (od.obj_id = bl.id)" .
244 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
245 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
251 "SELECT bl.id,od.title,od.description," .
252 "bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval," .
253 "bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height," .
254 "bl.nav_mode,bl.nav_list_mon_with_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order," .
257 " JOIN object_data od ON (od.obj_id = bl.id)" .
258 " WHERE " .
$ilDB->in(
"bl.id", $a_ids,
false,
"integer") .
259 " AND od.type = " .
$ilDB->quote(
"blog",
"text")
261 foreach ($this->data as $idx => $item) {
262 $this->data[$idx][
"ReadingTime"] = (
int) $this->reading_time->isActivated((
int) $item[
"Id"]);
268 if ($a_entity ===
"blog_posting") {
269 switch ($a_version) {
275 "SELECT id,blog_id,title,created,author,approved,last_withdrawn" .
276 " FROM il_blog_posting WHERE " .
277 $ilDB->in(
"blog_id", $a_ids,
false,
"integer")
279 foreach ($this->data as $idx => $item) {
287 foreach ($this->data as $idx => $item) {
291 foreach ($keywords as $kidx => $keyword) {
292 $this->data[$idx][
"Keyword" . $kidx] = $keyword;
302 ?array $a_rec =
null,
305 if ($a_entity ===
"blog") {
307 "blog_posting" => array(
"ids" => $a_rec[
"Id"] ??
null)
318 if ($a_entity ===
"blog") {
319 $style = $this->content_style_domain->styleForObjId((
int) $a_set[
"Id"]);
321 $a_set[
"Style"] = $style->getStyleId();
324 $a_set[
"Notes"] = $this->notes->domain()->commentsActive((
int) $a_set[
"Id"]);
335 string $a_schema_version
337 $data = $this->service->data();
343 if ($new_id = $a_mapping->
getMapping(
"components/ILIAS/Container",
"objs", $a_rec[
"Id"])) {
350 $newObj->setTitle($a_rec[
"Title"] ??
"");
351 $newObj->setDescription($a_rec[
"Description"] ??
"");
352 $newObj->setNotesStatus((
bool) ($a_rec[
"Notes"] ??
false));
355 $blog_settings =
$data->settings(
357 (bool) ($a_rec[
"Ppic"] ??
false),
358 $a_rec[
"BgColor"] ??
"",
359 $a_rec[
"FontColor"] ??
"",
360 (bool) ($a_rec[
"RssActive"] ??
false),
361 (bool) ($a_rec[
"Approval"] ??
false),
362 (bool) ($a_rec[
"AbsShorten"] ??
false),
363 (
int) ($a_rec[
"AbsShortenLen"] ?? 0),
364 (bool) ($a_rec[
"AbsImage"] ?? 0),
365 (
int) ($a_rec[
"AbsImgWidth"] ?? 0),
366 (
int) ($a_rec[
"AbsImgHeight"] ?? 0),
367 (bool) ($a_rec[
"Keywords"] ??
false),
368 (bool) ($a_rec[
"Authors"] ??
false),
369 (
int) ($a_rec[
"NavMode"] ?? 0),
370 (($a_rec[
"NavListMonWithPost"] ?? 0) == 0)
372 : (
int) $a_rec[
"NavListMonWithPost"],
373 (
int) ($a_rec[
"NavListMon"] ?? 3),
374 (
int) ($a_rec[
"OvPost"] ??
null),
375 trim($a_rec[
"NavOrder"])
376 ? explode(
";", $a_rec[
"NavOrder"])
379 $this->blog_settings->update($blog_settings);
381 if ($a_rec[
"Style"] ??
false) {
382 self::$style_map[$a_rec[
"Style"]][] = $newObj->getId();
386 $this->reading_time->activate($newObj->getId(), (bool) ($a_rec[
"ReadingTime"] ??
false));
388 $a_mapping->
addMapping(
"components/ILIAS/Blog",
"blog", $a_rec[
"Id"], (
string) $newObj->getId());
390 'components/ILIAS/MetaData',
392 $a_rec[
"Id"] .
':0:blog',
393 $newObj->getId() .
':0:blog' 398 $blog_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/Blog",
"blog", $a_rec[
"BlogId"]);
401 $newObj->setBlogId($blog_id);
402 $newObj->setTitle($a_rec[
"Title"] ??
"");
404 $newObj->setApproved((
bool) ($a_rec[
"Approved"] ?? null));
409 $newObj->setAuthor((
int) $author[
"id"]);
411 $newObj->create(
true);
415 for ($loop = 0; $loop < 1000; $loop++) {
416 $idx =
"Keyword" . $loop;
417 if (isset($a_rec[$idx])) {
418 $keyword = trim($a_rec[$idx]);
419 if ($keyword !==
'') {
420 $keywords[] = $keyword;
424 if (count($keywords)) {
425 $newObj->updateKeywords($keywords);
429 "components/ILIAS/COPage",
431 "blp:" . $a_rec[
"Id"],
432 "blp:" . $newObj->getId()
getXmlNamespace(string $a_entity, string $a_schema_version)
ReadingTimeManager $reading_time
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
SettingsManager $blog_settings
parseObjectExportId(string $a_id, ?string $a_fallback_id=null)
Parse export id.
ILIAS Style Content DomainService $content_style_domain
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
createObjectExportId(string $a_type, string $a_id)
Build ilias export id.
getMapping(string $a_comp, string $a_entity, string $a_old_id)
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)
__construct(Container $dic, ilPlugin $plugin)
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)