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