ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilBlogPostingGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
14 {
18  protected $tabs;
19 
23  protected $locator;
24 
28  protected $settings;
29 
33  protected $node_id;
34  protected $access_handler; // [object]
35 
40 
44  protected $may_contribute;
45 
49  protected $fetchall;
50 
54  protected $blpg;
55 
59  protected $term;
60 
71  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)
72  {
73  global $DIC;
74 
75  $this->tabs = $DIC->tabs();
76  $this->locator = $DIC["ilLocator"];
77  $this->settings = $DIC->settings();
78  $this->user = $DIC->user();
79  $tpl = $DIC["tpl"];
80  $lng = $DIC->language();
81 
82  $lng->loadLanguageModule("blog");
83 
84  $this->node_id = $a_node_id;
85  $this->access_handler = $a_access_handler;
86  $this->enable_public_notes = (bool) $a_enable_public_notes;
87 
88  parent::__construct("blp", $a_id, $a_old_nr);
89 
90  // needed for notification
91  $this->getBlogPosting()->setBlogNodeId($this->node_id, $this->isInWorkspace());
92  $this->getBlogPosting()->getPageConfig()->setEditLockSupport(!$this->isInWorkspace());
93 
94  // #11151
95  $this->may_contribute = (bool) $a_may_contribute;
96  $this->setEnableEditing($a_may_contribute);
97 
98  // content style
99 
100  $tpl->setCurrentBlock("SyntaxStyle");
101  $tpl->setVariable(
102  "LOCATION_SYNTAX_STYLESHEET",
104  );
105  $tpl->parseCurrentBlock();
106 
107  // #17814
108  $tpl->setCurrentBlock("ContentStyle");
109  $tpl->setVariable(
110  "LOCATION_CONTENT_STYLESHEET",
111  ilObjStyleSheet::getContentStylePath($a_style_sheet_id)
112  );
113  $tpl->parseCurrentBlock();
114 
115  // needed for editor
116  $this->setStyleId($a_style_sheet_id);
117 
118  $this->blpg = (int) $_GET["blpg"];
119  $this->fetchall = (bool) $_GET["fetchall"];
120  $this->term = ilUtil::stripSlashes($_GET["term"]);
121  }
122 
126  public function executeCommand()
127  {
129  $ilTabs = $this->tabs;
130  $ilLocator = $this->locator;
131  $tpl = $this->tpl;
132 
133  $next_class = $ilCtrl->getNextClass($this);
134  $cmd = $ilCtrl->getCmd();
135 
136  $posting = $this->getBlogPosting();
137  $ilCtrl->setParameter($this, "blpg", $posting->getId());
138 
139  switch ($next_class) {
140  case "ilnotegui":
141  $tpl->setTitle(ilObject::_lookupTitle($this->getBlogPosting()->getBlogId()) . ": " . // #15017
142  $posting->getTitle());
143  $tpl->setTitleIcon(
144  ilUtil::getImagePath("icon_blog.svg"),
145  $this->lng->txt("obj_blog")
146  ); // #12879
147  return $this->previewFullscreen();
148 
149  default:
150  if ($posting) {
151  if ($ilCtrl->getCmd() == "deactivatePageToList") {
152  ilUtil::sendSuccess($this->lng->txt("blog_draft_info"), true);
153  } elseif ($ilCtrl->getCmd() == "activatePageToList") {
154  ilUtil::sendSuccess($this->lng->txt("blog_new_posting_info"), true);
155  }
156  $this->setPresentationTitle($posting->getTitle());
157 
158  $tpl->setTitle(ilObject::_lookupTitle($this->getBlogPosting()->getBlogId()) . ": " . // #15017
159  $posting->getTitle());
160  $tpl->setTitleIcon(
161  ilUtil::getImagePath("icon_blog.svg"),
162  $this->lng->txt("obj_blog")
163  ); // #12879
164 
165  $ilLocator->addItem(
166  $posting->getTitle(),
167  $ilCtrl->getLinkTarget($this, "preview")
168  );
169  }
170  return parent::executeCommand();
171  }
172  }
173 
179  public function setBlogPosting(ilBlogPosting $a_posting)
180  {
181  $this->setPageObject($a_posting);
182  }
183 
189  public function getBlogPosting()
190  {
191  return $this->getPageObject();
192  }
193 
200  protected function checkAccess($a_cmd)
201  {
202  if ($a_cmd == "contribute") {
203  return $this->may_contribute;
204  }
205  return $this->access_handler->checkAccess($a_cmd, "", $this->node_id);
206  }
207 
211  public function preview($a_mode = null)
212  {
213  global $DIC;
214 
216  $tpl = $this->tpl;
218 
219  $toolbar = $DIC->toolbar();
220 
221  $this->getBlogPosting()->increaseViewCnt();
222 
223  $wtpl = new ilTemplate(
224  "tpl.blog_page_view_main_column.html",
225  true,
226  true,
227  "Modules/Blog"
228  );
229 
230  // page commands
231  if (!$a_mode) {
232  if (!$this->getEnableEditing()) {
233  $this->ctrl->redirect($this, "previewFullscreen");
234  }
235  /*
236  // delete
237  $page_commands = false;
238  if ($this->checkAccess("write"))
239  {
240  $wtpl->setCurrentBlock("page_command");
241  $wtpl->setVariable("HREF_PAGE_CMD",
242  $ilCtrl->getLinkTarget($this, "deleteBlogPostingConfirmationScreen"));
243  $wtpl->setVariable("TXT_PAGE_CMD", $lng->txt("delete"));
244  $wtpl->parseCurrentBlock();
245  }
246  if ($page_commands)
247  {
248  $wtpl->setCurrentBlock("page_commands");
249  $wtpl->parseCurrentBlock();
250  }
251  */
252  } else {
253  $callback = array($this, "observeNoteAction");
254 
255  // notes
256 
257  $may_delete_comments = ($this->checkAccess("contribute") &&
258  $ilSetting->get("comments_del_tutor", 1));
259 
260  $wtpl->setVariable("TOOLBAR", $toolbar->getHTML());
261  $wtpl->setVariable("NOTES", $this->getNotesHTML(
262  $this->getBlogPosting(),
263  false,
264  $this->enable_public_notes,
265  $may_delete_comments,
266  $callback
267  ));
268  }
269 
270  // permanent link
271  if ($a_mode != "embedded") {
272  $append = ($this->blpg > 0)
273  ? "_" . $this->blpg
274  : "";
275  if ($this->isInWorkspace()) {
276  $append .= "_wsp";
277  }
278  $tpl->setPermanentLink("blog", $this->node_id, $append);
279  }
280 
281  $wtpl->setVariable("PAGE", parent::preview());
282 
283  $tpl->setLoginTargetPar("blog_" . $this->node_id . $append);
284 
285  $ilCtrl->setParameter($this, "blpg", $this->getBlogPosting()->getId());
286 
287  return $wtpl->get();
288  }
289 
295  public function previewEmbedded()
296  {
297  return $this->preview("embedded");
298  }
299 
305  public function previewFullscreen()
306  {
307  $this->add_date = true;
308  return $this->preview("fullscreen");
309  }
310 
316  public function showPage($a_title = "")
317  {
318  $this->setTemplateOutput(false);
319 
320  if (!$this->getAbstractOnly()) {
321  if ($a_title != "") {
322  $this->setPresentationTitle($a_title);
323  } else {
324  $this->setPresentationTitle($this->getBlogPosting()->getTitle());
325  }
326  }
327  $this->getBlogPosting()->increaseViewCnt();
328 
329  return parent::showPage();
330  }
331 
337  protected function isInWorkspace()
338  {
339  $class = '';
340  if (is_object($this->access_handler)) {
341  $class = get_class($this->access_handler);
342  }
343 
344  return stristr($class, "workspace");
345  }
346 
353  public function postOutputProcessing($a_output)
354  {
355  // #8626/#9370
356  if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "offline")
357  && !$this->getAbstractOnly() && $this->add_date) {
358  $author = "";
359  if (!$this->isInWorkspace()) {
360  $authors = array();
361  $author_id = $this->getBlogPosting()->getAuthor();
362  if ($author_id) {
363  $authors[] = ilUserUtil::getNamePresentation($author_id);
364  }
365 
366  foreach (ilBlogPosting::getPageContributors("blp", $this->getBlogPosting()->getId()) as $editor) {
367  if ($editor["user_id"] != $author_id) {
368  $authors[] = ilUserUtil::getNamePresentation($editor["user_id"]);
369  }
370  }
371 
372  if ($authors) {
373  $author = implode(", ", $authors) . " - ";
374  }
375  }
376 
377  // prepend creation date
380  $prefix = "<div class=\"il_BlockInfo\" style=\"text-align:right\">" .
381  $author . ilDatePresentation::formatDate($this->getBlogPosting()->getCreated()) .
382  "</div>";
384 
385  $a_output = $prefix . $a_output;
386  }
387 
388  return $a_output;
389  }
390 
396  public function getTabs($a_activate = "")
397  {
399 
400  $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", $this->getBlogPosting()->getId());
401 
402  parent::getTabs($a_activate);
403  }
404 
409  {
410  $tpl = $this->tpl;
412  $lng = $this->lng;
413 
414  if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
415  $confirmation_gui = new ilConfirmationGUI();
416  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
417  $confirmation_gui->setHeaderText($lng->txt("blog_posting_deletion_confirmation"));
418  $confirmation_gui->setCancel($lng->txt("cancel"), "cancelBlogPostingDeletion");
419  $confirmation_gui->setConfirm($lng->txt("delete"), "confirmBlogPostingDeletion");
420 
421  $dtpl = new ilTemplate(
422  "tpl.blog_posting_deletion_confirmation.html",
423  true,
424  true,
425  "Modules/Blog"
426  );
427 
428  $dtpl->setVariable("PAGE_TITLE", $this->getBlogPosting()->getTitle());
429 
430  // notes/comments
431  $cnt_note_users = ilNote::getUserCount(
432  $this->getBlogPosting()->getParentId(),
433  $this->getBlogPosting()->getId(),
434  "wpg"
435  );
436  $dtpl->setVariable(
437  "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
438  $lng->txt("blog_number_users_notes_or_comments")
439  );
440  $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users);
441 
442  $confirmation_gui->addItem("", "", $dtpl->get());
443 
444  $tpl->setContent($confirmation_gui->getHTML());
445  }
446  }
447 
451  public function cancelBlogPostingDeletion()
452  {
454 
455  $ilCtrl->redirect($this, "preview");
456  }
457 
461  public function confirmBlogPostingDeletion()
462  {
464  $lng = $this->lng;
465 
466  if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
467  // delete all md keywords
468  $md_section = $this->getBlogPosting()->getMDSection();
469  foreach ($md_section->getKeywordIds() as $id) {
470  $md_key = $md_section->getKeyword($id);
471  $md_key->delete();
472  }
473 
474  $this->getBlogPosting()->delete();
475  ilUtil::sendSuccess($lng->txt("blog_posting_deleted"), true);
476  }
477 
478  $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", ""); // #14363
479  $ilCtrl->redirectByClass("ilobjbloggui", "render");
480  }
481 
482  public function editTitle($a_form = null)
483  {
484  $tpl = $this->tpl;
485  $ilTabs = $this->tabs;
486 
487  $ilTabs->clearTargets();
488  $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("ilobjblogGUI"));
489 
490  $ilTabs->activateTab("edit");
491 
492  if (!$a_form) {
493  $a_form = $this->initTitleForm();
494  }
495 
496  $tpl->setContent($a_form->getHTML());
497  }
498 
499  public function updateTitle()
500  {
502  $lng = $this->lng;
503 
504  $form = $this->initTitleForm();
505  if ($form->checkInput()) {
506  if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
507  $page = $this->getPageObject();
508  $page->setTitle($form->getInput("title"));
509  $page->update();
510 
511  $page->handleNews(true);
512 
513  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
514  //$ilCtrl->redirect($this, "preview");
515  $this->ctrl->redirectByClass("ilObjBlogGUI", "");
516  }
517  }
518 
519  $form->setValuesByPost();
520  $this->editTitle($form);
521  }
522 
523  public function initTitleForm()
524  {
525  $lng = $this->lng;
527 
528  $form = new ilPropertyFormGUI();
529  $form->setFormAction($ilCtrl->getFormAction($this));
530  $form->setTitle($lng->txt('blog_rename_posting'));
531 
532  $title = new ilTextInputGUI($lng->txt("title"), "title");
533  $title->setRequired(true);
534  $form->addItem($title);
535 
536  $title->setValue($this->getPageObject()->getTitle());
537 
538  $form->addCommandButton('updateTitle', $lng->txt('save'));
539  $form->addCommandButton('cancelEdit', $lng->txt('cancel'));
540 
541  return $form;
542  }
543 
544  public function editDate($a_form = null)
545  {
546  $tpl = $this->tpl;
547  $ilTabs = $this->tabs;
548 
549  $ilTabs->clearTargets();
550  $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("ilobjblogGUI"));
551 
552  $ilTabs->activateTab("edit");
553 
554  if (!$a_form) {
555  $a_form = $this->initDateForm();
556  }
557 
558  $tpl->setContent($a_form->getHTML());
559  }
560 
561  public function updateDate()
562  {
564  $lng = $this->lng;
565 
566  $form = $this->initDateForm();
567  if ($form->checkInput()) {
568  if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
569  $dt = $form->getItemByPostVar("date");
570  $dt = $dt->getDate();
571 
572  $page = $this->getPageObject();
573  $page->setCreated($dt);
574  $page->update();
575 
576  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
577  //$ilCtrl->redirect($this, "preview");
578  $this->ctrl->redirectByClass("ilObjBlogGUI", "");
579  }
580  }
581 
582  $form->setValuesByPost();
583  $this->editTitle($form);
584  }
585 
586  public function initDateForm()
587  {
588  $lng = $this->lng;
590 
591  $form = new ilPropertyFormGUI();
592  $form->setFormAction($ilCtrl->getFormAction($this));
593  $form->setTitle($lng->txt('blog_edit_date'));
594 
595  $date = new ilDateTimeInputGUI($lng->txt("date"), "date");
596  $date->setRequired(true);
597  $date->setShowTime(true);
598  $date->setInfo($lng->txt('blog_edit_date_info'));
599  $form->addItem($date);
600 
601  $date->setDate($this->getPageObject()->getCreated());
602 
603  $form->addCommandButton('updateDate', $lng->txt('save'));
604  $form->addCommandButton('cancelEdit', $lng->txt('cancel'));
605 
606  return $form;
607  }
608 
615  protected function cancelEdit()
616  {
617  $this->ctrl->redirectByClass("ilObjBlogGUI", "");
618  }
619 
620 
621  public function observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_action, $a_note_id)
622  {
623  // #10040 - get note text
624  $note = new ilNote($a_note_id);
625  $note = $note->getText();
626  ilObjBlog::sendNotification("comment", $this->isInWorkspace(), $this->node_id, $a_posting_id, $note);
627  }
628 
629  protected function getActivationCaptions()
630  {
631  $lng = $this->lng;
632 
633  return array("deactivatePage" => $lng->txt("blog_toggle_draft"),
634  "activatePage" => $lng->txt("blog_toggle_final"));
635  }
636 
637  public function deactivatePageToList()
638  {
639  $this->deactivatePage(true);
640  }
641 
642  public function deactivatePage($a_to_list = false)
643  {
644  if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
645  $this->getBlogPosting()->unpublish();
646  }
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 activatePageToList()
657  {
658  $this->activatePage(true);
659  }
660 
661  public function activatePage($a_to_list = false)
662  {
663  // send notifications
664  ilObjBlog::sendNotification("new", $this->isInWorkspace(), $this->node_id, $this->getBlogPosting()->getId());
665 
666  if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
667  $this->getBlogPosting()->setActive(true);
668  $this->getBlogPosting()->update(true, false, false);
669  }
670  if (!$a_to_list) {
671  $this->ctrl->redirect($this, "edit");
672  } else {
673  $this->ctrl->setParameterByClass("ilobjbloggui", "blpg", "");
674  $this->ctrl->redirectByClass("ilobjbloggui", "");
675  }
676  }
677 
682  public function editKeywords(ilPropertyFormGUI $a_form = null)
683  {
684  global $DIC;
685 
686  $renderer = $DIC->ui()->renderer();
687 
688  $ilTabs = $this->tabs;
689  $tpl = $this->tpl;
690 
691  $ilTabs->clearTargets();
692  $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("ilobjblogGUI"));
693 
694  if (!$this->checkAccess("contribute")) {
695  return;
696  }
697 
698  $ilTabs->activateTab("pg");
699 
700  if (!$a_form) {
701  $a_form = $this->initKeywordsForm();
702  }
703 
704  $tpl->setContent($renderer->render($a_form));
705  }
706 
707  protected function initKeywordsForm()
708  {
709  global $DIC;
710 
711  $ui_factory = $DIC->ui()->factory();
712  //$ilUser = $this->user;
713 
714  $md_section = $this->getBlogPosting()->getMDSection();
715 
716  $keywords = array();
717  foreach ($ids = $md_section->getKeywordIds() as $id) {
718  $md_key = $md_section->getKeyword($id);
719  if (trim($md_key->getKeyword()) != "") {
720  //$keywords[$md_key->getKeywordLanguageCode()][]
721  // = $md_key->getKeyword();
722  $keywords[] = $md_key->getKeyword();
723  }
724  }
725 
726  // language is not "used" anywhere
727  /*$ulang = $ilUser->getLanguage();
728  if($keywords[$ulang])
729  {
730  asort($keywords[$ulang]);
731  }*/
732 
733  // other keywords in blog
734  $other = array();
735  foreach (array_keys(ilBlogPosting::getAllPostings($this->getBlogPosting()->getBlogId())) as $posting_id) {
736  if ($posting_id != $this->getBlogPosting()->getId()) {
737  $other = array_merge($other, ilBlogPosting::getKeywords($this->getBlogPosting()->getBlogId(), $posting_id));
738  }
739  }
740  // #17414
741  $other = array_unique($other);
742  sort($other, SORT_LOCALE_STRING);
743  if (is_array($keywords[$ulang])) {
744  $other = array_diff($other, $keywords[$ulang]);
745  }
746 
747  $input_tag = $ui_factory->input()->field()->tag($this->lng->txt("blog_keywords"), $other, $this->lng->txt("blog_keyword_enter"));
748  if (count($keywords) > 0) {
749  $input_tag = $input_tag->withValue($keywords);
750  }
751 
752  $DIC->ctrl()->setParameter(
753  $this,
754  'tags',
755  'tags_processing'
756  );
757 
758  $section = $ui_factory->input()->field()->section([$input_tag], $this->lng->txt("blog_edit_keywords"), "");
759 
760  $form_action = $DIC->ctrl()->getFormAction($this, "saveKeywordsForm");
761  $form = $ui_factory->input()->container()->form()->standard($form_action, ["tags" => $section]);
762 
763  return $form;
764  }
765 
766  protected function getParentObjId()
767  {
768  if ($this->node_id) {
769  if ($this->isInWorkspace()) {
770  return $this->access_handler->getTree()->lookupObjectId($this->node_id);
771  } else {
772  return ilObject::_lookupObjId($this->node_id);
773  }
774  }
775  }
776 
777  public function saveKeywordsForm()
778  {
779  global $DIC;
780 
781  $request = $DIC->http()->request();
782  $form = $this->initKeywordsForm();
783 
784  if ($request->getMethod() == "POST"
785  && $request->getQueryParams()['tags'] == 'tags_processing') {
786  $form = $form->withRequest($request);
787  $result = $form->getData();
788  //TODO identify the input instead of use 0
789  $keywords = $result["tags"][0];
790 
791  if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
792  if (is_array($keywords)) {
793  $this->getBlogPosting()->updateKeywords($keywords);
794  } else {
795  $this->getBlogPosting()->updateKeywords([]);
796  }
797  }
798 
799  $this->ctrl->redirectByClass("ilObjBlogGUI", "");
800  }
801  }
802 
815  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)
816  {
817  $bpgui = new self(0, null, $a_id);
818 
819  // scan the full page for media objects
820  if ($a_include_picture) {
821  $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
822  }
823 
824  $bpgui->setRawPageContent(true);
825  $bpgui->setAbstractOnly(true);
826 
827  // #8627: export won't work - should we set offline mode?
828  $bpgui->setFileDownloadLink(".");
829  $bpgui->setFullscreenLink(".");
830  $bpgui->setSourcecodeDownloadScript(".");
831  $bpgui->setProfileBackUrl(".");
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  foreach ($mob_ids as $mob_id) {
853  $mob_obj = new ilObjMediaObject($mob_id);
854  $mob_item = $mob_obj->getMediaItem("Standard");
855  if (stristr($mob_item->getFormat(), "image")) {
856  $mob_size = $mob_item->getOriginalSize();
857  if ($mob_size["width"] >= $a_width ||
858  $mob_size["height"] >= $a_height) {
859  if (!$a_export_directory) {
860  $mob_dir = ilObjMediaObject::_getDirectory($mob_obj->getId());
861  } else {
862  // see ilCOPageHTMLExport::exportHTMLMOB()
863  $mob_dir = "./mobs/mm_" . $mob_obj->getId();
864  }
865  $mob_res = self::parseImage(
866  $mob_size["width"],
867  $mob_size["height"],
868  $a_width,
869  $a_height
870  );
871 
872 
873  $location = $mob_item->getLocationType() == "Reference"
874  ? $mob_item->getLocation()
875  : $mob_dir . "/" . $mob_item->getLocation();
876 
877  return '<img' .
878  ' src="' . $location . '"' .
879  ' width="' . $mob_res[0] . '"' .
880  ' height="' . $mob_res[1] . '"' .
881  ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' .
882  ' />';
883  }
884  }
885  }
886  }
887  }
888 
889  protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
890  {
891  $ratio_width = $ratio_height = 1;
892  if ($src_width > $tgt_width) {
893  $ratio_width = $tgt_width / $src_width;
894  }
895  if ($src_height > $tgt_height) {
896  $ratio_height = $tgt_height / $src_height;
897  }
898  $shrink_ratio = min($ratio_width, $ratio_height);
899 
900  return array(
901  (int) round($src_width * $shrink_ratio),
902  (int) round($src_height * $shrink_ratio)
903  );
904  }
905 
912  public function getDisabledText()
913  {
914  return $this->lng->txt("blog_draft_text");
915  }
916 }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
previewEmbedded()
Needed for portfolio/blog handling.
settings()
Definition: settings.php:2
getPageObject()
Get Page Object.
Class ilBlogPosting.
$result
setTemplateOutput($a_output=true)
This class represents a property form user interface.
observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_action, $a_note_id)
getTabs($a_activate="")
Get tabs.
$_GET["client_id"]
$location
Definition: buildRTE.php:44
Class ilBlogPosting GUI class.
getDisabledText()
Get disabled text.
Class ilPageObjectGUI.
static getPageContributors($a_parent_type, $a_page_id, $a_lang="-")
Get all contributors for parent object.
__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.
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
setEnableEditing($a_enableediting)
Set Enable Editing.
static getKeywords($a_obj_id, $a_posting_id)
postOutputProcessing($a_output)
Finalizing output processing.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
user()
Definition: user.php:4
static _getDirectory($a_mob_id)
Get absolute directory.
Note class.
static useRelativeDates()
check if relative dates are used
This class represents a date/time property in a property form.
global $ilCtrl
Definition: ilias.php:18
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
$section
Definition: Utf8Test.php:83
$a_type
Definition: workflow.php:92
getFirstMediaObjectAsTag($a_width=144, $a_height=144, $a_export_directory=null)
previewFullscreen()
Needed for portfolio/blog handling.
static getUserCount($a_rep_obj_id, $a_obj_id, $a_type)
How many users have attached a note/comment to a given object?
setBlogPosting(ilBlogPosting $a_posting)
Set blog posting.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
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.
getEnableEditing()
Get Enable Editing.
getBlogPosting()
Get blog posting.
static _lookupObjId($a_id)
setPageObject(ilPageObject $a_pg_obj)
Set Page Object.
setPresentationTitle($a_title="")
showPage($a_title="")
Embedded posting in portfolio.
Class ilObjMediaObject.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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 getSyntaxStylePath()
get syntax style path
getAbstractOnly()
Get abstract only.
preview($a_mode=null)
Preview blog posting.
cancelEdit()
Cancel editing.
confirmBlogPostingDeletion()
Delete the blog posting.
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
setStyleId($a_styleid)
Set Style Id.
static parseImage($src_width, $src_height, $tgt_width, $tgt_height)
deactivatePage($a_to_list=false)
global $ilSetting
Definition: privfeed.php:17
__construct(Container $dic, ilPlugin $plugin)
isInWorkspace()
Is current page part of personal workspace blog?
$DIC
Definition: xapitoken.php:46
editKeywords(ilPropertyFormGUI $a_form=null)
Diplay the form.
checkAccess($a_cmd)
Centralized access management.
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
executeCommand()
execute command
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.
activatePage($a_to_list=false)
setRequired($a_required)
Set Required.
deleteBlogPostingConfirmationScreen()
Delete blog posting confirmation screen.
cancelBlogPostingDeletion()
Cancel blog posting deletion.
Confirmation screen class.