19 declare(strict_types=1);
32 $this->current_user_id = $this->domain->user()->getId();
47 $posting = new \ilBlogPosting($posting_id);
49 $ignore_threshold = ($action ===
"comment");
52 if (!$posting->isApproved()) {
53 $blog_settings = $this->domain->blogSettings()->getByObjId($blog_obj_id);
54 if ($blog_settings?->getApproval()) {
61 $ignore_threshold =
true;
68 if (!$in_wsp && in_array($action, array(
"update",
"new"))) {
69 $this->domain->news()->handle($posting, ($action ===
"update"));
105 $tree = new \ilWorkspaceTree($this->current_user_id);
106 return $tree->lookupObjectId($blog_node_id);
108 return \ilObject::_lookupObjId($blog_node_id);
121 $ntf = new \ilSystemNotification($in_wsp);
122 $ntf->setLangModules(array(
"blog"));
123 $ntf->setRefId($blog_node_id);
124 $ntf->setChangedByUserId($this->current_user_id);
125 $ntf->setSubjectLangId(
'blog_change_notification_subject');
126 $ntf->setIntroductionLangId(
'blog_change_notification_body_' . $action);
127 $ntf->addAdditionalInfo(
'blog_posting', $posting->
getTitle());
130 $ntf->addAdditionalInfo(
'comment', $comment,
true);
133 $ntf->setGotoLangId(
'blog_change_notification_link');
134 $ntf->setReasonLangId(
'blog_change_notification_reason');
138 $ntf->addAdditionalInfo(
'content', $abstract,
true);
141 $notified = $ntf->sendMailAndReturnRecipients(
143 "_" . $posting->
getId(),
144 ($admin_only ?
"write" :
"read")
147 if (count($notified)) {
getNotificationAbstract()
getBlogObjectId(bool $in_wsp, int $blog_node_id)
static getNotificationsForObject(int $type, int $id, ?int $page_id=null, bool $ignore_threshold=false)
Get all users/recipients for given object.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return 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.
sendSystemNotification(bool $in_wsp, int $blog_node_id, string $action, \ilBlogPosting $posting, ?string $comment, array $users, bool $admin_only)
__construct(protected InternalDomainService $domain)
sendNotification(string $action, bool $in_wsp, int $blog_node_id, int $posting_id, ?string $comment=null)