19declare(strict_types=1);
48 $this->blog_settings = $this->domain->blogSettings()->getByObjId($context->
getBlog()->getId());
50 $this->content_style_domain = $content_style->domain()->styleForObjId($context->
getBlog()->getId());
52 $this->content_style_domain = $content_style->domain()->styleForRefId($context->
getBlog()->getRefId());
58 $next_class = $this->gui->ctrl()->getNextClass($this);
59 $cmd = $this->gui->ctrl()->getCmd(
"render");
61 switch ($next_class) {
62 case strtolower(ilBlogPostingGUI::class):
74 return $this->gui->navigation()->editingLink();
79 $ilCtrl = $this->gui->ctrl();
80 $tpl = $this->gui->ui()->mainTemplate();
81 $lng = $this->domain->lng();
82 $req = $this->context->getRequest();
84 $ilCtrl->saveParameter($this,
"user_page");
87 if (!$this->context->getPermission()->mayContribute()) {
92 $style_sheet_id = $this->content_style_domain->getEffectiveStyleId();
95 $this->context->getNodeId(),
96 $this->context->getPermission()->getAccessHandler(),
99 $this->context->getBlog()->getNotesStatus(),
100 $this->context->getPermission()->mayEditPosting(
$req->getBlogPage()),
106 $ilCtrl->setParameterByClass(ilBlogPostingGUI::class,
"blpg",
$req->getBlogPage());
107 $this->gui->tabs()->addNonTabbedLink(
109 $lng->txt(
"blog_preview"),
110 $ilCtrl->getLinkTargetByClass(ilBlogPostingGUI::class,
"previewFullscreen")
112 $ilCtrl->setParameterByClass(ilBlogPostingGUI::class,
"blpg",
"");
114 $ret = $ilCtrl->forwardCommand($bpost_gui);
117 $is_owner = $this->context->getPermission()->mayContribute();
118 $is_active = $bpost_gui->getBlogPosting()->getActive();
121 $cmd = $ilCtrl->getCmd();
122 if (($cmd ===
"previewFullscreen")
123 && !$is_owner && !$is_active) {
124 $ilCtrl->redirectByClass(ilObjBlogGUI::class,
"preview");
130 $info[] =
$lng->txt(
"blog_draft_info_contributors");
132 $public_action =
false;
133 if ($cmd !==
"history" && $cmd !==
"edit" && $is_active && empty(
$info)) {
134 $info[] =
$lng->txt(
"blog_new_posting_info");
135 $public_action =
true;
137 if ($this->context->getBlog()->getNotesStatus() &&
138 $this->blog_settings->getApproval() &&
139 !$bpost_gui->getBlogPosting()->isApproved()) {
141 $info[] =
$lng->txt(
"blog_posting_edit_approval_info");
143 if ($public_action) {
146 if (count(
$info) > 0) {
155 if (!$this->gui->tabs()->back_target) {
156 $ilCtrl->setParameter($this,
"bmn",
"");
157 $this->gui->tabs()->setBackTarget(
159 $ilCtrl->getLinkTarget($this,
"")
166 $tpl = $this->gui->ui()->mainTemplate();
167 $ilTabs = $this->gui->tabs();
168 $ilCtrl = $this->gui->ctrl();
169 $lng = $this->domain->lng();
172 if (!$this->context->getPermission()->canRead()) {
177 $ilTabs->activateTab(
"content");
180 if ($this->context->getPermission()->mayContribute()) {
181 $ilToolbar->setFormAction($ilCtrl->getFormActionByClass(self::class,
"createPosting"));
185 $ilToolbar->addStickyItem($title,
true);
187 document.getElementById('title').setAttribute('data-blog-input', 'posting-title');
188 document.getElementById('title').setAttribute('placeholder', ' ');
192 $lng->txt(
"blog_add_posting"),
194 )->submit()->toToolbar(
true, $ilToolbar);
198 $items = $this->domain->postingList($this->context->getBlog()->getId())->getPostingsGroupedByMonth();
199 $keys = array_keys($items);
200 $first = array_shift($keys);
201 if ($first != $this->context->getRequest()->getMonth()) {
202 $ilToolbar->addSeparator();
204 $ilCtrl->setParameterByClass(ilObjBlogGUI::class,
"bmn", $first);
205 $url = $ilCtrl->getLinkTargetByClass(ilObjBlogGUI::class,
"");
206 $ilCtrl->setParameterByClass(ilObjBlogGUI::class,
"bmn", $this->context->getRequest()->getMonth());
208 $ilToolbar->addComponent(
209 $this->gui->ui()->factory()->button()->standard(
210 $lng->txt(
"blog_show_latest"),
217 $print_view = $this->gui->presentation()->getPrintView(
218 $this->context->getNodeId(),
219 $this->context->isRepositoryNode(),
220 $this->context->getRequest()->getObjIds()
222 $modal_elements = $print_view->getModalElements(
223 $ilCtrl->getLinkTarget(
228 $ilToolbar->addSeparator();
229 $ilToolbar->addComponent($modal_elements->button);
230 $ilToolbar->addComponent($modal_elements->modal);
233 $include_inactive = $this->context->getPermission()->mayContribute();
234 $list_items = $this->domain->postingList($this->context->getBlog()->getId(), $include_inactive)
235 ->getPostingsForView(
236 $this->context->getAuthor() ?? 0,
237 $this->context->getRequest()->getKeyword(),
238 $this->context->getMonth()
244 $list = $this->gui->posting()->postingList(
245 $this->context->getBlog()->getId(),
246 $this->context->getPermission(),
247 $this->context->getMonth(),
248 $this->context->getNodeId(),
249 $this->context->getIdType()
256 $nav = $this->gui->navigation()->sideBar(
257 $this->context->getPermission(),
258 $this->getLinkBuilder(),
259 $this->blog_settings,
260 $this->context->getNodeId(),
261 $this->context->getIdType()
263 $this->domain->postingList($this->context->getBlog()->getId())->getPostingsGroupedByMonth(),
276 $print_view = $this->gui->presentation()->getPrintView(
277 $this->context->getNodeId(),
278 $this->context->isRepositoryNode(),
279 $this->context->getRequest()->getObjIds()
281 $print_view->sendForm();
286 $print_view = $this->gui->presentation()->getPrintView(
287 $this->context->getNodeId(),
288 $this->context->isRepositoryNode(),
289 $this->context->getRequest()->getObjIds()
291 $print_view->sendPrintView();
296 $apid = $this->context->getRequest()->getApId();
297 if ($this->context->getPermission()->canManage() && $apid > 0) {
298 $post = new \ilBlogPosting($apid);
299 $post->setApproved(
true);
300 $post->setBlogNodeId($this->context->getNodeId(), !$this->context->isRepositoryNode());
301 $post->update(
true,
false,
true,
"new");
303 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
305 $this->domain->lng()->txt(
"settings_saved"),
310 $this->gui->ctrl()->redirectByClass(
321 $apid = $this->context->getRequest()->getApId();
322 if ($this->context->getPermission()->canWrite() && $apid > 0) {
324 $post = new \ilBlogPosting($apid);
325 $post->setApproved(
false);
326 $post->setActive(
false);
327 $post->update(
true,
false,
false);
329 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
331 $this->domain->lng()->txt(
"settings_saved"),
336 $this->gui->ctrl()->redirect($this,
"render");
344 $ctrl = $this->gui->ctrl();
345 $user = $this->domain->user();
346 $mt = $this->gui->ui()->mainTemplate();
347 $lng = $this->domain->lng();
348 $title = $this->context->getRequest()->getTitle();
351 $posting = new \ilBlogPosting();
352 $posting->setTitle($title);
353 $posting->setBlogId($this->context->getBlog()->getId());
354 $posting->setActive(
false);
355 $posting->setAuthor($user->getId());
356 $posting->create(
false);
359 $ctrl->setParameter($this,
"bmn",
date(
"Y-m"));
361 $ctrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $posting->getId());
362 $ctrl->redirectByClass(
"ilblogpostinggui",
"edit");
364 $mt->setOnScreenMessage(
'failure',
$lng->txt(
"msg_no_title"),
true);
365 $ctrl->redirect($this,
"render");
371 $this->content_style->gui()->addCss(
372 $this->gui->ui()->mainTemplate(),
373 $this->context->getBlog()->getRefId(),
374 $this->context->getBlog()->getId()
@ilCtrl_Calls ILIAS\Blog\Editing\EditingGUI: ilRepositorySearchGUI, ilBlogPostingGUI
ILIAS Style Content Object ObjectFacade $content_style_domain
__construct(protected InternalDataService $data, protected InternalDomainService $domain, protected InternalGUIService $gui, protected BlogGUIContext $context, protected \ILIAS\Style\Content\Service $content_style)
createPosting()
Create new posting.
ILIAS Blog Settings Settings $blog_settings
Class ilBlogPosting GUI class.
@ilCtrl_Calls ilObjBlogGUI: ilWorkspaceAccessGUI @ilCtrl_Calls ilObjBlogGUI: ilInfoScreenGUI,...
This class represents a text property in a property form.
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
setRightContent(string $a_html)
Sets content of right column.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
readonly ilGlobalTemplateInterface $tpl
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
catch(\Exception $e) $req