ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjBlogGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once "./Services/Object/classes/class.ilObject2GUI.php";
6 require_once "./Modules/Blog/classes/class.ilBlogPosting.php";
7 require_once "./Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php";
8 
23 {
27  protected $help;
28 
32  protected $tabs;
33 
37  protected $nav_history;
38 
42  protected $main_menu;
43 
47  protected $rbacadmin;
48 
49  protected $month; // [string]
50  protected $items; // [array]
51  protected $keyword; // [string]
52  protected $author; // [int]
53  protected $month_default; // [bool]
54 
59  protected $gtp;
60 
64  protected $blpg;
65 
69  protected $old_nr;
70 
75  protected $ppage;
76 
81  protected $user_page;
82 
86  public $prtf_embed = false;
87 
93  protected $prvm;
94 
98  protected $ntf;
99 
104  protected $apid;
105 
109  protected $new_type;
110 
115  protected $prt_id;
116 
117  protected static $keyword_export_map; // [array]
118 
119  public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
120  {
121  global $DIC;
122 
123  $this->settings = $DIC->settings();
124  $this->help = $DIC["ilHelp"];
125  $this->tabs = $DIC->tabs();
126  $this->nav_history = $DIC["ilNavigationHistory"];
127  $this->user = $DIC->user();
128  $this->toolbar = $DIC->toolbar();
129  $this->tree = $DIC->repositoryTree();
130  $this->locator = $DIC["ilLocator"];
131  $this->main_menu = $DIC["ilMainMenu"];
132  $this->rbacreview = $DIC->rbac()->review();
133  $this->rbacadmin = $DIC->rbac()->admin();
134 
135  $lng = $DIC->language();
136  $ilCtrl = $DIC->ctrl();
137 
138  $this->gtp = (int) $_GET["gtp"];
139  $this->blpg = (int) $_REQUEST["blpg"];
140  $this->old_nr = (int) $_GET["old_nr"];
141  $this->ppage = (int) $_GET["ppage"];
142  $this->user_page = (int) $_REQUEST["user_page"];
143  $this->new_type = ilUtil::stripSlashes($_REQUEST["new_type"]);
144  $this->prvm = ilUtil::stripSlashes($_REQUEST["prvm"]);
145  $this->ntf = (int) $_GET["ntf"];
146  $this->apid = (int) $_GET["apid"];
147  $this->month = ilUtil::stripSlashes($_REQUEST["bmn"]);
148  $this->keyword = ilUtil::stripSlashes($_REQUEST["kwd"]);
149  $this->author = (int) $_REQUEST["ath"];
150  $this->prt_id = (int) $_REQUEST["prt_id"];
151 
152  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
153 
154  if ($_REQUEST["blpg"] > 0 && ilBlogPosting::lookupBlogId($_REQUEST["blpg"]) != $this->object->getId()) {
155  throw new ilException("Posting ID does not match blog.");
156  }
157 
158  if ($this->object) {
159  // gather postings by month
160  $this->items = $this->buildPostingList($this->object->getId());
161  if ($this->items) {
162  // current month (if none given or empty)
163  if (!$this->month || !$this->items[$this->month]) {
164  $this->month = array_keys($this->items);
165  $this->month = array_shift($this->month);
166  $this->month_default = true;
167  }
168  }
169 
170  $ilCtrl->setParameter($this, "bmn", $this->month);
171  }
172 
173  $lng->loadLanguageModule("blog");
174  $ilCtrl->saveParameter($this, "prvm");
175  }
176 
177  public function getType()
178  {
179  return "blog";
180  }
181 
182  protected function initCreationForms($a_new_type)
183  {
184  $forms = parent::initCreationForms($a_new_type);
185 
186  if ($this->id_type == self::WORKSPACE_NODE_ID) {
187  unset($forms[self::CFORM_IMPORT]);
188  unset($forms[self::CFORM_CLONE]);
189  }
190 
191  return $forms;
192  }
193 
194  protected function afterSave(ilObject $a_new_object)
195  {
197 
198  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
199  $ilCtrl->redirect($this, "");
200  }
201 
202  protected function setSettingsSubTabs($a_active)
203  {
204  global $DIC;
205 
206  $tree = $DIC->repositoryTree();
207  $access = $DIC->access();
208 
209  // general properties
210  $this->tabs_gui->addSubTab(
211  "properties",
212  $this->lng->txt("blog_properties"),
213  $this->ctrl->getLinkTarget($this, 'edit')
214  );
215 
216  $this->tabs_gui->addSubTab(
217  "style",
218  $this->lng->txt("obj_sty"),
219  $this->ctrl->getLinkTarget($this, 'editStyleProperties')
220  );
221 
222  // notification settings for blogs in courses and groups
223  if ($this->id_type == self::REPOSITORY_NODE_ID) {
224  $grp_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
225  $crs_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
226 
227  if ((int) $grp_ref_id > 0 || (int) $crs_ref_id > 0) {
228  if ($access->checkAccess('write', '', $this->ref_id)) {
229  $this->tabs_gui->addSubTab(
230  'notifications',
231  $this->lng->txt("notifications"),
232  $this->ctrl->getLinkTargetByClass("ilobjnotificationsettingsgui", '')
233  );
234  }
235  }
236  }
237 
238  $this->tabs_gui->activateSubTab($a_active);
239  }
240 
241  protected function initEditCustomForm(ilPropertyFormGUI $a_form)
242  {
243  $lng = $this->lng;
245  $obj_service = $this->getObjectService();
246 
247  $this->setSettingsSubTabs("properties");
248 
249  if ($this->id_type == self::REPOSITORY_NODE_ID) {
250  $appr = new ilCheckboxInputGUI($lng->txt("blog_enable_approval"), "approval");
251  $appr->setInfo($lng->txt("blog_enable_approval_info"));
252  $a_form->addItem($appr);
253  }
254 
255  $notes = new ilCheckboxInputGUI($lng->txt("blog_enable_notes"), "notes");
256  $a_form->addItem($notes);
257 
258  if ($ilSetting->get('enable_global_profiles')) {
259  $rss = new ilCheckboxInputGUI($lng->txt("blog_enable_rss"), "rss");
260  $rss->setInfo($lng->txt("blog_enable_rss_info"));
261  $a_form->addItem($rss);
262  }
263 
264 
265  // navigation
266 
267  $nav = new ilFormSectionHeaderGUI();
268  $nav->setTitle($lng->txt("blog_settings_navigation"));
269  $a_form->addItem($nav);
270 
271  $nav_mode = new ilRadioGroupInputGUI($lng->txt("blog_nav_mode"), "nav");
272  $nav_mode->setRequired(true);
273  $a_form->addItem($nav_mode);
274 
275  $opt = new ilRadioOption($lng->txt("blog_nav_mode_month_list"), ilObjBlog::NAV_MODE_LIST);
276  $opt->setInfo($lng->txt("blog_nav_mode_month_list_info"));
277  $nav_mode->addOption($opt);
278 
279 
280  $mon_num = new ilNumberInputGUI($lng->txt("blog_nav_mode_month_list_num_month"), "nav_list_mon");
281  $mon_num->setInfo($lng->txt("blog_nav_mode_month_list_num_month_info"));
282  $mon_num->setSize(3);
283  $mon_num->setMinValue(1);
284  $opt->addSubItem($mon_num);
285 
286  $detail_num = new ilNumberInputGUI($lng->txt("blog_nav_mode_month_list_num_month_with_post"), "nav_list_mon_with_post");
287  $detail_num->setInfo($lng->txt("blog_nav_mode_month_list_num_month_with_post_info"));
288  //$detail_num->setRequired(true);
289  $detail_num->setSize(3);
290  //$detail_num->setMinValue(0);
291  $opt->addSubItem($detail_num);
292 
293  $opt = new ilRadioOption($lng->txt("blog_nav_mode_month_single"), ilObjBlog::NAV_MODE_MONTH);
294  $opt->setInfo($lng->txt("blog_nav_mode_month_single_info"));
295  $nav_mode->addOption($opt);
296 
297  $order_options = array();
298  if ($this->object->getOrder()) {
299  foreach ($this->object->getOrder() as $item) {
300  $order_options[] = $lng->txt("blog_" . $item);
301  }
302  }
303 
304  if (!in_array($lng->txt("blog_navigation"), $order_options)) {
305  $order_options[] = $lng->txt("blog_navigation");
306  }
307 
308  if ($this->id_type == self::REPOSITORY_NODE_ID) {
309  if (!in_array($lng->txt("blog_authors"), $order_options)) {
310  $order_options[] = $lng->txt("blog_authors");
311  }
312 
313  $auth = new ilCheckboxInputGUI($lng->txt("blog_enable_nav_authors"), "nav_authors");
314  $auth->setInfo($lng->txt("blog_enable_nav_authors_info"));
315  $a_form->addItem($auth);
316  }
317 
318  $keyw = new ilCheckboxInputGUI($lng->txt("blog_enable_keywords"), "keywords");
319  $keyw->setInfo($lng->txt("blog_enable_keywords_info"));
320  $a_form->addItem($keyw);
321 
322  if (!in_array($lng->txt("blog_keywords"), $order_options)) {
323  $order_options[] = $lng->txt("blog_keywords");
324  }
325 
326  $order = new ilNonEditableValueGUI($lng->txt("blog_nav_sortorder"), "order");
327  $order->setMultiValues($order_options);
328  $order->setValue(array_shift($order_options));
329  $order->setMulti(true, true, false);
330  $a_form->addItem($order);
331 
332 
333  // presentation (frame)
334 
335  $pres = new ilFormSectionHeaderGUI();
336  $pres->setTitle($lng->txt("blog_presentation_frame"));
337  $a_form->addItem($pres);
338 
339  if ($this->id_type == self::REPOSITORY_NODE_ID) {
340  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->addTileImage();
341  }
342 
343  $ppic = new ilCheckboxInputGUI($lng->txt("blog_profile_picture"), "ppic");
344  $a_form->addItem($ppic);
345 
346  if ($this->id_type == self::REPOSITORY_NODE_ID) {
347  $ppic->setInfo($lng->txt("blog_profile_picture_repository_info"));
348  }
349 
350  $blga_set = new ilSetting("blga");
351  if ($blga_set->get("banner")) {
352  include_once "Services/Form/classes/class.ilFileInputGUI.php";
354 
355  $dimensions = " (" . $blga_set->get("banner_width") . "x" .
356  $blga_set->get("banner_height") . ")";
357 
358  $img = new ilImageFileInputGUI($lng->txt("blog_banner") . $dimensions, "banner");
359  $a_form->addItem($img);
360 
361  // show existing file
362  $file = $this->object->getImageFullPath(true);
363  if ($file) {
364  $img->setImage($file);
365  }
366  }
367 
368  /* #15000
369  $bg_color = new ilColorPickerInputGUI($lng->txt("blog_background_color"), "bg_color");
370  $a_form->addItem($bg_color);
371 
372  $font_color = new ilColorPickerInputGUI($lng->txt("blog_font_color"), "font_color");
373  $a_form->addItem($font_color);
374  */
375 
376  // presentation (overview)
377 
379  $list->setTitle($lng->txt("blog_presentation_overview"));
380  $a_form->addItem($list);
381 
382 
383  $post_num = new ilNumberInputGUI($lng->txt("blog_list_num_postings"), "ov_list_post_num");
384  $post_num->setInfo($lng->txt("blog_list_num_postings_info"));
385  $post_num->setSize(3);
386  $post_num->setMinValue(1);
387  $post_num->setRequired(true);
388  $a_form->addItem($post_num);
389 
390  $abs_shorten = new ilCheckboxInputGUI($lng->txt("blog_abstract_shorten"), "abss");
391  $a_form->addItem($abs_shorten);
392 
393  $abs_shorten_len = new ilNumberInputGUI($lng->txt("blog_abstract_shorten_length"), "abssl");
394  $abs_shorten_len->setSize(5);
395  $abs_shorten_len->setRequired(true);
396  $abs_shorten_len->setSuffix($lng->txt("blog_abstract_shorten_characters"));
397  $abs_shorten_len->setMinValue(50, true);
398  $abs_shorten->addSubItem($abs_shorten_len);
399 
400  $abs_img = new ilCheckboxInputGUI($lng->txt("blog_abstract_image"), "absi");
401  $abs_img->setInfo($lng->txt("blog_abstract_image_info"));
402  $a_form->addItem($abs_img);
403 
404  $abs_img_width = new ilNumberInputGUI($lng->txt("blog_abstract_image_width"), "absiw");
405  $abs_img_width->setSize(5);
406  $abs_img_width->setRequired(true);
407  $abs_img_width->setSuffix($lng->txt("blog_abstract_image_pixels"));
408  $abs_img_width->setMinValue(32, true);
409  $abs_img->addSubItem($abs_img_width);
410 
411  $abs_img_height = new ilNumberInputGUI($lng->txt("blog_abstract_image_height"), "absih");
412  $abs_img_height->setSize(5);
413  $abs_img_height->setRequired(true);
414  $abs_img_height->setSuffix($lng->txt("blog_abstract_image_pixels"));
415  $abs_img_height->setMinValue(32, true);
416  $abs_img->addSubItem($abs_img_height);
417  }
418 
419  protected function getEditFormCustomValues(array &$a_values)
420  {
421  if ($this->id_type == self::REPOSITORY_NODE_ID) {
422  $a_values["approval"] = $this->object->hasApproval();
423  $a_values["nav_authors"] = $this->object->hasAuthors();
424  }
425  $a_values["keywords"] = $this->object->hasKeywords();
426  $a_values["notes"] = $this->object->getNotesStatus();
427  $a_values["ppic"] = $this->object->hasProfilePicture();
428  /*
429  $a_values["bg_color"] = $this->object->getBackgroundColor();
430  $a_values["font_color"] = $this->object->getFontColor();
431  */
432  $a_values["banner"] = $this->object->getImage();
433  $a_values["rss"] = $this->object->hasRSS();
434  $a_values["abss"] = $this->object->hasAbstractShorten();
435  $a_values["absi"] = $this->object->hasAbstractImage();
436  $a_values["nav"] = $this->object->getNavMode();
437  $a_values["nav_list_mon_with_post"] = $this->object->getNavModeListMonthsWithPostings();
438  $a_values["nav_list_mon"] = $this->object->getNavModeListMonths();
439  $a_values["ov_list_post_num"] = $this->object->getOverviewPostings();
440 
441  // #13420
442  $a_values["abssl"] = $this->object->getAbstractShortenLength() ? $this->object->getAbstractShortenLength() : ilObjBlog::ABSTRACT_DEFAULT_SHORTEN_LENGTH;
443  $a_values["absiw"] = $this->object->getAbstractImageWidth() ? $this->object->getAbstractImageWidth() : ilObjBlog::ABSTRACT_DEFAULT_IMAGE_WIDTH;
444  $a_values["absih"] = $this->object->getAbstractImageHeight() ? $this->object->getAbstractImageHeight() : ilObjBlog::ABSTRACT_DEFAULT_IMAGE_HEIGHT;
445  }
446 
447  protected function updateCustom(ilPropertyFormGUI $a_form)
448  {
449  $lng = $this->lng;
450  $obj_service = $this->getObjectService();
451 
452  if ($this->id_type == self::REPOSITORY_NODE_ID) {
453  $this->object->setApproval($a_form->getInput("approval"));
454  $this->object->setAuthors($a_form->getInput("nav_authors"));
455  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
456  }
457  $this->object->setKeywords($a_form->getInput("keywords"));
458  $this->object->setNotesStatus($a_form->getInput("notes"));
459  $this->object->setProfilePicture($a_form->getInput("ppic"));
460  /*
461  $this->object->setBackgroundColor($a_form->getInput("bg_color"));
462  $this->object->setFontColor($a_form->getInput("font_color"));
463  */
464  $this->object->setRSS($a_form->getInput("rss"));
465  $this->object->setAbstractShorten($a_form->getInput("abss"));
466  $this->object->setAbstractShortenLength($a_form->getInput("abssl"));
467  $this->object->setAbstractImage($a_form->getInput("absi"));
468  $this->object->setAbstractImageWidth($a_form->getInput("absiw"));
469  $this->object->setAbstractImageHeight($a_form->getInput("absih"));
470  $this->object->setNavMode($a_form->getInput("nav"));
471  $this->object->setNavModeListMonthsWithPostings($a_form->getInput("nav_list_mon_with_post"));
472  $this->object->setNavModeListMonths($a_form->getInput("nav_list_mon"));
473  $this->object->setOverviewPostings($a_form->getInput("ov_list_post_num"));
474 
475  $order = $a_form->getInput("order");
476  foreach ($order as $idx => $value) {
477  if ($value == $lng->txt("blog_navigation")) {
478  $order[$idx] = "navigation";
479  } elseif ($value == $lng->txt("blog_keywords")) {
480  $order[$idx] = "keywords";
481  } else {
482  $order[$idx] = "authors";
483  }
484  }
485  $this->object->setOrder($order);
486  // banner field is optional
487  $banner = $a_form->getItemByPostVar("banner");
488  if ($banner) {
489  if ($_FILES["banner"]["tmp_name"]) {
490  $this->object->uploadImage($_FILES["banner"]);
491  } elseif ($banner->getDeletionFlag()) {
492  $this->object->deleteImage();
493  }
494  }
495  }
496 
497  public function setTabs()
498  {
499  $lng = $this->lng;
500  $ilHelp = $this->help;
501 
502  if ($this->id_type == self::WORKSPACE_NODE_ID) {
503  $this->ctrl->setParameter($this, "wsp_id", $this->node_id);
504  }
505 
506  $ilHelp->setScreenIdComponent("blog");
507 
508  if ($this->checkPermissionBool("read")) {
509  $this->tabs_gui->addTab(
510  "content",
511  $lng->txt("content"),
512  $this->ctrl->getLinkTarget($this, "")
513  );
514  }
515  if ($this->checkPermissionBool("read") && !$this->prtf_embed) {
516  $this->tabs_gui->addTab(
517  "id_info",
518  $lng->txt("info_short"),
519  $this->ctrl->getLinkTargetByClass(array("ilobjbloggui", "ilinfoscreengui"), "showSummary")
520  );
521  }
522 
523  if ($this->checkPermissionBool("write")) {
524  $this->tabs_gui->addTab(
525  "settings",
526  $lng->txt("settings"),
527  $this->ctrl->getLinkTarget($this, "edit")
528  );
529 
530  if (!$this->prtf_embed) {
531  if ($this->id_type == self::REPOSITORY_NODE_ID) {
532  $this->tabs_gui->addTab(
533  "contributors",
534  $lng->txt("blog_contributors"),
535  $this->ctrl->getLinkTarget($this, "contributors")
536  );
537  }
538 
539  if ($this->id_type == self::REPOSITORY_NODE_ID) {
540  $this->tabs_gui->addTab(
541  "export",
542  $lng->txt("export"),
543  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
544  );
545  }
546  }
547  }
548 
549  if (!$this->prtf_embed) {
550  if ($this->mayContribute()) {
551  $this->tabs_gui->addNonTabbedLink(
552  "preview",
553  $lng->txt("blog_preview"),
554  $this->ctrl->getLinkTarget($this, "preview")
555  );
556  }
557  parent::setTabs();
558  }
559  }
560 
561  public function executeCommand()
562  {
564  $tpl = $this->tpl;
565  $ilTabs = $this->tabs;
566  $lng = $this->lng;
567  $ilNavigationHistory = $this->nav_history;
568 
569  // goto link to blog posting
570  if ($this->gtp > 0) {
571  $page_id = $this->gtp;
572  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
573  if (ilBlogPosting::exists($this->object_id, $page_id)) {
574  // #12312
575  $ilCtrl->setCmdClass("ilblogpostinggui");
576  $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $page_id);
577  $ilCtrl->redirectByClass("ilblogpostinggui", "previewFullscreen");
578  } else {
579  ilUtil::sendFailure($lng->txt("blog_posting_not_found"));
580  }
581  }
582 
583  $next_class = $ilCtrl->getNextClass($this);
584  $cmd = $ilCtrl->getCmd();
585 
586  if ($this->id_type == self::REPOSITORY_NODE_ID) {
587  // add entry to navigation history
588  if (!$this->getCreationMode() &&
589  $this->getAccessHandler()->checkAccess("read", "", $this->node_id)) {
590  // see #22067
591  $link = $ilCtrl->getLinkTargetByClass(["ilrepositorygui", "ilObjBlogGUI"], "preview");
592  $ilNavigationHistory->addItem($this->node_id, $link, "blog");
593  }
594  }
595 
596  switch ($next_class) {
597  case 'ilblogpostinggui':
598  if (!$this->prtf_embed) {
599  $tpl->getStandardTemplate();
600  }
601 
602  if (!$this->checkPermissionBool("read") && !$this->prtf_embed) {
603  ilUtil::sendInfo($lng->txt("no_permission"));
604  return;
605  }
606 
607  // #9680
608  if ($this->id_type == self::REPOSITORY_NODE_ID) {
609  $this->setLocator();
610  } else {
611  include_once "Services/Form/classes/class.ilFileInputGUI.php";
613  }
614  $ilTabs->setBackTarget(
615  $lng->txt("back"),
616  $ilCtrl->getLinkTarget($this, "")
617  );
618 
620  $this->object->getStyleSheetId(),
621  "blog"
622  );
623 
624  include_once("./Modules/Blog/classes/class.ilBlogPostingGUI.php");
625  $bpost_gui = new ilBlogPostingGUI(
626  $this->node_id,
627  $this->getAccessHandler(),
628  $this->blpg,
629  $this->old_nr,
630  ($this->object->getNotesStatus() && !$this->disable_notes),
631  $this->mayEditPosting($this->blpg),
632  $style_sheet_id
633  );
634 
635  // keep preview mode through notes gui (has its own commands)
636  switch ($cmd) {
637  // blog preview
638  case "previewFullscreen":
639  $ilCtrl->setParameter($this, "prvm", "fsc");
640  break;
641 
642  // blog in portfolio
643  case "previewEmbedded":
644  $ilCtrl->setParameter($this, "prvm", "emb");
645  break;
646 
647  // edit
648  default:
649  $this->setContentStyleSheet();
650 
651 
652  if (!$this->prtf_embed) {
653  $this->ctrl->setParameterByClass("ilblogpostinggui", "blpg", $this->blpg);
654  $this->tabs_gui->addNonTabbedLink(
655  "preview",
656  $lng->txt("blog_preview"),
657  $this->ctrl->getLinkTargetByClass("ilblogpostinggui", "previewFullscreen")
658  );
659  $this->ctrl->setParameterByClass("ilblogpostinggui", "blpg", "");
660  } else {
661  $this->ctrl->setParameterByClass("ilobjportfoliogui", "user_page", $this->ppage);
662  $this->tabs_gui->addNonTabbedLink(
663  "preview",
664  $lng->txt("blog_preview"),
665  $this->ctrl->getLinkTargetByClass("ilobjportfoliogui", "preview")
666  );
667  $this->ctrl->setParameterByClass("ilobjportfoliogui", "user_page", "");
668  }
669  break;
670  }
671 
672  // keep preview mode through notes gui
673  if ($this->prvm) {
674  $cmd = "preview" . (($this->prvm == "fsc") ? "Fullscreen" : "Embedded");
675  }
676  if (in_array($cmd, array("previewFullscreen", "previewEmbedded"))) {
677  $this->renderToolbarNavigation($this->items, true);
678  }
679  $ret = $ilCtrl->forwardCommand($bpost_gui);
680  if ($ret != "") {
681 
682  // $is_owner = $this->object->getOwner() == $ilUser->getId();
683  $is_owner = $this->mayContribute();
684  $is_active = $bpost_gui->getBlogPosting()->getActive();
685 
686  // do not show inactive postings
687  if (($cmd == "previewFullscreen" || $cmd == "previewEmbedded")
688  && !$is_owner && !$is_active) {
689  $this->ctrl->redirect($this, "preview");
690  }
691 
692  switch ($cmd) {
693  // blog preview
694  case "previewFullscreen":
695  $this->addHeaderActionForCommand($cmd);
696  $this->filterInactivePostings();
697  $nav = $this->renderNavigation($this->items, "preview", $cmd);
698  $this->renderFullScreen($ret, $nav);
699  break;
700 
701  // blog in portfolio
702  case "previewEmbedded":
703  $this->filterInactivePostings();
704  $nav = $this->renderNavigation($this->items, "gethtml", $cmd);
705  return $this->buildEmbedded($ret, $nav);
706 
707  // ilias/editor
708  default:
709  // infos about draft status / snippet
710  $info = array();
711  if (!$is_active) {
712  // single author blog (owner) in personal workspace
713  if ($this->id_type == self::WORKSPACE_NODE_ID) {
714  $info[] = $lng->txt("blog_draft_info");
715  } else {
716  $info[] = $lng->txt("blog_draft_info_contributors");
717  }
718  }
719  if ($cmd != "history" && $is_active && empty($info)) {
720  $info[] = $lng->txt("blog_new_posting_info");
721  $public_action = true;
722  }
723  if ($this->object->hasApproval() && !$bpost_gui->getBlogPosting()->isApproved()) {
724  // #9737
725  $info[] = $lng->txt("blog_posting_edit_approval_info");
726  }
727  if (sizeof($info) && !$tpl->hasMessage("info")) { // #15121
728  if ($public_action) {
729  ilUtil::sendSuccess(implode("<br />", $info));
730  } else {
731  ilUtil::sendInfo(implode("<br />", $info));
732  }
733  }
734  // revert to edit cmd to avoid confusion
735  $this->addHeaderActionForCommand("render");
736  $tpl->setContent($ret);
737  $nav = $this->renderNavigation($this->items, "render", $cmd, null, $is_owner);
738  $tpl->setRightContent($nav);
739  break;
740  }
741  }
742  break;
743 
744  case "ilinfoscreengui":
745  $this->prepareOutput();
746  $this->addHeaderActionForCommand("render");
747  $this->infoScreenForward();
748  break;
749 
750  case "ilnotegui":
751  $this->preview();
752  break;
753 
754  case "ilcommonactiondispatchergui":
755  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
757  $this->ctrl->forwardCommand($gui);
758  break;
759 
760  case "ilpermissiongui":
761  $this->prepareOutput();
762  $ilTabs->activateTab("id_permissions");
763  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
764  $perm_gui = new ilPermissionGUI($this);
765  $this->ctrl->forwardCommand($perm_gui);
766  break;
767 
768  case "ilobjectcopygui":
769  $this->prepareOutput();
770  include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
771  $cp = new ilObjectCopyGUI($this);
772  $cp->setType("blog");
773  $this->ctrl->forwardCommand($cp);
774  break;
775 
776  case 'ilrepositorysearchgui':
777  $this->prepareOutput();
778  $ilTabs->activateTab("contributors");
779  include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
780  $rep_search = new ilRepositorySearchGUI();
781  $rep_search->setTitle($this->lng->txt("blog_add_contributor"));
782  $rep_search->setCallback($this, 'addContributor', $this->object->getAllLocalRoles($this->node_id));
783  $this->ctrl->setReturn($this, 'contributors');
784  $ret = &$this->ctrl->forwardCommand($rep_search);
785  break;
786 
787  case 'ilexportgui':
788  $this->prepareOutput();
789  $ilTabs->activateTab("export");
790  include_once("./Services/Export/classes/class.ilExportGUI.php");
791  $exp_gui = new ilExportGUI($this);
792  $exp_gui->addFormat("xml");
793  $exp_gui->addFormat("html", null, $this, "buildExportFile"); // #13419
794  $ret = $ilCtrl->forwardCommand($exp_gui);
795  break;
796 
797  case "ilobjstylesheetgui":
798  include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
799  $this->ctrl->setReturn($this, "editStyleProperties");
800  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
801  $style_gui->omitLocator();
802  if ($cmd == "create" || $this->new_type == "sty") {
803  $style_gui->setCreationMode(true);
804  }
805 
806  if ($cmd == "confirmedDelete") {
807  $this->object->setStyleSheetId(0);
808  $this->object->update();
809  }
810 
811  $ret = $this->ctrl->forwardCommand($style_gui);
812 
813  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
814  $style_id = $ret;
815  $this->object->setStyleSheetId($style_id);
816  $this->object->update();
817  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
818  }
819  break;
820 
821  case "ilblogexercisegui":
822  $this->ctrl->setReturn($this, "render");
823  include_once "Modules/Blog/classes/class.ilBlogExerciseGUI.php";
824  $gui = new ilBlogExerciseGUI($this->node_id);
825  $this->ctrl->forwardCommand($gui);
826  break;
827 
828  case 'ilobjnotificationsettingsgui':
829  $this->prepareOutput();
830  $ilTabs->activateTab("settings");
831  $this->setSettingsSubTabs("notifications");
832  include_once("./Services/Notification/classes/class.ilObjNotificationSettingsGUI.php");
833  $gui = new ilObjNotificationSettingsGUI($this->object->getRefId());
834  $this->ctrl->forwardCommand($gui);
835  break;
836 
837  default:
838  if ($cmd != "gethtml") {
839  // desktop item handling, must be toggled before header action
840  if ($cmd == "addToDesk" || $cmd == "removeFromDesk") {
841  $this->{$cmd . "Object"}();
842  if ($this->prvm) {
843  $cmd = "preview";
844  } else {
845  $cmd = "render";
846  }
847  $ilCtrl->setCmd($cmd);
848  }
849  $this->addHeaderActionForCommand($cmd);
850  }
851  if (!$this->prtf_embed) {
852  return parent::executeCommand();
853  } else {
854  $this->setTabs();
855 
856  if (!$cmd) {
857  $cmd = "render";
858  }
859  return $this->$cmd();
860  }
861  }
862 
863  return true;
864  }
865 
871  public function infoScreen()
872  {
873  $this->ctrl->setCmd("showSummary");
874  $this->ctrl->setCmdClass("ilinfoscreengui");
875  $this->infoScreenForward();
876  }
877 
881  public function infoScreenForward()
882  {
883  $ilTabs = $this->tabs;
884 
885  $ilTabs->activateTab("id_info");
886 
887  $this->checkPermission("visible");
888 
889  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
890  $info = new ilInfoScreenGUI($this);
891 
892  if ($this->id_type != self::WORKSPACE_NODE_ID) {
893  $info->enablePrivateNotes();
894  }
895 
896  if ($this->checkPermissionBool("read")) {
897  $info->enableNews();
898  }
899 
900  // no news editing for files, just notifications
901  $info->enableNewsEditing(false);
902  if ($this->checkPermissionBool("write")) {
903  $news_set = new ilSetting("news");
904  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
905 
906  if ($enable_internal_rss) {
907  $info->setBlockProperty("news", "settings", true);
908  $info->setBlockProperty("news", "public_notifications_option", true);
909  }
910  }
911 
912  // standard meta data
913  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
914 
915  if ($this->id_type == self::WORKSPACE_NODE_ID) {
916  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
917  }
918 
919  $this->ctrl->forwardCommand($info);
920  }
921 
925  public function createPosting()
926  {
929 
930  $title = trim(ilUtil::stripSlashes($_POST["title"]));
931  if ($title) {
932  // create new posting
933  include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
934  $posting = new ilBlogPosting();
935  $posting->setTitle($title);
936  $posting->setBlogId($this->object->getId());
937  $posting->setActive(false);
938  $posting->setAuthor($ilUser->getId());
939  $posting->create();
940 
941  // switch month list to current month (will include new posting)
942  $ilCtrl->setParameter($this, "bmn", date("Y-m"));
943 
944  $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $posting->getId());
945  $ilCtrl->redirectByClass("ilblogpostinggui", "edit");
946  } else {
947  ilUtil::sendFailure($this->lng->txt("msg_no_title"), true);
948  $ilCtrl->redirect($this, "render");
949  }
950  }
951 
952  // --- ObjectGUI End
953 
954 
958  public function render()
959  {
960  $tpl = $this->tpl;
961  $ilTabs = $this->tabs;
963  $lng = $this->lng;
964  $ilToolbar = new ilToolbarGUI();
966  $tree = $this->tree;
967 
968  if (!$this->checkPermissionBool("read")) {
969  ilUtil::sendInfo($lng->txt("no_permission"));
970  return;
971  }
972 
973  $ilTabs->activateTab("content");
974 
975  // toolbar
976  if ($this->mayContribute()) {
977  $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "createPosting"));
978 
979  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
980  $title = new ilTextInputGUI($lng->txt("title"), "title");
981  $ilToolbar->addStickyItem($title, $lng->txt("title"));
982 
983  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
984  $button = ilSubmitButton::getInstance();
985  $button->setCaption("blog_add_posting");
986  $button->setCommand("createPosting");
987  $ilToolbar->addStickyItem($button);
988 
989  // #18763
990  $first = array_shift((array_keys($this->items)));
991  if ($first != $this->month) {
992  $ilToolbar->addSeparator();
993 
994  $ilCtrl->setParameter($this, "bmn", $first);
995  $url = $ilCtrl->getLinkTarget($this, "");
996  $ilCtrl->setParameter($this, "bmn", $this->month);
997 
998  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
999  $button = ilLinkButton::getInstance();
1000  $button->setCaption("blog_show_latest");
1001  $button->setUrl($url);
1002  $ilToolbar->addButtonInstance($button);
1003  }
1004 
1005  // exercise blog?
1006  include_once "Modules/Blog/classes/class.ilBlogExerciseGUI.php";
1007  $message = ilBlogExerciseGUI::checkExercise($this->node_id);
1008  }
1009 
1010  // $is_owner = ($this->object->getOwner() == $ilUser->getId());
1011  $is_owner = $this->mayContribute();
1012 
1013  $list_items = $this->getListItems($is_owner);
1014 
1015  $list = $nav = "";
1016  if ($list_items) {
1017  $list = $this->renderList($list_items, "preview", null, $is_owner);
1018  $nav = $this->renderNavigation($this->items, "render", "preview", null, $is_owner);
1019  }
1020 
1021  $this->setContentStyleSheet();
1022 
1023  $tpl->setContent($message . $ilToolbar->getHTML() . $list);
1024  $tpl->setRightContent($nav);
1025  }
1026 
1032  public function getHTML()
1033  {
1034  $ilUser = $this->user;
1035  $ilCtrl = $this->ctrl;
1036  $lng = $this->lng;
1037 
1038  // getHTML() is called by ilRepositoryGUI::show()
1039  if ($this->id_type == self::REPOSITORY_NODE_ID) {
1040  return;
1041  }
1042 
1043  // there is no way to do a permissions check here, we have no wsp
1044 
1045  $this->filterInactivePostings();
1046 
1047  $list_items = $this->getListItems();
1048 
1049  $list = $nav = "";
1050  if ($list_items) {
1051  $list = $this->renderList($list_items, "previewEmbedded");
1052  $nav = $this->renderNavigation($this->items, "gethtml", "previewEmbedded");
1053  }
1054  // quick editing in portfolio
1055  elseif ($this->prt_id) {
1056  // see renderList()
1057  if (ilObject::_lookupOwner($this->prt_id) == $ilUser->getId()) {
1058  // see ilPortfolioPageTableGUI::fillRow()
1059  $ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", $this->user_page);
1060  $link = $ilCtrl->getLinkTargetByClass(array("ilportfoliopagegui", "ilobjbloggui"), "render");
1061  $ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", "");
1062 
1063  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1064  $btn = ilLinkButton::getInstance();
1065  $btn->setCaption(sprintf($lng->txt("prtf_edit_embedded_blog"), $this->object->getTitle()), false);
1066  $btn->setUrl($link);
1067  $btn->setPrimary(true);
1068 
1069  $list = $btn->render();
1070  }
1071  }
1072 
1073  return $this->buildEmbedded($list, $nav);
1074  }
1075 
1082  protected function getListItems($a_show_inactive = false)
1083  {
1084  if ($this->author) {
1085  $list_items = array();
1086  foreach ($this->items as $month => $items) {
1087  foreach ($items as $id => $item) {
1088  if ($item["author"] == $this->author ||
1089  (is_array($item["editors"]) && in_array($this->author, $item["editors"]))) {
1090  $list_items[$id] = $item;
1091  }
1092  }
1093  }
1094  } elseif ($this->keyword) {
1095  $list_items = $this->filterItemsByKeyword($this->items, $this->keyword);
1096  } else {
1097  $max = $this->object->getOverviewPostings();
1098  if ($this->month_default && $max) {
1099  $list_items = array();
1100  foreach ($this->items as $month => $postings) {
1101  foreach ($postings as $id => $item) {
1102  if (!$a_show_inactive &&
1103  !ilBlogPosting::_lookupActive($id, "blp")) {
1104  continue;
1105  }
1106  $list_items[$id] = $item;
1107 
1108  if (sizeof($list_items) >= $max) {
1109  break(2);
1110  }
1111  }
1112  }
1113  } else {
1114  $list_items = $this->items[$this->month];
1115  }
1116  }
1117  return $list_items;
1118  }
1119 
1123  public function preview()
1124  {
1125  global $DIC;
1126 
1127  $lng = $DIC->language();
1128  $toolbar = $DIC->toolbar();
1129 
1130  if (!$this->checkPermissionBool("read")) {
1131  ilUtil::sendInfo($lng->txt("no_permission"));
1132  return;
1133  }
1134 
1135  $this->filterInactivePostings();
1136 
1137  $list_items = $this->getListItems();
1138 
1139  $list = $nav = "";
1140  if ($list_items) {
1141  $list = $this->renderList($list_items, "previewFullscreen");
1142  $nav = $this->renderNavigation($this->items, "preview", "previewFullscreen");
1143  $this->renderToolbarNavigation($this->items);
1144  $list .= $toolbar->getHTML();
1145  }
1146 
1147  $this->renderFullScreen($list, $nav);
1148  }
1149 
1153  public function export()
1154  {
1155  $zip = $this->buildExportFile();
1156 
1157  ilUtil::deliverFile($zip, $this->object->getTitle() . ".zip", '', false, true);
1158  }
1159 
1160 
1161  // --- helper functions
1162 
1170  protected function buildEmbedded($a_content, $a_nav)
1171  {
1172  $wtpl = new ilTemplate("tpl.blog_embedded.html", true, true, "Modules/Blog");
1173  $wtpl->setVariable("VAL_LIST", $a_content);
1174  $wtpl->setVariable("VAL_NAVIGATION", $a_nav);
1175  return $wtpl->get();
1176  }
1177 
1184  public function renderFullScreen($a_content, $a_navigation)
1185  {
1186  $tpl = $this->tpl;
1187  $ilUser = $this->user;
1188  $ilTabs = $this->tabs;
1189  $ilLocator = $this->locator;
1190 
1191  $owner = $this->object->getOwner();
1192 
1193  $ilTabs->clearTargets();
1194  $ilLocator->clearItems();
1195  $tpl->setLocator();
1196 
1197  $back_caption = "";
1198 
1199  // back (edit)
1200  if ($owner == $ilUser->getId()) {
1201  // from shared/deeplink
1202  if ($this->id_type == self::WORKSPACE_NODE_ID) {
1203  $back = "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&wsp_id=" . $this->node_id;
1204  }
1205  // from editor (#10073)
1206  elseif ($this->mayContribute()) {
1207  $this->ctrl->setParameter($this, "prvm", "");
1208  if ($this->blpg == 0) {
1209  $back = $this->ctrl->getLinkTarget($this, "");
1210  } else {
1211  $this->ctrl->setParameterByClass("ilblogpostinggui", "bmn", $this->month);
1212  $this->ctrl->setParameterByClass("ilblogpostinggui", "blpg", $this->blpg);
1213  $back = $this->ctrl->getLinkTargetByClass("ilblogpostinggui", "preview");
1214  }
1215  $this->ctrl->setParameter($this, "prvm", $this->prvm);
1216  }
1217 
1218  $back_caption = $this->lng->txt("blog_back_to_blog_owner");
1219  }
1220  // back
1221  elseif ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
1222  // workspace (always shared)
1223  if ($this->id_type == self::WORKSPACE_NODE_ID) {
1224  $back = "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=" . $owner;
1225  }
1226  // contributor
1227  elseif ($this->mayContribute()) {
1228  $back = $this->ctrl->getLinkTarget($this, "");
1229  $back_caption = $this->lng->txt("blog_back_to_blog_owner");
1230  }
1231  // listgui / parent container
1232  else {
1233  $tree = $this->tree;
1234  $parent_id = $tree->getParentId($this->node_id);
1235  include_once "Services/Link/classes/class.ilLink.php";
1237  }
1238  }
1239 
1240  $ilMainMenu = $this->main_menu;
1241  $ilMainMenu->setMode(ilMainMenuGUI::MODE_TOPBAR_ONLY);
1242  $ilMainMenu->setTopBarBack($back, $back_caption);
1243 
1244  $this->renderFullscreenHeader($tpl, $owner);
1245 
1246  // #13564
1247  $this->ctrl->setParameter($this, "bmn", "");
1248  $tpl->setTitleUrl($this->ctrl->getLinkTarget($this, "preview"));
1249  $this->ctrl->setParameter($this, "bmn", $this->month);
1250 
1251  $this->setContentStyleSheet();
1252 
1253  // content
1254  $tpl->setContent($a_content);
1255  $tpl->setRightContent($a_navigation);
1256  }
1257 
1265  protected function renderFullscreenHeader($a_tpl, $a_user_id, $a_export = false)
1266  {
1267  $ilUser = $this->user;
1268 
1269  if (!$a_export) {
1270  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1272  $this->object->getType(),
1274  $this->object->getId(),
1275  $ilUser->getId()
1276  );
1277  }
1278 
1279  // repository blogs are multi-author
1280  $name = null;
1281  if ($this->id_type != self::REPOSITORY_NODE_ID) {
1282  $name = ilObjUser::_lookupName($a_user_id);
1283  $name = $name["lastname"] . ", " . ($t = $name["title"] ? $t . " " : "") . $name["firstname"];
1284  }
1285 
1286  // show banner?
1287  $banner = false;
1288  $blga_set = new ilSetting("blga");
1289  if ($blga_set->get("banner")) {
1290  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1291  $banner = ilWACSignedPath::signFile($this->object->getImageFullPath());
1292  $banner_width = $blga_set->get("banner_width");
1293  $banner_height = $blga_set->get("banner_height");
1294  if ($a_export) {
1295  $banner = basename($banner);
1296  }
1297  }
1298 
1299  $ppic = null;
1300  if ($this->object->hasProfilePicture()) {
1301  // repository (multi-user)
1302  if ($this->id_type == self::REPOSITORY_NODE_ID) {
1303  // #15030
1304  if ($this->blpg > 0 && !$a_export) {
1305  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
1306  $post = new ilBlogPosting($this->blpg);
1307  $author_id = $post->getAuthor();
1308  if ($author_id) {
1309  $ppic = ilObjUser::_getPersonalPicturePath($author_id, "xsmall", true, true);
1310 
1311  $name = ilObjUser::_lookupName($author_id);
1312  $name = $name["lastname"] . ", " . ($t = $name["title"] ? $t . " " : "") . $name["firstname"];
1313  }
1314  }
1315  }
1316  // workspace (author == owner)
1317  else {
1318  $ppic = ilObjUser::_getPersonalPicturePath($a_user_id, "xsmall", true, true);
1319  if ($a_export) {
1320  $ppic = basename($ppic);
1321  }
1322  }
1323  }
1324 
1325  $a_tpl->resetHeaderBlock(false);
1326  // $a_tpl->setBackgroundColor($this->object->getBackgroundColor());
1327  $a_tpl->setBanner($banner, $banner_width, $banner_height, $a_export);
1328  $a_tpl->setTitleIcon($ppic);
1329  $a_tpl->setTitle($this->object->getTitle());
1330  // $a_tpl->setTitleColor($this->object->getFontColor());
1331  $a_tpl->setDescription($name);
1332 
1333  // to get rid of locator in repository preview
1334  $a_tpl->setVariable("LOCATOR", "");
1335 
1336  // :TODO: obsolete?
1337  // $a_tpl->setBodyClass("std ilExternal ilBlog");
1338  }
1339 
1346  protected function buildPostingList($a_obj_id)
1347  {
1348  $author_found = false;
1349 
1350  $items = array();
1351  foreach (ilBlogPosting::getAllPostings($a_obj_id) as $posting) {
1352  if ($this->author &&
1353  ($posting["author"] == $this->author ||
1354  (is_array($posting["editors"]) && in_array($this->author, $posting["editors"])))) {
1355  $author_found = true;
1356  }
1357 
1358  $month = substr($posting["created"]->get(IL_CAL_DATE), 0, 7);
1359  $items[$month][$posting["id"]] = $posting;
1360  }
1361 
1362  if ($this->author && !$author_found) {
1363  $this->author = null;
1364  }
1365 
1366  return $items;
1367  }
1368 
1379  public function renderList(array $items, $a_cmd = "preview", $a_link_template = null, $a_show_inactive = false, $a_export_directory = null)
1380  {
1381  $lng = $this->lng;
1382  $ilCtrl = $this->ctrl;
1383  $ilUser = $this->user;
1384 
1385  include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
1386  $wtpl = new ilTemplate("tpl.blog_list.html", true, true, "Modules/Blog");
1387 
1388  // quick editing in portfolio
1389  if ($this->prt_id > 0 &&
1390  stristr($a_cmd, "embedded")) {
1391  if (ilObject::_lookupOwner($this->prt_id) == $ilUser->getId()) {
1392  // see ilPortfolioPageTableGUI::fillRow()
1393  $ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", $this->user_page);
1394  $link = $ilCtrl->getLinkTargetByClass(array("ilportfoliopagegui", "ilobjbloggui"), "render");
1395  $ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", "");
1396 
1397  include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
1399  $list->setListTitle($lng->txt("action"));
1400  $list->addItem(
1401  sprintf($lng->txt("prtf_edit_embedded_blog"), $this->object->getTitle()),
1402  "",
1403  $link
1404  );
1405 
1406  /*
1407  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1408  $btn = ilLinkButton::getInstance();
1409  $btn->setCaption(sprintf($lng->txt("prtf_edit_embedded_blog"), $this->object->getTitle()), false);
1410  $btn->setUrl($link);
1411  */
1412 
1413  $wtpl->setCurrentBlock("prtf_edit_bl");
1414  $wtpl->setVariable("PRTF_BLOG_EDIT", $list->getHTML());
1415  $wtpl->parseCurrentBlock();
1416  }
1417  }
1418 
1419  $is_admin = $this->isAdmin();
1420 
1421  include_once("./Modules/Blog/classes/class.ilBlogPostingGUI.php");
1422  $last_month = null;
1423  $is_empty = true;
1424  foreach ($items as $item) {
1425  // only published items
1426  $is_active = ilBlogPosting::_lookupActive($item["id"], "blp");
1427  if (!$is_active && !$a_show_inactive) {
1428  continue;
1429  }
1430 
1431  $is_empty = false;
1432 
1433  if (!$this->keyword && !$this->author) {
1434  $month = substr($item["created"]->get(IL_CAL_DATE), 0, 7);
1435  }
1436 
1437  if (!$last_month || $last_month != $month) {
1438  if ($last_month) {
1439  $wtpl->setCurrentBlock("month_bl");
1440  $wtpl->parseCurrentBlock();
1441  }
1442 
1443  // title according to current "filter"/navigation
1444  if ($this->keyword) {
1445  $title = $lng->txt("blog_keyword") . ": " . $this->keyword;
1446  } elseif ($this->author) {
1447  include_once "Services/User/classes/class.ilUserUtil.php";
1448  $title = $lng->txt("blog_author") . ": " . ilUserUtil::getNamePresentation($this->author);
1449  } else {
1450  include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
1452  " " . substr($month, 0, 4);
1453 
1454  $last_month = $month;
1455  }
1456 
1457  $wtpl->setVariable("TXT_CURRENT_MONTH", $title);
1458  }
1459 
1460  if (!$a_link_template) {
1461  $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $this->month);
1462  $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $item["id"]);
1463  $preview = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_cmd);
1464  } else {
1465  $preview = $this->buildExportLink($a_link_template, "posting", $item["id"]);
1466  }
1467 
1468  // actions
1469  $posting_edit = $this->mayEditPosting($item["id"], $item["author"]);
1470  if (($posting_edit || $is_admin) && !$a_link_template && $a_cmd == "preview") {
1471  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1472  $alist = new ilAdvancedSelectionListGUI();
1473  $alist->setId($item["id"]);
1474  $alist->setListTitle($lng->txt("actions"));
1475 
1476  if ($is_active && $this->object->hasApproval() && !$item["approved"]) {
1477  if ($is_admin) {
1478  $ilCtrl->setParameter($this, "apid", $item["id"]);
1479  $alist->addItem(
1480  $lng->txt("blog_approve"),
1481  "approve",
1482  $ilCtrl->getLinkTarget($this, "approve")
1483  );
1484  $ilCtrl->setParameter($this, "apid", "");
1485  }
1486 
1487  $wtpl->setVariable("APPROVAL", $lng->txt("blog_needs_approval"));
1488  }
1489 
1490  if ($posting_edit) {
1491  $alist->addItem(
1492  $lng->txt("edit_content"),
1493  "edit",
1494  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edit")
1495  );
1496 
1497  // #11858
1498  if ($is_active) {
1499  $alist->addItem(
1500  $lng->txt("blog_toggle_draft"),
1501  "deactivate",
1502  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deactivatePageToList")
1503  );
1504  } else {
1505  $alist->addItem(
1506  $lng->txt("blog_toggle_final"),
1507  "activate",
1508  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "activatePageToList")
1509  );
1510  }
1511 
1512  $alist->addItem(
1513  $lng->txt("rename"),
1514  "rename",
1515  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edittitle")
1516  );
1517 
1518  if ($this->object->hasKeywords()) { // #13616
1519  $alist->addItem(
1520  $lng->txt("blog_edit_keywords"),
1521  "keywords",
1522  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords")
1523  );
1524  }
1525 
1526  $alist->addItem(
1527  $lng->txt("blog_edit_date"),
1528  "editdate",
1529  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editdate")
1530  );
1531  $alist->addItem(
1532  $lng->txt("delete"),
1533  "delete",
1534  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen")
1535  );
1536  } elseif ($is_admin) {
1537  // #10513
1538  if ($is_active) {
1539  $ilCtrl->setParameter($this, "apid", $item["id"]);
1540  $alist->addItem(
1541  $lng->txt("blog_toggle_draft_admin"),
1542  "deactivate",
1543  $ilCtrl->getLinkTarget($this, "deactivateAdmin")
1544  );
1545  $ilCtrl->setParameter($this, "apid", "");
1546  }
1547 
1548  $alist->addItem(
1549  $lng->txt("delete"),
1550  "delete",
1551  $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen")
1552  );
1553  }
1554 
1555  $wtpl->setCurrentBlock("actions");
1556  $wtpl->setVariable("ACTION_SELECTOR", $alist->getHTML());
1557  $wtpl->parseCurrentBlock();
1558  }
1559 
1560  // comments
1561  if ($this->object->getNotesStatus() && !$a_link_template && !$this->disable_notes) {
1562  // count (public) notes
1563  include_once("Services/Notes/classes/class.ilNote.php");
1564  $count = sizeof(ilNote::_getNotesOfObject(
1565  $this->obj_id,
1566  $item["id"],
1567  "blp",
1569  ));
1570 
1571  if ($a_cmd != "preview") {
1572  $wtpl->setCurrentBlock("comments");
1573  $wtpl->setVariable("TEXT_COMMENTS", $lng->txt("blog_comments"));
1574  $wtpl->setVariable("URL_COMMENTS", $preview);
1575  $wtpl->setVariable("COUNT_COMMENTS", $count);
1576  $wtpl->parseCurrentBlock();
1577  }
1578  /* we disabled comments in edit mode (should always be done via pagegui)
1579  else
1580  {
1581  $hash = ilCommonActionDispatcherGUI::buildAjaxHash(ilCommonActionDispatcherGUI::TYPE_WORKSPACE,
1582  $this->node_id, "blog", $this->obj_id, "blp", $item["id"]);
1583  $notes_link = "#\" onclick=\"".ilNoteGUI::getListCommentsJSCall($hash);
1584  }
1585  */
1586  }
1587 
1588  // permanent link
1589  if ($a_cmd != "preview" && $a_cmd != "previewEmbedded") {
1590  if ($this->id_type == self::WORKSPACE_NODE_ID) {
1591  $goto = $this->getAccessHandler()->getGotoLink($this->node_id, $this->obj_id, "_" . $item["id"]);
1592  } else {
1593  include_once "Services/Link/classes/class.ilLink.php";
1594  $goto = ilLink::_getStaticLink($this->node_id, $this->getType(), true, "_" . $item["id"]);
1595  }
1596  $wtpl->setCurrentBlock("permalink");
1597  $wtpl->setVariable("URL_PERMALINK", $goto);
1598  $wtpl->setVariable("TEXT_PERMALINK", $lng->txt("blog_permanent_link"));
1599  $wtpl->parseCurrentBlock();
1600  }
1601 
1602  $snippet = ilBlogPostingGUI::getSnippet(
1603  $item["id"],
1604  $this->object->hasAbstractShorten(),
1605  $this->object->getAbstractShortenLength(),
1606  "&hellip;",
1607  $this->object->hasAbstractImage(),
1608  $this->object->getAbstractImageWidth(),
1609  $this->object->getAbstractImageHeight(),
1610  $a_export_directory
1611  );
1612 
1613  if ($snippet) {
1614  $wtpl->setCurrentBlock("more");
1615  $wtpl->setVariable("URL_MORE", $preview);
1616  $wtpl->setVariable("TEXT_MORE", $lng->txt("blog_list_more"));
1617  $wtpl->parseCurrentBlock();
1618  }
1619 
1620 
1621 
1622  if (!$is_active) {
1623  $wtpl->setCurrentBlock("draft_text");
1624  $wtpl->setVariable("DRAFT_TEXT", $lng->txt("blog_draft_text"));
1625  $wtpl->parseCurrentBlock();
1626  $wtpl->setVariable("DRAFT_CLASS", " ilBlogListItemDraft");
1627  }
1628 
1629  $wtpl->setCurrentBlock("posting");
1630 
1631  $author = "";
1632  if ($this->id_type == self::REPOSITORY_NODE_ID) {
1633  $authors = array();
1634 
1635  $author_id = $item["author"];
1636  if ($author_id) {
1637  include_once "Services/User/classes/class.ilUserUtil.php";
1638  $authors[] = ilUserUtil::getNamePresentation($author_id);
1639  }
1640 
1641  if (is_array($item["editors"])) {
1642  foreach ($item["editors"] as $editor_id) {
1643  $authors[] = ilUserUtil::getNamePresentation($editor_id);
1644  }
1645  }
1646 
1647  if ($authors) {
1648  $author = implode(", ", $authors) . " - ";
1649  }
1650  }
1651 
1652  // title
1653  $wtpl->setVariable("URL_TITLE", $preview);
1654  $wtpl->setVariable("TITLE", $item["title"]);
1655 
1656  $kw = ilBlogPosting::getKeywords($this->obj_id, $item["id"]);
1657  natcasesort($kw);
1658  $keywords = (count($kw) > 0)
1659  ? "<br>" . $this->lng->txt("keywords") . ": " . implode(", ", $kw)
1660  : "";
1661 
1662  $wtpl->setVariable("DATETIME", $author .
1663  ilDatePresentation::formatDate($item["created"]) . $keywords);
1664 
1665  // content
1666  $wtpl->setVariable("CONTENT", $snippet);
1667 
1668  $wtpl->parseCurrentBlock();
1669  }
1670 
1671  // permalink
1672  if ($a_cmd == "previewFullscreen") {
1673  $this->tpl->setPermanentLink(
1674  "blog",
1675  $this->node_id,
1676  ($this->id_type == self::WORKSPACE_NODE_ID)
1677  ? "_wsp"
1678  : ""
1679  );
1680  }
1681 
1682  if (!$is_empty || $a_show_inactive) {
1683  return $wtpl->get();
1684  }
1685  }
1686 
1697  protected function renderNavigationByDate(array $a_items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false, $a_blpg = 0)
1698  {
1699  $ilCtrl = $this->ctrl;
1700 
1701  $blpg = ($a_blpg > 0)
1702  ? $a_blpg
1703  : $this->blpg;
1704 
1705 
1706  // gather page active status
1707  foreach ($a_items as $month => $postings) {
1708  foreach (array_keys($postings) as $id) {
1709  $active = ilBlogPosting::_lookupActive($id, "blp");
1710  if (!$a_show_inactive && !$active) {
1711  unset($a_items[$month][$id]);
1712  } else {
1713  $a_items[$month][$id]["active"] = $active;
1714  }
1715  }
1716  if (!sizeof($a_items[$month])) {
1717  unset($a_items[$month]);
1718  }
1719  }
1720 
1721  // list month (incl. postings)
1722  if ($this->object->getNavMode() == ilObjBlog::NAV_MODE_LIST || $a_link_template) {
1723  //$max_detail_postings = $this->object->getNavModeListPostings();
1724  $max_months = $this->object->getNavModeListMonths();
1725 
1726  $wtpl = new ilTemplate("tpl.blog_list_navigation_by_date.html", true, true, "Modules/Blog");
1727 
1728  $ilCtrl->setParameter($this, "blpg", "");
1729 
1730  include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
1731  $counter = $mon_counter = $last_year = 0;
1732  foreach ($a_items as $month => $postings) {
1733  if (!$a_link_template && $max_months && $mon_counter >= $max_months) {
1734  break;
1735  }
1736 
1737  $add_year = false;
1738  $year = substr($month, 0, 4);
1739  if (!$last_year || $year != $last_year) {
1740  // #13562
1741  $add_year = true;
1742  $last_year = $year;
1743  }
1744 
1745  $mon_counter++;
1746 
1747  $month_name = ilCalendarUtil::_numericMonthToString((int) substr($month, 5));
1748 
1749  if (!$a_link_template) {
1750  $ilCtrl->setParameter($this, "bmn", $month);
1751  $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1752  } else {
1753  $month_url = $this->buildExportLink($a_link_template, "list", $month);
1754  }
1755 
1756  // list postings for month
1757  //if($counter < $max_detail_postings)
1758  if ($mon_counter <= $this->object->getNavModeListMonthsWithPostings()) {
1759  if ($add_year) {
1760  $wtpl->setCurrentBlock("navigation_year_details");
1761  $wtpl->setVariable("YEAR", $year);
1762  $wtpl->parseCurrentBlock();
1763  }
1764 
1765  foreach ($postings as $id => $posting) {
1766  //if($max_detail_postings && $counter >= $max_detail_postings)
1767  //{
1768  // break;
1769  //}
1770 
1771  $counter++;
1772 
1773  $caption = /* ilDatePresentation::formatDate($posting["created"], IL_CAL_DATETIME).
1774  ", ".*/ $posting["title"];
1775 
1776  if (!$a_link_template) {
1777  $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $month);
1778  $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $id);
1779  $url = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_posting_cmd);
1780  } else {
1781  $url = $this->buildExportLink($a_link_template, "posting", $id);
1782  }
1783 
1784  if (!$posting["active"]) {
1785  $wtpl->setVariable("NAV_ITEM_DRAFT", $this->lng->txt("blog_draft"));
1786  } elseif ($this->object->hasApproval() && !$posting["approved"]) {
1787  $wtpl->setVariable("NAV_ITEM_APPROVAL", $this->lng->txt("blog_needs_approval"));
1788  }
1789 
1790  $wtpl->setCurrentBlock("navigation_item");
1791  $wtpl->setVariable("NAV_ITEM_URL", $url);
1792  $wtpl->setVariable("NAV_ITEM_CAPTION", $caption);
1793  $wtpl->parseCurrentBlock();
1794  }
1795 
1796  $wtpl->setCurrentBlock("navigation_month_details");
1797  $wtpl->setVariable("NAV_MONTH", $month_name);
1798  $wtpl->setVariable("URL_MONTH", $month_url);
1799  $wtpl->parseCurrentBlock();
1800  }
1801  // summarized month
1802  else {
1803  if ($add_year) {
1804  $wtpl->setCurrentBlock("navigation_year");
1805  $wtpl->setVariable("YEAR", $year);
1806  $wtpl->parseCurrentBlock();
1807  }
1808 
1809  $wtpl->setCurrentBlock("navigation_month");
1810  $wtpl->setVariable("MONTH_NAME", $month_name);
1811  $wtpl->setVariable("URL_MONTH", $month_url);
1812  $wtpl->setVariable("MONTH_COUNT", sizeof($postings));
1813  $wtpl->parseCurrentBlock();
1814  }
1815  }
1816 
1817  $ilCtrl->setParameter($this, "bmn", $this->month);
1818  $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", "");
1819 
1820  return $wtpl->get();
1821  }
1822  // single month
1823  else {
1824  $wtpl = new ilTemplate("tpl.blog_list_navigation_month.html", true, true, "Modules/Blog");
1825 
1826  $ilCtrl->setParameter($this, "blpg", "");
1827 
1828  include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
1829  $month_options = array();
1830  foreach ($a_items as $month => $postings) {
1831  $month_name = ilCalendarUtil::_numericMonthToString((int) substr($month, 5)) .
1832  " " . substr($month, 0, 4);
1833 
1834  $month_options[$month] = $month_name;
1835 
1836  if ($month == $this->month) {
1837  if (!$a_link_template) {
1838  $ilCtrl->setParameter($this, "bmn", $month);
1839  $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1840  } else {
1841  $month_url = $this->buildExportLink($a_link_template, "list", $month);
1842  }
1843 
1844  foreach ($postings as $id => $posting) {
1845  $caption = /* ilDatePresentation::formatDate($posting["created"], IL_CAL_DATETIME).
1846  ", ".*/ $posting["title"];
1847 
1848  if (!$a_link_template) {
1849  $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $month);
1850  $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $id);
1851  $url = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_posting_cmd);
1852  } else {
1853  $url = $this->buildExportLink($a_link_template, "posting", $id);
1854  }
1855 
1856  if (!$posting["active"]) {
1857  $wtpl->setVariable("NAV_ITEM_DRAFT", $this->lng->txt("blog_draft"));
1858  } elseif ($this->object->hasApproval() && !$posting["approved"]) {
1859  $wtpl->setVariable("NAV_ITEM_APPROVAL", $this->lng->txt("blog_needs_approval"));
1860  }
1861 
1862  $wtpl->setCurrentBlock("navigation_item");
1863  $wtpl->setVariable("NAV_ITEM_URL", $url);
1864  $wtpl->setVariable("NAV_ITEM_CAPTION", $caption);
1865  $wtpl->parseCurrentBlock();
1866  }
1867 
1868  $wtpl->setCurrentBlock("navigation_month_details");
1869  if ($blpg > 0) {
1870  $wtpl->setVariable("NAV_MONTH", $month_name);
1871  $wtpl->setVariable("URL_MONTH", $month_url);
1872  }
1873  $wtpl->parseCurrentBlock();
1874  }
1875  }
1876 
1877  if ($blpg == 0) {
1878  $wtpl->setCurrentBlock("option_bl");
1879  foreach ($month_options as $value => $caption) {
1880  $wtpl->setVariable("OPTION_VALUE", $value);
1881  $wtpl->setVariable("OPTION_CAPTION", $caption);
1882  if ($value == $this->month) {
1883  $wtpl->setVariable("OPTION_SEL", ' selected="selected"');
1884  }
1885  $wtpl->parseCurrentBlock();
1886  }
1887 
1888  $wtpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, $a_list_cmd));
1889  }
1890 
1891  $ilCtrl->setParameter($this, "bmn", $this->month);
1892  $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", "");
1893 
1894  return $wtpl->get();
1895  }
1896  }
1897 
1905  protected function renderNavigationByKeywords(
1906  $a_list_cmd = "render",
1907  $a_show_inactive = false,
1908  $a_link_template = false,
1909  $a_blpg = 0
1910  ) {
1911  $ilCtrl = $this->ctrl;
1912 
1913  $blpg = ($a_blpg > 0)
1914  ? $a_blpg
1915  : $this->blpg;
1916 
1917  $keywords = $this->getKeywords($a_show_inactive, $blpg);
1918  if ($keywords) {
1919  $wtpl = new ilTemplate("tpl.blog_list_navigation_keywords.html", true, true, "Modules/Blog");
1920 
1921  $max = max($keywords);
1922  include_once "Services/Tagging/classes/class.ilTagging.php";
1923 
1924  $wtpl->setCurrentBlock("keyword");
1925  foreach ($keywords as $keyword => $counter) {
1926  if (!$a_link_template) {
1927  $ilCtrl->setParameter($this, "kwd", urlencode($keyword)); // #15885
1928  $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1929  $ilCtrl->setParameter($this, "kwd", "");
1930  } else {
1931  $url = $this->buildExportLink($a_link_template, "keyword", $keyword);
1932  }
1933 
1934  $wtpl->setVariable("TXT_KEYWORD", $keyword);
1935  $wtpl->setVariable("CLASS_KEYWORD", ilTagging::getRelevanceClass($counter, $max));
1936  $wtpl->setVariable("URL_KEYWORD", $url);
1937  $wtpl->parseCurrentBlock();
1938  }
1939 
1940  return $wtpl->get();
1941  }
1942  }
1943 
1944  protected function renderNavigationByAuthors(array $a_items, $a_list_cmd = "render", $a_show_inactive = false)
1945  {
1946  $ilCtrl = $this->ctrl;
1947 
1948  $authors = array();
1949  foreach ($a_items as $month => $items) {
1950  foreach ($items as $item) {
1951  if (($a_show_inactive || ilBlogPosting::_lookupActive($item["id"], "blp"))) {
1952  if ($item["author"]) {
1953  $authors[] = $item["author"];
1954  }
1955 
1956  if (is_array($item["editors"])) {
1957  foreach ($item["editors"] as $editor_id) {
1958  if ($editor_id != $item["author"]) {
1959  $authors[] = $editor_id;
1960  }
1961  }
1962  }
1963  }
1964  }
1965  }
1966 
1967  $authors = array_unique($authors);
1968  if (sizeof($authors) > 1) {
1969  include_once "Services/User/classes/class.ilUserUtil.php";
1970 
1971  $list = array();
1972  foreach ($authors as $user_id) {
1973  if ($user_id) {
1974  $ilCtrl->setParameter($this, "ath", $user_id);
1975  $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1976  $ilCtrl->setParameter($this, "ath", "");
1977 
1978  $name = ilUserUtil::getNamePresentation($user_id, true);
1979  $idx = trim(strip_tags($name)) . "///" . $user_id; // #10934
1980  $list[$idx] = array($name, $url);
1981  }
1982  }
1983  ksort($list);
1984 
1985  $wtpl = new ilTemplate("tpl.blog_list_navigation_authors.html", true, true, "Modules/Blog");
1986 
1987  $wtpl->setCurrentBlock("author");
1988  foreach ($list as $author) {
1989  $wtpl->setVariable("TXT_AUTHOR", $author[0]);
1990  $wtpl->setVariable("URL_AUTHOR", $author[1]);
1991  $wtpl->parseCurrentBlock();
1992  }
1993 
1994  return $wtpl->get();
1995  }
1996  }
1997 
2004  public function renderToolbarNavigation($a_items, $single_posting = false)
2005  {
2006  global $DIC;
2007 
2008  $toolbar = $DIC->toolbar();
2009  $lng = $DIC->language();
2010  $ctrl = $DIC->ctrl();
2011 
2012  $f = $DIC->ui()->factory();
2013 
2014  $cmd = ($this->prtf_embed)
2015  ? "previewEmbedded"
2016  : "previewFullscreen";
2017 
2018  if ($single_posting) { // single posting view
2019  include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
2020 
2021  $latest_posting = $this->getLatestPosting($a_items);
2022  if ($latest_posting != "" && $this->blpg != $latest_posting) {
2023  $ctrl->setParameterByClass("ilblogpostinggui", "blpg", $latest_posting);
2024  $mb = $f->button()->standard(
2025  $lng->txt("blog_latest_posting"),
2026  $ctrl->getLinkTargetByClass("ilblogpostinggui", $cmd)
2027  );
2028  } else {
2029  $mb = $f->button()->standard($lng->txt("blog_latest_posting"), "#")->withUnavailableAction();
2030  }
2031 
2032  $prev_posting = $this->getPreviousPosting($a_items);
2033  if ($prev_posting != "") {
2034  $ctrl->setParameterByClass("ilblogpostinggui", "blpg", $prev_posting);
2035  $pb = $f->button()->standard(
2036  $lng->txt("previous"),
2037  $ctrl->getLinkTargetByClass("ilblogpostinggui", $cmd)
2038  );
2039  } else {
2040  $pb = $f->button()->standard($lng->txt("previous"), "#")->withUnavailableAction();
2041  }
2042 
2043  $next_posting = $this->getNextPosting($a_items);
2044  if ($next_posting != "") {
2045  $ctrl->setParameterByClass("ilblogpostinggui", "blpg", $next_posting);
2046  $nb = $f->button()->standard(
2047  $lng->txt("next"),
2048  $ctrl->getLinkTargetByClass("ilblogpostinggui", $cmd)
2049  );
2050  } else {
2051  $nb = $f->button()->standard($lng->txt("next"), "#")->withUnavailableAction();
2052  }
2053  $ctrl->setParameter($this, "blpg", $this->blpg);
2054  $vc = $f->viewControl()->section($pb, $mb, $nb);
2055  $toolbar->addComponent($vc);
2056  } else { // month view
2057  include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
2058 
2059  $latest_month = $this->getLatestMonth($a_items);
2060  if ($latest_month != "" && $this->month != $latest_month) {
2061  $ctrl->setParameter($this, "bmn", $latest_month);
2062  $mb = $f->button()->standard(
2063  $lng->txt("blog_latest_posting"),
2064  $ctrl->getLinkTarget($this, "preview")
2065  );
2066  } else {
2067  $mb = $f->button()->standard($lng->txt("blog_latest_posting"), "#")->withUnavailableAction();
2068  }
2069 
2070  $prev_month = $this->getPreviousMonth($a_items);
2071  if ($prev_month != "") {
2072  $ctrl->setParameter($this, "bmn", $prev_month);
2073  $pb = $f->button()->standard($lng->txt("previous"), $ctrl->getLinkTarget($this, "preview"));
2074  } else {
2075  $pb = $f->button()->standard($lng->txt("previous"), "#")->withUnavailableAction();
2076  }
2077 
2078  $next_month = $this->getNextMonth($a_items);
2079  if ($next_month != "") {
2080  $ctrl->setParameter($this, "bmn", $next_month);
2081  $nb = $f->button()->standard($lng->txt("next"), $ctrl->getLinkTarget($this, "preview"));
2082  } else {
2083  $nb = $f->button()->standard($lng->txt("next"), "#")->withUnavailableAction();
2084  }
2085  $ctrl->setParameter($this, "bmn", $this->month);
2086  $vc = $f->viewControl()->section($pb, $mb, $nb);
2087  $toolbar->addComponent($vc);
2088  }
2089  }
2090 
2097  public function getNextMonth($a_items)
2098  {
2099  reset($a_items);
2100  $found = "";
2101  foreach ($a_items as $month => $items) {
2102  if ($month > $this->month) {
2103  $found = $month;
2104  }
2105  }
2106  return $found;
2107  }
2108 
2115  public function getPreviousMonth($a_items)
2116  {
2117  reset($a_items);
2118  $found = "";
2119  foreach ($a_items as $month => $items) {
2120  if ($month < $this->month && $found == "") {
2121  $found = $month;
2122  }
2123  }
2124  return $found;
2125  }
2126 
2133  public function getLatestMonth($a_items)
2134  {
2135  reset($a_items);
2136  return key($a_items);
2137  }
2138 
2145  public function getNextPosting($a_items)
2146  {
2147  reset($a_items);
2148  $found = "";
2149  $next_blpg = 0;
2150  foreach ($a_items as $month => $items) {
2151  foreach ($items as $item) {
2152  if ($item["id"] == $this->blpg) {
2153  $found = true;
2154  }
2155  if (!$found) {
2156  $next_blpg = $item["id"];
2157  }
2158  }
2159  }
2160  return $next_blpg;
2161  }
2162 
2169  public function getPreviousPosting($a_items)
2170  {
2171  reset($a_items);
2172  $found = "";
2173  $prev_blpg = 0;
2174  foreach ($a_items as $month => $items) {
2175  foreach ($items as $item) {
2176  if ($found && $prev_blpg == "") {
2177  $prev_blpg = $item["id"];
2178  }
2179  if ($item["id"] == $this->blpg) {
2180  $found = true;
2181  }
2182  }
2183  }
2184  return $prev_blpg;
2185  }
2186 
2193  public function getLatestPosting($a_items)
2194  {
2195  reset($a_items);
2196  $month = current($a_items);
2197  if (is_array($month)) {
2198  return current($month)["id"];
2199  }
2200  return false;
2201  }
2202 
2214  public function renderNavigation(array $a_items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false, $a_blpg = 0)
2215  {
2216  $ilCtrl = $this->ctrl;
2218 
2219  $blpg = ($a_blpg > 0)
2220  ? $a_blpg
2221  : $this->blpg;
2222 
2223  if ($this->object->getOrder()) {
2224  $order = array_flip($this->object->getOrder());
2225  } else {
2226  $order = array(
2227  "navigation" => 0
2228  ,"keywords" => 2
2229  ,"authors" => 1
2230  );
2231  }
2232 
2233  $wtpl = new ilTemplate("tpl.blog_list_navigation.html", true, true, "Modules/Blog");
2234 
2235  $blocks = array();
2236 
2237  // by date
2238  if (sizeof($a_items)) {
2239  $blocks[$order["navigation"]] = array(
2240  $this->lng->txt("blog_navigation"),
2241  $this->renderNavigationByDate($a_items, $a_list_cmd, $a_posting_cmd, $a_link_template, $a_show_inactive, $a_blpg)
2242  );
2243  }
2244 
2245  if ($this->object->hasKeywords()) {
2246  // keywords
2247  $may_edit_keywords = ($blpg > 0 &&
2248  $this->mayEditPosting($blpg) &&
2249  $a_list_cmd != "preview" &&
2250  $a_list_cmd != "gethtml" &&
2251  !$a_link_template);
2252  $keywords = $this->renderNavigationByKeywords($a_list_cmd, $a_show_inactive, $a_link_template, $a_blpg);
2253  if ($keywords || $may_edit_keywords) {
2254  if (!$keywords) {
2255  $keywords = $this->lng->txt("blog_no_keywords");
2256  }
2257  $cmd = null;
2258  $blocks[$order["keywords"]] = array(
2259  $this->lng->txt("blog_keywords"),
2260  $keywords,
2261  $cmd
2262  ? array($cmd, $this->lng->txt("blog_edit_keywords"))
2263  : null
2264  );
2265  }
2266  }
2267 
2268  // is not part of (html) export
2269  if (!$a_link_template) {
2270  // authors
2271  if ($this->id_type == self::REPOSITORY_NODE_ID &&
2272  $this->object->hasAuthors()) {
2273  $authors = $this->renderNavigationByAuthors($a_items, $a_list_cmd, $a_show_inactive);
2274  if ($authors) {
2275  $blocks[$order["authors"]] = array($this->lng->txt("blog_authors"), $authors);
2276  }
2277  }
2278 
2279  // rss
2280  if ($this->object->hasRSS() &&
2281  $ilSetting->get('enable_global_profiles') &&
2282  $a_list_cmd == "preview") {
2283  // #10827
2284  $blog_id = $this->node_id;
2285  if ($this->id_type != self::WORKSPACE_NODE_ID) {
2286  $blog_id .= "_cll";
2287  }
2288  $url = ILIAS_HTTP_PATH . "/feed.php?blog_id=" . $blog_id .
2289  "&client_id=" . rawurlencode(CLIENT_ID);
2290 
2291  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
2292  $wtpl->setVariable("RSS_BUTTON", ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS, $url));
2293  }
2294  }
2295 
2296  if (sizeof($blocks)) {
2297  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
2298 
2299  ksort($blocks);
2300  foreach ($blocks as $block) {
2301  $panel = ilPanelGUI::getInstance();
2302  $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
2303  $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
2304  $panel->setHeading($block[0]);
2305  $panel->setBody($block[1]);
2306 
2307  if (isset($block[2]) && is_array($block[2])) {
2308  $panel->setFooter('<a href="' . $block[2][0] . '">' . $block[2][1] . '</a>');
2309  }
2310 
2311  $wtpl->setCurrentBlock("block_bl");
2312  $wtpl->setVariable("BLOCK", $panel->getHTML());
2313  $wtpl->parseCurrentBlock();
2314  }
2315  }
2316 
2317  return $wtpl->get();
2318  }
2319 
2327  public function getKeywords($a_show_inactive, $a_posting_id = null)
2328  {
2329  $keywords = array();
2330  include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
2331  if ($a_posting_id) {
2332  foreach (ilBlogPosting::getKeywords($this->obj_id, $a_posting_id) as $keyword) {
2333  $keywords[$keyword]++;
2334  }
2335  } else {
2336  foreach ($this->items as $month => $items) {
2337  foreach ($items as $item) {
2338  if ($a_show_inactive || ilBlogPosting::_lookupActive($item["id"], "blp")) {
2339  foreach (ilBlogPosting::getKeywords($this->obj_id, $item["id"]) as $keyword) {
2340  $keywords[$keyword]++;
2341  }
2342  }
2343  }
2344  }
2345  }
2346 
2347  // #15881
2348  $tmp = array();
2349  foreach ($keywords as $keyword => $counter) {
2350  $tmp[] = array("keyword" => $keyword, "counter" => $counter);
2351  }
2352  $tmp = ilUtil::sortArray($tmp, "keyword", "ASC");
2353 
2354  $keywords = array();
2355  foreach ($tmp as $item) {
2356  $keywords[$item["keyword"]] = $item["counter"];
2357  }
2358  return $keywords;
2359  }
2360 
2366  public function buildExportFile()
2367  {
2368  // create export file
2369  include_once("./Services/Export/classes/class.ilExport.php");
2370  ilExport::_createExportDirectory($this->object->getId(), "html", "blog");
2371  $exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "blog");
2372 
2373  $subdir = $this->object->getType() . "_" . $this->object->getId();
2374  $export_dir = $exp_dir . "/" . $subdir;
2375 
2376  // initialize temporary target directory
2377  ilUtil::delDir($export_dir);
2378  ilUtil::makeDir($export_dir);
2379 
2380  // system style html exporter
2381  include_once("./Services/Style/System/classes/class.ilSystemStyleHTMLExport.php");
2382  $this->sys_style_html_export = new ilSystemStyleHTMLExport($export_dir);
2383  $this->sys_style_html_export->addImage("icon_blog.svg");
2384  $this->sys_style_html_export->export();
2385 
2386  // init co page html exporter
2387  include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
2388  $this->co_page_html_export = new ilCOPageHTMLExport($export_dir);
2389  $this->co_page_html_export->setContentStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
2390  $this->object->getStyleSheetId(),
2391  "blog"
2392  ));
2393  $this->co_page_html_export->createDirectories();
2394  $this->co_page_html_export->exportStyles();
2395  $this->co_page_html_export->exportSupportScripts();
2396 
2397  // banner / profile picture
2398  $blga_set = new ilSetting("blga");
2399  if ($blga_set->get("banner")) {
2400  $banner = $this->object->getImageFullPath();
2401  if ($banner) {
2402  copy($banner, $export_dir . "/" . basename($banner));
2403  }
2404  }
2405  $ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "xsmall", true, true);
2406  if ($ppic) {
2407  $ppic = array_shift(explode("?", $ppic));
2408  copy($ppic, $export_dir . "/" . basename($ppic));
2409  }
2410 
2411  // export pages
2412  $this->exportHTMLPages($export_dir);
2413 
2414  // zip everything
2415  if (true) {
2416  // zip it all
2417  $date = time();
2418  $zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "blog") .
2419  "/" . $date . "__" . IL_INST_ID . "__" .
2420  $this->object->getType() . "_" . $this->object->getId() . ".zip";
2421  ilUtil::zip($export_dir, $zip_file);
2422  ilUtil::delDir($export_dir);
2423  }
2424 
2425  return $zip_file;
2426  }
2427 
2437  public function exportHTMLPages($a_target_directory, $a_link_template = null, $a_tpl_callback = null, $a_co_page_html_export = null, $a_index_name = "index.html")
2438  {
2439  require_once('Services/MathJax/classes/class.ilMathJax.php');
2441 
2442  if (!$a_link_template) {
2443  $a_link_template = "bl{TYPE}_{ID}.html";
2444  }
2445 
2446  if ($a_co_page_html_export) {
2447  $this->co_page_html_export = $a_co_page_html_export;
2448  }
2449 
2450 
2451  // lists
2452 
2453  // global nav
2454  $nav = $this->renderNavigation($this->items, "", "", $a_link_template);
2455 
2456  // month list
2457  $has_index = false;
2458  foreach (array_keys($this->items) as $month) {
2459  $list = $this->renderList($this->items[$month], "render", $a_link_template, false, $a_target_directory);
2460 
2461  if (!$list) {
2462  continue;
2463  }
2464 
2465  if (!$a_tpl_callback) {
2466  $tpl = $this->buildExportTemplate();
2467  } else {
2468  $tpl = call_user_func($a_tpl_callback);
2469  }
2470 
2471  $file = $this->buildExportLink($a_link_template, "list", $month);
2472  $file = $this->writeExportFile(
2473  $a_target_directory,
2474  $file,
2475  $tpl,
2476  $list,
2477  $nav
2478  );
2479 
2480  if (!$has_index) {
2481  copy($file, $a_target_directory . "/" . $a_index_name);
2482  $has_index = true;
2483  }
2484  }
2485 
2486  // keywords
2487  foreach (array_keys($this->getKeywords(false)) as $keyword) {
2488  $this->keyword = $keyword;
2489  $list_items = $this->filterItemsByKeyword($this->items, $keyword);
2490  $list = $this->renderList($list_items, "render", $a_link_template, false, $a_target_directory);
2491 
2492  if (!$list) {
2493  continue;
2494  }
2495 
2496  if (!$a_tpl_callback) {
2497  $tpl = $this->buildExportTemplate();
2498  } else {
2499  $tpl = call_user_func($a_tpl_callback);
2500  }
2501 
2502  $file = $this->buildExportLink($a_link_template, "keyword", $keyword);
2503  $file = $this->writeExportFile(
2504  $a_target_directory,
2505  $file,
2506  $tpl,
2507  $list,
2508  $nav
2509  );
2510  }
2511 
2512 
2513  // single postings
2514 
2515  include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
2516  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2517  $pages = ilBlogPosting::getAllPostings($this->object->getId(), 0);
2518  foreach ($pages as $page) {
2519  if (ilBlogPosting::_exists("blp", $page["id"])) {
2520  include_once("./Modules/Blog/classes/class.ilBlogPostingGUI.php");
2521  $blp_gui = new ilBlogPostingGUI(0, null, $page["id"]);
2522  $blp_gui->setOutputMode("offline");
2523  $blp_gui->setFullscreenLink("fullscreen.html"); // #12930 - see page.xsl
2524  $blp_gui->add_date = true;
2525  $page_content = $blp_gui->showPage();
2526 
2527  $back = $this->buildExportLink(
2528  $a_link_template,
2529  "list",
2530  substr($page["created"]->get(IL_CAL_DATE), 0, 7)
2531  );
2532 
2533  $file = $this->buildExportLink($a_link_template, "posting", $page["id"]);
2534 
2535  if (!$a_tpl_callback) {
2536  $tpl = $this->buildExportTemplate();
2537  } else {
2538  $tpl = call_user_func($a_tpl_callback);
2539  }
2540 
2541  // posting nav
2542  $nav = $this->renderNavigation(
2543  $this->items,
2544  "",
2545  "",
2546  $a_link_template,
2547  false,
2548  $page["id"]
2549  );
2550 
2551  $this->writeExportFile(
2552  $a_target_directory,
2553  $file,
2554  $tpl,
2555  $page_content,
2556  $nav,
2557  $back
2558  );
2559 
2560  $this->co_page_html_export->collectPageElements("blp:pg", $page["id"]);
2561  }
2562  }
2563  $this->co_page_html_export->exportPageElements();
2564  }
2565 
2574  protected function buildExportLink($a_template, $a_type, $a_id)
2575  {
2576  switch ($a_type) {
2577  case "list":
2578  $a_type = "m";
2579  break;
2580  break;
2581 
2582  case "keyword":
2583  if (!self::$keyword_export_map) {
2584  self::$keyword_export_map = array_flip(array_keys($this->getKeywords(false)));
2585  }
2586  $a_id = self::$keyword_export_map[$a_id];
2587  $a_type = "k";
2588  break;
2589 
2590  default:
2591  $a_type = "p";
2592  break;
2593  }
2594 
2595  $link = str_replace("{TYPE}", $a_type, $a_template);
2596  return str_replace("{ID}", $a_id, $link);
2597  }
2598 
2605  protected function buildExportTemplate($a_back_url = "")
2606  {
2607  $ilTabs = $this->tabs;
2608  $lng = $this->lng;
2609 
2610  $tpl = $this->co_page_html_export->getPreparedMainTemplate();
2611 
2612  $tpl->getStandardTemplate();
2613 
2614  $ilTabs->clearTargets();
2615  if ($a_back_url) {
2616  $ilTabs->setBackTarget($lng->txt("back"), $a_back_url);
2617  }
2618 
2619  $this->renderFullscreenHeader($tpl, $this->object->getOwner(), true);
2620 
2621  return $tpl;
2622  }
2623 
2634  protected function writeExportFile($a_target_directory, $a_file, $a_tpl, $a_content, $a_right_content = null, $a_back = null)
2635  {
2636  $file = $a_target_directory . "/" . $a_file;
2637  // return if file is already existing
2638  if (@is_file($file)) {
2639  return;
2640  }
2641 
2642  // export template: page content
2643  $ep_tpl = new ilTemplate(
2644  "tpl.export_page.html",
2645  true,
2646  true,
2647  "Modules/Blog"
2648  );
2649  if ($a_back) {
2650  $ep_tpl->setVariable("PAGE_CONTENT", $a_content);
2651  } else {
2652  $ep_tpl->setVariable("LIST", $a_content);
2653  }
2654  unset($a_content);
2655  $a_tpl->setContent($ep_tpl->get());
2656  unset($ep_tpl);
2657 
2658  // template: right content
2659  if ($a_right_content) {
2660  $a_tpl->setRightContent($a_right_content);
2661  unset($a_right_content);
2662  }
2663 
2664  $content = $a_tpl->get(
2665  "DEFAULT",
2666  false,
2667  false,
2668  false,
2669  true,
2670  true,
2671  true
2672  );
2673 
2674  // open file
2675  if (!file_put_contents($file, $content)) {
2676  die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
2677  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
2678  }
2679 
2680  // set file permissions
2681  chmod($file, 0770);
2682 
2683  return $file;
2684  }
2685 
2686  public function getNotesSubId()
2687  {
2688  return $this->blpg;
2689  }
2690 
2691  public function disableNotes($a_value = false)
2692  {
2693  $this->disable_notes = (bool) $a_value;
2694  }
2695 
2696  protected function addHeaderActionForCommand($a_cmd)
2697  {
2698  $ilUser = $this->user;
2699  $ilCtrl = $this->ctrl;
2700 
2701  // preview?
2702  if ($a_cmd == "preview" || $a_cmd == "previewFullscreen" || $this->prvm) {
2703  // notification
2704  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
2705  if (!$this->prvm) {
2706  $ilCtrl->setParameter($this, "prvm", "fsc");
2707  }
2708  $this->insertHeaderAction($this->initHeaderAction(null, null, true));
2709  if (!$this->prvm) {
2710  $ilCtrl->setParameter($this, "prvm", "");
2711  }
2712  }
2713  } else {
2714  return parent::addHeaderAction();
2715  }
2716  }
2717 
2718  protected function initHeaderAction($sub_type = null, $sub_id = null, $a_is_preview = false)
2719  {
2720  $ilUser = $this->user;
2721  $ilCtrl = $this->ctrl;
2722 
2723  if (!$this->obj_id) {
2724  return false;
2725  }
2726 
2727  $sub_type = $sub_id = null;
2728  if ($this->blpg > 0) {
2729  $sub_type = "blp";
2730  $sub_id = $this->blpg;
2731  }
2732 
2733  $lg = parent::initHeaderAction($sub_type, $sub_id);
2734 
2735  if ($a_is_preview) {
2736  $lg->enableComments(false);
2737  $lg->enableNotes(false);
2738  $lg->enableTags(false);
2739 
2740  include_once "./Services/Notification/classes/class.ilNotification.php";
2742  $ilCtrl->setParameter($this, "ntf", 1);
2743  $link = $ilCtrl->getLinkTarget($this, "setNotification");
2744  $ilCtrl->setParameter($this, "ntf", "");
2745  if (ilNotification::hasOptOut($this->obj_id)) {
2746  $lg->addCustomCommand($link, "blog_notification_toggle_off");
2747  }
2748 
2749  $lg->addHeaderIcon(
2750  "not_icon",
2751  ilUtil::getImagePath("notification_on.svg"),
2752  $this->lng->txt("blog_notification_activated")
2753  );
2754  } else {
2755  $ilCtrl->setParameter($this, "ntf", 2);
2756  $link = $ilCtrl->getLinkTarget($this, "setNotification");
2757  $ilCtrl->setParameter($this, "ntf", "");
2758  $lg->addCustomCommand($link, "blog_notification_toggle_on");
2759 
2760  $lg->addHeaderIcon(
2761  "not_icon",
2762  ilUtil::getImagePath("notification_off.svg"),
2763  $this->lng->txt("blog_notification_deactivated")
2764  );
2765  }
2766 
2767  // #11758
2768  if ($this->mayContribute()) {
2769  $ilCtrl->setParameter($this, "prvm", "");
2770 
2771  $ilCtrl->setParameter($this, "bmn", "");
2772  $ilCtrl->setParameter($this, "blpg", "");
2773  $link = $ilCtrl->getLinkTarget($this, "");
2774  $ilCtrl->setParameter($this, "blpg", $sub_id);
2775  $ilCtrl->setParameter($this, "bmn", $this->month);
2776  $lg->addCustomCommand($link, "blog_edit"); // #11868
2777 
2778  if ($sub_id && $this->mayEditPosting($sub_id)) {
2779  $link = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edit");
2780  $lg->addCustomCommand($link, "blog_edit_posting");
2781  }
2782 
2783  $ilCtrl->setParameter($this, "prvm", "fsc");
2784  }
2785 
2786  $ilCtrl->setParameter($this, "ntf", "");
2787  }
2788 
2789  return $lg;
2790  }
2791 
2792  protected function setNotification()
2793  {
2794  $ilUser = $this->user;
2795  $ilCtrl = $this->ctrl;
2796 
2797  include_once "./Services/Notification/classes/class.ilNotification.php";
2798  switch ($this->ntf) {
2799  case 1:
2801  break;
2802 
2803  case 2:
2805  break;
2806  }
2807 
2808  $ilCtrl->redirect($this, "preview");
2809  }
2810 
2818  public static function lookupSubObjectTitle($a_blog_id, $a_posting_id)
2819  {
2820  // page might be deleted, so setting halt on errors to false
2821  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
2822  $post = new ilBlogPosting($a_posting_id);
2823  if ($post->getBlogId() == $a_blog_id) {
2824  return $post->getTitle();
2825  }
2826  }
2827 
2833  protected function filterInactivePostings()
2834  {
2835  foreach ($this->items as $month => $postings) {
2836  foreach ($postings as $id => $item) {
2837  if (!ilBlogPosting::_lookupActive($id, "blp")) {
2838  unset($this->items[$month][$id]);
2839  } elseif ($this->object->hasApproval() && !$item["approved"]) {
2840  unset($this->items[$month][$id]);
2841  }
2842  }
2843  if (!sizeof($this->items[$month])) {
2844  unset($this->items[$month]);
2845  }
2846  }
2847 
2848  if ($this->items && !isset($this->items[$this->month])) {
2849  $this->month = array_shift(array_keys($this->items));
2850  }
2851  }
2852 
2853  protected function filterItemsByKeyWord(array $a_items, $a_keyword)
2854  {
2855  $res = array();
2856  include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
2857  foreach ($a_items as $month => $items) {
2858  foreach ($items as $item) {
2859  if (in_array(
2860  $a_keyword,
2861  ilBlogPosting::getKeywords($this->obj_id, $item["id"])
2862  )) {
2863  $res[] = $item;
2864  }
2865  }
2866  }
2867  return $res;
2868  }
2869 
2875  protected function isAdmin()
2876  {
2877  return ($this->checkPermissionBool("redact") ||
2878  $this->checkPermissionBool("write"));
2879  }
2880 
2888  protected function mayEditPosting($a_posting_id, $a_author_id = null)
2889  {
2890  $ilUser = $this->user;
2891 
2892  // single author blog (owner) in personal workspace
2893  if ($this->id_type == self::WORKSPACE_NODE_ID) {
2894  return $this->checkPermissionBool("write");
2895  }
2896 
2897  // repository blogs
2898 
2899  // redact allows to edit all postings
2900  if ($this->checkPermissionBool("redact")) {
2901  return true;
2902  }
2903 
2904  // contribute gives access to own postings
2905  if ($this->checkPermissionBool("contribute")) {
2906  // check owner of posting
2907  if (!$a_author_id) {
2908  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
2909  $post = new ilBlogPosting($a_posting_id);
2910  $a_author_id = $post->getAuthor();
2911  }
2912  if ($ilUser->getId() == $a_author_id) {
2913  return true;
2914  } else {
2915  return false;
2916  }
2917 
2918  return true;
2919  }
2920  return false;
2921  }
2922 
2928  protected function mayContribute()
2929  {
2930  // single author blog (owner) in personal workspace
2931  if ($this->id_type == self::WORKSPACE_NODE_ID) {
2932  return $this->checkPermissionBool("write");
2933  }
2934 
2935  return ($this->checkPermissionBool("redact") ||
2936  $this->checkPermissionBool("contribute"));
2937  }
2938 
2939  public function addLocatorItems()
2940  {
2941  $ilLocator = $this->locator;
2942 
2943  if (is_object($this->object)) {
2944  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
2945  }
2946  }
2947 
2948  public function approve()
2949  {
2950  if ($this->isAdmin() && $this->apid > 0) {
2951  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
2952  $post = new ilBlogPosting($this->apid);
2953  $post->setApproved(true);
2954  $post->setBlogNodeId($this->node_id, ($this->id_type == self::WORKSPACE_NODE_ID));
2955  $post->update(true, false, true, "new"); // #13434
2956 
2957  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
2958  }
2959 
2960  $this->ctrl->redirect($this, "render");
2961  }
2962 
2963 
2964  //
2965  // contributors
2966  //
2967 
2968  public function contributors()
2969  {
2970  $ilTabs = $this->tabs;
2971  $ilToolbar = $this->toolbar;
2972  $ilCtrl = $this->ctrl;
2973  $lng = $this->lng;
2974  $tpl = $this->tpl;
2975 
2976  if (!$this->checkPermissionBool("write")) {
2977  return;
2978  }
2979 
2980  $ilTabs->activateTab("contributors");
2981 
2982  $local_roles = $this->object->getAllLocalRoles($this->node_id);
2983 
2984  // add member
2985  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
2987  $this,
2988  $ilToolbar,
2989  array(
2990  'auto_complete_name' => $lng->txt('user'),
2991  'submit_name' => $lng->txt('add'),
2992  'add_search' => true,
2993  'add_from_container' => $this->node_id,
2994  'user_type' => $local_roles
2995  ),
2996  true
2997  );
2998 
2999  $other_roles = $this->object->getRolesWithContributeOrRedact($this->node_id);
3000  if ($other_roles) {
3001  ilUtil::sendInfo(sprintf($lng->txt("blog_contribute_other_roles"), implode(", ", $other_roles)));
3002  }
3003 
3004  include_once "Modules/Blog/classes/class.ilContributorTableGUI.php";
3005  $tbl = new ilContributorTableGUI($this, "contributors", $this->object->getAllLocalRoles($this->node_id));
3006 
3007  $tpl->setContent($tbl->getHTML());
3008  }
3009 
3013  public function addUserFromAutoComplete()
3014  {
3015  $lng = $this->lng;
3016 
3017  $user_login = ilUtil::stripSlashes($_POST['user_login']);
3018  $user_type = ilUtil::stripSlashes($_POST["user_type"]);
3019 
3020  if (!strlen(trim($user_login))) {
3021  ilUtil::sendFailure($lng->txt('msg_no_search_string'));
3022  return $this->contributors();
3023  }
3024  $users = explode(',', $user_login);
3025 
3026  $user_ids = array();
3027  foreach ($users as $user) {
3028  $user_id = ilObjUser::_lookupId($user);
3029 
3030  if (!$user_id) {
3031  ilUtil::sendFailure($lng->txt('user_not_known'));
3032  return $this->contributors();
3033  }
3034 
3035  $user_ids[] = $user_id;
3036  }
3037 
3038  return $this->addContributor($user_ids, $user_type);
3039  }
3040 
3046  public function addContributor($a_user_ids = array(), $a_user_type = null)
3047  {
3048  $ilCtrl = $this->ctrl;
3049  $lng = $this->lng;
3052 
3053  if (!$this->checkPermissionBool("write")) {
3054  return;
3055  }
3056 
3057  if (!count($a_user_ids) || !$a_user_type) {
3058  ilUtil::sendFailure($lng->txt("no_checkbox"));
3059  return $this->contributors();
3060  }
3061 
3062  // get contributor role
3063  $local_roles = array_keys($this->object->getAllLocalRoles($this->node_id));
3064  if (!in_array($a_user_type, $local_roles)) {
3065  ilUtil::sendFailure($lng->txt("missing_perm"));
3066  return $this->contributors();
3067  }
3068 
3069  foreach ($a_user_ids as $user_id) {
3070  if (!$rbacreview->isAssigned($user_id, $a_user_type)) {
3071  $rbacadmin->assignUser($a_user_type, $user_id);
3072  }
3073  }
3074 
3075  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
3076  $ilCtrl->redirect($this, "contributors");
3077  }
3078 
3082  public function confirmRemoveContributor()
3083  {
3084  $ids = ilUtil::stripSlashesRecursive($_POST["id"]);
3085 
3086  if (!is_array($ids)) {
3087  ilUtil::sendFailure($this->lng->txt("select_one"), true);
3088  $this->ctrl->redirect($this, "contributors");
3089  }
3090 
3091  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
3092  $confirm = new ilConfirmationGUI();
3093  $confirm->setHeaderText($this->lng->txt('blog_confirm_delete_contributors'));
3094  $confirm->setFormAction($this->ctrl->getFormAction($this, 'removeContributor'));
3095  $confirm->setConfirm($this->lng->txt('delete'), 'removeContributor');
3096  $confirm->setCancel($this->lng->txt('cancel'), 'contributors');
3097 
3098  include_once 'Services/User/classes/class.ilUserUtil.php';
3099 
3100  foreach ($ids as $user_id) {
3101  $confirm->addItem(
3102  'id[]',
3103  $user_id,
3104  ilUserUtil::getNamePresentation($user_id, false, false, "", true)
3105  );
3106  }
3107 
3108  $this->tpl->setContent($confirm->getHTML());
3109  }
3110 
3114  public function removeContributor()
3115  {
3116  $ilCtrl = $this->ctrl;
3117  $lng = $this->lng;
3119 
3120  $ids = ilUtil::stripSlashesRecursive($_POST["id"]);
3121 
3122  if (!is_array($ids)) {
3123  ilUtil::sendFailure($lng->txt("select_one"), true);
3124  $ilCtrl->redirect($this, "contributors");
3125  }
3126 
3127  // get contributor role
3128  $local_roles = array_keys($this->object->getAllLocalRoles($this->node_id));
3129  if (!$local_roles) {
3130  ilUtil::sendFailure($lng->txt("missing_perm"));
3131  return $this->contributors();
3132  }
3133 
3134  foreach ($ids as $user_id) {
3135  foreach ($local_roles as $role_id) {
3136  $rbacadmin->deassignUser($role_id, $user_id);
3137  }
3138  }
3139 
3140  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
3141  $this->ctrl->redirect($this, "contributors");
3142  }
3143 
3147  public function addToDeskObject()
3148  {
3149  $lng = $this->lng;
3150 
3151  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
3153  ilUtil::sendSuccess($lng->txt("added_to_desktop"));
3154  }
3155 
3159  public function removeFromDeskObject()
3160  {
3161  $lng = $this->lng;
3162 
3163  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
3165  ilUtil::sendSuccess($lng->txt("removed_from_desktop"));
3166  }
3167 
3168  public function deactivateAdmin()
3169  {
3170  if ($this->checkPermissionBool("write") && $this->apid > 0) {
3171  // ilBlogPostingGUI::deactivatePage()
3172  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
3173  $post = new ilBlogPosting($this->apid);
3174  $post->setApproved(false);
3175  $post->setActive(false);
3176  $post->update(true, false, false);
3177 
3178  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
3179  }
3180 
3181  $this->ctrl->redirect($this, "render");
3182  }
3183 
3184 
3188 
3189  public function setContentStyleSheet($a_tpl = null)
3190  {
3191  $tpl = $this->tpl;
3192 
3193  if ($a_tpl != null) {
3194  $ctpl = $a_tpl;
3195  } else {
3196  $ctpl = $tpl;
3197  }
3198 
3199  $ctpl->setCurrentBlock("ContentStyle");
3200  $ctpl->setVariable(
3201  "LOCATION_CONTENT_STYLESHEET",
3202  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
3203  );
3204  $ctpl->parseCurrentBlock();
3205  }
3206 
3207  public function editStyleProperties()
3208  {
3209  $this->checkPermission("write");
3210 
3211  $this->tabs_gui->activateTab("settings");
3212  $this->setSettingsSubTabs("style");
3213 
3214  $form = $this->initStylePropertiesForm();
3215  $this->tpl->setContent($form->getHTML());
3216  }
3217 
3218  public function initStylePropertiesForm()
3219  {
3221 
3222  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
3223  $this->lng->loadLanguageModule("style");
3224 
3225  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3226  $form = new ilPropertyFormGUI();
3227 
3228  $fixed_style = $ilSetting->get("fixed_content_style_id");
3229  $style_id = $this->object->getStyleSheetId();
3230 
3231  if ($fixed_style > 0) {
3232  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
3233  $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
3234  $this->lng->txt("global_fixed") . ")");
3235  $form->addItem($st);
3236  } else {
3238  true,
3239  false,
3240  $this->ref_id
3241  );
3242 
3243  $st_styles[0] = $this->lng->txt("default");
3244  ksort($st_styles);
3245 
3246  if ($style_id > 0) {
3247  // individual style
3248  if (!ilObjStyleSheet::_lookupStandard($style_id)) {
3249  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
3250  $st->setValue(ilObject::_lookupTitle($style_id));
3251  $form->addItem($st);
3252 
3253  // delete command
3254  $form->addCommandButton("editStyle", $this->lng->txt("style_edit_style"));
3255  $form->addCommandButton("deleteStyle", $this->lng->txt("style_delete_style"));
3256  }
3257  }
3258 
3259  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
3260  $style_sel = new ilSelectInputGUI(
3261  $this->lng->txt("style_current_style"),
3262  "style_id"
3263  );
3264  $style_sel->setOptions($st_styles);
3265  $style_sel->setValue($style_id);
3266  $form->addItem($style_sel);
3267 
3268  $form->addCommandButton("saveStyleSettings", $this->lng->txt("save"));
3269  $form->addCommandButton("createStyle", $this->lng->txt("sty_create_ind_style"));
3270  }
3271  }
3272 
3273  $form->setTitle($this->lng->txt("blog_style"));
3274  $form->setFormAction($this->ctrl->getFormAction($this));
3275 
3276  return $form;
3277  }
3278 
3279  public function createStyle()
3280  {
3281  $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
3282  }
3283 
3284  public function editStyle()
3285  {
3286  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
3287  }
3288 
3289  public function deleteStyle()
3290  {
3291  $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
3292  }
3293 
3294  public function saveStyleSettings()
3295  {
3297 
3298  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
3299  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
3300  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
3301  || $this->object->getStyleSheetId() == 0)) {
3302  $this->object->setStyleSheetId((int) $_POST["style_id"]);
3303  $this->object->update();
3304 
3305  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
3306  }
3307  $this->ctrl->redirect($this, "editStyleProperties");
3308  }
3309 
3315  public static function _goto($a_target)
3316  {
3317  global $DIC;
3318 
3319  $ilCtrl = $DIC->ctrl();
3320 
3321  if (substr($a_target, -3) == "wsp") {
3322  $id = explode("_", $a_target);
3323 
3324  $ilCtrl->setTargetScript("ilias.php");
3325  $ilCtrl->initBaseClass("ilSharedResourceGUI");
3326  $ilCtrl->setParameterByClass("ilSharedResourceGUI", "wsp_id", $id[0]);
3327 
3328  if (sizeof($id) >= 2) {
3329  if (is_numeric($id[1])) {
3330  $ilCtrl->setParameterByClass("ilSharedResourceGUI", "gtp", $id[1]);
3331  } else {
3332  $ilCtrl->setParameterByClass("ilSharedResourceGUI", "kwd", $id[1]);
3333  }
3334  }
3335  $ilCtrl->redirectByClass("ilSharedResourceGUI", "");
3336  } else {
3337  $id = explode("_", $a_target);
3338 
3339  $ilCtrl->setTargetScript("ilias.php");
3340  $ilCtrl->initBaseClass("ilRepositoryGUI");
3341  $ilCtrl->setParameterByClass("ilRepositoryGUI", "ref_id", $id[0]);
3342 
3343  if (sizeof($id) == 2) {
3344  if (is_numeric($id[1])) {
3345  $ilCtrl->setParameterByClass("ilRepositoryGUI", "gtp", $id[1]);
3346  } else {
3347  $ilCtrl->setParameterByClass("ilRepositoryGUI", "kwd", $id[1]);
3348  }
3349  }
3350  $ilCtrl->redirectByClass("ilRepositoryGUI", "preview");
3351  }
3352  }
3353 }
static _createExportDirectory($a_obj_id, $a_export_type="xml", $a_obj_type="")
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _lookupName($a_user_id)
lookup user name
setLocator()
set Locator
getLatestPosting($a_items)
Get previous posting.
filterInactivePostings()
Filter inactive items from items list.
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
const ABSTRACT_DEFAULT_IMAGE_WIDTH
This class represents an option in a radio group.
static get($a_type, $a_href="")
Get icon html.
$lg
Definition: example_018.php:62
addUserFromAutoComplete()
Autocomplete submit.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
disableNotes($a_value=false)
settings()
Definition: settings.php:2
Class ilInfoScreenGUI.
mayContribute()
Check if user may contribute at all.
renderFullscreenHeader($a_tpl, $a_user_id, $a_export=false)
Render banner, user name.
static lookupBlogId($a_posting_id)
Lookup blog id.
getNextPosting($a_items)
Get next posting.
Class ilBlogPosting.
getItemByPostVar($a_post_var)
Get Item by POST variable.
This class represents a selection list property in a property form.
preview()
Render fullscreen presentation.
This class represents a property form user interface.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
global $DIC
Definition: saml.php:7
HTML export class for pages.
static _goto($a_target)
Deep link.
$_GET["client_id"]
$tbl
Definition: example_048.php:81
static lookupSubObjectTitle($a_blog_id, $a_posting_id)
Get title for blog posting (used in ilNotesGUI)
This class represents a section header in a property form.
Class ilBlogPosting GUI class.
getAccessHandler()
Get access handler.
$preview
getPermanentLinkWidget($a_append=null, $a_center=false)
HTML export class for system styles.
getPreviousMonth($a_items)
Get next month.
if(!array_key_exists('StateId', $_REQUEST)) $id
static hasOptOut($obj_id)
Is opt out (disable notification) allowed?
buildExportTemplate($a_back_url="")
Build export "frame".
static _lookupId($a_user_str)
Lookup id by login.
This class represents a checkbox property in a property form.
const NAV_MODE_LIST
static _lookupTitle($a_id)
lookup object title
static _getNotesOfObject( $a_rep_obj_id, $a_obj_id, $a_obj_type, $a_type=IL_NOTE_PRIVATE, $a_incl_sub=false, $a_filter="", $a_all_public="y", $a_repository_mode=true, $a_sort_ascending=false, $a_news_id=0)
get all notes related to a specific object
static _getStandardStyles( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
addItem($a_item)
Add Item (Property, SectionHeader).
static getKeywords($a_obj_id, $a_posting_id)
setMultiValues(array $a_values)
Set multi values.
export()
Build and deliver export file.
const ABSTRACT_DEFAULT_SHORTEN_LENGTH
static addToDesktop()
Add desktop item public.
setInfo($a_info)
Set Info.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
$auth
Definition: fileserver.php:48
user()
Definition: user.php:4
updateCustom(ilPropertyFormGUI $a_form)
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
Class ilBlogExerciseGUI.
initEditCustomForm(ilPropertyFormGUI $a_form)
filterItemsByKeyWord(array $a_items, $a_keyword)
static _lookupStandard($a_id)
Lookup standard flag.
global $ilCtrl
Definition: ilias.php:18
renderNavigationByKeywords( $a_list_cmd="render", $a_show_inactive=false, $a_link_template=false, $a_blpg=0)
Build navigation by keywords block.
getEditFormCustomValues(array &$a_values)
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
renderNavigationByDate(array $a_items, $a_list_cmd="render", $a_posting_cmd="preview", $a_link_template=null, $a_show_inactive=false, $a_blpg=0)
Build navigation by date block.
$a_type
Definition: workflow.php:92
Export User Interface Class.
getListItems($a_show_inactive=false)
Filter blog postings by month, keyword or author.
buildEmbedded($a_content, $a_nav)
Combine content (list/posting) and navigation to html chunk.
catch(Exception $e) $message
renderList(array $items, $a_cmd="preview", $a_link_template=null, $a_show_inactive=false, $a_export_directory=null)
Build posting month list.
This class represents a property in a property form.
static exists($a_blog_id, $a_posting_id)
Checks whether a posting exists.
buildExportFile()
Build export file.
getNextMonth($a_items)
Get next month.
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
foreach($_POST as $key=> $value) $res
renderFullScreen($a_content, $a_navigation)
Build fullscreen context.
if(isset($_POST['submit'])) $form
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
$a_content
Definition: workflow.php:93
const ABSTRACT_DEFAULT_IMAGE_HEIGHT
Class ilObjBlogGUI.
static setPersonalWorkspaceQuotaCheck($a_value)
buildPostingList($a_obj_id)
Gather all blog postings.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
confirmRemoveContributor()
Used in ilContributorTableGUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
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.
special template class to simplify handling of ITX/PEAR
omitLocator($a_omit=true)
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
This class represents a text property in a property form.
$post
Definition: post.php:34
$ilUser
Definition: imgupload.php:18
render()
Render object context.
static _lookupOwner($a_id)
lookup object owner
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 signFile($path_to_file)
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
setOptions($a_options)
Set Options.
static getRelevanceClass($cnt, $max)
Get style class for tag relevance.
addContributor($a_user_ids=array(), $a_user_type=null)
Centralized method to add contributors.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
const PURPOSE_EXPORT
$users
Definition: authpage.php:44
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
createPosting()
Create new posting.
infoScreenForward()
show information screen
renderNavigation(array $a_items, $a_list_cmd="render", $a_posting_cmd="preview", $a_link_template=null, $a_show_inactive=false, $a_blpg=0)
Build navigation blocks.
setSize($a_size)
Set Size.
User interface class for advanced drop-down selection lists.
buildExportLink($a_template, $a_type, $a_id)
Build static export link.
removeContributor()
Used in ilContributorTableGUI.
This class represents an image file property in a property form.
static removeFromDesktop()
Remove item from personal desktop public.
getKeywords($a_show_inactive, $a_posting_id=null)
Get keywords for single posting or complete blog.
renderNavigationByAuthors(array $a_items, $a_list_cmd="render", $a_show_inactive=false)
static getInstance()
Get instance.
const IL_CAL_DATE
setContentStyleSheet($a_tpl=null)
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
isAdmin()
Check if user has admin access (approve, may edit & deactivate all postings)
This class represents a non editable value in a property form.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
static getInstance()
Singleton: get instance.
Class ilObjStyleSheetGUI.
global $ilSetting
Definition: privfeed.php:17
setSettingsSubTabs($a_active)
Handles general notification settings, see e.g.
insertHeaderAction($a_list_gui)
Insert header action into main template.
$ret
Definition: parser.php:6
initCreationForms($a_new_type)
initHeaderAction($sub_type=null, $sub_id=null, $a_is_preview=false)
const PANEL_STYLE_SECONDARY
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
prepareOutput($a_show_subobjects=true)
getPreviousPosting($a_items)
Get previous posting.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$url
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
getObjectService()
Get object service.
const HEADING_STYLE_BLOCK
getLatestMonth($a_items)
Get next month.
const NAV_MODE_MONTH
List all contributors members of a blog.
writeExportFile($a_target_directory, $a_file, $a_tpl, $a_content, $a_right_content=null, $a_back=null)
Write HTML to file.
$info
Definition: index.php:5
static checkExercise($a_node_id)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
addHeaderActionForCommand($a_cmd)
$_POST["username"]
afterSave(ilObject $a_new_object)
setRequired($a_required)
Set Required.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
renderToolbarNavigation($a_items, $single_posting=false)
Toolbar navigation.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Confirmation screen class.
getHTML()
Return embeddable HTML chunk.
exportHTMLPages($a_target_directory, $a_link_template=null, $a_tpl_callback=null, $a_co_page_html_export=null, $a_index_name="index.html")
Export all pages.
mayEditPosting($a_posting_id, $a_author_id=null)
Check if user may edit posting.