19 declare(strict_types=1);
42 protected string $img =
"";
44 protected bool $rss =
false;
63 bool $a_reference =
true 67 $this->notes_service = $DIC->notes();
69 $this->rbac_review = $DIC->rbac()->review();
70 $this->image_conversion = $DIC->fileConverters()->legacyImages();
72 $this->content_style_domain = $DIC
86 $set =
$ilDB->query(
"SELECT * FROM il_blog" .
87 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
88 $row =
$ilDB->fetchAssoc($set);
92 $this->
setImage((
string) $row[
"img"]);
93 $this->
setRSS((
bool) $row[
"rss_active"]);
106 if (trim((
string) $row[
"nav_order"])) {
107 $this->
setOrder(explode(
";", $row[
"nav_order"]));
112 $this->notes_service->domain()->commentsActive($this->
id)
116 protected function doCreate(
bool $clone_mode =
false): void
120 $ilDB->manipulate(
"INSERT INTO il_blog (id,ppic,rss_active,approval" .
121 ",abs_shorten,abs_shorten_len,abs_image,abs_img_width,abs_img_height" .
122 ",keywords,authors,nav_mode,nav_list_mon_with_post,ov_post) VALUES (" .
123 $ilDB->quote($this->id,
"integer") .
"," .
124 $ilDB->quote(
true,
"integer") .
"," .
125 $ilDB->quote(
true,
"integer") .
"," .
126 $ilDB->quote(
false,
"integer") .
"," .
140 $this->notes_service->domain()->activateComments($this->
id);
154 $ilDB->manipulate(
"DELETE FROM il_blog" .
155 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
163 $ilDB->manipulate(
"UPDATE il_blog" .
164 " SET ppic = " .
$ilDB->quote($this->hasProfilePicture(),
"integer") .
165 ",bg_color = " .
$ilDB->quote($this->getBackgroundColor(),
"text") .
166 ",font_color = " .
$ilDB->quote($this->getFontColor(),
"text") .
167 ",img = " .
$ilDB->quote($this->getImage(),
"text") .
168 ",rss_active = " .
$ilDB->quote($this->hasRSS(),
"integer") .
169 ",approval = " .
$ilDB->quote($this->hasApproval(),
"integer") .
170 ",abs_shorten = " .
$ilDB->quote($this->hasAbstractShorten(),
"integer") .
171 ",abs_shorten_len = " .
$ilDB->quote($this->getAbstractShortenLength(),
"integer") .
172 ",abs_image = " .
$ilDB->quote($this->hasAbstractImage(),
"integer") .
173 ",abs_img_width = " .
$ilDB->quote($this->getAbstractImageWidth(),
"integer") .
174 ",abs_img_height = " .
$ilDB->quote($this->getAbstractImageHeight(),
"integer") .
175 ",keywords = " .
$ilDB->quote($this->hasKeywords(),
"integer") .
176 ",authors = " .
$ilDB->quote($this->hasAuthors(),
"integer") .
177 ",nav_mode = " .
$ilDB->quote($this->getNavMode(),
"integer") .
178 ",nav_list_mon_with_post = " .
$ilDB->quote($this->getNavModeListMonthsWithPostings(),
"integer") .
179 ",nav_list_mon = " .
$ilDB->quote($this->getNavModeListMonths(),
"integer") .
180 ",ov_post = " .
$ilDB->quote($this->getOverviewPostings(),
"integer") .
181 ",nav_order = " .
$ilDB->quote(implode(
";", $this->
getOrder()),
"text") .
182 " WHERE id = " .
$ilDB->quote($this->
id,
"integer"));
185 $this->notes_service->domain()->activateComments(
198 $new_obj->setImage($img);
200 $source = self::initStorage($this->
getId());
201 $target = $new_obj->initStorage($new_obj->
getId());
203 copy($source . $img, $target . $img);
210 $new_obj->setRSS($this->
hasRSS());
220 $this->content_style_domain->styleForObjId($this->
getId())->cloneTo($new_obj->
getId());
230 $this->notes = $a_status;
240 $this->ppic = $a_status;
245 if (!$this->bg_color) {
246 $this->bg_color =
"ffffff";
253 $this->bg_color = $a_value;
258 if (!$this->font_color) {
259 $this->font_color =
"505050";
266 $this->font_color = $a_value;
276 $this->img = $a_value;
280 bool $a_as_thumb =
false 283 $path = self::initStorage($this->
id);
310 string $a_subdir = null
315 $path = $storage->getAbsolutePath() .
"/";
318 $path .= $a_subdir .
"/";
321 throw new \RuntimeException(sprintf(
'Directory "%s" was not created',
$path));
340 $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/",
"", $a_upload[
"name"]);
342 $path = self::initStorage($this->
id);
343 $original =
"org_" . $this->
id .
"_" . $clean_name;
344 $thumb =
"thb_" . $this->
id .
"_" . $clean_name;
345 $processed = $this->
id .
"_" . $clean_name;
348 chmod(
$path . $original, 0770);
353 $banner_width = (
int) $blga_set->get(
"banner_width");
356 $this->image_conversion->croppedSquare(
360 ImageOutputOptions::FORMAT_KEEP
363 $this->image_conversion->resizeByWidth(
367 ImageOutputOptions::FORMAT_KEEP,
385 public function setRSS(
bool $a_status): void
387 $this->rss = $a_status;
397 $this->approval = $a_status;
408 $this->abstract_shorten = $a_value;
418 $this->abstract_shorten_length = $a_value;
428 $this->abstract_image = $a_value;
438 $this->abstract_image_width = $a_value;
448 $this->abstract_image_height = $a_value;
453 $this->keywords = $a_value;
463 $this->authors = $a_value;
473 if (in_array($a_value, array(self::NAV_MODE_LIST, self::NAV_MODE_MONTH))) {
474 $this->nav_mode = $a_value;
485 $this->nav_mode_list_months_with_post = $a_value;
495 $this->nav_mode_list_months = $a_value;
505 $this->overview_postings = $a_value;
513 public function setOrder(array $a_values = []): void
515 $this->order = $a_values;
528 ?
string $a_comment = null
532 $ilUser = $DIC->user();
537 $blog_obj_id =
$tree->lookupObjectId($a_blog_node_id);
541 $access_handler = null;
550 $ignore_threshold = ($a_action ===
"comment");
555 if (!$posting->isApproved()) {
556 $blog =
new self($blog_obj_id,
false);
557 if ($blog->hasApproval()) {
566 $ignore_threshold =
true;
567 $a_action =
"approve";
575 in_array($a_action, array(
"update",
"new"))) {
576 $posting->handleNews(($a_action ===
"update"));
586 if (!count($users)) {
591 $ntf->setLangModules(array(
"blog"));
592 $ntf->setRefId($a_blog_node_id);
593 $ntf->setChangedByUserId($ilUser->getId());
594 $ntf->setSubjectLangId(
'blog_change_notification_subject');
595 $ntf->setIntroductionLangId(
'blog_change_notification_body_' . $a_action);
596 $ntf->addAdditionalInfo(
'blog_posting', $posting->getTitle());
598 $ntf->addAdditionalInfo(
'comment', $a_comment,
true);
600 $ntf->setGotoLangId(
'blog_change_notification_link');
601 $ntf->setReasonLangId(
'blog_change_notification_reason');
603 $abstract = $posting->getNotificationAbstract();
605 $ntf->addAdditionalInfo(
'content', $abstract,
true);
608 $notified = $ntf->sendMailAndReturnRecipients(
611 ($admin_only ?
"write" :
"read")
615 if (count($notified)) {
629 if (!
$ilSetting->get(
'enable_global_profiles')) {
634 if (!str_ends_with($a_wsp_id,
"_cll")) {
636 $obj_id = $wsp_id->lookupObjectId((
int) $a_wsp_id);
638 $pl = $DIC->blog()->internal()->gui()->permanentLink(0, (
int) $a_wsp_id);
640 $a_wsp_id = substr($a_wsp_id, 0, -4);
643 $pl = $DIC->blog()->internal()->gui()->permanentLink((
int) $a_wsp_id);
649 $blog =
new self($obj_id,
false);
650 if (!$blog->hasRSS()) {
656 $url = $pl->getPermanentLink();
657 $url = str_replace(
"&",
"&",
$url);
660 $feed->setChannelTitle(str_replace(
"&",
"&", $blog->getTitle()));
661 $feed->setChannelDescription(str_replace(
"&",
"&", $blog->getDescription()));
662 $feed->setChannelLink(
$url);
678 $snippet = str_replace(
"&",
"&", $snippet);
679 $snippet =
"<![CDATA[" . $snippet .
"]]>";
681 $url = $pl->getPermanentLink((
int)
$id);
682 $url = str_replace(
"&",
"&",
$url);
685 $feed_item->setTitle(str_replace(
"&",
"&", $item[
"title"]));
687 $feed_item->setDescription($snippet);
688 $feed_item->setLink(
$url);
689 $feed_item->setAbout(
$url);
690 $feed->addItem($feed_item);
700 'il_blog_contributor_' . $this->
getRefId(),
701 "Contributor of blog obj_no." . $this->
getId(),
702 'il_blog_contributor',
707 'il_blog_editor_' . $this->
getRefId(),
708 "Editor of blog obj_no." . $this->
getId(),
716 foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
726 foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
737 foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
753 foreach ($this->rbac_review->getParentRoleIds($a_node_id) as $role_id => $role) {
754 if ($role_id != $contr_role_id &&
755 $role_id != $editor_role_id) {
756 $all_ops = $this->rbac_review->getActiveOperationsOfRole($a_node_id, $role_id);
757 if (in_array($contr_op_id, $all_ops) ||
758 in_array($redact_op_id, $all_ops)) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
int $nav_mode_list_months_with_post
const ABSTRACT_DEFAULT_IMAGE_WIDTH
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
int $abstract_image_width
const NAV_MODE_LIST_DEFAULT_POSTINGS
int $abstract_image_height
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Filesystem Util Convert LegacyImages $image_conversion
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
special template class to simplify handling of ITX/PEAR
getLocalContributorRole(int $a_node_id)
getRolesWithContributeOrRedact(int $a_node_id)
ILIAS Style Content DomainService $content_style_domain
setNavModeListMonthsWithPostings(int $a_value)
setAbstractShorten(bool $a_value)
setNotesStatus(bool $a_status)
int $abstract_shorten_length
setProfilePicture(bool $a_status)
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...
setApproval(bool $a_status)
static createDefaultRole(string $a_title, string $a_description, string $a_tpl_name, int $a_ref_id)
getAllLocalRoles(int $a_node_id)
getAbstractShortenLength()
const ABSTRACT_DEFAULT_SHORTEN_LENGTH
static getNotificationsForObject(int $type, int $id, ?int $page_id=null, bool $ignore_threshold=false)
Get all users/recipients for given object.
setNavModeListMonths(?int $a_value)
setKeywords(bool $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOverviewPostings(?int $a_value)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getImageFullPath(bool $a_as_thumb=false)
static deleteAllBlogPostings(int $a_blog_id)
Delete all postings for blog.
setAbstractImage(bool $a_value)
__construct(int $a_id=0, bool $a_reference=true)
setOrder(array $a_values=[])
setAbstractImageHeight(int $a_value)
static sendNotification(string $a_action, bool $a_in_wsp, int $a_blog_node_id, int $a_posting_id, ?string $a_comment=null)
static _lookupTitle(int $obj_id)
setBackgroundColor(string $a_value)
static initStorage(int $a_id, string $a_subdir=null)
Init file system storage.
uploadImage(array $a_upload)
Upload new image file.
const ABSTRACT_DEFAULT_IMAGE_HEIGHT
setFontColor(string $a_value)
static _getTranslation(string $a_role_title)
static deliverRSS(string $a_wsp_id)
Deliver blog as rss feed.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
int $nav_mode_list_postings
setAbstractShortenLength(int $a_value)
setAuthors(bool $a_value)
doCloneObject(ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
static updateNotificationTime(int $type, int $id, array $user_ids, ?int $page_id=null, bool $activate_new_entries=true)
Update the last mail timestamp for given object and users.
static _getOperationIdByName(string $a_operation)
get operation id by name of operation
int $nav_mode_list_months
static getSnippet(int $a_id, bool $a_truncate=false, int $a_truncate_length=500, string $a_truncate_sign="...", bool $a_include_picture=false, int $a_picture_width=144, int $a_picture_height=144, string $a_export_directory=null)
Get first text paragraph of page.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getNavModeListMonthsWithPostings()
getLocalEditorRole(int $a_node_id)
static removeForObject(int $type, int $id)
Remove all notifications for given object.
setAbstractImageWidth(int $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
doCreate(bool $clone_mode=false)
ILIAS Notes Service $notes_service
setImage(string $a_value)