ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilBlogPostingGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
5include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
6
19{
23 protected $tabs;
24
28 protected $locator;
29
33 protected $settings;
34
35 protected $node_id; // [int]
36 protected $access_handler; // [object]
37 protected $enable_public_notes; // [bool]
38 protected $may_contribute; // [bool]
39
51 public function __construct($a_node_id, $a_access_handler = null, $a_id = 0, $a_old_nr = 0, $a_enable_public_notes = true, $a_may_contribute = true, $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
62 $lng->loadLanguageModule("blog");
63
64 $this->node_id = $a_node_id;
65 $this->access_handler = $a_access_handler;
66 $this->enable_public_notes = (bool) $a_enable_public_notes;
67
68 parent::__construct("blp", $a_id, $a_old_nr);
69
70 // needed for notification
71 $this->getBlogPosting()->setBlogNodeId($this->node_id, $this->isInWorkspace());
72 $this->getBlogPosting()->getPageConfig()->setEditLockSupport(!$this->isInWorkspace());
73
74 // #11151
75 $this->may_contribute = (bool) $a_may_contribute;
76 $this->setEnableEditing($a_may_contribute);
77
78 // content style
79 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
80
81 $tpl->setCurrentBlock("SyntaxStyle");
82 $tpl->setVariable(
83 "LOCATION_SYNTAX_STYLESHEET",
85 );
86 $tpl->parseCurrentBlock();
87
88 // #17814
89 $tpl->setCurrentBlock("ContentStyle");
90 $tpl->setVariable(
91 "LOCATION_CONTENT_STYLESHEET",
93 );
94 $tpl->parseCurrentBlock();
95
96 // needed for editor
97 $this->setStyleId($a_style_sheet_id);
98 }
99
103 public function executeCommand()
104 {
106 $ilTabs = $this->tabs;
107 $ilLocator = $this->locator;
109
110 $next_class = $ilCtrl->getNextClass($this);
111 $cmd = $ilCtrl->getCmd();
112
113 $posting = $this->getBlogPosting();
114 $ilCtrl->setParameter($this, "blpg", $posting->getId());
115
116 switch ($next_class) {
117 case "ilnotegui":
118 // $this->getTabs();
119 // $ilTabs->setTabActive("pg");
120 return $this->previewFullscreen();
121
122 /*
123 case "ilratinggui":
124 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
125 $rating_gui = new ilRatingGUI();
126 $rating_gui->setObject($this->getBlogPosting()->getParentId(), "blog",
127 $this->getBlogPosting()->getId(), "blp");
128 $this->ctrl->forwardCommand($rating_gui);
129 $ilCtrl->redirect($this, "preview");
130 break;
131 */
132
133 case "ilpageobjectgui":
134 die("Deprecated. Blog Posting gui forwarding to ilpageobject");
135 return;
136
137 default:
138 if ($posting) {
139 if ($_REQUEST["cmd"] == "deactivatePageToList") {
140 ilUtil::sendSuccess($this->lng->txt("blog_draft_info"), true);
141 } elseif ($_REQUEST["cmd"] == "activatePageToList") {
142 ilUtil::sendSuccess($this->lng->txt("blog_new_posting_info"), true);
143 }
144 $this->setPresentationTitle($posting->getTitle());
145
146 $tpl->setTitle(ilObject::_lookupTitle($this->getBlogPosting()->getBlogId()) . ": " . // #15017
147 $posting->getTitle());
148 $tpl->setTitleIcon(
149 ilUtil::getImagePath("icon_blog.svg"),
150 $this->lng->txt("obj_blog")
151 ); // #12879
152
153 $ilLocator->addItem(
154 $posting->getTitle(),
155 $ilCtrl->getLinkTarget($this, "preview")
156 );
157 }
158 return parent::executeCommand();
159 }
160 }
161
167 public function setBlogPosting(ilBlogPosting $a_posting)
168 {
169 $this->setPageObject($a_posting);
170 }
171
177 public function getBlogPosting()
178 {
179 return $this->getPageObject();
180 }
181
188 protected function checkAccess($a_cmd)
189 {
190 if ($a_cmd == "contribute") {
192 }
193 return $this->access_handler->checkAccess($a_cmd, "", $this->node_id);
194 }
195
199 public function preview($a_mode = null)
200 {
201 global $DIC;
202
206
207 $toolbar = $DIC->toolbar();
208
209 $this->getBlogPosting()->increaseViewCnt();
210
211 $wtpl = new ilTemplate(
212 "tpl.blog_page_view_main_column.html",
213 true,
214 true,
215 "Modules/Blog"
216 );
217
218 // page commands
219 if (!$a_mode) {
220 if (!$this->getEnableEditing()) {
221 $this->ctrl->redirect($this, "previewFullscreen");
222 }
223 /*
224 // delete
225 $page_commands = false;
226 if ($this->checkAccess("write"))
227 {
228 $wtpl->setCurrentBlock("page_command");
229 $wtpl->setVariable("HREF_PAGE_CMD",
230 $ilCtrl->getLinkTarget($this, "deleteBlogPostingConfirmationScreen"));
231 $wtpl->setVariable("TXT_PAGE_CMD", $lng->txt("delete"));
232 $wtpl->parseCurrentBlock();
233 }
234 if ($page_commands)
235 {
236 $wtpl->setCurrentBlock("page_commands");
237 $wtpl->parseCurrentBlock();
238 }
239 */
240 } else {
241 $callback = array($this, "observeNoteAction");
242
243 // notes
244
245 $may_delete_comments = ($this->checkAccess("contribute") &&
246 $ilSetting->get("comments_del_tutor", 1));
247
248 $wtpl->setVariable("TOOLBAR", $toolbar->getHTML());
249
250 $wtpl->setVariable("NOTES", $this->getNotesHTML(
251 $this->getBlogPosting(),
252 false,
253 $this->enable_public_notes,
254 $may_delete_comments,
255 $callback
256 ));
257 }
258
259 // permanent link
260 if ($a_mode != "embedded") {
261 $append = ($_GET["blpg"] != "")
262 ? "_" . ilUtil::stripSlashes($_GET["blpg"])
263 : "";
264 if ($this->isInWorkspace()) {
265 $append .= "_wsp";
266 }
267 $tpl->setPermanentLink("blog", $this->node_id, $append);
268 }
269
270 $wtpl->setVariable("PAGE", parent::preview());
271
272 $tpl->setLoginTargetPar("blog_" . $this->node_id . $append);
273
274 $ilCtrl->setParameter($this, "blpg", $this->getBlogPosting()->getId());
275
276 return $wtpl->get();
277 }
278
284 public function previewEmbedded()
285 {
286 return $this->preview("embedded");
287 }
288
294 public function previewFullscreen()
295 {
296 $this->add_date = true;
297 return $this->preview("fullscreen");
298 }
299
305 public function showPage($a_title = "")
306 {
307 $this->setTemplateOutput(false);
308
309 if (!$this->getAbstractOnly()) {
310 if ($a_title != "") {
311 $this->setPresentationTitle($a_title);
312 } else {
313 $this->setPresentationTitle($this->getBlogPosting()->getTitle());
314 }
315 }
316 $this->getBlogPosting()->increaseViewCnt();
317
318 return parent::showPage();
319 }
320
326 protected function isInWorkspace()
327 {
328 $class = '';
329 if (is_object($this->access_handler)) {
330 $class = get_class($this->access_handler);
331 }
332
333 return stristr($class, "workspace");
334 }
335
342 public function postOutputProcessing($a_output)
343 {
344 // #8626/#9370
345 if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "offline")
346 && !$this->getAbstractOnly() && $this->add_date) {
347 $author = "";
348 if (!$this->isInWorkspace()) {
349 $authors = array();
350 $author_id = $this->getBlogPosting()->getAuthor();
351 if ($author_id) {
352 include_once "Services/User/classes/class.ilUserUtil.php";
353 $authors[] = ilUserUtil::getNamePresentation($author_id);
354 }
355
356 foreach (ilBlogPosting::getPageContributors("blp", $this->getBlogPosting()->getId()) as $editor) {
357 if ($editor["user_id"] != $author_id) {
358 $authors[] = ilUserUtil::getNamePresentation($editor["user_id"]);
359 }
360 }
361
362 if ($authors) {
363 $author = implode(", ", $authors) . " - ";
364 }
365 }
366
367 // prepend creation date
370 $prefix = "<div class=\"il_BlockInfo\" style=\"text-align:right\">" .
371 $author . ilDatePresentation::formatDate($this->getBlogPosting()->getCreated()) .
372 "</div>";
374
375 $a_output = $prefix . $a_output;
376 }
377
378 return $a_output;
379 }
380
386 public function getTabs($a_activate = "")
387 {
389
390 $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", $this->getBlogPosting()->getId());
391
392 parent::getTabs($a_activate);
393 }
394
399 {
403
404 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
405 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
406 $confirmation_gui = new ilConfirmationGUI();
407 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
408 $confirmation_gui->setHeaderText($lng->txt("blog_posting_deletion_confirmation"));
409 $confirmation_gui->setCancel($lng->txt("cancel"), "cancelBlogPostingDeletion");
410 $confirmation_gui->setConfirm($lng->txt("delete"), "confirmBlogPostingDeletion");
411
412 $dtpl = new ilTemplate(
413 "tpl.blog_posting_deletion_confirmation.html",
414 true,
415 true,
416 "Modules/Blog"
417 );
418
419 $dtpl->setVariable("PAGE_TITLE", $this->getBlogPosting()->getTitle());
420
421 // notes/comments
422 include_once("./Services/Notes/classes/class.ilNote.php");
423 $cnt_note_users = ilNote::getUserCount(
424 $this->getBlogPosting()->getParentId(),
425 $this->getBlogPosting()->getId(),
426 "wpg"
427 );
428 $dtpl->setVariable(
429 "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
430 $lng->txt("blog_number_users_notes_or_comments")
431 );
432 $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users);
433
434 $confirmation_gui->addItem("", "", $dtpl->get());
435
436 $tpl->setContent($confirmation_gui->getHTML());
437 }
438 }
439
444 {
446
447 $ilCtrl->redirect($this, "preview");
448 }
449
454 {
457
458 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
459 // delete all md keywords
460 $md_section = $this->getBlogPosting()->getMDSection();
461 foreach ($md_section->getKeywordIds() as $id) {
462 $md_key = $md_section->getKeyword($id);
463 $md_key->delete();
464 }
465
466 $this->getBlogPosting()->delete();
467 ilUtil::sendSuccess($lng->txt("blog_posting_deleted"), true);
468 }
469
470 $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", ""); // #14363
471 $ilCtrl->redirectByClass("ilobjbloggui", "render");
472 }
473
474 public function editTitle($a_form = null)
475 {
477 $ilTabs = $this->tabs;
478
479 $ilTabs->activateTab("edit");
480
481 if (!$a_form) {
482 $a_form = $this->initTitleForm();
483 }
484
485 $tpl->setContent($a_form->getHTML());
486 }
487
488 public function updateTitle()
489 {
492
493 $form = $this->initTitleForm();
494 if ($form->checkInput()) {
495 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
496 $page = $this->getPageObject();
497 $page->setTitle($form->getInput("title"));
498 $page->update();
499
500 $page->handleNews(true);
501
502 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
503 $ilCtrl->redirect($this, "preview");
504 }
505 }
506
507 $form->setValuesByPost();
508 $this->editTitle($form);
509 }
510
511 public function initTitleForm()
512 {
515
516 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
517 $form = new ilPropertyFormGUI();
518 $form->setFormAction($ilCtrl->getFormAction($this));
519 $form->setTitle($lng->txt('blog_rename_posting'));
520
521 $title = new ilTextInputGUI($lng->txt("title"), "title");
522 $title->setRequired(true);
523 $form->addItem($title);
524
525 $title->setValue($this->getPageObject()->getTitle());
526
527 $form->addCommandButton('updateTitle', $lng->txt('save'));
528 $form->addCommandButton('preview', $lng->txt('cancel'));
529
530 return $form;
531 }
532
533 public function editDate($a_form = null)
534 {
536 $ilTabs = $this->tabs;
537
538 $ilTabs->activateTab("edit");
539
540 if (!$a_form) {
541 $a_form = $this->initDateForm();
542 }
543
544 $tpl->setContent($a_form->getHTML());
545 }
546
547 public function updateDate()
548 {
551
552 $form = $this->initDateForm();
553 if ($form->checkInput()) {
554 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
555 $dt = $form->getItemByPostVar("date");
556 $dt = $dt->getDate();
557
558 $page = $this->getPageObject();
559 $page->setCreated($dt);
560 $page->update();
561
562 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
563 $ilCtrl->redirect($this, "preview");
564 }
565 }
566
567 $form->setValuesByPost();
568 $this->editTitle($form);
569 }
570
571 public function initDateForm()
572 {
575
576 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
577 $form = new ilPropertyFormGUI();
578 $form->setFormAction($ilCtrl->getFormAction($this));
579 $form->setTitle($lng->txt('blog_edit_date'));
580
581 $date = new ilDateTimeInputGUI($lng->txt("date"), "date");
582 $date->setRequired(true);
583 $date->setShowTime(true);
584 $date->setInfo($lng->txt('blog_edit_date_info'));
585 $form->addItem($date);
586
587 $date->setDate($this->getPageObject()->getCreated());
588
589 $form->addCommandButton('updateDate', $lng->txt('save'));
590 $form->addCommandButton('preview', $lng->txt('cancel'));
591
592 return $form;
593 }
594
595 public function observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_action, $a_note_id)
596 {
597 // #10040 - get note text
598 include_once "Services/Notes/classes/class.ilNote.php";
599 $note = new ilNote($a_note_id);
600 $note = $note->getText();
601
602 include_once "Modules/Blog/classes/class.ilObjBlog.php";
603 ilObjBlog::sendNotification("comment", $this->isInWorkspace(), $this->node_id, $a_posting_id, $note);
604 }
605
606 protected function getActivationCaptions()
607 {
609
610 return array("deactivatePage" => $lng->txt("blog_toggle_draft"),
611 "activatePage" => $lng->txt("blog_toggle_final"));
612 }
613
614 public function deactivatePageToList()
615 {
616 $this->deactivatePage(true);
617 }
618
619 public function deactivatePage($a_to_list = false)
620 {
621 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
622 $this->getBlogPosting()->unpublish();
623 }
624
625 if (!$a_to_list) {
626 $this->ctrl->redirect($this, "edit");
627 } else {
628 $this->ctrl->setParameterByClass("ilobjbloggui", "blpg", "");
629 $this->ctrl->redirectByClass("ilobjbloggui", "");
630 }
631 }
632
633 public function activatePageToList()
634 {
635 $this->activatePage(true);
636 }
637
638 public function activatePage($a_to_list = false)
639 {
640 // send notifications
641 include_once "Modules/Blog/classes/class.ilObjBlog.php";
642 ilObjBlog::sendNotification("new", $this->isInWorkspace(), $this->node_id, $this->getBlogPosting()->getId());
643
644 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
645 $this->getBlogPosting()->setActive(true);
646 $this->getBlogPosting()->update(true, false, false);
647 }
648 if (!$a_to_list) {
649 $this->ctrl->redirect($this, "edit");
650 } else {
651 $this->ctrl->setParameterByClass("ilobjbloggui", "blpg", "");
652 $this->ctrl->redirectByClass("ilobjbloggui", "");
653 }
654 }
655
656 public function editKeywords(ilPropertyFormGUI $a_form = null)
657 {
658 $ilTabs = $this->tabs;
660
661 if (!$this->checkAccess("contribute")) {
662 return;
663 }
664
665 $ilTabs->activateTab("pg");
666
667 if (!$a_form) {
668 $a_form = $this->initKeywordsForm();
669 }
670
671 $tpl->setContent($a_form->getHTML());
672 }
673
674 protected function initKeywordsForm()
675 {
677
678 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
679 $form = new ilPropertyFormGUI();
680 $form->setFormAction($this->ctrl->getFormAction($this, "saveKeywordsForm"));
681 $form->setTitle($this->lng->txt("blog_edit_keywords"));
682
683 $txt = new ilTextInputGUI($this->lng->txt("blog_keywords"), "keywords");
684 // $txt->setRequired(true); #10504
685 $txt->setMulti(true);
686 $txt->setDataSource($this->ctrl->getLinkTarget($this, "keywordAutocomplete", "", true));
687 $txt->setMaxLength(200);
688 $txt->setSize(50);
689 $txt->setInfo($this->lng->txt("blog_keywords_info"));
690 $form->addItem($txt);
691
692 $md_section = $this->getBlogPosting()->getMDSection();
693
694 $keywords = array();
695 foreach ($ids = $md_section->getKeywordIds() as $id) {
696 $md_key = $md_section->getKeyword($id);
697 if (trim($md_key->getKeyword()) != "") {
698 $keywords[$md_key->getKeywordLanguageCode()][]
699 = $md_key->getKeyword();
700 }
701 }
702
703 // language is not "used" anywhere
704 $ulang = $ilUser->getLanguage();
705 if ($keywords[$ulang]) {
706 asort($keywords[$ulang]);
707 $txt->setValue($keywords[$ulang]);
708 }
709
710 // other keywords in blog
711 $other = array();
712 foreach (array_keys(ilBlogPosting::getAllPostings($this->getBlogPosting()->getBlogId())) as $posting_id) {
713 if ($posting_id != $this->getBlogPosting()->getId()) {
714 $other = array_merge($other, ilBlogPosting::getKeywords($this->getBlogPosting()->getBlogId(), $posting_id));
715 }
716 }
717 // #17414
718 $other = array_unique($other);
719 sort($other, SORT_LOCALE_STRING);
720 if (is_array($keywords[$ulang])) {
721 $other = array_diff($other, $keywords[$ulang]);
722 }
723 if (sizeof($other)) {
724 $html = "";
725 foreach ($other as $item) {
726 $html .= '<span class="ilTag">' . $item . '</span>';
727 }
728 $info = new ilNonEditableValueGUI($this->lng->txt("blog_keywords_other"), "", true);
729 $info->setInfo($this->lng->txt("blog_keywords_other_info"));
730 $info->setValue($html);
731 $form->addItem($info);
732 }
733
734 $form->addCommandButton("saveKeywordsForm", $this->lng->txt("save"));
735 $form->addCommandButton("preview", $this->lng->txt("cancel"));
736
737 return $form;
738 }
739
740 protected function getParentObjId()
741 {
742 if ($this->node_id) {
743 if ($this->isInWorkspace()) {
744 return $this->access_handler->getTree()->lookupObjectId($this->node_id);
745 } else {
746 return ilObject::_lookupObjId($this->node_id);
747 }
748 }
749 }
750
751 public function saveKeywordsForm()
752 {
753 $form = $this->initKeywordsForm();
754 if ($form->checkInput()) {
755 if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
756 $keywords = $form->getInput("keywords");
757 if (is_array($keywords)) {
758 $this->getBlogPosting()->updateKeywords($keywords);
759 }
760 }
761
762 $this->ctrl->redirect($this, "preview");
763 }
764
765 $form->setValuesByPost();
766 $this->editKeywords($form);
767 }
768
769 public function keywordAutocomplete()
770 {
771 $force_all = (bool) $_GET["fetchall"];
772
773 include_once("./Services/MetaData/classes/class.ilMDKeyword.php");
776 "blp",
777 $this->getParentObjId()
778 );
779
780 include_once("./Services/Search/classes/class.ilSearchSettings.php");
781 $cut = (int) ilSearchSettings::getInstance()->getAutoCompleteLength();
782
783 $has_more = false;
784 $result = array();
785 foreach ($res as $r) {
786 if (!$force_all &&
787 sizeof($result["items"]) >= $cut) {
788 $has_more = true;
789 break;
790 }
791 $entry = new stdClass();
792 $entry->value = $r;
793 $entry->label = $r;
794 $result["items"][] = $entry;
795 }
796
797 $result["hasMoreResults"] = $has_more;
798
799 include_once './Services/JSON/classes/class.ilJsonUtil.php';
801 exit;
802 }
803
816 public static function getSnippet($a_id, $a_truncate = false, $a_truncate_length = 500, $a_truncate_sign = "...", $a_include_picture = false, $a_picture_width = 144, $a_picture_height = 144, $a_export_directory = null)
817 {
818 $bpgui = new self(0, null, $a_id);
819
820 // scan the full page for media objects
821 if ($a_include_picture) {
822 $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
823 }
824
825 $bpgui->setRawPageContent(true);
826 $bpgui->setAbstractOnly(true);
827
828 // #8627: export won't work - should we set offline mode?
829 $bpgui->setFileDownloadLink(".");
830 $bpgui->setFullscreenLink(".");
831 $bpgui->setSourcecodeDownloadScript(".");
832
833 // render without title
834 $page = $bpgui->showPage();
835
836 if ($a_truncate) {
837 $page = ilPageObject::truncateHTML($page, $a_truncate_length, $a_truncate_sign);
838 }
839
840 if ($img) {
841 $page = '<div>' . $img . $page . '</div><div style="clear:both;"></div>';
842 }
843
844 return $page;
845 }
846
847 protected function getFirstMediaObjectAsTag($a_width = 144, $a_height = 144, $a_export_directory = null)
848 {
849 $this->obj->buildDom();
850 $mob_ids = $this->obj->collectMediaObjects();
851 if ($mob_ids) {
852 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
853 foreach ($mob_ids as $mob_id) {
854 $mob_obj = new ilObjMediaObject($mob_id);
855 $mob_item = $mob_obj->getMediaItem("Standard");
856 if (stristr($mob_item->getFormat(), "image")) {
857 $mob_size = $mob_item->getOriginalSize();
858 if ($mob_size["width"] >= $a_width ||
859 $mob_size["height"] >= $a_height) {
860 if (!$a_export_directory) {
861 $mob_dir = ilObjMediaObject::_getDirectory($mob_obj->getId());
862 } else {
863 // see ilCOPageHTMLExport::exportHTMLMOB()
864 $mob_dir = "./mobs/mm_" . $mob_obj->getId();
865 }
866 $mob_res = self::parseImage(
867 $mob_size["width"],
868 $mob_size["height"],
869 $a_width,
870 $a_height
871 );
872
873
874 $location = $mob_item->getLocationType() == "Reference"
875 ? $mob_item->getLocation()
876 : $mob_dir . "/" . $mob_item->getLocation();
877
878 return '<img' .
879 ' src="' . $location . '"' .
880 ' width="' . $mob_res[0] . '"' .
881 ' height="' . $mob_res[1] . '"' .
882 ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' .
883 ' />';
884 }
885 }
886 }
887 }
888 }
889
890 protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
891 {
892 $ratio_width = $ratio_height = 1;
893 if ($src_width > $tgt_width) {
894 $ratio_width = $tgt_width / $src_width;
895 }
896 if ($src_height > $tgt_height) {
897 $ratio_height = $tgt_height / $src_height;
898 }
899 $shrink_ratio = min($ratio_width, $ratio_height);
900
901 return array(
902 (int) round($src_width*$shrink_ratio),
903 (int) round($src_height*$shrink_ratio)
904 );
905 }
906
913 public function getDisabledText()
914 {
915 return $this->lng->txt("blog_draft_text");
916 }
917}
$result
user()
Definition: user.php:4
$location
Definition: buildRTE.php:44
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class ilBlogPosting GUI class.
deactivatePage($a_to_list=false)
preview($a_mode=null)
Preview blog posting.
getActivationCaptions()
Get captions for activation action menu entries.
isInWorkspace()
Is current page part of personal workspace blog?
checkAccess($a_cmd)
Centralized access management.
previewEmbedded()
Needed for portfolio/blog handling.
getDisabledText()
Get disabled text.
previewFullscreen()
Needed for portfolio/blog handling.
postOutputProcessing($a_output)
Finalizing output processing.
static parseImage($src_width, $src_height, $tgt_width, $tgt_height)
getTabs($a_activate="")
Get tabs.
editKeywords(ilPropertyFormGUI $a_form=null)
getFirstMediaObjectAsTag($a_width=144, $a_height=144, $a_export_directory=null)
executeCommand()
execute command
deleteBlogPostingConfirmationScreen()
Delete blog posting confirmation screen.
setBlogPosting(ilBlogPosting $a_posting)
Set blog posting.
cancelBlogPostingDeletion()
Cancel blog posting deletion.
__construct($a_node_id, $a_access_handler=null, $a_id=0, $a_old_nr=0, $a_enable_public_notes=true, $a_may_contribute=true, $a_style_sheet_id=0)
Constructor.
confirmBlogPostingDeletion()
Delete the blog posting.
static getSnippet($a_id, $a_truncate=false, $a_truncate_length=500, $a_truncate_sign="...", $a_include_picture=false, $a_picture_width=144, $a_picture_height=144, $a_export_directory=null)
Get first text paragraph of page.
activatePage($a_to_list=false)
observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_action, $a_note_id)
showPage($a_title="")
Embedded posting in portfolio.
getBlogPosting()
Get blog posting.
Class ilBlogPosting.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
static getKeywords($a_obj_id, $a_posting_id)
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
This class represents a date/time property in a property form.
static encode($mixed, $suppress_native=false)
static _getMatchingKeywords($a_query, $a_type, $a_rbac_id=0)
Search for keywords.
This class represents a non editable value in a property form.
Note class.
static getUserCount($a_rep_obj_id, $a_obj_id, $a_type)
How many users have attached a note/comment to a given object?
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
Class ilObjMediaObject.
static _getDirectory($a_mob_id)
get directory for files of media object (static)
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
Class ilPageObjectGUI.
setPresentationTitle($a_title="")
getNotesHTML($a_content_object=null, $a_enable_private_notes=true, $a_enable_public_notes=false, $a_enable_notes_deletion=false, $a_callback=null)
Get html for public and/or private notes.
getAbstractOnly()
Get abstract only.
getPageObject()
Get Page Object.
setEnableEditing($a_enableediting)
Set Enable Editing.
setTemplateOutput($a_output=true)
setStyleId($a_styleid)
Set Style Id.
getEnableEditing()
Get Enable Editing.
setPageObject(ilPageObject $a_pg_obj)
Set Page Object.
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
static getPageContributors($a_parent_type, $a_page_id, $a_lang="-")
Get all contributors for parent object.
This class represents a property form user interface.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$txt
Definition: error.php:11
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
global $ilSetting
Definition: privfeed.php:17
$editor
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92