19 declare(strict_types=1);
42 bool $a_reference =
true 46 $this->notes_service = $DIC->notes();
47 $this->settings_manager = $DIC->blog()->internal()->domain()->blogSettings();
50 $this->rbac_review = $DIC->rbac()->review();
52 $this->content_style_domain = $DIC
56 if ($this->
getId() > 0) {
57 $this->blog_settings = $this->settings_manager->getByObjId($this->
getId());
70 $this->notes_service->domain()->commentsActive($this->
id)
72 $this->blog_settings = $this->settings_manager->getByObjId($this->
getId());
75 protected function doCreate(
bool $clone_mode =
false): void
81 $ilDB->manipulate(
"INSERT INTO il_blog (id,ppic,rss_active,approval" .
82 ",abs_shorten,abs_shorten_len,abs_image,abs_img_width,abs_img_height" .
83 ",keywords,authors,nav_mode,nav_list_mon_with_post,ov_post) VALUES (" .
84 $ilDB->quote($this->id,
"integer") .
"," .
85 $ilDB->quote(
true,
"integer") .
"," .
86 $ilDB->quote(
true,
"integer") .
"," .
87 $ilDB->quote(
false,
"integer") .
"," .
88 $ilDB->quote(
false,
"integer") .
"," .
89 $ilDB->quote(0,
"integer") .
"," .
90 $ilDB->quote(
false,
"integer") .
"," .
91 $ilDB->quote(0,
"integer") .
"," .
92 $ilDB->quote(0,
"integer") .
"," .
93 $ilDB->quote(
true,
"integer") .
"," .
94 $ilDB->quote(
false,
"integer") .
"," .
95 $ilDB->quote(self::NAV_MODE_LIST,
"integer") .
"," .
96 $ilDB->quote(5,
"integer") .
"," .
97 $ilDB->quote(5,
"integer") .
101 $this->notes_service->domain()->activateComments($this->
id);
115 $ilDB->manipulate(
"DELETE FROM il_blog" .
116 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
125 $this->notes_service->domain()->activateComments(
139 $this->settings_manager->clone($this->
getId(), $new_obj->
getId());
142 $this->content_style_domain->styleForObjId($this->
getId())->cloneTo($new_obj->
getId());
154 $this->notes = $a_status;
162 ?
string $a_comment = null
166 $ilUser = $DIC->user();
171 $blog_obj_id =
$tree->lookupObjectId($a_blog_node_id);
175 $access_handler = null;
184 $ignore_threshold = ($a_action ===
"comment");
189 if (!$posting->isApproved()) {
190 $blog_settings = $DIC->blog()->internal()->domain()->blogSettings()->getByObjId($blog_obj_id);
191 if ($blog_settings?->getApproval()) {
200 $ignore_threshold =
true;
201 $a_action =
"approve";
209 in_array($a_action, array(
"update",
"new"))) {
210 $posting->handleNews(($a_action ===
"update"));
220 if (!count($users)) {
225 $ntf->setLangModules(array(
"blog"));
226 $ntf->setRefId($a_blog_node_id);
227 $ntf->setChangedByUserId($ilUser->getId());
228 $ntf->setSubjectLangId(
'blog_change_notification_subject');
229 $ntf->setIntroductionLangId(
'blog_change_notification_body_' . $a_action);
230 $ntf->addAdditionalInfo(
'blog_posting', $posting->getTitle());
232 $ntf->addAdditionalInfo(
'comment', $a_comment,
true);
234 $ntf->setGotoLangId(
'blog_change_notification_link');
235 $ntf->setReasonLangId(
'blog_change_notification_reason');
237 $abstract = $posting->getNotificationAbstract();
239 $ntf->addAdditionalInfo(
'content', $abstract,
true);
242 $notified = $ntf->sendMailAndReturnRecipients(
245 ($admin_only ?
"write" :
"read")
249 if (count($notified)) {
263 if (!
$ilSetting->get(
'enable_global_profiles')) {
268 if (!str_ends_with($a_wsp_id,
"_cll")) {
270 $obj_id = $wsp_id->lookupObjectId((
int) $a_wsp_id);
272 $pl = $DIC->blog()->internal()->gui()->permanentLink(0, (
int) $a_wsp_id);
274 $a_wsp_id = substr($a_wsp_id, 0, -4);
277 $pl = $DIC->blog()->internal()->gui()->permanentLink((
int) $a_wsp_id);
283 $blog_settings = $DIC->blog()->internal()->domain()->blogSettings()
284 ->getByObjId($obj_id);
285 if (!$blog_settings?->getRSS()) {
289 $blog =
new self($obj_id,
false);
292 $url = $pl->getPermanentLink();
293 $url = str_replace(
"&",
"&",
$url);
296 $feed->setChannelTitle(str_replace(
"&",
"&", $blog->getTitle()));
297 $feed->setChannelDescription(str_replace(
"&",
"&", $blog->getDescription()));
298 $feed->setChannelLink(
$url);
314 $snippet = str_replace(
"&",
"&", $snippet);
315 $snippet =
"<![CDATA[" . $snippet .
"]]>";
317 $url = $pl->getPermanentLink((
int)
$id);
318 $url = str_replace(
"&",
"&",
$url);
321 $feed_item->setTitle(str_replace(
"&",
"&", $item[
"title"]));
323 $feed_item->setDescription($snippet);
324 $feed_item->setLink(
$url);
325 $feed_item->setAbout(
$url);
326 $feed->addItem($feed_item);
336 'il_blog_contributor_' . $this->
getRefId(),
337 "Contributor of blog obj_no." . $this->
getId(),
338 'il_blog_contributor',
343 'il_blog_editor_' . $this->
getRefId(),
344 "Editor of blog obj_no." . $this->
getId(),
352 foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
362 foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
373 foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
389 foreach ($this->rbac_review->getParentRoleIds($a_node_id) as $role_id => $role) {
390 if ($role_id != $contr_role_id &&
391 $role_id != $editor_role_id) {
392 $all_ops = $this->rbac_review->getActiveOperationsOfRole($a_node_id, $role_id);
393 if (in_array($contr_op_id, $all_ops) ||
394 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...
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
const NAV_MODE_LIST_DEFAULT_POSTINGS
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
cloneMetaData(ilObject $target_obj)
special template class to simplify handling of ITX/PEAR
SettingsManager $settings_manager
getLocalContributorRole(int $a_node_id)
getRolesWithContributeOrRedact(int $a_node_id)
ILIAS Style Content DomainService $content_style_domain
setNotesStatus(bool $a_status)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static createDefaultRole(string $a_title, string $a_description, string $a_tpl_name, int $a_ref_id)
getAllLocalRoles(int $a_node_id)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static deleteAllBlogPostings(int $a_blog_id)
Delete all postings for blog.
__construct(int $a_id=0, bool $a_reference=true)
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)
const ABSTRACT_DEFAULT_IMAGE_HEIGHT
static _getTranslation(string $a_role_title)
static deliverRSS(string $a_wsp_id)
Deliver blog as rss feed.
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
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
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.
getLocalEditorRole(int $a_node_id)
static removeForObject(int $type, int $id)
Remove all notifications for given object.
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