ILIAS  release_8 Revision v8.24
class.ilBlogPostingGUI.php
Go to the documentation of this file.
1<?php
2
20
28{
29 protected \ILIAS\Notes\Service $notes;
30 protected \ILIAS\Blog\ReadingTime\ReadingTimeManager $reading_time_manager;
32 protected ilTabsGUI$tabs;
35 protected int $node_id;
36 protected ?object $access_handler = null;
37 protected bool $enable_public_notes = false;
38 protected bool $may_contribute = false;
39 protected bool $fetchall = false;
40 protected int $blpg = 0;
41 protected string $term = "";
42 public bool $add_date = false;
43
44 public function __construct(
45 int $a_node_id,
46 object $a_access_handler = null,
47 int $a_id = 0,
48 int $a_old_nr = 0,
49 bool $a_enable_public_notes = true,
50 bool $a_may_contribute = true,
51 int $a_style_sheet_id = 0
52 ) {
53 global $DIC;
54
55 $this->tabs = $DIC->tabs();
56 $this->locator = $DIC["ilLocator"];
57 $this->settings = $DIC->settings();
58 $this->user = $DIC->user();
59 $tpl = $DIC["tpl"];
60 $lng = $DIC->language();
61 $this->blog_request = $DIC->blog()
62 ->internal()
63 ->gui()
64 ->standardRequest();
65
66 $lng->loadLanguageModule("blog");
67
68 $this->node_id = $a_node_id;
69 $this->access_handler = $a_access_handler;
70 $this->enable_public_notes = $a_enable_public_notes;
71
72 parent::__construct("blp", $a_id, $a_old_nr);
73
74 // needed for notification
75 $this->getBlogPosting()->setBlogNodeId($this->node_id, $this->isInWorkspace());
76 $this->getBlogPosting()->getPageConfig()->setEditLockSupport(!$this->isInWorkspace());
77
78 // #11151
79 $this->may_contribute = $a_may_contribute;
80 $this->setEnableEditing($a_may_contribute);
81
82 // content style
83
84 $tpl->setCurrentBlock("SyntaxStyle");
86 "LOCATION_SYNTAX_STYLESHEET",
88 );
90
91 // #17814
92 $tpl->setCurrentBlock("ContentStyle");
94 "LOCATION_CONTENT_STYLESHEET",
96 );
98
99 // needed for editor
100 $this->setStyleId($a_style_sheet_id);
101
102 $this->blpg = $this->blog_request->getBlogPage();
103 $this->fetchall = $this->blog_request->getFetchAll();
104 $this->term = $this->blog_request->getTerm();
105
106 $this->reading_time_manager = new \ILIAS\Blog\ReadingTime\ReadingTimeManager();
107 $this->notes = $DIC->notes();
108 }
109
110 public function executeCommand(): string
111 {
112 $ilCtrl = $this->ctrl;
113 $ilLocator = $this->locator;
115
116 $next_class = $ilCtrl->getNextClass($this);
117
118 $posting = $this->getBlogPosting();
119 $ilCtrl->setParameter($this, "blpg", $posting->getId());
120
121 switch ($next_class) {
122 case "ilnotegui":
123 // $this->getTabs();
124 // $ilTabs->setTabActive("pg");
125 return $this->previewFullscreen();
126
127 default:
128 if ($posting) {
129 if ($ilCtrl->getCmd() === "deactivatePageToList") {
130 $this->tpl->setOnScreenMessage('success', $this->lng->txt("blog_draft_info"), true);
131 } elseif ($ilCtrl->getCmd() === "activatePageToList") {
132 $this->tpl->setOnScreenMessage('success', $this->lng->txt("blog_new_posting_info"), true);
133 }
134 $this->setPresentationTitle($posting->getTitle());
135
136 $tpl->setTitle(ilObject::_lookupTitle($this->getBlogPosting()->getBlogId()) . ": " . // #15017
137 $posting->getTitle());
139 ilUtil::getImagePath("icon_blog.svg"),
140 $this->lng->txt("obj_blog")
141 ); // #12879
142
143 $ilLocator->addItem(
144 $posting->getTitle(),
145 $ilCtrl->getLinkTarget($this, "preview")
146 );
147 }
148 return parent::executeCommand();
149 }
150 }
151
152 public function setBlogPosting(ilBlogPosting $a_posting): void
153 {
154 $this->setPageObject($a_posting);
155 }
156
157 public function getBlogPosting(): ilBlogPosting
158 {
160 $bp = $this->getPageObject();
161 return $bp;
162 }
163
164 protected function checkAccess(string $a_cmd): bool
165 {
166 if ($a_cmd === "contribute") {
168 }
169 return $this->access_handler->checkAccess($a_cmd, "", $this->node_id);
170 }
171
172 public function preview(
173 string $a_mode = null
174 ): string {
175 global $DIC;
176 $ilCtrl = $this->ctrl;
179
180 $toolbar = $DIC->toolbar();
181 $append = "";
182
183 $this->getBlogPosting()->increaseViewCnt();
184
185 $wtpl = new ilTemplate(
186 "tpl.blog_page_view_main_column.html",
187 true,
188 true,
189 "Modules/Blog"
190 );
191
192 // page commands
193 if (!$a_mode) {
194 if (!$this->getEnableEditing()) {
195 $this->ctrl->redirect($this, "previewFullscreen");
196 }
197 } else {
198 $callback = array($this, "observeNoteAction");
199
200 // notes
201
202 $may_delete_comments = ($this->checkAccess("contribute") &&
203 $ilSetting->get("comments_del_tutor", '1'));
204
205 $wtpl->setVariable("TOOLBAR", $toolbar->getHTML());
206
207 $wtpl->setVariable("NOTES", $this->getNotesHTML(
208 $this->getBlogPosting(),
209 false,
210 $this->enable_public_notes,
211 $may_delete_comments,
212 $callback
213 ));
214 }
215 // permanent link
216 if ($a_mode !== "embedded") {
217 $append = ($this->blpg > 0)
218 ? "_" . $this->blpg
219 : "";
220 if ($this->isInWorkspace()) {
221 $append .= "_wsp";
222 }
223 $tpl->setPermanentLink("blog", $this->node_id, $append);
224 }
225
226 $wtpl->setVariable("PAGE", parent::preview());
227
228 $tpl->setLoginTargetPar("blog_" . $this->node_id . $append);
229
230 $ilCtrl->setParameter($this, "blpg", $this->getBlogPosting()->getId());
231
232 return $wtpl->get();
233 }
234
238 public function previewEmbedded(): string
239 {
240 return $this->preview("embedded");
241 }
242
246 public function previewFullscreen(): string
247 {
248 $this->add_date = true;
249 return $this->preview("fullscreen");
250 }
251
252 public function showPage(
253 string $a_title = ""
254 ): string {
255 $this->setTemplateOutput(false);
256
257 $this->setPresentationTitle("");
258 if (!$this->getAbstractOnly() && !$this->showPageHeading()) {
259 if ($a_title !== "") {
260 $this->setPresentationTitle($a_title);
261 } else {
262 $this->setPresentationTitle($this->getBlogPosting()->getTitle());
263 }
264 }
265 $this->getBlogPosting()->increaseViewCnt();
266 return parent::showPage();
267 }
268
272 protected function isInWorkspace(): bool
273 {
274 $class = '';
275 if (is_object($this->access_handler)) {
276 $class = get_class($this->access_handler);
277 }
278
279 return stristr($class, "workspace");
280 }
281
285 public function postOutputProcessing(
286 string $a_output
287 ): string {
288 // #8626/#9370
289 if ($this->showPageHeading()) {
290 $a_output = $this->getPageHeading() . $a_output;
291 }
292
293 return $a_output;
294 }
295
296 protected function showPageHeading(): bool
297 {
298 if (!$this->getAbstractOnly() && $this->add_date) {
299 return true;
300 }
301
302 return false;
303 }
304
310 protected function getPageHeading(): string
311 {
312 $author = "";
313 if (!$this->isInWorkspace()) {
314 $authors = array();
315 $author_id = $this->getBlogPosting()->getAuthor();
316 if ($author_id) {
317 $authors[] = ilUserUtil::getNamePresentation($author_id);
318 }
319
320 foreach (ilBlogPosting::getPageContributors("blp", $this->getBlogPosting()->getId()) as $editor) {
321 if ($editor["user_id"] != $author_id) {
322 $authors[] = ilUserUtil::getNamePresentation($editor["user_id"]);
323 }
324 }
325
326 if ($authors) {
327 $author = implode(", ", $authors) . " - ";
328 }
329 }
332 $tpl = new ilTemplate("tpl.posting_head.html", true, true, "Modules/Blog");
333
334 // reading time
335 $reading_time = $this->reading_time_manager->getReadingTime(
336 $this->getBlogPosting()->getParentId(),
337 $this->getBlogPosting()->getId()
338 );
339 if (!is_null($reading_time)) {
340 $this->lng->loadLanguageModule("copg");
341 $tpl->setCurrentBlock("reading_time");
342 $tpl->setVariable(
343 "READING_TIME",
344 $this->lng->txt("copg_est_reading_time") . ": " .
345 sprintf($this->lng->txt("copg_x_minutes"), $reading_time)
346 );
347 $tpl->parseCurrentBlock();
348 }
349
350 $tpl->setVariable("TITLE", $this->getBlogPosting()->getTitle());
351 $tpl->setVariable(
352 "DATETIME",
353 $author . ilDatePresentation::formatDate($this->getBlogPosting()->getCreated())
354 );
356 return $tpl->get();
357 }
358
359 public function getTabs(string $a_activate = ""): void
360 {
361 $ilCtrl = $this->ctrl;
362
363 $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", $this->getBlogPosting()->getId());
364
365 parent::getTabs($a_activate);
366 }
367
369 {
371 $ilCtrl = $this->ctrl;
373
374 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
375 $confirmation_gui = new ilConfirmationGUI();
376 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
377 $confirmation_gui->setHeaderText($lng->txt("blog_posting_deletion_confirmation"));
378 $confirmation_gui->setCancel($lng->txt("cancel"), "cancelBlogPostingDeletion");
379 $confirmation_gui->setConfirm($lng->txt("delete"), "confirmBlogPostingDeletion");
380
381 $dtpl = new ilTemplate(
382 "tpl.blog_posting_deletion_confirmation.html",
383 true,
384 true,
385 "Modules/Blog"
386 );
387
388 $dtpl->setVariable("PAGE_TITLE", $this->getBlogPosting()->getTitle());
389
390 // notes/comments
391 $cnt_note_users = $this->notes->domain()->getUserCount(
392 $this->getBlogPosting()->getParentId(),
393 $this->getBlogPosting()->getId(),
394 "wpg"
395 );
396 $dtpl->setVariable(
397 "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
398 $lng->txt("blog_number_users_notes_or_comments")
399 );
400 $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users);
401
402 $confirmation_gui->addItem("", "", $dtpl->get());
403
404 $tpl->setContent($confirmation_gui->getHTML());
405 }
406 }
407
408 public function cancelBlogPostingDeletion(): void
409 {
410 $ilCtrl = $this->ctrl;
411
412 $ilCtrl->redirect($this, "preview");
413 }
414
415 public function confirmBlogPostingDeletion(): void
416 {
417 $ilCtrl = $this->ctrl;
419
420 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
421 // delete all md keywords
422 $md_section = $this->getBlogPosting()->getMDSection();
423 foreach ($md_section->getKeywordIds() as $id) {
424 $md_key = $md_section->getKeyword($id);
425 $md_key->delete();
426 }
427
428 $this->getBlogPosting()->delete();
429 $this->tpl->setOnScreenMessage('success', $lng->txt("blog_posting_deleted"), true);
430 }
431
432 $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", ""); // #14363
433 $ilCtrl->redirectByClass("ilobjbloggui", "render");
434 }
435
436 public function editTitle(ilPropertyFormGUI $a_form = null): void
437 {
439 $ilTabs = $this->tabs;
440
441 $ilTabs->clearTargets();
442 $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("ilobjblogGUI"));
443
444 $ilTabs->activateTab("edit");
445
446 if (!$a_form) {
447 $a_form = $this->initTitleForm();
448 }
449
450 $tpl->setContent($a_form->getHTML());
451 }
452
453 public function updateTitle(): void
454 {
456
457 $form = $this->initTitleForm();
458 if ($form->checkInput()) {
459 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
460 $page = $this->getPageObject();
461 $page->setTitle($form->getInput("title"));
462 $page->update();
463
464 $page->handleNews(true);
465
466 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
467 //$ilCtrl->redirect($this, "preview");
468 $this->ctrl->redirectByClass("ilObjBlogGUI", "");
469 }
470 }
471
472 $form->setValuesByPost();
473 $this->editTitle($form);
474 }
475
477 {
479 $ilCtrl = $this->ctrl;
480
481 $form = new ilPropertyFormGUI();
482 $form->setFormAction($ilCtrl->getFormAction($this));
483 $form->setTitle($lng->txt('blog_rename_posting'));
484
485 $title = new ilTextInputGUI($lng->txt("title"), "title");
486 $title->setRequired(true);
487 $form->addItem($title);
488
489 $title->setValue($this->getPageObject()->getTitle());
490
491 $form->addCommandButton('updateTitle', $lng->txt('save'));
492 $form->addCommandButton('cancelEdit', $lng->txt('cancel'));
493
494 return $form;
495 }
496
497 public function editDate(ilPropertyFormGUI $a_form = null): void
498 {
500 $ilTabs = $this->tabs;
501
502 $ilTabs->clearTargets();
503 $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("ilobjblogGUI"));
504
505 $ilTabs->activateTab("edit");
506
507 if (!$a_form) {
508 $a_form = $this->initDateForm();
509 }
510
511 $tpl->setContent($a_form->getHTML());
512 }
513
514 public function updateDate(): void
515 {
517
518 $form = $this->initDateForm();
519 if ($form->checkInput()) {
520 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
521 $dt = $form->getItemByPostVar("date");
522 $dt = $dt->getDate();
523
524 $page = $this->getPageObject();
525 $page->setCreated($dt);
526 $page->update();
527
528 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
529 //$ilCtrl->redirect($this, "preview");
530 $this->ctrl->redirectByClass("ilObjBlogGUI", "");
531 }
532 }
533
534 $form->setValuesByPost();
535 $this->editTitle($form);
536 }
537
539 {
541 $ilCtrl = $this->ctrl;
542
543 $form = new ilPropertyFormGUI();
544 $form->setFormAction($ilCtrl->getFormAction($this));
545 $form->setTitle($lng->txt('blog_edit_date'));
546
547 $date = new ilDateTimeInputGUI($lng->txt("date"), "date");
548 $date->setRequired(true);
549 $date->setShowTime(true);
550 $date->setInfo($lng->txt('blog_edit_date_info'));
551 $form->addItem($date);
552
553 $date->setDate($this->getPageObject()->getCreated());
554
555 $form->addCommandButton('updateDate', $lng->txt('save'));
556 $form->addCommandButton('cancelEdit', $lng->txt('cancel'));
557
558 return $form;
559 }
560
561 protected function cancelEdit(): void
562 {
563 $this->ctrl->redirectByClass("ilObjBlogGUI", "");
564 }
565
566 public function observeNoteAction(
567 int $a_blog_id,
568 int $a_posting_id,
569 string $a_type,
570 string $a_action,
571 int $a_note_id
572 ): void {
573 // #10040 - get note text
574 $note = $this->notes->domain()->getById($a_note_id);
575 $text = $note->getText();
576 ilObjBlog::sendNotification("comment", $this->isInWorkspace(), $this->node_id, $a_posting_id, $text);
577 }
578
579 public function getActivationCaptions(): array
580 {
582
583 return array("deactivatePage" => $lng->txt("blog_toggle_draft"),
584 "activatePage" => $lng->txt("blog_toggle_final"));
585 }
586
587 public function deactivatePageToList(): void
588 {
589 $this->deactivatePage(true);
590 }
591
592 public function deactivatePage(bool $a_to_list = false): void
593 {
594 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
595 $this->getBlogPosting()->unpublish();
596 }
597
598 if (!$a_to_list) {
599 $this->ctrl->redirect($this, "edit");
600 } else {
601 $this->ctrl->setParameterByClass("ilobjbloggui", "blpg", "");
602 $this->ctrl->redirectByClass("ilobjbloggui", "");
603 }
604 }
605
606 public function activatePageToList(): void
607 {
608 $this->activatePage(true);
609 }
610
611 public function activatePage(bool $a_to_list = false): void
612 {
613 // send notifications
614 ilObjBlog::sendNotification("new", $this->isInWorkspace(), $this->node_id, $this->getBlogPosting()->getId());
615
616 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
617 $this->getBlogPosting()->setActive(true);
618 $this->getBlogPosting()->update(true, false);
619 }
620 if (!$a_to_list) {
621 $this->ctrl->redirect($this, "edit");
622 } else {
623 $this->ctrl->setParameterByClass("ilobjbloggui", "blpg", "");
624 $this->ctrl->redirectByClass("ilobjbloggui", "");
625 }
626 }
627
631 public function editKeywords(): void
632 {
633 global $DIC;
634
635 $renderer = $DIC->ui()->renderer();
636
637 $ilTabs = $this->tabs;
639
640 $ilTabs->clearTargets();
641 $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("ilobjblogGUI"));
642
643 if (!$this->checkAccess("contribute")) {
644 return;
645 }
646
647 $ilTabs->activateTab("pg");
648
649 $tpl->setContent($renderer->render($this->initKeywordsForm()));
650 }
651
655 protected function initKeywordsForm(): \ILIAS\UI\Component\Input\Container\Form\Standard
656 {
657 global $DIC;
658
659 $ui_factory = $DIC->ui()->factory();
660
661 $md_section = $this->getBlogPosting()->getMDSection();
662
663 $keywords = array();
664 foreach ($ids = $md_section->getKeywordIds() as $id) {
665 $md_key = $md_section->getKeyword($id);
666 if (trim($md_key->getKeyword()) !== "") {
667 $keywords[] = $md_key->getKeyword();
668 }
669 }
670
671 // other keywords in blog
672 $other = array();
673 foreach (array_keys(ilBlogPosting::getAllPostings($this->getBlogPosting()->getBlogId())) as $posting_id) {
674 if ($posting_id != $this->getBlogPosting()->getId()) {
675 $other = array_merge($other, ilBlogPosting::getKeywords($this->getBlogPosting()->getBlogId(), $posting_id));
676 }
677 }
678 // #17414
679 $other = array_unique($other);
680 sort($other, SORT_LOCALE_STRING);
681
682 $input_tag = $ui_factory->input()->field()->tag($this->lng->txt("blog_keywords"), $other, $this->lng->txt("blog_keyword_enter"))->withUserCreatedTagsAllowed(true);
683 if (count($keywords) > 0) {
684 $input_tag = $input_tag->withValue($keywords);
685 }
686
687 $DIC->ctrl()->setParameter(
688 $this,
689 'tags',
690 'tags_processing'
691 );
692
693 $section = $ui_factory->input()->field()->section([$input_tag], $this->lng->txt("blog_edit_keywords"), "");
694
695 $form_action = $DIC->ctrl()->getFormAction($this, "saveKeywordsForm");
696 return $ui_factory->input()->container()->form()->standard($form_action, ["tags" => $section]);
697 }
698
699 protected function getParentObjId(): int
700 {
701 if ($this->node_id) {
702 if ($this->isInWorkspace()) {
703 return $this->access_handler->getTree()->lookupObjectId($this->node_id);
704 }
705
706 return ilObject::_lookupObjId($this->node_id);
707 }
708 return 0;
709 }
710
711 public function saveKeywordsForm(): void
712 {
713 global $DIC;
714
715 $request = $DIC->http()->request();
716 $form = $this->initKeywordsForm();
717
718 if ($request->getMethod() === "POST"
719 && $request->getQueryParams()['tags'] == 'tags_processing') {
720 $form = $form->withRequest($request);
721 $result = $form->getData();
722 //TODO identify the input instead of use 0
723 $keywords = $result["tags"][0];
724
725 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
726 if (is_array($keywords)) {
727 $this->getBlogPosting()->updateKeywords($keywords);
728 } else {
729 $this->getBlogPosting()->updateKeywords([]);
730 }
731 }
732
733 $this->ctrl->redirectByClass("ilObjBlogGUI", "");
734 }
735 }
736
740 public static function getSnippet(
741 int $a_id,
742 bool $a_truncate = false,
743 int $a_truncate_length = 500,
744 string $a_truncate_sign = "...",
745 bool $a_include_picture = false,
746 int $a_picture_width = 144,
747 int $a_picture_height = 144,
748 string $a_export_directory = null
749 ): string {
750 $bpgui = new self(0, null, $a_id);
751
752 // scan the full page for media objects
753 $img = "";
754 if ($a_include_picture) {
755 $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
756 }
757
758 $bpgui->setRawPageContent(true);
759 $bpgui->setAbstractOnly(true);
760
761 // #8627: export won't work - should we set offline mode?
762 $bpgui->setFileDownloadLink(".");
763 $bpgui->setFullscreenLink(".");
764 $bpgui->setSourcecodeDownloadScript(".");
765 $bpgui->setProfileBackUrl(".");
766
767 // render without title
768 $page = $bpgui->showPage();
769
770 if ($a_truncate) {
771 $page = ilPageObject::truncateHTML($page, $a_truncate_length, $a_truncate_sign);
772 }
773
774 if ($img) {
775 $page = '<div>' . $img . $page . '</div><div style="clear:both;"></div>';
776 }
777
778 return $page;
779 }
780
781 protected function getFirstMediaObjectAsTag(
782 int $a_width = 144,
783 int $a_height = 144,
784 string $a_export_directory = null
785 ): string {
786 $this->obj->buildDom();
787 $mob_ids = $this->obj->collectMediaObjects();
788 if ($mob_ids) {
789 foreach ($mob_ids as $mob_id) {
790 $mob_obj = new ilObjMediaObject($mob_id);
791 $mob_item = $mob_obj->getMediaItem("Standard");
792 if (stripos($mob_item->getFormat(), "image") !== false) {
793 $mob_size = $mob_item->getOriginalSize();
794 if (is_null($mob_size)) {
795 continue;
796 }
797 if ($mob_size["width"] >= $a_width ||
798 $mob_size["height"] >= $a_height) {
799 if (!$a_export_directory) {
800 $mob_dir = ilObjMediaObject::_getDirectory($mob_obj->getId());
801 } else {
802 // see ilCOPageHTMLExport::exportHTMLMOB()
803 $mob_dir = "./mobs/mm_" . $mob_obj->getId();
804 }
805 $mob_res = self::parseImage(
806 $mob_size["width"],
807 $mob_size["height"],
808 $a_width,
809 $a_height
810 );
811
812
813 $location = $mob_item->getLocationType() === "Reference"
814 ? $mob_item->getLocation()
815 : $mob_dir . "/" . $mob_item->getLocation();
816
817 return '<img' .
818 ' src="' . $location . '"' .
819 ' width="' . $mob_res[0] . '"' .
820 ' height="' . $mob_res[1] . '"' .
821 ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' .
822 ' />';
823 }
824 }
825 }
826 }
827 return "";
828 }
829
830 protected static function parseImage(
831 int $src_width,
832 int $src_height,
833 int $tgt_width,
834 int $tgt_height
835 ): array {
836 $ratio_width = $ratio_height = 1;
837 if ($src_width > $tgt_width) {
838 $ratio_width = $tgt_width / $src_width;
839 }
840 if ($src_height > $tgt_height) {
841 $ratio_height = $tgt_height / $src_height;
842 }
843 $shrink_ratio = min($ratio_width, $ratio_height);
844
845 return array(
846 (int) round($src_width * $shrink_ratio),
847 (int) round($src_height * $shrink_ratio)
848 );
849 }
850
851 public function getDisabledText(): string
852 {
853 return $this->lng->txt("blog_draft_text");
854 }
855
856 public function getCommentsHTMLExport(): string
857 {
858 return $this->getNotesHTML(
859 $this->getBlogPosting(),
860 false,
861 $this->enable_public_notes,
862 false,
863 null,
864 true
865 );
866 }
867
868 protected function showEditToolbar(): void
869 {
870 }
871
872 public function finishEditing(): void
873 {
874 $this->ctrl->setParameterByClass("ilobjbloggui", "bmn", "");
875 $this->ctrl->redirectByClass("ilobjbloggui", "render");
876 }
877}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
Class ilBlogPosting GUI class.
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.
getActivationCaptions()
Get captions for activation action menu entries.
isInWorkspace()
Is current page part of personal workspace blog?
getTabs(string $a_activate="")
previewEmbedded()
Needed for portfolio/blog handling.
previewFullscreen()
Needed for portfolio/blog handling.
ILIAS Notes Service $notes
observeNoteAction(int $a_blog_id, int $a_posting_id, string $a_type, string $a_action, int $a_note_id)
postOutputProcessing(string $a_output)
Finalizing output processing.
static parseImage(int $src_width, int $src_height, int $tgt_width, int $tgt_height)
executeCommand()
execute command
setBlogPosting(ilBlogPosting $a_posting)
preview(string $a_mode=null)
editTitle(ilPropertyFormGUI $a_form=null)
ILIAS Blog ReadingTime ReadingTimeManager $reading_time_manager
getPageHeading()
Get page heading see also https://docu.ilias.de/goto_docu_wiki_wpage_5793_1357.html the presentation ...
deactivatePage(bool $a_to_list=false)
StandardGUIRequest $blog_request
editDate(ilPropertyFormGUI $a_form=null)
showPage(string $a_title="")
showEditToolbar()
Show edit toolbar.
editKeywords()
Diplay the keywords form.
getFirstMediaObjectAsTag(int $a_width=144, int $a_height=144, string $a_export_directory=null)
activatePage(bool $a_to_list=false)
__construct(int $a_node_id, object $a_access_handler=null, int $a_id=0, int $a_old_nr=0, bool $a_enable_public_notes=true, bool $a_may_contribute=true, int $a_style_sheet_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
static getKeywords(int $a_obj_id, int $a_posting_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static sendNotification(string $a_action, bool $a_in_wsp, int $a_blog_node_id, int $a_posting_id, ?string $a_comment=null)
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
Class ilPageObjectGUI.
setStyleId(int $a_styleid)
setPresentationTitle(string $a_title="")
getNotesHTML(object $a_content_object=null, bool $a_enable_private_notes=true, bool $a_enable_public_notes=false, bool $a_enable_notes_deletion=false, callable $a_callback=null, bool $export=false)
Get html for public and/or private notes.
ilGlobalTemplateInterface $tpl
setEnableEditing(bool $a_enableediting)
setPageObject(ilPageObject $a_pg_obj)
static truncateHTML(string $a_text, int $a_length=100, string $a_ending='...', bool $a_exact=false, bool $a_consider_html=true)
Truncate (html) string.
static getPageContributors(string $a_parent_type, int $a_page_id, string $a_lang="-")
Get all contributors for parent object.
This class represents a property form user interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
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="ilpublicuserprofilegui")
Default behaviour is:
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
global $DIC
Definition: feed.php:28
$img
Definition: imgupload.php:83
setLoginTargetPar(string $a_val)
Set target parameter for login (public sector).
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
global $ilSetting
Definition: privfeed.php:17
$lng