19declare(strict_types=1);
42 $this->posting_gui = $gui->posting();
50 $lng = $this->domain->lng();
51 $ilUser = $this->domain->user();
53 if (!
$page->getActive()) {
64 $page->getParentType(),
68 $news_item = new \ilNewsItem($news_id);
73 $news_set = new \ilSetting(
"news");
74 $default_visibility = $news_set->get(
"default_visibility",
"users");
76 $news_item = new \ilNewsItem();
77 $news_item->setContext(
81 $page->getParentType()
84 $news_item->setVisibility($default_visibility);
87 $news_item->setUserId($ilUser->getId());
89 $news_item->setTitle(
$page->getTitle());
92 ?
"blog_news_posting_updated"
93 :
"blog_news_posting_published";
95 $lng->txt($contentKey),
100 foreach ($this->page_manager->getPageContributors(
$page->getParentType(),
$page->getId()) as $user) {
101 $contributors[] = $user[
"user_id"];
103 if (count($contributors) > 1 || !in_array(
$page->getAuthor(), $contributors,
true)) {
105 foreach ($contributors as
$user_id) {
110 $content .=
"\n" . sprintf(
111 $lng->txt(
"blog_news_posting_authors"),
112 implode(
", ", $authors)
116 $news_item->setContentTextIsLangVar(
false);
117 $news_item->setContent($content);
119 $snippet = $this->posting_gui->getSnippet(
$page->getId());
120 $news_item->setContentLong($snippet);
122 if (!$news_item->getId()) {
123 $news_item->create();
125 $news_item->update(
true);
Domain class for handling news items of blog postings.
__construct(protected InternalDataService $data, protected InternalRepoService $repo, protected InternalDomainService $domain, \ILIAS\Blog\InternalGUIService $gui, protected PageManagerInterface $page_manager)
handle(\ilBlogPosting $page, bool $update=false)
Handle news item for a blog posting.
ILIAS Blog Posting Service GUIService $posting_gui
static getLastNewsIdForContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="", bool $a_only_today=false)
Get last news id of news set related to a certain context.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.