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