ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
5 include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
6 
19 {
20  protected $node_id; // [int]
21  protected $access_handler; // [object]
22  protected $enable_public_notes; // [bool]
23  protected $may_contribute; // [bool]
24 
36  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)
37  {
38  global $tpl, $lng;
39 
40  $lng->loadLanguageModule("blog");
41 
42  $this->node_id = $a_node_id;
43  $this->access_handler = $a_access_handler;
44  $this->enable_public_notes = (bool)$a_enable_public_notes;
45 
46  parent::__construct("blp", $a_id, $a_old_nr);
47 
48  // needed for notification
49  $this->getBlogPosting()->setBlogNodeId($this->node_id, $this->isInWorkspace());
50 
51  // #11151
52  $this->may_contribute = (bool)$a_may_contribute;
53  $this->setEnableEditing($a_may_contribute);
54 
55  // content style
56  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
57 
58  $tpl->setCurrentBlock("SyntaxStyle");
59  $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
61  $tpl->parseCurrentBlock();
62 
63  // #17814
64  $tpl->setCurrentBlock("ContentStyle");
65  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
66  ilObjStyleSheet::getContentStylePath($a_style_sheet_id));
67  $tpl->parseCurrentBlock();
68 
69  // needed for editor
70  $this->setStyleId($a_style_sheet_id);
71  }
72 
76  function executeCommand()
77  {
78  global $ilCtrl, $ilTabs, $ilLocator, $tpl;
79 
80  $next_class = $ilCtrl->getNextClass($this);
81  $cmd = $ilCtrl->getCmd();
82 
83  $posting = $this->getBlogPosting();
84  $ilCtrl->setParameter($this, "blpg", $posting->getId());
85 
86  switch($next_class)
87  {
88  case "ilnotegui":
89  // $this->getTabs();
90  // $ilTabs->setTabActive("pg");
91  return $this->previewFullscreen();
92 
93  /*
94  case "ilratinggui":
95  include_once("./Services/Rating/classes/class.ilRatingGUI.php");
96  $rating_gui = new ilRatingGUI();
97  $rating_gui->setObject($this->getBlogPosting()->getParentId(), "blog",
98  $this->getBlogPosting()->getId(), "blp");
99  $this->ctrl->forwardCommand($rating_gui);
100  $ilCtrl->redirect($this, "preview");
101  break;
102  */
103 
104  case "ilpageobjectgui":
105  die("Deprecated. Blog Posting gui forwarding to ilpageobject");
106  return;
107 
108  default:
109  if($posting)
110  {
111  $this->setPresentationTitle($posting->getTitle());
112 
113  $tpl->setTitle(ilObject::_lookupTitle($this->getBlogPosting()->getBlogId()).": ". // #15017
114  $posting->getTitle());
115  $tpl->setTitleIcon(ilUtil::getImagePath("icon_blog.svg"),
116  $this->lng->txt("obj_blog")); // #12879
117 
118  $ilLocator->addItem($posting->getTitle(),
119  $ilCtrl->getLinkTarget($this, "preview"));
120  }
121  return parent::executeCommand();
122  }
123  }
124 
130  function setBlogPosting(ilBlogPosting $a_posting)
131  {
132  $this->setPageObject($a_posting);
133  }
134 
140  function getBlogPosting()
141  {
142  return $this->getPageObject();
143  }
144 
151  protected function checkAccess($a_cmd)
152  {
153  if($a_cmd == "contribute")
154  {
155  return $this->may_contribute;
156  }
157  return $this->access_handler->checkAccess($a_cmd, "", $this->node_id);
158  }
159 
163  function preview($a_mode = null)
164  {
165  global $ilCtrl, $tpl, $ilSetting;
166 
167  $this->getBlogPosting()->increaseViewCnt();
168 
169  $wtpl = new ilTemplate("tpl.blog_page_view_main_column.html",
170  true, true, "Modules/Blog");
171 
172  // page commands
173  if(!$a_mode)
174  {
175  if (!$this->getEnableEditing())
176  {
177  $this->ctrl->redirect($this, "previewFullscreen");
178  }
179  /*
180  // delete
181  $page_commands = false;
182  if ($this->checkAccess("write"))
183  {
184  $wtpl->setCurrentBlock("page_command");
185  $wtpl->setVariable("HREF_PAGE_CMD",
186  $ilCtrl->getLinkTarget($this, "deleteBlogPostingConfirmationScreen"));
187  $wtpl->setVariable("TXT_PAGE_CMD", $lng->txt("delete"));
188  $wtpl->parseCurrentBlock();
189  }
190  if ($page_commands)
191  {
192  $wtpl->setCurrentBlock("page_commands");
193  $wtpl->parseCurrentBlock();
194  }
195  */
196  }
197  else
198  {
199  $callback = array($this, "observeNoteAction");
200 
201  // notes
202 
203  $may_delete_comments = ($this->checkAccess("contribute") &&
204  $ilSetting->get("comments_del_tutor", 1));
205 
206  $wtpl->setVariable("NOTES", $this->getNotesHTML($this->getBlogPosting(),
207  false, $this->enable_public_notes, $may_delete_comments, $callback));
208  }
209 
210  // permanent link
211  if($a_mode != "embedded")
212  {
213  $append = ($_GET["blpg"] != "")
214  ? "_".$_GET["blpg"]
215  : "";
216  if($this->isInWorkspace())
217  {
218  $append .= "_wsp";
219  }
220  $tpl->setPermanentLink("blog", $this->node_id, $append);
221  }
222 
223  $wtpl->setVariable("PAGE", parent::preview());
224 
225  $tpl->setLoginTargetPar("blog_".$this->node_id.$append);
226 
227  $ilCtrl->setParameter($this, "blpg", $this->getBlogPosting()->getId());
228 
229  return $wtpl->get();
230  }
231 
237  function previewEmbedded()
238  {
239  return $this->preview("embedded");
240  }
241 
247  function previewFullscreen()
248  {
249  $this->add_date = true;
250  return $this->preview("fullscreen");
251  }
252 
258  function showPage()
259  {
260  $this->setTemplateOutput(false);
261 
262  if (!$this->getAbstractOnly())
263  {
264  $this->setPresentationTitle($this->getBlogPosting()->getTitle());
265  }
266  $this->getBlogPosting()->increaseViewCnt();
267 
268  return parent::showPage();
269  }
270 
276  protected function isInWorkspace()
277  {
278  return stristr(get_class($this->access_handler), "workspace");
279  }
280 
287  function postOutputProcessing($a_output)
288  {
289  // #8626/#9370
290  if(($this->getOutputMode() == "preview" || $this->getOutputMode() == "offline")
291  && !$this->getAbstractOnly() && $this->add_date)
292  {
293  $author = "";
294  if(!$this->isInWorkspace())
295  {
296  $authors = array();
297  $author_id = $this->getBlogPosting()->getAuthor();
298  if($author_id)
299  {
300  include_once "Services/User/classes/class.ilUserUtil.php";
301  $authors[] = ilUserUtil::getNamePresentation($author_id);
302  }
303 
304  foreach(ilBlogPosting::getPageContributors("blp", $this->getBlogPosting()->getId()) as $editor)
305  {
306  if($editor["user_id"] != $author_id)
307  {
308  $authors[] = ilUserUtil::getNamePresentation($editor["user_id"]);
309  }
310  }
311 
312  if($authors)
313  {
314  $author = implode(", ", $authors)." - ";
315  }
316  }
317 
318  // prepend creation date
321  $prefix = "<div class=\"il_BlockInfo\" style=\"text-align:right\">".
322  $author.ilDatePresentation::formatDate($this->getBlogPosting()->getCreated()).
323  "</div>";
325 
326  $a_output = $prefix.$a_output;
327  }
328 
329  return $a_output;
330  }
331 
337  function getTabs($a_activate = "")
338  {
339  global $ilCtrl;
340 
341  $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", $this->getBlogPosting()->getId());
342 
343  parent::getTabs($a_activate);
344  }
345 
350  {
351  global $tpl, $ilCtrl, $lng;
352 
353  if ($this->checkAccess("write") || $this->checkAccess("contribute"))
354  {
355  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
356  $confirmation_gui = new ilConfirmationGUI();
357  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
358  $confirmation_gui->setHeaderText($lng->txt("blog_posting_deletion_confirmation"));
359  $confirmation_gui->setCancel($lng->txt("cancel"), "cancelBlogPostingDeletion");
360  $confirmation_gui->setConfirm($lng->txt("delete"), "confirmBlogPostingDeletion");
361 
362  $dtpl = new ilTemplate("tpl.blog_posting_deletion_confirmation.html", true,
363  true, "Modules/Blog");
364 
365  $dtpl->setVariable("PAGE_TITLE", $this->getBlogPosting()->getTitle());
366 
367  // notes/comments
368  include_once("./Services/Notes/classes/class.ilNote.php");
369  $cnt_note_users = ilNote::getUserCount($this->getBlogPosting()->getParentId(),
370  $this->getBlogPosting()->getId(), "wpg");
371  $dtpl->setVariable("TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
372  $lng->txt("blog_number_users_notes_or_comments"));
373  $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users);
374 
375  $confirmation_gui->addItem("", "", $dtpl->get());
376 
377  $tpl->setContent($confirmation_gui->getHTML());
378  }
379  }
380 
385  {
386  global $ilCtrl;
387 
388  $ilCtrl->redirect($this, "preview");
389  }
390 
395  {
396  global $ilCtrl, $lng;
397 
398  if ($this->checkAccess("write") || $this->checkAccess("contribute"))
399  {
400  // delete all md keywords
401  $md_section = $this->getBlogPosting()->getMDSection();
402  foreach($md_section->getKeywordIds() as $id)
403  {
404  $md_key = $md_section->getKeyword($id);
405  $md_key->delete();
406  }
407 
408  $this->getBlogPosting()->delete();
409  ilUtil::sendSuccess($lng->txt("blog_posting_deleted"), true);
410  }
411 
412  $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", ""); // #14363
413  $ilCtrl->redirectByClass("ilobjbloggui", "render");
414  }
415 
416  function editTitle($a_form = null)
417  {
418  global $tpl, $ilTabs;
419 
420  $ilTabs->activateTab("edit");
421 
422  if(!$a_form)
423  {
424  $a_form = $this->initTitleForm();
425  }
426 
427  $tpl->setContent($a_form->getHTML());
428  }
429 
430  function updateTitle()
431  {
432  global $ilCtrl, $lng;
433 
434  $form = $this->initTitleForm();
435  if($form->checkInput())
436  {
437  if ($this->checkAccess("write") || $this->checkAccess("contribute"))
438  {
439  $page = $this->getPageObject();
440  $page->setTitle($form->getInput("title"));
441  $page->update();
442 
443  $page->handleNews(true);
444 
445  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
446  $ilCtrl->redirect($this, "preview");
447  }
448  }
449 
450  $form->setValuesByPost();
451  $this->editTitle($form);
452  }
453 
454  function initTitleForm()
455  {
456  global $lng, $ilCtrl;
457 
458  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
459  $form = new ilPropertyFormGUI();
460  $form->setFormAction($ilCtrl->getFormAction($this));
461  $form->setTitle($lng->txt('blog_rename_posting'));
462 
463  $title = new ilTextInputGUI($lng->txt("title"), "title");
464  $title->setRequired(true);
465  $form->addItem($title);
466 
467  $title->setValue($this->getPageObject()->getTitle());
468 
469  $form->addCommandButton('updateTitle', $lng->txt('save'));
470  $form->addCommandButton('preview', $lng->txt('cancel'));
471 
472  return $form;
473  }
474 
475  function editDate($a_form = null)
476  {
477  global $tpl, $ilTabs;
478 
479  $ilTabs->activateTab("edit");
480 
481  if(!$a_form)
482  {
483  $a_form = $this->initDateForm();
484  }
485 
486  $tpl->setContent($a_form->getHTML());
487  }
488 
489  function updateDate()
490  {
491  global $ilCtrl, $lng;
492 
493  $form = $this->initDateForm();
494  if($form->checkInput())
495  {
496  if ($this->checkAccess("write") || $this->checkAccess("contribute"))
497  {
498  $dt = $form->getItemByPostVar("date");
499  $dt = $dt->getDate();
500 
501  $page = $this->getPageObject();
502  $page->setCreated($dt);
503  $page->update();
504 
505  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
506  $ilCtrl->redirect($this, "preview");
507  }
508  }
509 
510  $form->setValuesByPost();
511  $this->editTitle($form);
512  }
513 
514  function initDateForm()
515  {
516  global $lng, $ilCtrl;
517 
518  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
519  $form = new ilPropertyFormGUI();
520  $form->setFormAction($ilCtrl->getFormAction($this));
521  $form->setTitle($lng->txt('blog_edit_date'));
522 
523  $date = new ilDateTimeInputGUI($lng->txt("date"), "date");
524  $date->setRequired(true);
525  $date->setShowTime(true);
526  $date->setInfo($lng->txt('blog_edit_date_info'));
527  $form->addItem($date);
528 
529  $date->setDate($this->getPageObject()->getCreated());
530 
531  $form->addCommandButton('updateDate', $lng->txt('save'));
532  $form->addCommandButton('preview', $lng->txt('cancel'));
533 
534  return $form;
535  }
536 
537  function observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_action, $a_note_id)
538  {
539  // #10040 - get note text
540  include_once "Services/Notes/classes/class.ilNote.php";
541  $note = new ilNote($a_note_id);
542  $note = $note->getText();
543 
544  include_once "Modules/Blog/classes/class.ilObjBlog.php";
545  ilObjBlog::sendNotification("comment", $this->isInWorkspace(), $this->node_id, $a_posting_id, $note);
546  }
547 
548  protected function getActivationCaptions()
549  {
550  global $lng;
551 
552  return array("deactivatePage" => $lng->txt("blog_toggle_draft"),
553  "activatePage" => $lng->txt("blog_toggle_final"));
554  }
555 
557  {
558  $this->deactivatePage(true);
559  }
560 
561  function deactivatePage($a_to_list = false)
562  {
563  if ($this->checkAccess("write") || $this->checkAccess("contribute"))
564  {
565  $this->getBlogPosting()->unpublish();
566  }
567 
568  if(!$a_to_list)
569  {
570  $this->ctrl->redirect($this, "edit");
571  }
572  else
573  {
574  $this->ctrl->setParameterByClass("ilobjbloggui", "blpg", "");
575  $this->ctrl->redirectByClass("ilobjbloggui", "");
576  }
577  }
578 
580  {
581  $this->activatePage(true);
582  }
583 
584  function activatePage($a_to_list = false)
585  {
586  // send notifications
587  include_once "Modules/Blog/classes/class.ilObjBlog.php";
588  ilObjBlog::sendNotification("new", $this->isInWorkspace(), $this->node_id, $this->getBlogPosting()->getId());
589 
590  if ($this->checkAccess("write") || $this->checkAccess("contribute"))
591  {
592  $this->getBlogPosting()->setActive(true);
593  $this->getBlogPosting()->update(true, false, false);
594  }
595  if(!$a_to_list)
596  {
597  $this->ctrl->redirect($this, "edit");
598  }
599  else
600  {
601  $this->ctrl->setParameterByClass("ilobjbloggui", "blpg", "");
602  $this->ctrl->redirectByClass("ilobjbloggui", "");
603  }
604  }
605 
606  function editKeywords(ilPropertyFormGUI $a_form = null)
607  {
608  global $ilTabs, $tpl;
609 
610  if (!$this->checkAccess("contribute"))
611  {
612  return;
613  }
614 
615  $ilTabs->activateTab("pg");
616 
617  if(!$a_form)
618  {
619  $a_form = $this->initKeywordsForm();
620  }
621 
622  $tpl->setContent($a_form->getHTML());
623  }
624 
625  protected function initKeywordsForm()
626  {
627  global $ilUser;
628 
629  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
630  $form = new ilPropertyFormGUI();
631  $form->setFormAction($this->ctrl->getFormAction($this, "saveKeywordsForm"));
632  $form->setTitle($this->lng->txt("blog_edit_keywords"));
633 
634  $txt = new ilTextInputGUI($this->lng->txt("blog_keywords"), "keywords");
635  // $txt->setRequired(true); #10504
636  $txt->setMulti(true);
637  $txt->setDataSource($this->ctrl->getLinkTarget($this, "keywordAutocomplete", "", true));
638  $txt->setMaxLength(200);
639  $txt->setSize(50);
640  $txt->setInfo($this->lng->txt("blog_keywords_info"));
641  $form->addItem($txt);
642 
643  $md_section = $this->getBlogPosting()->getMDSection();
644 
645  $keywords = array();
646  foreach($ids = $md_section->getKeywordIds() as $id)
647  {
648  $md_key = $md_section->getKeyword($id);
649  if (trim($md_key->getKeyword()) != "")
650  {
651  $keywords[$md_key->getKeywordLanguageCode()][]
652  = $md_key->getKeyword();
653  }
654  }
655 
656  // language is not "used" anywhere
657  $ulang = $ilUser->getLanguage();
658  if($keywords[$ulang])
659  {
660  asort($keywords[$ulang]);
661  $txt->setValue($keywords[$ulang]);
662  }
663 
664  // other keywords in blog
665  $other = array();
666  foreach(array_keys(ilBlogPosting::getAllPostings($this->getBlogPosting()->getBlogId())) as $posting_id)
667  {
668  if($posting_id != $this->getBlogPosting()->getId())
669  {
670  $other = array_merge($other, ilBlogPosting::getKeywords($this->getBlogPosting()->getBlogId(), $posting_id));
671  }
672  }
673  // #17414
674  $other = array_unique($other);
675  sort($other, SORT_LOCALE_STRING);
676  if(is_array($keywords[$ulang]))
677  {
678  $other = array_diff($other, $keywords[$ulang]);
679  }
680  if(sizeof($other))
681  {
682  $html = "";
683  foreach($other as $item)
684  {
685  $html .= '<span class="ilTag">'.$item.'</span>';
686  }
687  $info = new ilNonEditableValueGUI($this->lng->txt("blog_keywords_other"), "", true);
688  $info->setInfo($this->lng->txt("blog_keywords_other_info"));
689  $info->setValue($html);
690  $form->addItem($info);
691  }
692 
693  $form->addCommandButton("saveKeywordsForm", $this->lng->txt("save"));
694  $form->addCommandButton("preview", $this->lng->txt("cancel"));
695 
696  return $form;
697  }
698 
699  protected function getParentObjId()
700  {
701  if($this->node_id)
702  {
703  if($this->isInWorkspace())
704  {
705  return $this->access_handler->getTree()->lookupObjectId($this->node_id);
706  }
707  else
708  {
709  return ilObject::_lookupObjId($this->node_id);
710  }
711  }
712  }
713 
714  function saveKeywordsForm()
715  {
716  $form = $this->initKeywordsForm();
717  if($form->checkInput())
718  {
719  if ($this->checkAccess("write") || $this->checkAccess("contribute"))
720  {
721  $keywords = $form->getInput("keywords");
722  if (is_array($keywords))
723  {
724  $this->getBlogPosting()->updateKeywords($keywords);
725  }
726  }
727 
728  $this->ctrl->redirect($this, "preview");
729  }
730 
731  $form->setValuesByPost();
732  $this->editKeywords($form);
733  }
734 
736  {
737  $force_all = (bool)$_GET["fetchall"];
738 
739  include_once("./Services/MetaData/classes/class.ilMDKeyword.php");
741  "blp", $this->getParentObjId());
742 
743  include_once("./Services/Search/classes/class.ilSearchSettings.php");
744  $cut = (int)ilSearchSettings::getInstance()->getAutoCompleteLength();
745 
746  $has_more = false;
747  $result = array();
748  foreach ($res as $r)
749  {
750  if(!$force_all &&
751  sizeof($result["items"]) >= $cut)
752  {
753  $has_more = true;
754  break;
755  }
756  $entry = new stdClass();
757  $entry->value = $r;
758  $entry->label = $r;
759  $result["items"][] = $entry;
760  }
761 
762  $result["hasMoreResults"] = $has_more;
763 
764  include_once './Services/JSON/classes/class.ilJsonUtil.php';
766  exit;
767  }
768 
781  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)
782  {
783  $bpgui = new self(0, null, $a_id);
784 
785  // scan the full page for media objects
786  if($a_include_picture)
787  {
788  $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
789  }
790 
791  $bpgui->setRawPageContent(true);
792  $bpgui->setAbstractOnly(true);
793 
794  // #8627: export won't work - should we set offline mode?
795  $bpgui->setFileDownloadLink(".");
796  $bpgui->setFullscreenLink(".");
797  $bpgui->setSourcecodeDownloadScript(".");
798 
799  // render without title
800  $page = $bpgui->showPage();
801 
802  if($a_truncate)
803  {
804  $page = ilPageObject::truncateHTML($page, $a_truncate_length, $a_truncate_sign);
805  }
806 
807  if($img)
808  {
809  $page = '<div>'.$img.$page.'</div><div style="clear:both;"></div>';
810  }
811 
812  return $page;
813  }
814 
815  protected function getFirstMediaObjectAsTag($a_width = 144, $a_height = 144, $a_export_directory = null)
816  {
817  $this->obj->buildDom();
818  $mob_ids = $this->obj->collectMediaObjects();
819  if($mob_ids)
820  {
821  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
822  foreach($mob_ids as $mob_id)
823  {
824  $mob_obj = new ilObjMediaObject($mob_id);
825  $mob_item = $mob_obj->getMediaItem("Standard");
826  if(stristr($mob_item->getFormat(), "image"))
827  {
828  $mob_size = $mob_item->getOriginalSize();
829  if($mob_size["width"] >= $a_width ||
830  $mob_size["height"] >= $a_height)
831  {
832  if(!$a_export_directory)
833  {
834  $mob_dir = ilObjMediaObject::_getDirectory($mob_obj->getId());
835  }
836  else
837  {
838  // see ilCOPageHTMLExport::exportHTMLMOB()
839  $mob_dir = "./mobs/mm_".$mob_obj->getId();
840  }
841  $mob_res = self::parseImage($mob_size["width"],
842  $mob_size["height"], $a_width, $a_height);
843 
844 
845  $location = $mob_item->getLocationType() == "Reference"
846  ? $mob_item->getLocation()
847  : $mob_dir."/".$mob_item->getLocation();
848 
849  return '<img'.
850  ' src="'.$location.'"'.
851  ' width="'.$mob_res[0].'"'.
852  ' height="'.$mob_res[1].'"'.
853  ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"'.
854  ' />';
855  }
856  }
857  }
858  }
859  }
860 
861  protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
862  {
863  $ratio_width = $ratio_height = 1;
864  if($src_width > $tgt_width)
865  {
866  $ratio_width = $tgt_width / $src_width;
867  }
868  if($src_height > $tgt_height)
869  {
870  $ratio_height = $tgt_height / $src_height;
871  }
872  $shrink_ratio = min($ratio_width, $ratio_height);
873 
874  return array(
875  (int)round($src_width*$shrink_ratio),
876  (int)round($src_height*$shrink_ratio)
877  );
878  }
879 }
880 
881 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
previewEmbedded()
Needed for portfolio/blog handling.
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.
Class ilPageObjectGUI.
$cmd
Definition: sahs_server.php:35
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.
setPageObject($a_pg_obj)
Set Page Object.
static _getDirectory($a_mob_id)
get directory for files of media object (static)
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.
$a_type
Definition: workflow.php:93
getFirstMediaObjectAsTag($a_width=144, $a_height=144, $a_export_directory=null)
$info
Definition: example_052.php:80
previewFullscreen()
Needed for portfolio/blog handling.
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)
Default behaviour is:
$r
Definition: example_031.php:79
static encode($mixed, $suppress_native=false)
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)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setPresentationTitle($a_title="")
$ilUser
Definition: imgupload.php:18
Class ilObjMediaObject.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSyntaxStylePath()
get syntax style path
getAbstractOnly()
Get abstract only.
preview($a_mode=null)
Preview blog posting.
$txt
Definition: error.php:12
Create styles array
The data for the language used.
confirmBlogPostingDeletion()
Delete the blog posting.
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
static getContentStylePath($a_style_id)
get content style path
showPage()
Embedded posting in portfolio.
static _getMatchingKeywords($a_query, $a_type, $a_rbac_id=0)
Search for keywords.
setStyleId($a_styleid)
Set Style Id.
static parseImage($src_width, $src_height, $tgt_width, $tgt_height)
deactivatePage($a_to_list=false)
This class represents a non editable value in a property form.
global $ilSetting
Definition: privfeed.php:17
isInWorkspace()
Is current page part of personal workspace blog?
editKeywords(ilPropertyFormGUI $a_form=null)
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)
$html
Definition: example_001.php:87
setRequired($a_required)
Set Required.
deleteBlogPostingConfirmationScreen()
Delete blog posting confirmation screen.
cancelBlogPostingDeletion()
Cancel blog posting deletion.
Confirmation screen class.