ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilWikiPageGUI.php
Go to the documentation of this file.
1 <?php
2 
21 
33 {
34  protected \ILIAS\Exercise\InternalDomainService $exc_domain;
35  protected \ILIAS\Wiki\InternalDomainService $domain;
36  protected \ILIAS\Wiki\Page\PageManager $wiki_pm;
37  protected Translations $ot;
38  protected \ILIAS\Wiki\InternalGUIService $wiki_gui;
39  protected \ILIAS\Notes\Service $notes;
40  protected \ILIAS\HTTP\Services $http;
41  protected \ILIAS\Wiki\WikiGUIRequest $wiki_request;
43  protected bool $fill_on_load_code = false;
44  protected int $wiki_ref_id = 0;
45  protected ilSetting $settings;
46  protected ilObjWiki $wiki;
47 
48  public function __construct(
49  int $a_id = 0,
50  int $a_old_nr = 0,
51  int $a_wiki_ref_id = 0,
52  string $lang = "-"
53  ) {
55  global $DIC;
56 
57  $service = $DIC->wiki()->internal();
58  $domain = $service->domain();
59  $gui = $service->gui();
60 
61  $this->domain = $domain;
62  $this->settings = $domain->settings();
63  $this->http = $gui->http();
64 
65  // needed for notifications
66  $this->setWikiRefId($a_wiki_ref_id);
67  parent::__construct("wpg", $a_id, $a_old_nr, false, $lang);
68  $this->getPageObject()->setWikiRefId($this->getWikiRefId());
69  $this->ctrl->saveParameterByClass(self::class, "wpg_id");
70 
71  // content style
72  $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
73  $this->wiki_request = $gui->request();
74  $this->notes = $DIC->notes();
75  $this->wiki_gui = $gui;
76  $this->ot = $gui->wiki()->translation($this->getWikiRefId());
77  $this->wiki_pm = $this->domain->page()->page($this->getWikiRefId());
78  $this->exc_domain = $DIC->exercise()->internal()->domain();
79  }
80 
81  public function setScreenIdComponent(): void
82  {
83  $ilHelp = $this->help;
84  $ilHelp->setScreenIdComponent("copgwpg");
85  }
86 
87  public function setWikiRefId(int $a_ref_id): void
88  {
89  $this->wiki_ref_id = $a_ref_id;
90  }
91 
92  public function getWikiRefId(): int
93  {
94  return $this->wiki_ref_id;
95  }
96 
97  public function setWiki(ilObjWiki $a_val): void
98  {
99  $this->wiki = $a_val;
100  }
101 
102  public function getWiki(): ilObjWiki
103  {
104  return $this->wiki;
105  }
106 
110  public function executeCommand(): string
111  {
112  $ilCtrl = $this->ctrl;
113  $ilTabs = $this->tabs_gui;
114  $ilUser = $this->user;
115  $ilAccess = $this->access;
116  $lng = $this->lng;
117  $tpl = $this->tpl;
118 
119  $next_class = $this->ctrl->getNextClass($this);
120 
121  $head_title = ilObject::_lookupTitle(ilObject::_lookupObjId($this->requested_ref_id)) .
122  ": " . $this->getWikiPage()->getTitle();
123  $tpl->setHeaderPageTitle($head_title);
124  // see #13804
125  //if ($this->wiki_request->getWikiPageId() > 0) {
126  PageContentProvider::setPermaLink($this->wiki_pm->getPermaLink(
127  $this->getPageObject()->getId(),
128  $this->getPageObject()->getLanguage()
129  ));
130  //} else {
131  // $tpl->setPermanentLink("wiki", $this->requested_ref_id);
132  //}
133 
134 
135  switch ($next_class) {
136  case "ilnotegui":
137  case "ilcommentgui":
138  $this->getTabs();
139  $ilTabs->setTabActive("pg");
140  return $this->preview();
141 
142  case "ilratinggui":
143  // for rating side block
144  $rating_gui = new ilRatingGUI();
145  $rating_gui->setObject(
146  $this->getPageObject()->getParentId(),
147  "wiki",
148  $this->getPageObject()->getId(),
149  "wpg"
150  );
151  $rating_gui->setUpdateCallback(array($this, "updateStatsRating"));
152  $this->ctrl->forwardCommand($rating_gui);
153  $ilCtrl->redirect($this, "preview");
154  break;
155 
156  case "ilcommonactiondispatchergui":
158  if (!is_null($gui)) {
159  $gui->enableCommentsSettings(false);
160  $gui->setRatingCallback(
161  $this,
162  "preview"
163  );
164  $this->ctrl->forwardCommand($gui);
165  }
166  break;
167 
168  case "ilwikistatgui":
169  if ($ilAccess->checkAccess("statistics_read", "", $this->wiki_ref_id)) {
170  $this->tabs_gui->clearTargets(); // see ilObjWikiGUI::getTabs()
171  $this->getTabs("statistics");
172 
173  $gui = new ilWikiStatGUI(
174  $this->getPageObject()->getParentId(),
175  $this->getPageObject()->getId()
176  );
177  $this->ctrl->forwardCommand($gui);
178  }
179  break;
180  case 'ilobjectmetadatagui':
181 
182  if (!$ilAccess->checkAccess("write", "", $this->wiki_ref_id)) {
183  $this->tpl->setOnScreenMessage('failure', $lng->txt("permission_denied"), true);
184  $ilCtrl->redirect($this, "preview");
185  }
186  return parent::executeCommand();
187 
188  case "ilpropertyformgui":
189  // only case is currently adv metadata internal link in info settings, see #24497
190  $form = $this->initAdvancedMetaDataForm();
191  $ilCtrl->forwardCommand($form);
192  break;
193 
194  default:
195 
196  if (strtolower($ilCtrl->getNextClass()) === "ilpageeditorgui") {
197  self::initEditingJS($this->tpl);
198  }
199 
200  if ($this->wiki_request->getNotification() > 0
201  && $ilUser->getId() !== ANONYMOUS_USER_ID) {
202  switch ($this->wiki_request->getNotification()) {
203  case 1:
204  ilNotification::setNotification(ilNotification::TYPE_WIKI, $ilUser->getId(), $this->getPageObject()->getParentId(), false);
205  break;
206 
207  case 2:
208  // remove all page notifications here?
209  ilNotification::setNotification(ilNotification::TYPE_WIKI, $ilUser->getId(), $this->getPageObject()->getParentId(), true);
210  break;
211 
212  case 3:
213  ilNotification::setNotification(ilNotification::TYPE_WIKI_PAGE, $ilUser->getId(), $this->getPageObject()->getId(), false);
214  break;
215 
216  case 4:
217  ilNotification::setNotification(ilNotification::TYPE_WIKI_PAGE, $ilUser->getId(), $this->getPageObject()->getId(), true);
218  break;
219  }
220  $ilCtrl->redirect($this, "preview");
221  }
222 
223  $this->setPresentationTitle($this->getWikiPage()->getTitle());
224  return parent::executeCommand();
225  }
226  return "";
227  }
228 
229  public function setWikiPage(ilWikiPage $a_wikipage): void
230  {
231  $this->setPageObject($a_wikipage);
232  }
233 
234  public function getWikiPage(): ilWikiPage
235  {
238  return $this->getPageObject();
239  }
240 
241  public function setSideBlock(): void
242  {
244  $this->getWikiPage()->getId(),
245  $this->wiki_ref_id,
246  $this->getWikiPage()
247  );
248  }
249 
250  public function addHeaderAction(
251  bool $a_redraw = false
252  ): string {
253  $ilUser = $this->user;
254  $ilAccess = $this->access;
255 
256  $wiki_id = $this->getPageObject()->getParentId();
257  $page_id = $this->getPageObject()->getId();
258 
259  $dispatcher = new ilCommonActionDispatcherGUI(
261  $ilAccess,
262  "wiki",
263  $this->requested_ref_id,
264  $wiki_id
265  );
266 
267  // see #33422
268  $dispatcher->setSubObject("wpg", $page_id);
269 
271  $this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true),
272  "",
273  $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false)
274  );
275 
276  $lg = $dispatcher->initHeaderAction();
277  $lg->enableNotes(true);
278  $lg->enableComments(ilObjWiki::_lookupPublicNotes($wiki_id), false);
279 
280  // rating
281  if (ilObjWiki::_lookupRatingOverall($wiki_id)) {
282  $lg->enableRating(
283  true,
284  $this->lng->txt("wiki_rate_overall"),
285  false,
286  // so ilCtrl does not use the shortcut via ilWikiGUI
287  array("ilcommonactiondispatchergui", "ilratinggui"),
288  true
289  );
290  }
291 
292  // notification
293  if ($ilUser->getId() !== ANONYMOUS_USER_ID) {
294  if (ilNotification::hasNotification(ilNotification::TYPE_WIKI, $ilUser->getId(), $wiki_id)) {
295  $this->ctrl->setParameter($this, "ntf", 1);
296  if (ilNotification::hasOptOut($wiki_id)) {
297  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_wiki");
298  }
299 
300  $lg->addHeaderIcon(
301  "not_icon",
302  ilUtil::getImagePath("object/notification_on.svg"),
303  $this->lng->txt("wiki_notification_activated")
304  );
305  } else {
306  $this->ctrl->setParameter($this, "ntf", 2);
307  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_wiki");
308 
309  if (ilNotification::hasNotification(ilNotification::TYPE_WIKI_PAGE, $ilUser->getId(), $page_id)) {
310  $this->ctrl->setParameter($this, "ntf", 3);
311  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_page");
312 
313  $lg->addHeaderIcon(
314  "not_icon",
315  ilUtil::getImagePath("object/notification_on.svg"),
316  $this->lng->txt("wiki_page_notification_activated")
317  );
318  } else {
319  $this->ctrl->setParameter($this, "ntf", 4);
320  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_page");
321 
322  $lg->addHeaderIcon(
323  "not_icon",
324  ilUtil::getImagePath("object/notification_off.svg"),
325  $this->lng->txt("wiki_notification_deactivated")
326  );
327  }
328  }
329  $this->ctrl->setParameter($this, "ntf", "");
330  }
331 
332  if (!$a_redraw) {
333  $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
334  } else {
335  // we need to add onload code manually (rating, comments, etc.)
336  return $lg->getHeaderAction() .
337  $this->tpl->getOnLoadCodeForAsynch();
338  }
339  return "";
340  }
341 
342  public function redrawHeaderAction(): void
343  {
344  echo $this->addHeaderAction(true);
345  exit;
346  }
347 
348  public function preview(): string
349  {
350  $ilCtrl = $this->ctrl;
351  $ilAccess = $this->access;
352  $lng = $this->lng;
353  $tpl = $this->tpl;
354  $ilUser = $this->user;
356  $append = "";
357  $message = "";
358 
359 
360  // block/unblock
361  if ($this->getPageObject()->getBlocked()) {
362  $this->tpl->setOnScreenMessage('info', $lng->txt("wiki_page_status_blocked"));
363  }
364 
365  $this->increaseViewCount();
366 
367  $this->addHeaderAction();
368 
369  // content
370  if (!in_array($ilCtrl->getNextClass(), ["ilnotegui", "ilcommentgui"])) {
371  $this->setSideBlock();
372  }
373 
374  $wtpl = new ilTemplate(
375  "tpl.wiki_page_view_main_column.html",
376  true,
377  true,
378  "components/ILIAS/Wiki"
379  );
380  $callback = array($this, "observeNoteAction");
381  // notes
382  if (!$ilSetting->get("disable_comments") &&
383  ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId())) {
384  $may_delete = ($ilSetting->get("comments_del_tutor", '1') &&
385  $ilAccess->checkAccess("write", "", $this->requested_ref_id));
386  $wtpl->setVariable("NOTES", $this->getNotesHTML(
387  $this->getPageObject(),
388  true,
389  ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()),
390  $may_delete,
391  $callback
392  ));
393  }
394 
395 
396  // page content
398  $this->showEditToolbar();
399  $this->setRenderPageContainer(true);
400  $wtpl->setVariable("PAGE", $this->showPage());
401 
402  $tpl->setLoginTargetPar("wiki_" . $this->requested_ref_id . $append);
403 
404  // last edited info
405  $wtpl->setVariable(
406  "LAST_EDITED_INFO",
407  $lng->txt("wiki_last_edited") . ": " .
409  new ilDateTime($this->getPageObject()->getLastChange(), IL_CAL_DATETIME)
410  ) . ", " .
412  $this->getPageObject()->getLastChangeUser(),
413  false,
414  true,
415  $ilCtrl->getLinkTarget($this, "preview")
416  )
417  );
418 
419  $tpl->setLoginTargetPar("wiki_" . $this->requested_ref_id . $append);
420 
421  //highlighting
422  if ($this->wiki_request->getSearchString()) {
423  $cache = ilUserSearchCache::_getInstance($ilUser->getId());
424  $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
425  $search_string = $cache->getQuery();
426 
427  // advanced search?
428  if (is_array($search_string)) {
429  $search_string = $search_string["lom_content"];
430  }
431 
432  $p = new ilQueryParser($search_string);
433  $p->parse();
434 
435  $words = $p->getQuotedWords();
436  if (is_array($words)) {
437  foreach ($words as $w) {
438  ilTextHighlighterGUI::highlight("ilCOPageContent", $w, $tpl);
439  }
440  }
441  $this->fill_on_load_code = true;
442  }
443 
444  return $message . $wtpl->get();
445  }
446 
447  public function showPage(): string
448  {
449  if ($this->getOutputMode() === ilPageObjectGUI::PRESENTATION && !$this->getAbstractOnly()) {
450  $this->initToolbar();
451  }
452  $this->setTemplateOutput(false);
453 
454  if (!$this->getAbstractOnly()) {
455  $this->setPresentationTitle($this->getWikiPage()->getTitle());
456 
457  // wiki stats clean up
458  // $this->increaseViewCount();
459  }
460 
461  return parent::showPage();
462  }
463 
464  protected function initToolbar(): void
465  {
467 
469 
470  $print_view = $this->getPrintView();
471  $modal_elements = $print_view->getModalElements($this->ctrl->getLinkTarget(
472  $this,
473  "printViewSelection"
474  ));
475  $toolbar->addComponent($modal_elements->button);
476  $toolbar->addComponent($modal_elements->modal);
477  }
478 
479  protected function getCurrentLanguage(): string
480  {
481  return $this->getPageObject()->getLanguage();
482  }
483 
484  protected function addLanguageSelectionToToolbar(): void
485  {
487  $f = $this->wiki_gui->ui()->factory();
488 
489  $this->ctrl->setParameterByClass(self::class, "wpg_id", $this->getId());
490  $this->ctrl->setParameterByClass(self::class, "page", null);
491  if ($this->ot->getContentTranslationActivated()) {
492  $actions = [];
493  foreach ($this->ot->getLanguages() as $language) {
494  $lang_code = ($language->getLanguageCode() === $this->ot->getBaseLanguage())
495  ? "-"
496  : $language->getLanguageCode();
497  $exists = $this->wiki_pm->exists($this->getId(), $lang_code);
498  $this->ctrl->setParameterByClass(self::class, "transl", $lang_code);
499  $action = ($lang_code !== "-" && !$exists)
500  ? "switchToLanguage"
501  : "preview";
502  if ($action === "switchToLanguage") {
503  $this->ctrl->setParameterByClass(self::class, "transl", null);
504  $this->ctrl->setParameterByClass(self::class, "totransl", $lang_code);
505  }
506  $append = $exists
507  ? ""
508  : " (" . $this->lng->txt("wiki_not_existing") . ")";
509  if ($lang_code === $this->getCurrentLanguage()) {
510  continue;
511  }
512  $actions[] = $f->link()->standard(
513  $this->getLanguageLabelForCode($language->getLanguageCode()) . $append,
514  $this->ctrl->getLinkTargetByClass(self::class, $action)
515  );
516  }
517  $this->ctrl->setParameterByClass(self::class, "transl", $this->requested_transl);
518  $this->ctrl->setParameterByClass(self::class, "totransl", null);
519  if (count($actions) > 0) {
520  $dd = $f->dropdown()->standard($actions)
521  ->withLabel($this->getLanguageLabelForCode($this->getCurrentLanguage()));
522  $toolbar->addComponent($dd);
523  }
524  }
525  }
526 
527  protected function getLanguageLabelForCode(string $code): string
528  {
529  if ($code === "-") {
530  $code = $this->ot->getBaseLanguage();
531  }
532  return $this->lng->txt("language") . ": " . $this->lng->txt("meta_l_" . $code);
533  }
534 
535  protected function getPrintView(): \ILIAS\Export\PrintProcessGUI
536  {
537  $provider = new \ILIAS\Wiki\WikiPrintViewProviderGUI(
538  $this->lng,
539  $this->ctrl,
540  $this->getWikiPage()->getWikiRefId(),
541  []
542  );
543 
544  return new \ILIAS\Export\PrintProcessGUI(
545  $provider,
546  $this->http,
547  $this->ui,
548  $this->lng
549  );
550  }
551 
552  protected function increaseViewCount(): void
553  {
554  $ilUser = $this->user;
555 
556  $this->getWikiPage()->increaseViewCnt();
557 
558  // enable object statistics
560  "wiki",
561  $this->getWikiPage()->getWikiRefId(),
562  $this->getWikiPage()->getWikiId(),
563  $ilUser->getId()
564  );
565 
567  }
568 
569  public function postOutputProcessing(string $a_output): string
570  {
571  $ilCtrl = $this->ctrl;
572 
573  $title = $this->getPageObject()->getTitle();
574  $ilCtrl->setParameterByClass(
575  "ilobjwikigui",
576  "from_page",
578  );
579  if ($this->getEnabledHref() && $this->getOutputMode() !== self::EDIT) {
581  $a_output,
582  $this->getWikiPage()->getWikiId(),
583  ($this->getOutputMode() === "offline"),
584  $this->getCurrentLanguage()
585  );
586  } else {
587  $output = $a_output;
588  }
589  $ilCtrl->setParameterByClass(
590  "ilobjwikigui",
591  "from_page",
592  $this->wiki_request->getFromPage()
593  );
594 
595 
596  // metadata in print view
597  if ($this->getOutputMode() === "print" && $this->wiki instanceof ilObjWiki) {
598  $mdgui = new ilObjectMetaDataGUI($this->wiki, "wpg", $this->getId());
599  $md = $mdgui->getKeyValueList();
600  if ($md !== "") {
601  $output = str_replace("<!--COPage-PageTop-->", "<p>" . $md . "</p>", $output);
602  }
603  }
604 
605 
606  return $output;
607  }
608 
609  public function whatLinksHere(): void
610  {
611  $tpl = $this->tpl;
612 
613  //$this->setSideBlock();
614  $table_gui = new ilWikiPagesTableGUI(
615  $this,
616  "whatLinksHere",
617  $this->getWikiPage()->getWikiId(),
619  $this->getId(),
620  $this->wiki_request->getTranslation()
621  );
622 
623  $tpl->setContent($table_gui->getHTML());
624  }
625 
626  public function getTabs(
627  string $a_activate = ""
628  ): void {
629  $ilTabs = $this->tabs_gui;
630  $ilCtrl = $this->ctrl;
631  $ilAccess = $this->access;
632 
633  parent::getTabs($a_activate);
634 
635  if ($ilAccess->checkAccess("statistics_read", "", $this->requested_ref_id)) {
636  $ilTabs->addTarget(
637  "statistics",
638  $this->ctrl->getLinkTargetByClass(
639  array("ilwikipagegui", "ilwikistatgui"),
640  "initial"
641  ),
642  "",
643  "ilwikistatgui"
644  );
645  }
646 
647  $ilTabs->addTarget(
648  "wiki_what_links_here",
649  $this->ctrl->getLinkTargetByClass(
650  "ilwikipagegui",
651  "whatLinksHere"
652  ),
653  "whatLinksHere"
654  );
655  }
656 
657  public function deleteWikiPageConfirmationScreen(): void
658  {
659  $tpl = $this->tpl;
660  $ilCtrl = $this->ctrl;
661  $lng = $this->lng;
662 
663  if (ilWikiPerm::check("delete_wiki_pages", $this->requested_ref_id)) {
664  $confirmation_gui = new ilConfirmationGUI();
665  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
666  $confirmation_gui->setHeaderText($lng->txt("wiki_page_deletion_confirmation"));
667  $confirmation_gui->setCancel($lng->txt("cancel"), "cancelWikiPageDeletion");
668  $confirmation_gui->setConfirm($lng->txt("delete"), "confirmWikiPageDeletion");
669 
670  $dtpl = new ilTemplate(
671  "tpl.wiki_page_deletion_confirmation.html",
672  true,
673  true,
674  "components/ILIAS/Wiki"
675  );
676 
677  $dtpl->setVariable("PAGE_TITLE", $this->getWikiPage()->getTitle());
678 
679  // other pages that link to this page
680  $dtpl->setVariable("TXT_OTHER_PAGES", $lng->txt("wiki_other_pages_linking"));
682  $this->getWikiPage()->getWikiId(),
683  $this->getWikiPage()->getId()
684  );
685  if (count($pages) > 0) {
686  foreach ($pages as $page) {
687  $dtpl->setCurrentBlock("lpage");
688  $dtpl->setVariable("TXT_LINKING_PAGE", $page["title"]);
689  $dtpl->parseCurrentBlock();
690  }
691  } else {
692  $dtpl->setCurrentBlock("lpage");
693  $dtpl->setVariable("TXT_LINKING_PAGE", "-");
694  $dtpl->parseCurrentBlock();
695  }
696 
697  // contributors
698  $dtpl->setVariable("TXT_CONTRIBUTORS", $lng->txt("wiki_contributors"));
699  $contributors = ilWikiPage::getWikiPageContributors($this->getWikiPage()->getId());
700  foreach ($contributors as $contributor) {
701  $dtpl->setCurrentBlock("contributor");
702  $dtpl->setVariable(
703  "TXT_CONTRIBUTOR",
704  $contributor["lastname"] . ", " . $contributor["firstname"]
705  );
706  $dtpl->parseCurrentBlock();
707  }
708 
709  // notes/comments
710  $cnt_note_users = $this->notes->domain()->getUserCount(
711  $this->getPageObject()->getParentId(),
712  $this->getPageObject()->getId(),
713  "wpg"
714  );
715  $dtpl->setVariable(
716  "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
717  $lng->txt("wiki_number_users_notes_or_comments")
718  );
719  $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users);
720 
721  $confirmation_gui->addItem("", "", $dtpl->get());
722 
723  $tpl->setContent($confirmation_gui->getHTML());
724  }
725  }
726 
727  public function cancelWikiPageDeletion(): void
728  {
729  $ilCtrl = $this->ctrl;
730 
731  $ilCtrl->redirect($this, "preview");
732  }
733 
734  public function confirmWikiPageDeletion(): void
735  {
736  $ilCtrl = $this->ctrl;
737  $lng = $this->lng;
738  if (ilWikiPerm::check("delete_wiki_pages", $this->requested_ref_id)) {
739  $this->getPageObject()->delete();
740 
741  $this->tpl->setOnScreenMessage('success', $lng->txt("wiki_page_deleted"), true);
742  }
743 
744  $ilCtrl->redirectByClass("ilobjwikigui", "allPages");
745  }
746 
750 
751  public function printViewSelection(): void
752  {
753  $view = $this->getPrintView();
754  $view->sendForm();
755  }
756 
757  public function printViewOrder(): void
758  {
759  $this->printViewOrderList();
760  }
761 
762  protected function printViewOrderList(
763  ): void {
764  $ilTabs = $this->tabs_gui;
765 
766  $pg_ids = $all_pages = array();
767 
768  // coming from type selection
769  $ordering = $this->wiki_request->getPrintOrdering();
770  if (count($ordering) === 0) {
771  switch ($this->wiki_request->getSelectedPrintType()) {
772  case "wiki":
773  foreach ($this->wiki_pm->getWikiPages($this->getLanguage()) as $p) {
774  $pg_ids[] = $p->getId();
775  }
776  break;
777 
778  case "selection":
779  $pg_ids = $this->wiki_request->getWikiPageIds();
780  if (count($pg_ids) === 0) {
781  $pg_ids = [$this->wiki_request->getWikiPageId()];
782  }
783  if (count($pg_ids) > 1) {
784  break;
785  } else {
786  $wiki_page_id = array_pop($pg_ids);
787  }
788  $this->ctrl->setParameterByClass(
789  "ilObjWikiGUI",
790  "wpg_id",
791  $wiki_page_id
792  );
793  $this->ctrl->redirectByClass("ilObjWikiGUI", "printView");
794  break;
795 
796  default:
797  $this->ctrl->setParameterByClass(
798  "ilObjWikiGUI",
799  "wpg_id",
800  $this->wiki_request->getWikiPageId()
801  );
802  $this->ctrl->redirectByClass("ilObjWikiGUI", "printView");
803  break;
804  }
805  }
806  // refresh sorting
807  else {
808  asort($ordering);
809  $pg_ids = array_keys($ordering);
810  }
811 
812  $ilTabs->clearTargets();
813  $ilTabs->setBackTarget(
814  $this->lng->txt("back"),
815  $this->ctrl->getLinkTarget($this, "preview")
816  );
817 
818  if (!count($all_pages)) {
819  $all_pages = ilWikiPage::getAllWikiPages($this->getPageObject()->getWikiId());
820  }
821 
822  $tbl = new ilWikiExportOrderTableGUI(
823  $this,
824  "printViewOrderList",
825  $all_pages,
826  $pg_ids
827  );
828  $this->tpl->setContent($tbl->getHTML());
829  }
830 
831 
835 
836  public function blockWikiPage(): void
837  {
838  $ilCtrl = $this->ctrl;
839  $lng = $this->lng;
840 
841  if (ilWikiPerm::check("activate_wiki_protection", $this->requested_ref_id)) {
842  $this->getPageObject()->setBlocked(true);
843  $this->getPageObject()->update();
844 
845  $this->tpl->setOnScreenMessage('success', $lng->txt("wiki_page_blocked"), true);
846  }
847 
848  $ilCtrl->redirect($this, "preview");
849  }
850 
851  public function unblockWikiPage(): void
852  {
853  $ilCtrl = $this->ctrl;
854  $lng = $this->lng;
855 
856  if (ilWikiPerm::check("activate_wiki_protection", $this->requested_ref_id)) {
857  $this->getPageObject()->setBlocked(false);
858  $this->getPageObject()->update();
859 
860  $this->tpl->setOnScreenMessage('success', $lng->txt("wiki_page_unblocked"), true);
861  }
862 
863  $ilCtrl->redirect($this, "preview");
864  }
865 
866 
870 
871  public function renameWikiPage(): void
872  {
873  $ilAccess = $this->access;
874  $tpl = $this->tpl;
875 
876  if (($ilAccess->checkAccess(
877  "edit_content",
878  "",
879  $this->requested_ref_id
880  ) && !$this->getPageObject()->getBlocked())
881  || $ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
882  $this->ctrl->setParameterByClass(ilWikiPageGUI::class, "wpg_id", $this->wiki_request->getWikiPageId());
883  $this->initRenameForm();
884  $tpl->setContent($this->form->getHTML());
885  }
886  }
887 
888  protected function initRenameForm(): void
889  {
890  $lng = $this->lng;
891  $ilCtrl = $this->ctrl;
892 
893  $this->form = new ilPropertyFormGUI();
894 
895  // new name
896  $ti = new ilTextInputGUI($lng->txt("wiki_new_page_name"), "new_page_name");
897  $ti->setMaxLength(200);
898  $ti->setSize(50);
899  $ti->setValue($this->getPageObject()->getTitle());
900  $ti->setRequired(true);
901  $this->form->addItem($ti);
902 
903  $this->form->addCommandButton("renamePage", $lng->txt("wiki_rename"));
904  $this->form->addCommandButton("preview", $lng->txt("cancel"));
905 
906  $this->form->setTitle($lng->txt("wiki_rename_page"));
907  $this->form->setFormAction($ilCtrl->getFormAction($this));
908  }
909 
910  public function renamePage(): void
911  {
912  $tpl = $this->tpl;
913  $lng = $this->lng;
914  $ilCtrl = $this->ctrl;
915  $ilAccess = $this->access;
916 
917  $this->initRenameForm();
918  if ($this->form->checkInput()) {
919  if (($ilAccess->checkAccess("edit_content", "", $this->requested_ref_id) && !$this->getPageObject()->getBlocked())
920  || $ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
921  $new_name = $this->form->getInput("new_page_name");
922 
923  $page_title = ilWikiUtil::makeDbTitle($new_name);
925  $this->getPageObject()->getWikiId(),
926  $page_title,
927  $this->getPageObject()->getLanguage()
928  );
929 
930  // we might get the same page id back here, if the page
931  // name only differs in diacritics
932  // see bug http://www.ilias.de/mantis/view.php?id=11226
933  if ($pg_id > 0 && $pg_id != $this->getPageObject()->getId()) {
934  $this->tpl->setOnScreenMessage('failure', $lng->txt("wiki_page_already_exists"));
935  } else {
936  $new_name = $this->getPageObject()->rename($new_name);
937  $ilCtrl->setParameterByClass("ilobjwikigui", "page", ilWikiUtil::makeUrlTitle($new_name));
938  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
939  $ilCtrl->redirect($this, "preview");
940  }
941  }
942  }
943 
944  $this->form->setValuesByPost();
945  $tpl->setContent($this->form->getHTML());
946  }
947 
951 
952  public function activateWikiPageRating(): void
953  {
954  $lng = $this->lng;
955  $ilCtrl = $this->ctrl;
956 
957  $this->getPageObject()->setRating(true);
958  $this->getPageObject()->update();
959 
960  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
961  $ilCtrl->redirect($this, "preview");
962  }
963 
964  public function deactivateWikiPageRating(): void
965  {
966  $lng = $this->lng;
967  $ilCtrl = $this->ctrl;
968 
969  $this->getPageObject()->setRating(false);
970  $this->getPageObject()->update();
971 
972  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
973  $ilCtrl->redirect($this, "preview");
974  }
975 
976 
977  public function observeNoteAction(
978  int $a_wiki_id,
979  int $a_page_id,
980  string $a_type,
981  string $a_action,
982  int $a_note_id
983  ): void {
984  // #10040 - get note text
985  $note = $this->notes->domain()->getById($a_note_id);
986  $text = $note->getText();
987 
988  $noti = $this->wiki_gui->notification();
989  $noti->send("comment", ilNotification::TYPE_WIKI_PAGE, $this->getWikiRefId(), $a_page_id, $text, $this->getLanguage());
990  }
991 
992  public function updateStatsRating(
993  int $a_wiki_id,
994  string $a_wiki_type,
995  int $a_page_id,
996  string $a_page_type
997  ): void {
999  }
1000 
1001 
1002  //
1003  // advanced meta data
1004  //
1005 
1007  {
1008  $ilCtrl = $this->ctrl;
1009  $lng = $this->lng;
1010 
1011  $page = $this->getWikiPage();
1012 
1013  $form = new ilPropertyFormGUI();
1014  $form->setFormAction($ilCtrl->getFormAction($this, "updateAdvancedMetaData"));
1015 
1016  // :TODO:
1017  $form->setTitle($lng->txt("wiki_advmd_block_title") . ": " . $page->getTitle());
1018 
1019  $this->record_gui = new ilAdvancedMDRecordGUI(
1021  'wiki',
1022  $page->getWikiId(),
1023  'wpg',
1024  $page->getId()
1025  );
1026  $this->record_gui->setPropertyForm($form);
1027  $this->record_gui->parse();
1028 
1029  $form->addCommandButton("updateAdvancedMetaData", $lng->txt("save"));
1030  $form->addCommandButton("preview", $lng->txt("cancel"));
1031 
1032  return $form;
1033  }
1034 
1035  public function editAdvancedMetaData(
1036  ?ilPropertyFormGUI $a_form = null
1037  ): void {
1038  $ilTabs = $this->tabs_gui;
1039  $lng = $this->lng;
1040  $ilCtrl = $this->ctrl;
1041  $tpl = $this->tpl;
1042  $ilAccess = $this->access;
1043 
1044  if (!$ilAccess->checkAccess("write", "", $this->wiki_ref_id) &&
1045  !$ilAccess->checkAccess("edit_page_meta", "", $this->wiki_ref_id)) {
1046  return;
1047  }
1048 
1049 
1050  $ilTabs->clearTargets();
1051  $ilTabs->setBackTarget(
1052  $lng->txt("back"),
1053  $ilCtrl->getLinkTarget($this, "preview")
1054  );
1055 
1056  if (!$a_form) {
1057  $a_form = $this->initAdvancedMetaDataForm();
1058  }
1059 
1060  $tpl->setContent($a_form->getHTML());
1061  }
1062 
1063  public function updateAdvancedMetaData(): void
1064  {
1065  $ilCtrl = $this->ctrl;
1066  $lng = $this->lng;
1067  $ilAccess = $this->access;
1068 
1069  if (!$ilAccess->checkAccess("write", "", $this->wiki_ref_id) &&
1070  !$ilAccess->checkAccess("edit_page_meta", "", $this->wiki_ref_id)) {
1071  return;
1072  }
1073 
1074  $form = $this->initAdvancedMetaDataForm();
1075 
1076  // needed for proper advanced MD validation
1077  $form->checkInput();
1078  if (!$this->record_gui->importEditFormPostValues()) {
1079  $this->editAdvancedMetaData($form); // #16470
1080  return;
1081  }
1082 
1083  if ($this->record_gui->writeEditForm()) {
1084  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
1085  }
1086  $ilCtrl->redirect($this, "preview");
1087  }
1088 
1089  public function hideAdvancedMetaData(): void
1090  {
1091  $ilCtrl = $this->ctrl;
1092  $lng = $this->lng;
1093  $ilAccess = $this->access;
1094 
1095  if (!$ilAccess->checkAccess("write", "", $this->wiki_ref_id) &&
1096  !$ilAccess->checkAccess("edit_page_meta", "", $this->wiki_ref_id)) {
1097  return;
1098  }
1099 
1100  $this->getPageObject()->hideAdvancedMetadata(true);
1101  $this->getPageObject()->update();
1102 
1103  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
1104  $ilCtrl->redirect($this, "preview");
1105  }
1106 
1107  public function unhideAdvancedMetaData(): void
1108  {
1109  $ilCtrl = $this->ctrl;
1110  $lng = $this->lng;
1111  $ilAccess = $this->access;
1112 
1113  if (!$ilAccess->checkAccess("write", "", $this->wiki_ref_id) &&
1114  !$ilAccess->checkAccess("edit_page_meta", "", $this->wiki_ref_id)) {
1115  return;
1116  }
1117 
1118  $this->getPageObject()->hideAdvancedMetadata(false);
1119  $this->getPageObject()->update();
1120 
1121  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
1122  $ilCtrl->redirect($this, "preview");
1123  }
1124 
1125  public function edit(): string
1126  {
1127  $tpl = $this->tpl;
1128  $lng = $this->lng;
1129  $this->ctrl->setParameterByClass(self::class, "wpg_id", $this->getId());
1130  self::initEditingJS($tpl);
1131 
1132  return parent::edit();
1133  }
1134 
1135  public static function initEditingJS(ilGlobalTemplateInterface $a_tpl): void
1136  {
1137  global $DIC;
1138 
1139  $lng = $DIC->language();
1140 
1141  $a_tpl->addJavaScript("assets/js/WikiEdit.js");
1142  $a_tpl->addOnLoadCode("il.Wiki.Edit.txt.page_exists = '" . $lng->txt("wiki_page_exists") . "';");
1143  $a_tpl->addOnLoadCode("il.Wiki.Edit.txt.new_page = '" . $lng->txt("wiki_new_page") . "';");
1144  }
1145 
1146 
1150  public function insertWikiLink(): void
1151  {
1152  $lng = $this->lng;
1153  $ilCtrl = $this->ctrl;
1154 
1155  $form = new ilPropertyFormGUI();
1156  $form->addCommandButton("addWikiLink", $lng->txt("wiki_add_link"));
1157  $form->addCommandButton("searchWikiLink", $lng->txt("search"));
1158 
1159  // Target page
1160  $tp = new ilTextInputGUI($this->lng->txt("wiki_target_page"), "target_page");
1161  $tp->setSize(18);
1162  $tp->setRequired(true);
1163  $tp->setInfo("...");
1164  $tp->setDataSource($ilCtrl->getLinkTarget($this, "insertWikiLinkAC", "", true));
1165  $form->addItem($tp);
1166 
1167  // Link text
1168  $lt = new ilTextInputGUI($this->lng->txt("wiki_link_text"), "link_text");
1169  $lt->setSize(18);
1170  $form->addItem($lt);
1171 
1172  //$form->setTitle($lng->txt("wiki_link"));
1173 
1174  echo $form->getHTML();
1175  exit;
1176  }
1177 
1181  public function insertWikiLinkAC(): void
1182  {
1183  $result = array();
1184 
1185  $term = $this->wiki_request->getTerm();
1186 
1187  // if page exists, make it first entry
1188  if (ilWikiPage::_wikiPageExists($this->getPageObject()->getParentId(), $term)) {
1189  $entry = new stdClass();
1190  $entry->value = $term;
1191  $entry->label = $term;
1192  $result[] = $entry;
1193  }
1194 
1195  $res = ilWikiPage::getPagesForSearch($this->getPageObject()->getParentId(), $term);
1196 
1197  $cnt = 0;
1198  foreach ($res as $r) {
1199  if ($result[0]->value == $r) {
1200  continue;
1201  }
1202  if ($cnt++ > 19) {
1203  continue;
1204  }
1205  $entry = new stdClass();
1206  $entry->value = $r;
1207  $entry->label = $r;
1208  $result[] = $entry;
1209  }
1210 
1211  echo json_encode($result, JSON_THROW_ON_ERROR);
1212  exit;
1213  }
1214 
1218  public function searchWikiLinkAC(): void
1219  {
1220  $lng = $this->lng;
1221 
1222  $lng->loadLanguageModule("wiki");
1223 
1224  $tpl = new ilTemplate("tpl.wiki_ac_search_result.html", true, true, "components/ILIAS/Wiki");
1225  $term = $this->wiki_request->getTerm();
1226 
1227  $pages = ilObjWiki::_performSearch($this->getPageObject()->getParentId(), $term);
1228 
1229  $found = array();
1230  foreach ($pages as $page) {
1231  $found[] = array("page_id" => $page["page_id"], "title" => ilWikiPage::lookupTitle($page["page_id"]));
1232  }
1233 
1234  // sort if all pages are listed
1235  if ($term === "") {
1236  $found = ilArrayUtil::sortArray($found, "title", "asc");
1237  }
1238 
1239  foreach ($found as $f) {
1240  $tpl->setCurrentBlock("item");
1241  $tpl->setVariable("WIKI_TITLE", $f["title"]);
1243  }
1244 
1245  if (count($pages) === 0) {
1246  $tpl->setVariable("INFOTEXT", str_replace("$1", $term, $lng->txt("wiki_no_page_found")));
1247  } elseif ($term === '') {
1248  $tpl->setVariable("INFOTEXT", $lng->txt("wiki_no_search_term"));
1249  } else {
1250  $tpl->setVariable("INFOTEXT", str_replace("$1", $term, $lng->txt("wiki_pages_found")));
1251  }
1252 
1253  $tpl->setVariable("TXT_BACK", $lng->txt("back"));
1254  echo $tpl->get();
1255  exit;
1256  }
1257 
1258  //
1259  // exercise assignment
1260  //
1261 
1265  protected function finalizeAssignment(): void
1266  {
1267  $ilCtrl = $this->ctrl;
1268  $lng = $this->lng;
1269 
1271 
1272  $ass_id = $this->wiki_request->getAssignmentId();
1273  $wiki_ass->submitWiki($ass_id, $this->user->getId(), $this->getWikiRefId());
1274 
1275  $this->tpl->setOnScreenMessage('success', $lng->txt("wiki_finalized"), true);
1276  $ilCtrl->redirectByClass("ilObjWikiGUI", "gotoStartPage");
1277  }
1278 
1279  protected function downloadExcSubFile(): void
1280  {
1281  $ilUser = $this->user;
1282 
1283  $ass_id = $this->wiki_request->getAssignmentId();
1284  $ass = new ilExAssignment($ass_id);
1285 
1286  $sub_manager = $this->exc_domain->submission($ass_id);
1287  $sub = $sub_manager->getSubmissionsOfUser($ilUser->getId())->current();
1288  $team_id = $this->exc_domain->team()->getTeamForMember(
1289  $ass->getId(),
1290  $ilUser->getId()
1291  );
1292 
1293  if ($sub) {
1294  $user_data = ilObjUser::_lookupName($sub->getUserId());
1295  $title = ilObject::_lookupTitle($ass->getExerciseId()) . " - " .
1296  $ass->getTitle() . " (Team " . $team_id . ").zip";
1297 
1298  $sub_manager->deliverFile(
1299  $ilUser->getId(),
1300  $sub->getRid(),
1301  $title
1302  );
1303  }
1304  }
1305 
1306  public function getCommentsHTMLExport(): string
1307  {
1308  return $this->getNotesHTML(
1309  $this->getPageObject(),
1310  false,
1311  ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()),
1312  false,
1313  null,
1314  true
1315  );
1316  }
1317 
1321  public function confirmPageTranslationCreation(): void
1322  {
1323  $this->tabs_gui->clearTargets();
1324  $this->tabs_gui->setBackTarget(
1325  $this->lng->txt("back"),
1326  $this->ctrl->getLinkTarget($this, "edit")
1327  );
1328 
1329  $l = $this->request->getString("totransl");
1330  $this->ctrl->setParameter($this, "totransl", $l);
1331  $this->lng->loadLanguageModule("meta");
1332 
1333  $r = $this->wiki_gui->ui()->renderer();
1334  $box = $this->wiki_gui->ui()->factory()->messageBox()->confirmation(
1335  $this->lng->txt("cont_page_translation_does_not_exist") . ": " .
1336  $this->lng->txt("meta_l_" . $l)
1337  );
1338 
1340 
1341  $content = $r->render($box) . $form->render();
1342 
1343  /*
1344  $cgui = new ilConfirmationGUI();
1345  $cgui->setFormAction($this->ctrl->getFormAction($this));
1346  $cgui->setHeaderText($this->lng->txt("cont_page_translation_does_not_exist") . ": " .
1347  $this->lng->txt("meta_l_" . $l));
1348  $cgui->setCancel($this->lng->txt("cancel"), "editMasterLanguage");
1349  $cgui->setConfirm($this->lng->txt("confirm"), "createPageTranslation");*/
1350  $this->tpl->setContent($content);
1351  }
1352 
1353  protected function getTranslatePageFormAdapter(): \ILIAS\Repository\Form\FormAdapterGUI
1354  {
1355  $f = $this->wiki_gui->form(self::class, "createPageTranslation")
1356  ->text("title", $this->lng->txt("title"));
1357  //->required();
1358  return $f;
1359  }
1360 
1361  public function createPageTranslation(): void
1362  {
1363  $l = $this->request->getString("totransl");
1364 
1366  //if ($form->isValid()) {
1367 
1368  $p = $this->domain->page()->getWikiPage(
1369  $this->getWikiRefId(),
1370  $this->getPageObject()->getId(),
1371  0,
1372  "-"
1373  );
1374 
1375  $p->copyPageToTranslation($l);
1376 
1379  $this->getPageObject()->getParentType(),
1380  $this->getPageObject()->getId(),
1381  0,
1382  $l
1383  );
1384  $p2->setWikiRefId($this->getWikiRefId());
1385  $p2->setTitle($form->getData("title"));
1386  $p2->update();
1387  $this->ctrl->setParameter($this, "transl", $l);
1388  //}
1389 
1390  $this->ctrl->redirect($this, "edit");
1391  }
1392 
1393  protected function checkLangPageAvailable(int $id, string $lang): bool
1394  {
1395  return $this->wiki_pm->exists($id, $lang);
1396  }
1397 
1398 }
getLanguageLabelForCode(string $code)
finalizeAssignment()
Finalize and submit blog to exercise.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
$res
Definition: ltiservices.php:66
Class ilObjectMetaDataGUI.
confirmPageTranslationCreation()
Confirm page translation creation.
setPropertyForm(ilPropertyFormGUI $form)
Exercise assignment.
postOutputProcessing(string $a_output)
const IL_CAL_DATETIME
const ANONYMOUS_USER_ID
Definition: constants.php:27
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
static getPagesForSearch(int $a_wiki_id, string $a_term)
observeNoteAction(int $a_wiki_id, int $a_page_id, string $a_type, string $a_action, int $a_note_id)
setOutputMode(string $a_mode=self::PRESENTATION)
Interface Observer Contains several chained tasks and infos about them.
ilAdvancedMDRecordGUI $record_gui
Wiki statistics GUI class.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
static _getInstance(int $a_usr_id)
static renderSideBlock(int $a_wpg_id, int $a_wiki_ref_id, ?ilWikiPage $a_wp=null)
addComponent(\ILIAS\UI\Component\Component $a_comp)
static lookupTitle(int $a_page_id, string $lang="-")
Class ilPageObjectGUI.
Class handles translation mode for an object.
static getLinksToPage(int $a_wiki_id, int $a_page_id, string $lang="-")
static _lookupName(int $a_user_id)
lookup user name
TableGUI class for wiki pages table.
setContent(string $a_html)
Sets content for standard template.
static _performSearch(int $a_wiki_id, string $a_searchterm)
Search in Wiki.
ILIAS Wiki WikiGUIRequest $wiki_request
ILIAS COPage InternalGUIService $gui
loadLanguageModule(string $a_module)
Load language module.
showEditToolbar()
Show edit toolbar.
const EVENT_PAGE_READ
setWikiRefId(int $a_ref_id)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static replaceInternalLinks(string $s, int $a_wiki_id, bool $a_offline=false, string $lang="-")
This one is based on Mediawiki Parser->replaceInternalLinks since we display images in another way...
setTemplateOutput(bool $a_output=true)
static _lookupObjId(int $ref_id)
static getWikiPageContributors(int $a_page_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80
ILIAS HTTP Services $http
editAdvancedMetaData(?ilPropertyFormGUI $a_form=null)
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
static _lookupTitle(int $obj_id)
ILIAS Exercise InternalDomainService $exc_domain
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
__construct(string $a_parent_type, int $a_id, int $a_old_nr=0, bool $a_prevent_get_id=false, string $a_lang="", string $concrete_lang="")
setFormAction(string $a_formaction)
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
checkLangPageAvailable(int $id, string $lang)
setRenderPageContainer(bool $a_val)
setHeaderPageTitle(string $a_title)
Sets the title of the page (for browser window).
ilGlobalTemplateInterface $tpl
setScreenIdComponent(string $a_comp)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setPageObject(ilPageObject $a_pg_obj)
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
ilAccessHandler $access
global $DIC
Definition: shib_login.php:26
setLoginTargetPar(string $a_val)
Set target parameter for login (public sector).
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Class ilWikiPage GUI class.
const EVENT_PAGE_RATING
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setPresentationTitle(string $a_title="")
ILIAS Wiki InternalGUIService $wiki_gui
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
insertWikiLink()
Returns form to insert a wiki link per ajax.
exit
activateWikiPageRating()
Rating /.
getTabs(string $a_activate="")
$lang
Definition: xapiexit.php:25
ILIAS Wiki InternalDomainService $domain
static initEditingJS(ilGlobalTemplateInterface $a_tpl)
static handleEvent(int $a_event, ilWikiPage $a_page_obj, ?int $a_user_id=null, ?array $a_additional_data=null)
Handle wiki page event.
const IL_WIKI_WHAT_LINKS_HERE
static makeUrlTitle(string $a_par)
form( $class_path, string $cmd, string $submit_caption="")
insertWikiLinkAC()
Auto complete for insert wiki link.
updateStatsRating(int $a_wiki_id, string $a_wiki_type, int $a_page_id, string $a_page_type)
ILIAS Wiki Page PageManager $wiki_pm
static makeDbTitle(string $a_par)
static getPageIdForTitle(int $a_wiki_id, string $a_title, string $lang="-")
Get wiki page object for id and title.
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ?ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
static _wikiPageExists(int $a_wiki_id, string $a_title, string $lang="-")
global $ilSetting
Definition: privfeed.php:31
__construct(Container $dic, ilPlugin $plugin)
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
setWiki(ilObjWiki $a_val)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
static _lookupRatingOverall(int $a_wiki_id)
Lookup whether rating is activated for whole object.
static _lookupPublicNotes(int $a_wiki_id)
Lookup whether public notes are activated.
static check(string $a_perm, int $a_ref_id, string $a_cmd="")
$message
Definition: xapiexit.php:31
ILIAS Notes Service $notes
static getAllWikiPages(int $a_wiki_id, string $lang="-")
ilPropertyFormGUI $form
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$service
Definition: ltiservices.php:40
createPageTranslation()
Create page translation.
Class ilCommonActionDispatcherGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
searchWikiLinkAC()
Search wiki link list.
addHeaderAction(bool $a_redraw=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getNotesHTML(?object $a_content_object=null, bool $a_enable_private_notes=true, bool $a_enable_public_notes=false, bool $a_enable_notes_deletion=false, ?callable $a_callback=null, bool $export=false)
Get html for public and/or private notes.
setWikiPage(ilWikiPage $a_wikipage)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static hasOptOut(int $obj_id)
Is opt out (disable notification) allowed?
$r