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