ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjWikiGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
37 {
38  protected \ILIAS\Wiki\InternalDomainService $domain;
39  protected \ILIAS\Wiki\InternalGUIService $gui;
40  protected \ILIAS\Wiki\Content\GUIService $content_gui;
41  protected \ILIAS\Wiki\Navigation\ImportantPageManager $imp_pages;
42  protected \ILIAS\Wiki\Page\PageManager $pm;
44  protected \ILIAS\HTTP\Services $http;
45  protected string $requested_page;
47  protected ilTabsGUI $tabs;
48  protected ilHelpGUI $help;
49  protected ilLogger $log;
51  protected \ILIAS\DI\UIServices $ui;
52  protected bool $req_with_comments = false;
54  protected \ILIAS\Style\Content\GUIService $content_style_gui;
55  protected \ILIAS\Style\Content\Object\ObjectFacade $content_style_domain;
56 
57  public function __construct(
58  $a_data,
59  int $a_id,
60  bool $a_call_by_reference,
61  bool $a_prepare_output = true
62  ) {
63  global $DIC;
64 
65  $gui = $DIC->wiki()->internal()->gui();
66  $domain = $DIC->wiki()->internal()->domain();
67  $this->gui = $gui;
68  $this->domain = $domain;
69 
70  $this->ctrl = $gui->ctrl();
71  $this->lng = $domain->lng();
72  $this->tabs = $gui->tabs();
73  $this->help = $gui->help();
74  $this->locator = $gui->locator();
75  $this->http = $gui->http();
76  $this->ot = $gui->wiki()->translation();
77 
78  $this->type = "wiki";
79 
80  $this->log = ilLoggerFactory::getLogger('wiki');
81 
82  $this->tool_context = $gui->globalScreen()->tool()->context();
83  $this->ui = $gui->ui();
84 
85  $this->edit_request = $gui->request();
86  $this->content_gui = $gui->content();
87 
88  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
89  $this->lng->loadLanguageModule("obj");
90  $this->lng->loadLanguageModule("wiki");
91 
92  $this->requested_page = $this->edit_request->getPage();
93  if ($this->requested_page !== "") {
94  $this->ctrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($this->requested_page));
95  }
96  $this->ctrl->saveParameterByClass(self::class, "transl");
97  $this->ctrl->saveParameterByClass(self::class, "wpg_id");
98  $this->req_with_comments = $this->edit_request->getWithComments();
99  $cs = $DIC->contentStyle();
100  $this->content_style_gui = $cs->gui();
101  if (is_object($this->object)) {
102  $this->content_style_domain = $cs->domain()->styleForRefId($this->object->getRefId());
103  $this->pm = $this->domain->page()->page($this->object->getRefId());
104  $this->imp_pages = $this->domain->importantPage($this->object->getRefId());
105  }
106  }
107 
108  public function executeCommand(): void
109  {
110  $ilCtrl = $this->ctrl;
111  $tpl = $this->tpl;
112  $ilTabs = $this->tabs;
113  $ilAccess = $this->access;
114 
115  $next_class = $this->ctrl->getNextClass($this);
116  $cmd = $this->ctrl->getCmd();
117 
118  $this->triggerAssignmentTool();
119 
120  $this->prepareOutput();
121 
122  // see ilWikiPageGUI::printViewOrderList()
123  // printView() cannot be in ilWikiPageGUI because of stylesheet confusion
124  if ($cmd === "printView") {
125  $next_class = null;
126  }
127 
128  switch ($next_class) {
129  case "ilinfoscreengui":
130  $this->checkPermission("visible");
131  $this->addHeaderAction();
132  $this->infoScreen(); // forwards command
133  break;
134 
135  case 'ilpermissiongui':
136  $this->addHeaderAction();
137  $ilTabs->activateTab("perm_settings");
138  $perm_gui = new ilPermissionGUI($this);
139  $this->ctrl->forwardCommand($perm_gui);
140  break;
141 
142  case 'ilsettingspermissiongui':
143  $this->checkPermission("write");
144  $this->addHeaderAction();
145  $ilTabs->activateTab("settings");
146  $this->setSettingsSubTabs("permission_settings");
147  $perm_gui = new ilSettingsPermissionGUI($this);
148  $perm_gui->setPermissions(array("edit_wiki_navigation", "add_pages", "delete_wiki_pages", "activate_wiki_protection",
149  "wiki_html_export"));
150  $perm_gui->setRoleRequiredPermissions(array("edit_content"));
151  $perm_gui->setRoleProhibitedPermissions(array("write"));
152  $this->ctrl->forwardCommand($perm_gui);
153  break;
154 
155  case 'ilobjecttranslationgui':
156  $this->checkPermission("read");
157  $this->addHeaderAction();
158  $ilTabs->activateTab("settings");
159  $this->setSettingsSubTabs("obj_multilinguality");
160  $transgui = new ilObjectTranslationGUI($this);
161  $transgui->setTitleDescrOnlyMode(false);
162  $this->ctrl->forwardCommand($transgui);
163  break;
164 
165  case 'ilwikipagegui':
166  $this->checkPermission("read");
167  $requested_page = $this->requested_page;
168  if ($this->edit_request->getWikiPageId() > 0) {
169  $requested_page = $this->pm->getTitle(
170  $this->edit_request->getWikiPageId(),
171  $this->edit_request->getTranslation()
172  );
173  }
174  $wpage_gui = $this->content_gui->getCurrentPageGUI();
175  $wpage_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
176  $this->setContentStyleSheet();
177  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
178  (
179  !$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
180  $wpage_gui->getPageObject()->getBlocked()
181  )) {
182  $wpage_gui->setEnableEditing(false);
183  }
184 
185  // alter title and description
186  // $tpl->setTitle($wpage_gui->getPageObject()->getTitle());
187  // $tpl->setDescription($this->object->getTitle());
188  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
189  $wpage_gui->activateMetaDataEditor($this->object, "wpg", $wpage_gui->getId());
190  }
191 
192  $ret = $this->ctrl->forwardCommand($wpage_gui);
193  if ($ret != "") {
194  $tpl->setContent($ret);
195  }
196  break;
197 
198  case 'ilobjectcopygui':
199  $cp = new ilObjectCopyGUI($this);
200  $cp->setType('wiki');
201  $this->ctrl->forwardCommand($cp);
202  break;
203 
204  case 'ilpublicuserprofilegui':
205  $profile_gui = new ilPublicUserProfileGUI(
206  $this->edit_request->getUserId()
207  );
208  $ret = $this->ctrl->forwardCommand($profile_gui);
209  $tpl->setContent($ret);
210  break;
211 
212  case "ilobjectcontentstylesettingsgui":
213  $this->checkPermission("write");
214  $this->addHeaderAction();
215  $ilTabs->activateTab("settings");
216  $this->setSettingsSubTabs("style");
217 
218  $settings_gui = $this->content_style_gui
219  ->objectSettingsGUIForRefId(
220  null,
221  $this->object->getRefId()
222  );
223  $this->ctrl->forwardCommand($settings_gui);
224  break;
225 
226  case "ilexportgui":
227  $this->addHeaderAction();
228  $ilTabs->activateTab("export");
229  $exp_gui = new ilExportGUI($this);
230  $exp_gui->addFormat("xml");
231  $exp_gui->addFormat("html", "", $this, "exportHTML");
232  if ($this->object->isCommentsExportPossible()) {
233  $exp_gui->addFormat("html_comments", "HTML (" . $this->lng->txt("wiki_incl_comments") . ")", $this, "exportHTML");
234  }
235  $this->ctrl->forwardCommand($exp_gui);
236  break;
237 
238  case "ilcommonactiondispatchergui":
240  $this->ctrl->forwardCommand($gui);
241  break;
242 
243  case "ilratinggui":
244  // for rating category editing
245  $this->checkPermission("write");
246  $this->addHeaderAction();
247  $ilTabs->activateTab("settings");
248  $this->setSettingsSubTabs("rating_categories");
249  $gui = new ilRatingGUI();
250  $gui->setObject($this->object->getId(), $this->object->getType());
251  $gui->setExportCallback(array($this, "getSubObjectTitle"), $this->lng->txt("page"));
252  $this->ctrl->forwardCommand($gui);
253  break;
254 
255  case "ilwikistatgui":
256  $this->checkPermission("statistics_read");
257 
258  $this->addHeaderAction();
259  $ilTabs->activateTab("statistics");
260  $gui = new ilWikiStatGUI($this->object->getId());
261  $this->ctrl->forwardCommand($gui);
262  break;
263 
264  case "ilwikipagetemplategui":
265  $this->checkPermission("write");
266  $this->addHeaderAction();
267  $ilTabs->activateTab("settings");
268  $this->setSettingsSubTabs("page_templates");
269  $wptgui = new ilWikiPageTemplateGUI($this);
270  $this->ctrl->forwardCommand($wptgui);
271  break;
272 
273  case 'ilobjectmetadatagui':
274  $this->checkPermission("write");
275  $this->addHeaderAction();
276  $ilTabs->activateTab("advmd");
277  $md_gui = new ilObjectMetaDataGUI($this->object, "wpg");
278  $this->ctrl->forwardCommand($md_gui);
279  break;
280 
281  case 'ilrepositoryobjectsearchgui':
282  $this->addHeaderAction();
283  $this->setSideBlock();
284  $ilTabs->setTabActive("wiki_search_results");
285  $ilCtrl->setReturn($this, 'view');
286  $ilCtrl->setParameterByClass(ilWikiPageGUI::class, "wpg_id", null);
287  $ilCtrl->setParameterByClass(ilObjWikiGUI::class, "wpg_id", null);
288  $search_gui = new ilRepositoryObjectSearchGUI(
289  $this->object->getRefId(),
290  $this,
291  'view'
292  );
293  $ilCtrl->forwardCommand($search_gui);
294  break;
295 
296  case 'ilobjnotificationsettingsgui':
297  $this->addHeaderAction();
298  $ilTabs->activateTab("settings");
299  $this->setSettingsSubTabs("notifications");
300  $gui = new ilObjNotificationSettingsGUI($this->object->getRefId());
301  $this->ctrl->forwardCommand($gui);
302  break;
303 
304  case 'illtiproviderobjectsettinggui':
305  $this->addHeaderAction();
306  $ilTabs->activateTab("settings");
307  $this->setSettingsSubTabs("lti_provider");
308  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
309  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
310  $lti_gui->offerLTIRolesForSelection(false);
311  $this->ctrl->forwardCommand($lti_gui);
312  break;
313 
314  default:
315  $this->addHeaderAction();
316  if (!$cmd) {
317  $cmd = "infoScreen";
318  }
319  $cmd .= "Object";
320  if ($cmd !== "cancelObject") {
321  if ($cmd !== "infoScreenObject") {
322  if (!in_array($cmd, array("createObject", "saveObject", "importFileObject"))) {
323  $this->checkPermission("read");
324  }
325  } else {
326  $this->checkPermission("visible");
327  }
328  }
329  $this->$cmd();
330  break;
331  }
332  }
333 
334  public function viewObject(): void
335  {
336  $this->checkPermission("read");
337  $this->gotoStartPageObject();
338  }
339 
340  protected function initCreationForms(string $new_type): array
341  {
342  $this->initSettingsForm("create");
343  $this->getSettingsFormValues("create");
344 
345  $forms = array(self::CFORM_NEW => $this->form_gui,
346  self::CFORM_IMPORT => $this->initImportForm($new_type));
347 
348  return $forms;
349  }
350 
351  public function saveObject(): void
352  {
353  $tpl = $this->tpl;
354  $lng = $this->lng;
355 
356  if (!$this->checkPermissionBool("create", "", "wiki", $this->requested_ref_id)) {
357  throw new ilPermissionException($this->lng->txt("permission_denied"));
358  }
359 
360  $this->initSettingsForm("create");
361  if ($this->form_gui->checkInput()) {
362  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle"))) {
363  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
364  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
365  } else {
366  parent::saveObject();
367  return;
368  }
369  }
370 
371  $this->form_gui->setValuesByPost();
372  $tpl->setContent($this->form_gui->getHTML());
373  }
374 
375  protected function afterSave(ilObject $new_object): void
376  {
378 
379  $new_object->setTitle($this->form_gui->getInput("title"));
380  $new_object->setDescription($this->form_gui->getInput("description"));
381  $new_object->setIntroduction($this->form_gui->getInput("intro"));
382  $new_object->setStartPage($this->form_gui->getInput("startpage"));
383  $new_object->setShortTitle((string) $this->form_gui->getInput("shorttitle"));
384  $new_object->setRating($this->form_gui->getInput("rating"));
385  // $new_object->setRatingAsBlock($this->form_gui->getInput("rating_side"));
386  $new_object->setRatingForNewPages($this->form_gui->getInput("rating_new"));
387  $new_object->setRatingCategories($this->form_gui->getInput("rating_ext"));
388 
389  $new_object->setRatingOverall($this->form_gui->getInput("rating_overall"));
390  $new_object->setPageToc($this->form_gui->getInput("page_toc"));
391 
392 
393 
394  if (!$ilSetting->get("disable_comments")) {
395  $new_object->setPublicNotes($this->form_gui->getInput("public_notes"));
396  }
397  $new_object->setOnline($this->form_gui->getInput("online"));
398  $new_object->update();
399 
400  // always send a message
401  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
402  ilUtil::redirect(self::getGotoLink($new_object->getRefId()));
403  }
404 
410  public function infoScreenObject(): void
411  {
412  $this->checkPermission("visible");
413  $this->ctrl->setCmd("showSummary");
414  $this->ctrl->setCmdClass("ilinfoscreengui");
415  $this->infoScreen();
416  }
417 
418  public function infoScreen(): void
419  {
420  $ilAccess = $this->access;
421  $ilUser = $this->user;
422  $ilTabs = $this->tabs;
423  $lng = $this->lng;
424 
425  $ilTabs->activateTab("info_short");
426 
427  if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId())) {
428  throw new ilPermissionException($this->lng->txt("permission_denied"));
429  }
430 
431  $info = new ilInfoScreenGUI($this);
432  $info->enablePrivateNotes();
433  if (trim($this->object->getIntroduction()) !== "") {
434  $info->addSection($lng->txt("wiki_introduction"));
435  $info->addProperty("", nl2br($this->object->getIntroduction()));
436  }
437 
438  // feedback from tutor; mark, status, comment
439  $lpcomment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId());
440  $mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId());
441  $status = ilWikiContributor::_lookupStatus($this->object->getId(), $ilUser->getId());
442  if ($lpcomment !== "" || $mark !== "" || (int) $status !== ilWikiContributor::STATUS_NOT_GRADED) {
443  $info->addSection($this->lng->txt("wiki_feedback_from_tutor"));
444  if ($lpcomment !== "") {
445  $info->addProperty(
446  $this->lng->txt("wiki_comment"),
447  $lpcomment
448  );
449  }
450  if ($mark !== "") {
451  $info->addProperty(
452  $this->lng->txt("wiki_mark"),
453  $mark
454  );
455  }
456 
457  if ((int) $status === ilWikiContributor::STATUS_PASSED) {
458  $info->addProperty(
459  $this->lng->txt("status"),
460  $this->lng->txt("wiki_passed")
461  );
462  }
463  if ((int) $status === ilWikiContributor::STATUS_FAILED) {
464  $info->addProperty(
465  $this->lng->txt("status"),
466  $this->lng->txt("wiki_failed")
467  );
468  }
469  }
470 
471  if ($ilAccess->checkAccess("read", "", $this->object->getRefId())) {
472  $info->addButton($lng->txt("wiki_start_page"), self::getGotoLink($this->object->getRefId()));
473  }
474 
475  // general information
476  $this->lng->loadLanguageModule("meta");
477  $this->lng->loadLanguageModule("wiki");
478 
479  // forward the command
480  $this->ctrl->forwardCommand($info);
481  }
482 
483  public function gotoStartPageObject(): void
484  {
485  ilUtil::redirect(self::getGotoLink($this->object->getRefId()));
486  }
487 
488  public function addPageTabs(): void
489  {
490  $ilTabs = $this->tabs;
491  $ilCtrl = $this->ctrl;
492 
493  $ilCtrl->setParameter(
494  $this,
495  "wpg_id",
496  ilWikiPage::getPageIdForTitle($this->object->getId(), ilWikiUtil::makeDbTitle($this->requested_page))
497  );
498  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($this->requested_page));
499  $ilTabs->addTarget(
500  "wiki_what_links_here",
501  $this->ctrl->getLinkTargetByClass(
502  "ilwikipagegui",
503  "whatLinksHere"
504  ),
505  "whatLinksHere"
506  );
507  $ilTabs->addTarget(
508  "wiki_print_view",
509  $this->ctrl->getLinkTargetByClass(
510  "ilwikipagegui",
511  "printViewSelection"
512  ),
513  "printViewSelection"
514  );
515  }
516 
517  public function addPagesSubTabs(): void
518  {
519  $ilTabs = $this->tabs;
520  $ilCtrl = $this->ctrl;
521 
522  $ilTabs->activateTab("wiki_pages");
523 
524  $ilCtrl->setParameter(
525  $this,
526  "wpg_id",
528  $this->object->getId(),
529  ilWikiUtil::makeDbTitle($this->requested_page)
530  )
531  );
532  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($this->requested_page));
533  $ilTabs->addSubTabTarget(
534  "wiki_all_pages",
535  $this->ctrl->getLinkTarget($this, "allPages"),
536  "allPages"
537  );
538  $ilTabs->addSubTabTarget(
539  "wiki_recent_changes",
540  $this->ctrl->getLinkTarget($this, "recentChanges"),
541  "recentChanges"
542  );
543  $ilTabs->addSubTabTarget(
544  "wiki_new_pages",
545  $this->ctrl->getLinkTarget($this, "newPages"),
546  "newPages"
547  );
548  $ilTabs->addSubTabTarget(
549  "wiki_popular_pages",
550  $this->ctrl->getLinkTarget($this, "popularPages"),
551  "popularPages"
552  );
553  $ilTabs->addSubTabTarget(
554  "wiki_orphaned_pages",
555  $this->ctrl->getLinkTarget($this, "orphanedPages"),
556  "orphanedPages"
557  );
558  }
559 
560  protected function getTabs(): void
561  {
562  $ilCtrl = $this->ctrl;
563  $ilAccess = $this->access;
564  $lng = $this->lng;
565  $ilHelp = $this->help;
566 
567  $ilHelp->setScreenIdComponent("wiki");
568 
569  // wiki tabs
570  if (in_array(strtolower($ilCtrl->getCmdClass()), array("", "ilobjectcontentstylesettingsgui", "ilobjwikigui",
571  "ilinfoscreengui", "ilpermissiongui", "ilexportgui", "ilratingcategorygui", "ilobjnotificationsettingsgui", "iltaxmdgui",
572  "ilwikistatgui", "ilwikipagetemplategui", "iladvancedmdsettingsgui", "ilsettingspermissiongui", 'ilrepositoryobjectsearchgui',
573  'ilobjecttranslationgui'
574  ), true) || $ilCtrl->getNextClass() === "ilpermissiongui") {
575  if ($this->requested_page !== "") {
576  $page_id = ($this->edit_request->getWikiPageId() > 0)
577  ? $this->edit_request->getWikiPageId()
578  : $this->pm->getPageIdForTitle(
579  $this->requested_page,
580  $this->edit_request->getTranslation()
581  );
582  if (is_null($page_id) && $this->edit_request->getFromPage() !== "") {
583  $page_id = $this->pm->getPageIdForTitle(
584  $this->edit_request->getFromPage(),
585  $this->edit_request->getTranslation()
586  );
587  }
588  if (!is_null($page_id)) {
589  $this->tabs_gui->setBackTarget(
590  $lng->txt("wiki_last_visited_page"),
591  $this->pm->getPermaLink(
592  $page_id,
593  $this->edit_request->getTranslation()
594  )
595  );
596  }
597  }
598 
599  // pages
600  if ($ilAccess->checkAccess('read', "", $this->object->getRefId())) {
601  $this->tabs_gui->addTab(
602  "wiki_pages",
603  $lng->txt("wiki_pages"),
604  $this->ctrl->getLinkTarget($this, "allPages")
605  );
606  }
607 
608  // info screen
609  if ($ilAccess->checkAccess('visible', "", $this->object->getRefId())) {
610  $this->tabs_gui->addTab(
611  "info_short",
612  $lng->txt("info_short"),
613  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
614  );
615  }
616 
617  // settings
618  if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
619  $this->tabs_gui->addTab(
620  "settings",
621  $lng->txt("settings"),
622  $this->ctrl->getLinkTarget($this, "editSettings")
623  );
624 
625  // metadata
626  $mdgui = new ilObjectMetaDataGUI($this->object, "wpg");
627  $mdtab = $mdgui->getTab();
628  if ($mdtab) {
629  $this->tabs_gui->addTab(
630  "advmd",
631  $this->lng->txt("meta_data"),
632  $mdtab
633  );
634  }
635  }
636 
637  // contributors
638  if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
639  $this->tabs_gui->addTab(
640  "wiki_contributors",
641  $lng->txt("wiki_contributors"),
642  $this->ctrl->getLinkTarget($this, "listContributors")
643  );
644  }
645 
646  // statistics
647  if ($ilAccess->checkAccess('statistics_read', "", $this->object->getRefId())) {
648  $this->tabs_gui->addTab(
649  "statistics",
650  $lng->txt("statistics"),
651  $this->ctrl->getLinkTargetByClass("ilWikiStatGUI", "initial")
652  );
653  }
654 
655  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
656  $this->tabs_gui->addTab(
657  "export",
658  $lng->txt("export"),
659  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
660  );
661  }
662 
663  // edit permissions
664  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
665  $this->tabs_gui->addTab(
666  "perm_settings",
667  $lng->txt("perm_settings"),
668  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
669  );
670  }
671  }
672  }
673 
674  public function setSettingsSubTabs(string $a_active): void
675  {
676  $ilTabs = $this->tabs;
677  $ilCtrl = $this->ctrl;
678  $lng = $this->lng;
679  $ilAccess = $this->access;
680  if (in_array(
681  $a_active,
682  array("general_settings", "style", "imp_pages", "rating_categories", "obj_multilinguality",
683  "page_templates", "advmd", "permission_settings", "notifications", "lti_provider")
684  )) {
685  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
686  // general properties
687  $ilTabs->addSubTab(
688  "general_settings",
689  $lng->txt("wiki_general_settings"),
690  $ilCtrl->getLinkTarget($this, 'editSettings')
691  );
692 
693  // permission settings
694  $ilTabs->addSubTab(
695  "permission_settings",
696  $lng->txt("obj_permission_settings"),
697  $this->ctrl->getLinkTargetByClass("ilsettingspermissiongui", "")
698  );
699 
700  // style properties
701  $ilTabs->addSubTab(
702  "style",
703  $lng->txt("wiki_style"),
704  $ilCtrl->getLinkTargetByClass("ilObjectContentStyleSettingsGUI", "")
705  );
706  }
707 
708  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
709  // important pages
710  $ilTabs->addSubTab(
711  "imp_pages",
712  $lng->txt("wiki_navigation"),
713  $ilCtrl->getLinkTarget($this, 'editImportantPages')
714  );
715  }
716 
717  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
718  // page templates
719  $ilTabs->addSubTab(
720  "page_templates",
721  $lng->txt("wiki_page_templates"),
722  $ilCtrl->getLinkTargetByClass("ilwikipagetemplategui", "")
723  );
724 
725  // rating categories
726  if ($this->object->getRating() && $this->object->getRatingCategories()) {
727  $lng->loadLanguageModule("rating");
728  $ilTabs->addSubTab(
729  "rating_categories",
730  $lng->txt("rating_categories"),
731  $ilCtrl->getLinkTargetByClass(array('ilratinggui', 'ilratingcategorygui'), '')
732  );
733  }
734 
735  $ilTabs->addSubTab(
736  'notifications',
737  $lng->txt("notifications"),
738  $ilCtrl->getLinkTargetByClass("ilobjnotificationsettingsgui", '')
739  );
740 
741  $ilTabs->addSubTab(
742  'obj_multilinguality',
743  $lng->txt("obj_multilinguality"),
744  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
745  );
746  }
747 
748  // LTI Provider
749  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
750  if ($lti_settings->hasSettingsAccess()) {
751  $ilTabs->addSubTabTarget(
752  'lti_provider',
753  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
754  );
755  }
756 
757  $ilTabs->activateSubTab($a_active);
758  }
759  }
760 
761  public function editSettingsObject(): void
762  {
763  $tpl = $this->tpl;
764 
765  $this->checkPermission("write");
766 
767  $this->setSettingsSubTabs("general_settings");
768 
769  $this->initSettingsForm();
770  $this->getSettingsFormValues();
771 
772  // Edit ecs export settings
773  $ecs = new ilECSWikiSettings($this->object);
774  $ecs->addSettingsToForm($this->form_gui, 'wiki');
775 
776  $tpl->setContent($this->form_gui->getHTML());
777  $this->setSideBlock();
778  }
779 
780  public function initSettingsForm(string $a_mode = "edit"): void
781  {
782  $lng = $this->lng;
783  $ilCtrl = $this->ctrl;
784  $ilTabs = $this->tabs;
786  $obj_service = $this->object_service;
787 
788  $lng->loadLanguageModule("wiki");
789  $ilTabs->activateTab("settings");
790 
791  $this->form_gui = new ilPropertyFormGUI();
792 
793  // Title
794  $tit = new ilTextInputGUI($lng->txt("title"), "title");
795  $tit->setRequired(true);
796  $this->form_gui->addItem($tit);
797 
798  // Description
799  $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
800  $this->form_gui->addItem($des);
801 
802  // Introduction
803  $intro = new ilTextAreaInputGUI($lng->txt("wiki_introduction"), "intro");
804  $intro->setCols(40);
805  $intro->setRows(4);
806  $this->form_gui->addItem($intro);
807 
808  // Start Page
809  $options = [];
810  if ($a_mode === "edit") {
811  foreach ($this->pm->getWikiPages() as $page) {
812  $options[$page->getId()] = ilStr::shortenTextExtended($page->getTitle(), 60, true);
813  }
814  $si = new ilSelectInputGUI($lng->txt("wiki_start_page"), "startpage_id");
815  $si->setOptions($options);
816  $this->form_gui->addItem($si);
817  } else {
818  $sp = new ilTextInputGUI($lng->txt("wiki_start_page"), "startpage");
819  if ($a_mode === "edit") {
820  $sp->setInfo($lng->txt("wiki_start_page_info"));
821  }
822  $sp->setMaxLength(200);
823  $sp->setRequired(true);
824  $this->form_gui->addItem($sp);
825  }
826 
827  // Online
828  $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
829  $this->form_gui->addItem($online);
830 
831 
832  // rating
833 
834  $lng->loadLanguageModule('rating');
835  $rate = new ilCheckboxInputGUI($lng->txt('rating_activate_rating'), 'rating_overall');
836  $rate->setInfo($lng->txt('rating_activate_rating_info'));
837  $this->form_gui->addItem($rate);
838 
839  $rating = new ilCheckboxInputGUI($lng->txt("wiki_activate_rating"), "rating");
840  $this->form_gui->addItem($rating);
841 
842  /* always active
843  $side = new ilCheckboxInputGUI($lng->txt("wiki_activate_sideblock_rating"), "rating_side");
844  $rating->addSubItem($side);
845  */
846 
847  $new = new ilCheckboxInputGUI($lng->txt("wiki_activate_new_page_rating"), "rating_new");
848  $rating->addSubItem($new);
849 
850  $extended = new ilCheckboxInputGUI($lng->txt("wiki_activate_extended_rating"), "rating_ext");
851  $rating->addSubItem($extended);
852 
853 
854  // public comments
855  if (!$ilSetting->get("disable_comments")) {
856  $comments = new ilCheckboxInputGUI($lng->txt("wiki_public_comments"), "public_notes");
857  $this->form_gui->addItem($comments);
858  }
859 
860  // important pages
861  // $imp_pages = new ilCheckboxInputGUI($lng->txt("wiki_important_pages"), "imp_pages");
862  // $this->form_gui->addItem($imp_pages);
863 
864  // page toc
865  $page_toc = new ilCheckboxInputGUI($lng->txt("wiki_page_toc"), "page_toc");
866  $page_toc->setInfo($lng->txt("wiki_page_toc_info"));
867  $this->form_gui->addItem($page_toc);
868 
869  if ($a_mode === "edit") {
870  // advanced metadata auto-linking
871  if (count(ilAdvancedMDRecord::_getSelectedRecordsByObject("wiki", $this->object->getRefId(), "wpg")) > 0) {
872  $link_md = new ilCheckboxInputGUI($lng->txt("wiki_link_md_values"), "link_md_values");
873  $link_md->setInfo($lng->txt("wiki_link_md_values_info"));
874  $this->form_gui->addItem($link_md);
875  }
876 
877 
878  $section = new ilFormSectionHeaderGUI();
879  $section->setTitle($this->lng->txt('obj_presentation'));
880  $this->form_gui->addItem($section);
881 
882  // tile image
883  $obj_service->commonSettings()->legacyForm($this->form_gui, $this->object)->addTileImage();
884 
885 
886  // additional features
887  $feat = new ilFormSectionHeaderGUI();
888  $feat->setTitle($this->lng->txt('obj_features'));
889  $this->form_gui->addItem($feat);
890 
892  $this->object->getId(),
894  array(
896  )
897  );
898  }
899 
900  // :TODO: sorting
901 
902  // Form action and save button
903  $this->form_gui->setTitleIcon(ilUtil::getImagePath("standard/icon_wiki.svg"));
904  if ($a_mode !== "create") {
905  $this->form_gui->setTitle($lng->txt("wiki_settings"));
906  $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
907  } else {
908  $this->form_gui->setTitle($lng->txt("wiki_new"));
909  $this->form_gui->addCommandButton("save", $lng->txt("wiki_add"));
910  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
911  }
912 
913  // set values
914  if ($a_mode === "create") {
915  $ilCtrl->setParameter($this, "new_type", "wiki");
916  }
917 
918  $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
919  }
920 
921  public function getSettingsFormValues(string $a_mode = "edit"): void
922  {
923  // set values
924  if ($a_mode === "create") {
925  $values["rating_new"] = true;
926 
927  $parent = ilObjectFactory::getInstanceByRefId($this->requested_ref_id);
928  $values["rating_overall"] = $parent->selfOrParentWithRatingEnabled();
929  } else {
930  $values["online"] = $this->object->getOnline();
931  $values["title"] = $this->object->getTitle();
932  //$values["startpage"] = $this->object->getStartPage();
933  $values["startpage_id"] = ilWikiPage::_getPageIdForWikiTitle($this->object->getId(), $this->object->getStartPage());
934  $values["shorttitle"] = $this->object->getShortTitle();
935  $values["description"] = $this->object->getLongDescription();
936  $values["rating_overall"] = $this->object->getRatingOverall();
937  $values["rating"] = $this->object->getRating();
938  $values["rating_new"] = $this->object->getRatingForNewPages();
939  $values["rating_ext"] = $this->object->getRatingCategories();
940  $values["public_notes"] = $this->object->getPublicNotes();
941  $values["intro"] = $this->object->getIntroduction();
942  $values["page_toc"] = $this->object->getPageToc();
943  $values["link_md_values"] = $this->object->getLinkMetadataValues();
944 
945  // only set given values (because of adv. metadata)
946  }
947  $this->form_gui->setValuesByArray($values, true);
948  }
949 
950 
951  public function saveSettingsObject(): void
952  {
953  $ilCtrl = $this->ctrl;
954  $lng = $this->lng;
956  $obj_service = $this->object_service;
957 
958  $this->checkPermission("write");
959 
960  $this->initSettingsForm();
961 
962  if ($this->form_gui->checkInput()) {
963  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")) &&
964  $this->form_gui->getInput("shorttitle") !== $this->object->getShortTitle()) {
965  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
966  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
967  } else {
968  $this->object->setTitle($this->form_gui->getInput("title"));
969  $this->object->setDescription($this->form_gui->getInput("description"));
970  $this->object->setOnline($this->form_gui->getInput("online"));
971  $this->object->setStartPage(ilWikiPage::lookupTitle($this->form_gui->getInput("startpage_id")));
972  $this->object->setShortTitle((string) $this->form_gui->getInput("shorttitle"));
973  $this->object->setRatingOverall($this->form_gui->getInput("rating_overall"));
974  $this->object->setRating($this->form_gui->getInput("rating"));
975  // $this->object->setRatingAsBlock($this->form_gui->getInput("rating_side"));
976  $this->object->setRatingForNewPages($this->form_gui->getInput("rating_new"));
977  $this->object->setRatingCategories($this->form_gui->getInput("rating_ext"));
978 
979  if (!$ilSetting->get("disable_comments")) {
980  $this->object->setPublicNotes($this->form_gui->getInput("public_notes"));
981  }
982  $this->object->setIntroduction($this->form_gui->getInput("intro"));
983  $this->object->setPageToc($this->form_gui->getInput("page_toc"));
984  $this->object->setLinkMetadataValues($this->form_gui->getInput("link_md_values"));
985  $this->object->update();
986 
987  // tile image
988  $obj_service->commonSettings()->legacyForm($this->form_gui, $this->object)->saveTileImage();
989 
991  $this->object->getId(),
993  array(
995  )
996  );
997 
998  // Update ecs export settings
999  $ecs = new ilECSWikiSettings($this->object);
1000  if ($ecs->handleSettingsUpdate($this->form_gui)) {
1001  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1002  $ilCtrl->redirect($this, "editSettings");
1003  }
1004  }
1005  }
1006 
1007  $this->form_gui->setValuesByPost();
1008  $this->tpl->setContent($this->form_gui->getHTML());
1009  }
1010 
1011  public function listContributorsObject(): void
1012  {
1013  $tpl = $this->tpl;
1014  $ilTabs = $this->tabs;
1015 
1016  $this->checkPermission("write");
1017  $ilTabs->activateTab("wiki_contributors");
1018 
1019  $table_gui = new ilWikiContributorsTableGUI(
1020  $this,
1021  "listContributors",
1022  $this->object->getId()
1023  );
1024 
1025  $tpl->setContent($table_gui->getHTML());
1026 
1027  $this->setSideBlock();
1028  }
1029 
1030  public function saveGradingObject(): void
1031  {
1032  $ilCtrl = $this->ctrl;
1033  $lng = $this->lng;
1034 
1035  $this->checkPermission("write");
1036 
1037  $users = $this->edit_request->getUserIds();
1038  $marks = $this->edit_request->getMarks();
1039  $comments = $this->edit_request->getComments();
1040  $status = $this->edit_request->getStatus();
1041 
1042  $saved = false;
1043  foreach ($users as $user_id) {
1044  if ($user_id != "") {
1045  $marks_obj = new ilLPMarks($this->object->getId(), $user_id);
1046  $new_mark = ilUtil::stripSlashes($marks[$user_id]);
1047  $new_comment = ilUtil::stripSlashes($comments[$user_id] ?? "");
1048  $new_status = ilUtil::stripSlashes($status[$user_id]);
1049 
1050  if ($marks_obj->getMark() !== $new_mark ||
1051  $marks_obj->getComment() !== $new_comment ||
1052  (int) ilWikiContributor::_lookupStatus($this->object->getId(), $user_id) !== (int) $new_status) {
1053  ilWikiContributor::_writeStatus($this->object->getId(), $user_id, $new_status);
1054  $marks_obj->setMark($new_mark);
1055  $marks_obj->setComment($new_comment);
1056  $marks_obj->update();
1057  $saved = true;
1058  }
1059  }
1060  }
1061  if ($saved) {
1062  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1063  }
1064 
1065  $ilCtrl->redirect($this, "listContributors");
1066  }
1067 
1068  // add wiki to locator
1069  protected function addLocatorItems(): void
1070  {
1071  $ilLocator = $this->locator;
1072 
1073  if (is_object($this->object)) {
1074  $ilLocator->addItem(
1075  $this->object->getTitle(),
1076  self::getGotoLink($this->object->getRefId()),
1077  "",
1078  $this->requested_ref_id
1079  );
1080  }
1081  }
1082 
1083  public static function _goto(string $a_target): void
1084  {
1085  global $DIC;
1086  $main_tpl = $DIC->ui()->mainTemplate();
1087 
1088  $wpg_id = 0;
1089  $lang = "";
1090  $ilAccess = $DIC->access();
1091  $lng = $DIC->language();
1092  $ctrl = $DIC->ctrl();
1093  $transl = $DIC->wiki()->internal()->gui()->request()->getTranslation();
1094  $DIC->ctrl()->setParameterByClass(self::class, "transl", $transl);
1095 
1096 
1097  $i = strpos($a_target, "_");
1098  $a_page = "";
1099  if ($i > 0) {
1100  $a_page = substr($a_target, $i + 1);
1101  $a_target = substr($a_target, 0, $i);
1102  }
1103 
1104  if ($a_target === "wpage") {
1105  $a_page_arr = explode("_", $a_page);
1106  $wpg_id = (int) $a_page_arr[0];
1107  $ref_id = (int) ($a_page_arr[1] ?? 0);
1108  $lang = ($a_page_arr[2] ?? "");
1109  $w_id = ilWikiPage::lookupWikiId($wpg_id);
1110  if ($ref_id > 0) {
1111  $refs = array($ref_id);
1112  } else {
1113  $refs = ilObject::_getAllReferences($w_id);
1114  }
1115  foreach ($refs as $r) {
1116  if ($ilAccess->checkAccess("read", "", $r)) {
1117  $a_target = $r;
1118  $a_page = ilWikiPage::lookupTitle($wpg_id);
1119  }
1120  }
1121  }
1122 
1123  if ($ilAccess->checkAccess("read", "", $a_target)) {
1124  if ($wpg_id > 0) {
1126  "ilobjwikigui",
1127  "wpg_id",
1128  $wpg_id
1129  );
1130  } else {
1132  "ilobjwikigui",
1133  "page",
1134  ilWikiUtil::makeUrlTitle($a_page)
1135  );
1136  }
1137  if ($lang != "") {
1139  "ilobjwikigui",
1140  "transl",
1141  $lang
1142  );
1143  }
1145  "ilwikihandlergui",
1146  "ref_id",
1147  $a_target
1148  );
1149  if ($a_page != "") {
1151  ["ilwikihandlergui", "ilobjwikigui"],
1152  "viewPage"
1153  );
1154  } else {
1156  ["ilwikihandlergui"],
1157  "view"
1158  );
1159  }
1160  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1161  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
1162  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1163  $main_tpl->setOnScreenMessage('failure', sprintf(
1164  $lng->txt("msg_no_perm_read_item"),
1166  ), true);
1168  }
1169 
1170  throw new ilPermissionException($lng->txt("permission_denied"));
1171  }
1172 
1173  public static function getGotoLink(
1174  int $a_ref_id,
1175  string $a_page = "",
1176  string $lang = "-"
1177  ): string {
1178  if ($a_page === "") {
1180  }
1181 
1182  $append = (!in_array($lang, ["", "-"]))
1183  ? "&transl=" . $lang
1184  : "";
1185  $goto = "goto.php?target=wiki_" . $a_ref_id . "_" .
1186  ilWikiUtil::makeUrlTitle($a_page) . $append;
1187  return $goto;
1188  }
1189 
1190  public function viewPageObject(): void
1191  {
1192  $lng = $this->lng;
1193  $ilCtrl = $this->ctrl;
1194  $tpl = $this->tpl;
1195  $ilTabs = $this->tabs;
1196  $ilAccess = $this->access;
1197 
1198  $this->checkPermission("read");
1199 
1200  $ilTabs->clearTargets();
1202 
1203  $wpage_gui = $this->gui->content()->getCurrentPageGUI();
1204 
1205  // page exists, show it !
1206  $ilCtrl->setParameter(
1207  $this,
1208  "page",
1209  ilWikiUtil::makeUrlTitle($wpage_gui->getPageObject()->getTitle())
1210  );
1211 
1212  $wpage_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
1213 
1214  $this->setContentStyleSheet();
1215 
1216  //$wpage_gui->setSideBlock();
1217  $ilCtrl->setCmdClass("ilwikipagegui");
1218  $ilCtrl->setCmd("preview");
1219  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
1220  (
1221  !$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
1222  $wpage_gui->getPageObject()->getBlocked()
1223  )) {
1224  $wpage_gui->setEnableEditing(false);
1225  }
1226 
1227  // alter title and description
1228  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1229  $wpage_gui->activateMetaDataEditor($this->object, "wpg", $wpage_gui->getId());
1230  }
1231 
1232  $html = $ilCtrl->forwardCommand($wpage_gui);
1233 
1234  $tpl->setContent($html);
1235  }
1236 
1237  public function allPagesObject(): void
1238  {
1239  $tpl = $this->tpl;
1240 
1241  $this->checkPermission("read");
1242 
1243  $this->addPagesSubTabs();
1244 
1245  $table_gui = new ilWikiPagesTableGUI(
1246  $this,
1247  "allPages",
1248  $this->object->getId(),
1250  );
1251 
1252  //$this->setSideBlock();
1253  $tpl->setContent($table_gui->getHTML());
1254  }
1255 
1259  public function popularPagesObject(): void
1260  {
1261  $tpl = $this->tpl;
1262 
1263  $this->checkPermission("read");
1264 
1265  $this->addPagesSubTabs();
1266 
1267  $table_gui = new ilWikiPagesTableGUI(
1268  $this,
1269  "popularPages",
1270  $this->object->getId(),
1272  );
1273 
1274  //$this->setSideBlock();
1275  $tpl->setContent($table_gui->getHTML());
1276  }
1277 
1281  public function orphanedPagesObject(): void
1282  {
1283  $tpl = $this->tpl;
1284 
1285  $this->checkPermission("read");
1286 
1287  $this->addPagesSubTabs();
1288 
1289  $table_gui = new ilWikiPagesTableGUI(
1290  $this,
1291  "orphanedPages",
1292  $this->object->getId(),
1294  );
1295 
1296  //$this->setSideBlock();
1297  $tpl->setContent($table_gui->getHTML());
1298  }
1299 
1303  public function gotoPageObject(
1304  string $a_page = ""
1305  ): void {
1306  $ilCtrl = $this->ctrl;
1307 
1308  if ($a_page === "") {
1309  $a_page = $this->requested_page;
1310  }
1311 
1312  if ($this->pm->existsByTitle(
1313  ilWikiUtil::makeDbTitle($a_page),
1314  $this->edit_request->getTranslation()
1315  )) {
1316  // to do: get rid of this redirect
1317  ilUtil::redirect(self::getGotoLink($this->object->getRefId(), $a_page, $this->edit_request->getTranslation()));
1318  } else {
1319  if (!$this->access->checkAccess("add_pages", "", $this->object->getRefId())) {
1320  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("no_permission"), true);
1321  $from_page_id = $this->pm->getPageIdForTitle($this->edit_request->getFromPage(), $this->edit_request->getTranslation());
1322  ilUtil::redirect($this->pm->getPermaLink($from_page_id, $this->edit_request->getTranslation()));
1323  }
1324  if ($this->isNewTranslatedPage()) {
1325  return;
1326  }
1327  if (!$this->object->getTemplateSelectionOnCreation()) {
1328  // check length
1329  if (ilStr::strLen(ilWikiUtil::makeDbTitle($a_page)) > 200) {
1330  $this->tpl->setOnScreenMessage(
1331  'failure',
1332  $this->lng->txt("wiki_page_title_too_long") . " (" . $a_page . ")",
1333  true
1334  );
1335  $ilCtrl->setParameterByClass(
1336  "ilwikipagegui",
1337  "page",
1338  ilWikiUtil::makeUrlTitle($this->edit_request->getFromPage())
1339  );
1340  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1341  }
1342 
1343  $this->pm->createWikiPage(
1344  $a_page,
1345  0,
1346  $this->edit_request->getTranslation()
1347  );
1348 
1349  // redirect to newly created page
1350  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
1351  $ilCtrl->redirectByClass("ilwikipagegui", "edit");
1352  } else {
1353  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($this->requested_page));
1354  $ilCtrl->setParameter(
1355  $this,
1356  "from_page",
1357  ilWikiUtil::makeUrlTitle($this->edit_request->getFromPage())
1358  );
1359  $ilCtrl->redirect($this, "showTemplateSelection");
1360  }
1361  }
1362  }
1363 
1364  protected function isNewTranslatedPage(): bool
1365  {
1366  if (in_array($this->edit_request->getTranslation(), ["-", ""])) {
1367  return false;
1368  }
1369  $page = $this->requested_page;
1371  $this->object->getId(),
1372  ilWikiUtil::makeDbTitle($page),
1373  $this->edit_request->getTranslation()
1374  )) {
1375  $this->tabs_gui->clearTargets();
1376  $this->tabs_gui->setBackTarget(
1377  $this->lng->txt("back"),
1378  $this->pm->getPermaLink(
1379  $this->pm->getPageIdForTitle(
1380  $this->edit_request->getFromPage(),
1381  $this->edit_request->getTranslation()
1382  ),
1383  $this->edit_request->getTranslation()
1384  )
1385  );
1386  $form = $this->getNewTranslatedPageForm();
1387  $this->tpl->setContent($this->getRenderedTranslationInfo() . $form->render());
1388  return true;
1389  }
1390  return false;
1391  }
1392 
1393  protected function getRenderedTranslationInfo()
1394  {
1395  $mess = $this->gui->ui()->factory()->messageBox()->info(
1396  $this->lng->txt("wiki_translate_page_master_info")
1397  );
1398  return $this->gui->ui()->renderer()->render($mess);
1399  }
1400 
1401  protected function getNewTranslatedPageForm(): \ILIAS\Repository\Form\FormAdapterGUI
1402  {
1403  $pm = $this->domain->page()->page($this->object->getRefId());
1404  $options = [];
1405  foreach ($pm->getMasterPagesWithoutTranslation($this->edit_request->getTranslation()) as $page) {
1406  $options[$page->getId()] = $page->getTitle();
1407  }
1408  $append = " '" . $this->edit_request->getPage() . "'";
1409  $append .= " (" . $this->lng->txt("meta_l_" . $this->edit_request->getTranslation()) . ")";
1410  $append2 = " (" . $this->lng->txt("meta_l_" . $this->ot->getMasterLanguage()) . ")";
1411  $form = $this->gui->form([self::class], "createNewTranslatedPage")
1412  ->section("sec", $this->lng->txt("wiki_translation_page") . $append)
1413  ->switch("type", $this->lng->txt("wiki_page_in_master_language") . $append2, "", "existing")
1414  ->group("existing", $this->lng->txt("wiki_master_existing"))
1415  ->select("master_id", $this->lng->txt("wiki_master_title"), $options)
1416  ->required()
1417  ->group("new", $this->lng->txt("wiki_no_master"))
1418  ->text("master_title", $this->lng->txt("wiki_master_title"))
1419  ->end();
1420 
1421  if ($this->object->getTemplateSelectionOnCreation($this->edit_request->getTranslation())) {
1422  $form = $form->radio("page_templ", $this->lng->txt("wiki_page_template"), "", "0")->required();
1423  if ($this->object->getEmptyPageTemplate()) {
1424  $form = $form->radioOption("0", $this->lng->txt("wiki_empty_page"));
1425  }
1426  $wt = new ilWikiPageTemplate($this->object->getId());
1427  $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES, $this->edit_request->getTranslation());
1428  foreach ($ts as $t) {
1429  $form = $form->radioOption($t["wpage_id"], $t["title"]);
1430  }
1431  }
1432 
1433  return $form;
1434  }
1435 
1436  protected function createNewTranslatedPageObject(): void
1437  {
1438  $form = $this->getNewTranslatedPageForm();
1439  if ($form->isValid()) {
1440  $page_template_id = 0;
1441  if ($this->object->getTemplateSelectionOnCreation($this->edit_request->getTranslation())) {
1442  $page_template_id = (int) $form->getData("page_templ");
1443  }
1444  if ($form->getData("type") === "new") {
1445  $wpg_id = $this->pm->createWikiPage(
1446  $form->getData("master_title")
1447  );
1448  } else {
1449  $wpg_id = $form->getData("master_id");
1450  }
1451  $wpg_id = $this->pm->createWikiPage(
1452  $this->edit_request->getPage(),
1453  $wpg_id,
1454  $this->edit_request->getTranslation(),
1455  $page_template_id
1456  );
1457  }
1458  $this->ctrl->setParameterByClass(ilWikiPageGUI::class, "wpg_id", $wpg_id);
1459  $this->ctrl->redirectByClass(ilWikiPageGUI::class, "preview");
1460  }
1461 
1462  public function randomPageObject(): void
1463  {
1464  $this->checkPermission("read");
1465 
1466  $page = ilWikiPage::getRandomPage($this->object->getId());
1467  $this->gotoPageObject($page);
1468  }
1469 
1470  public function recentChangesObject(): void
1471  {
1472  $tpl = $this->tpl;
1473 
1474  $this->checkPermission("read");
1475 
1476  $this->addPagesSubTabs();
1477 
1478  $table_gui = new ilWikiRecentChangesTableGUI(
1479  $this,
1480  "recentChanges",
1481  $this->object->getId()
1482  );
1483 
1484  //$this->setSideBlock();
1485  $tpl->setContent($table_gui->getHTML());
1486  }
1487 
1488  public function setSideBlock(int $a_wpg_id = 0): void
1489  {
1490  self::renderSideBlock($a_wpg_id, $this->object->getRefId());
1491  }
1492 
1493  public static function renderSideBlock(
1494  int $a_wpg_id,
1495  int $a_wiki_ref_id,
1496  ?ilWikiPage $a_wp = null
1497  ): void {
1498  global $DIC;
1499 
1500  $tpl = $DIC["tpl"];
1501  $lng = $DIC->language();
1502  $ilAccess = $DIC->access();
1503  $ilCtrl = $DIC->ctrl();
1504 
1505  $tpl->addJavaScript("./Modules/Wiki/js/WikiPres.js");
1506 
1507  // setting asynch to false fixes #0019457, since otherwise ilBlockGUI would act on asynch and output html when side blocks
1508  // being processed during the export. This is a flaw in ilCtrl and/or ilBlockGUI.
1509  $tpl->addOnLoadCode("il.Wiki.Pres.init('" . $ilCtrl->getLinkTargetByClass("ilobjwikigui", "", "", false, false) . "');");
1510 
1511  if ($a_wpg_id > 0 && !$a_wp) {
1512  $a_wp = new ilWikiPage($a_wpg_id);
1513  }
1514 
1515  // search block
1516  $rcontent = ilRepositoryObjectSearchGUI::getSearchBlockHTML($lng->txt('wiki_search'));
1517 
1518 
1519  // quick navigation
1520  if ($a_wpg_id > 0) {
1521  // rating
1522  $wiki_id = ilObject::_lookupObjId($a_wiki_ref_id);
1523  if (ilObjWiki::_lookupRating($wiki_id) &&
1524  // ilObjWiki::_lookupRatingAsBlock($wiki_id) &&
1525  $a_wp->getRating()) {
1526  $rgui = new ilRatingGUI();
1527  $rgui->setObject($wiki_id, "wiki", $a_wpg_id, "wpg");
1528  $rgui->enableCategories(ilObjWiki::_lookupRatingCategories($wiki_id));
1529  $rgui->setYourRatingText("#");
1530  $rcontent .= $rgui->getBlockHTML($lng->txt("wiki_rate_page"));
1531  }
1532 
1533  // advanced metadata
1534  if (!ilWikiPage::lookupAdvancedMetadataHidden($a_wpg_id)) {
1535  $cmd = null;
1536  if ($ilAccess->checkAccess("write", "", $a_wiki_ref_id) ||
1537  $ilAccess->checkAccess("edit_page_meta", "", $a_wiki_ref_id)) {
1538  $cmd = array(
1539  "edit" => $ilCtrl->getLinkTargetByClass("ilwikipagegui", "editAdvancedMetaData"),
1540  "hide" => $ilCtrl->getLinkTargetByClass("ilwikipagegui", "hideAdvancedMetaData")
1541  );
1542  }
1543  $wiki = new ilObjWiki($a_wiki_ref_id);
1544  $callback = $wiki->getLinkMetadataValues()
1545  ? array($wiki, "decorateAdvMDValue")
1546  : null;
1547  $mdgui = new ilObjectMetaDataGUI($wiki, "wpg", $a_wpg_id);
1548  $rcontent .= $mdgui->getBlockHTML($cmd, $callback); // #17291
1549  }
1550  }
1551 
1552  // important pages
1553  $imp_pages_block = new ilWikiImportantPagesBlockGUI();
1554  $rcontent .= $imp_pages_block->getHTML();
1555 
1556  // wiki functions block
1557  if ($a_wpg_id > 0) {
1558  $wiki_functions_block = new ilWikiFunctionsBlockGUI();
1559  $wiki_functions_block->setPageObject($a_wp);
1560  $rcontent .= $wiki_functions_block->getHTML();
1561  }
1562 
1563  $tpl->setRightContent($rcontent);
1564  }
1565 
1566  public function newPagesObject(): void
1567  {
1568  $tpl = $this->tpl;
1569 
1570  $this->checkPermission("read");
1571 
1572  $this->addPagesSubTabs();
1573 
1574  $table_gui = new ilWikiPagesTableGUI(
1575  $this,
1576  "newPages",
1577  $this->object->getId(),
1579  );
1580 
1581  //$this->setSideBlock();
1582  $tpl->setContent($table_gui->getHTML());
1583  }
1584 
1585  protected function getPrintPageIds(): array
1586  {
1587  $page_ids = [];
1588  $ordering = $this->edit_request->getPrintOrdering();
1589 
1590  // multiple ordered page ids
1591  if (count($ordering) > 0) {
1592  asort($ordering);
1593  $page_ids = array_keys($ordering);
1594  }
1595  // single page
1596  elseif ($this->edit_request->getWikiPageId()) {
1597  $page_ids = array($this->edit_request->getWikiPageId());
1598  }
1599  return $page_ids;
1600  }
1601 
1602  public function getPrintView(bool $export = false): \ILIAS\Export\PrintProcessGUI
1603  {
1604  $page_ids = $export
1605  ? null
1606  : $this->getPrintPageIds();
1607  $provider = new \ILIAS\Wiki\WikiPrintViewProviderGUI(
1608  $this->lng,
1609  $this->ctrl,
1610  $this->object->getRefId(),
1611  $page_ids
1612  );
1613 
1614  return new \ILIAS\Export\PrintProcessGUI(
1615  $provider,
1616  $this->http,
1617  $this->ui,
1618  $this->lng
1619  );
1620  }
1621 
1622  public function printViewObject(): void
1623  {
1624  $print_view = $this->getPrintView();
1625  $print_view->sendPrintView();
1626  }
1627 
1628  public function performSearchObject(): void
1629  {
1630  $tpl = $this->tpl;
1631  $ilTabs = $this->tabs;
1632  $ilCtrl = $this->ctrl;
1633  $lng = $this->lng;
1634 
1635  $this->checkPermission("read");
1636 
1637  $ilTabs->setTabActive("wiki_search_results");
1638 
1639  if ($this->edit_request->getSearchTerm() === "") {
1640  $this->tpl->setOnScreenMessage('failure', $lng->txt("wiki_please_enter_search_term"), true);
1641  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1642  }
1643 
1644  $search_results = ilObjWiki::_performSearch(
1645  $this->object->getId(),
1646  $this->edit_request->getSearchTerm()
1647  );
1648  $table_gui = new ilWikiSearchResultsTableGUI(
1649  $this,
1650  "performSearch",
1651  $this->object->getId(),
1652  $search_results,
1653  $this->edit_request->getSearchTerm()
1654  );
1655 
1656  $this->setSideBlock();
1657  $tpl->setContent($table_gui->getHTML());
1658  }
1659 
1660  public function setContentStyleSheet(): void
1661  {
1662  $tpl = $this->tpl;
1663 
1664  if ($tpl == null) {
1665  $tpl = $this->tpl;
1666  }
1667 
1668  $this->content_style_gui->addCss($tpl, $this->object->getRefId());
1670  }
1671 
1672 
1673  //
1674  // Important pages
1675  //
1676 
1677  public function editImportantPagesObject(): void
1678  {
1679  $tpl = $this->tpl;
1680  $ilToolbar = $this->toolbar;
1681  $ilTabs = $this->tabs;
1682  $lng = $this->lng;
1683  $ilCtrl = $this->ctrl;
1684 
1685  $this->checkPermission("edit_wiki_navigation");
1686 
1687  $this->tpl->setOnScreenMessage('info', $lng->txt("wiki_navigation_info"));
1688 
1689  $ipages_ids = $this->imp_pages->getImportantPageIds();
1690 
1691  // list pages
1692  $pages = $this->pm->getAllPagesInfo();
1693  $options = array("" => $lng->txt("please_select"));
1694  foreach ($pages as $p) {
1695  if (!in_array($p->getId(), $ipages_ids)) {
1696  $options[$p->getId()] = ilStr::shortenTextExtended($p->getTitle(), 60, true);
1697  }
1698  }
1699  if (count($options) > 0) {
1700  $si = new ilSelectInputGUI($lng->txt("wiki_pages"), "imp_page_id");
1701  $si->setOptions($options);
1702  $si->setInfo($lng->txt(""));
1703  $ilToolbar->addInputItem($si);
1704  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1705  $ilToolbar->addFormButton($lng->txt("add"), "addImportantPage");
1706  }
1707 
1708 
1709  $ilTabs->activateTab("settings");
1710  $this->setSettingsSubTabs("imp_pages");
1711 
1712  $imp_table = new ilImportantPagesTableGUI($this, "editImportantPages");
1713 
1714  $tpl->setContent($imp_table->getHTML());
1715  }
1716 
1717  public function addImportantPageObject(): void
1718  {
1719  $ilCtrl = $this->ctrl;
1720  $lng = $this->lng;
1721 
1722  $this->checkPermission("edit_wiki_navigation");
1723 
1724  $imp_page_id = $this->edit_request->getImportantPageId();
1725  if ($imp_page_id > 0) {
1726  $this->imp_pages->add($imp_page_id);
1727  $this->tpl->setOnScreenMessage('success', $lng->txt("wiki_imp_page_added"), true);
1728  }
1729  $ilCtrl->redirect($this, "editImportantPages");
1730  }
1731 
1732  public function confirmRemoveImportantPagesObject(): void
1733  {
1734  $ilCtrl = $this->ctrl;
1735  $tpl = $this->tpl;
1736  $lng = $this->lng;
1737 
1738  $imp_page_ids = $this->edit_request->getImportantPageIds();
1739  if (count($imp_page_ids) === 0) {
1740  $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
1741  $ilCtrl->redirect($this, "editImportantPages");
1742  } else {
1743  $cgui = new ilConfirmationGUI();
1744  $cgui->setFormAction($ilCtrl->getFormAction($this));
1745  $cgui->setHeaderText($lng->txt("wiki_sure_remove_imp_pages"));
1746  $cgui->setCancel($lng->txt("cancel"), "editImportantPages");
1747  $cgui->setConfirm($lng->txt("remove"), "removeImportantPages");
1748 
1749  foreach ($imp_page_ids as $i) {
1750  $cgui->addItem("imp_page_id[]", $i, ilWikiPage::lookupTitle((int) $i));
1751  }
1752 
1753  $tpl->setContent($cgui->getHTML());
1754  }
1755  }
1756 
1757  public function removeImportantPagesObject(): void
1758  {
1759  $ilCtrl = $this->ctrl;
1760  $lng = $this->lng;
1761 
1762  $this->checkPermission("edit_wiki_navigation");
1763 
1764  $imp_page_ids = $this->edit_request->getImportantPageIds();
1765  foreach ($imp_page_ids as $i) {
1766  $this->imp_pages->removeImportantPage($i);
1767  }
1768  $this->tpl->setOnScreenMessage('success', $lng->txt("wiki_removed_imp_pages"), true);
1769  $ilCtrl->redirect($this, "editImportantPages");
1770  }
1771 
1772  public function saveOrderingAndIndentObject(): void
1773  {
1774  $ilCtrl = $this->ctrl;
1775  $lng = $this->lng;
1776 
1777  $this->checkPermission("edit_wiki_navigation");
1778 
1779  $ordering = $this->edit_request->getImportantPageOrdering();
1780  $indentation = $this->edit_request->getImportantPageIndentation();
1781  $this->imp_pages->saveOrderingAndIndentation($ordering, $indentation);
1782  $this->tpl->setOnScreenMessage('success', $lng->txt("wiki_ordering_and_indent_saved"), true);
1783  $ilCtrl->redirect($this, "editImportantPages");
1784  }
1785 
1786  public function setAsStartPageObject(): void
1787  {
1788  $ilCtrl = $this->ctrl;
1789  $lng = $this->lng;
1790 
1791  $this->checkPermission("edit_wiki_navigation");
1792 
1793  $imp_page_ids = $this->edit_request->getImportantPageIds();
1794  if (count($imp_page_ids) !== 1) {
1795  $this->tpl->setOnScreenMessage('info', $lng->txt("wiki_select_one_item"), true);
1796  } else {
1797  $this->imp_pages->removeImportantPage($imp_page_ids[0]);
1798  $this->object->setStartPage(ilWikiPage::lookupTitle($imp_page_ids[0]));
1799  $this->object->update();
1800  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1801  }
1802  $ilCtrl->redirect($this, "editImportantPages");
1803  }
1804 
1805 
1811  public function exportHTML(): void
1812  {
1814  $wiki = $this->object;
1815  $cont_exp = new Export\WikiHtmlExport($wiki);
1816 
1817  $format = explode("_", $this->edit_request->getFormat());
1818  if (($format[1] ?? "") === "comments") {
1819  $cont_exp->setMode(Export\WikiHtmlExport::MODE_COMMENTS);
1820  }
1821 
1822  $cont_exp->buildExportFile();
1823  }
1824 
1828  public static function lookupSubObjectTitle(
1829  int $a_wiki_id,
1830  string $a_page_id
1831  ): string {
1832  $page = new ilWikiPage($a_page_id);
1833  if ($page->getWikiId() === $a_wiki_id) {
1834  return $page->getTitle();
1835  }
1836  return "";
1837  }
1838 
1842  public function getSubObjectTitle(
1843  int $a_id,
1844  string $a_type
1845  ): string {
1846  return ilWikiPage::lookupTitle($a_id);
1847  }
1848 
1849  public function showTemplateSelectionObject(): void
1850  {
1851  $lng = $this->lng;
1852  $tpl = $this->tpl;
1853  $ilTabs = $this->tabs;
1854  $ilCtrl = $this->ctrl;
1855 
1856  $ilCtrl->setParameterByClass(
1857  "ilobjwikigui",
1858  "from_page",
1859  ilWikiUtil::makeUrlTitle($this->edit_request->getFromPage())
1860  );
1861  $ilTabs->clearTargets();
1862  $this->tpl->setOnScreenMessage('info', $lng->txt("wiki_page_not_exist_select_templ"));
1863 
1864  $form = $this->initTemplateSelectionForm();
1865  $tpl->setContent($form->getHTML());
1866  }
1867 
1869  {
1870  $lng = $this->lng;
1871  $ilCtrl = $this->ctrl;
1872 
1873  $form = new ilPropertyFormGUI();
1874 
1875  // page name
1876  $hi = new ilHiddenInputGUI("page");
1877  $hi->setValue($this->requested_page);
1878  $form->addItem($hi);
1879 
1880  // page template
1881  $radg = new ilRadioGroupInputGUI($lng->txt("wiki_page_template"), "page_templ");
1882  $radg->setRequired(true);
1883 
1884  if ($this->object->getEmptyPageTemplate()) {
1885  $op1 = new ilRadioOption($lng->txt("wiki_empty_page"), 0);
1886  $radg->addOption($op1);
1887  }
1888 
1889  $wt = new ilWikiPageTemplate($this->object->getId());
1890  $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES, $this->edit_request->getTranslation());
1891  foreach ($ts as $t) {
1892  $op = new ilRadioOption($t["title"], $t["wpage_id"]);
1893  $radg->addOption($op);
1894  }
1895 
1896  $form->addItem($radg);
1897 
1898  // save and cancel commands
1899  $form->addCommandButton("createPageUsingTemplate", $lng->txt("wiki_create_page"));
1900  $form->addCommandButton("cancelCreationPageUsingTemplate", $lng->txt("cancel"));
1901 
1902  $form->setTitle($lng->txt("wiki_new_page") . ": " . $this->requested_page);
1903  $form->setFormAction($ilCtrl->getFormAction($this));
1904 
1905  return $form;
1906  }
1907 
1908  public function createPageUsingTemplateObject(): void
1909  {
1910  $tpl = $this->tpl;
1911  $lng = $this->lng;
1912  $ilCtrl = $this->ctrl;
1913 
1914  $form = $this->initTemplateSelectionForm();
1915  if ($form->checkInput()) {
1916  $a_page = $this->edit_request->getPage();
1917  $this->pm->createWikiPage(
1918  $a_page,
1919  0,
1920  $this->edit_request->getTranslation(),
1921  $this->edit_request->getPageTemplateId()
1922  );
1923 
1924  // redirect to newly created page
1925  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
1926  $ilCtrl->redirectByClass("ilwikipagegui", "edit");
1927 
1928  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1929  $ilCtrl->redirect($this, "");
1930  } else {
1931  $form->setValuesByPost();
1932  $tpl->setContent($form->getHTML());
1933  }
1934  }
1935 
1937  {
1938  $ilCtrl = $this->ctrl;
1939 
1940  // redirect to newly created page
1941  $ilCtrl->setParameterByClass(
1942  "ilwikipagegui",
1943  "page",
1944  ilWikiUtil::makeUrlTitle($this->edit_request->getFromPage())
1945  );
1946  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1947  }
1948 
1949  protected function checkPermissionBool(string $perm, string $cmd = "", string $type = "", ?int $ref_id = null): bool
1950  {
1951  if ($perm === "create") {
1952  return parent::checkPermissionBool($perm, $cmd, $type, $ref_id);
1953  } else {
1954  if (!$ref_id) {
1955  $ref_id = $this->object->getRefId();
1956  }
1957  return ilWikiPerm::check($perm, $ref_id, $cmd);
1958  }
1959  }
1960 
1961 
1962  //
1963  // User HTML Export
1964  //
1981  public function initUserHTMLExportObject(): void
1982  {
1983  $this->log->debug("init: " . $this->req_with_comments);
1984  $this->checkPermission("wiki_html_export");
1985  $this->object->initUserHTMLExport($this->req_with_comments);
1986  }
1987 
1991  public function startUserHTMLExportObject(): void
1992  {
1993  $this->log->debug("start: " . $this->req_with_comments);
1994  $this->checkPermission("wiki_html_export");
1995  $this->object->startUserHTMLExport($this->req_with_comments);
1996  }
1997 
2001  public function getUserHTMLExportProgressObject(): void
2002  {
2003  $this->log->debug("get progress: " . $this->req_with_comments);
2004  $this->checkPermission("wiki_html_export");
2005  $p = $this->object->getUserHTMLExportProgress($this->req_with_comments);
2006 
2008  $pb->setCurrent($p["progress"]);
2009 
2010  $r = new stdClass();
2011  $r->progressBar = $pb->render();
2012  $r->status = $p["status"];
2013  $this->log->debug("status: " . $r->status);
2014  echo(json_encode($r, JSON_THROW_ON_ERROR));
2015  exit;
2016  }
2017 
2018  public function downloadUserHTMLExportObject(): void
2019  {
2020  $this->log->debug("download");
2021  $this->checkPermission("wiki_html_export");
2022  $this->object->deliverUserHTMLExport();
2023  }
2024 
2026  {
2027  $this->log->debug("download");
2028  $this->checkPermission("wiki_html_export");
2029  $this->object->deliverUserHTMLExport(true);
2030  }
2031 
2032  protected function triggerAssignmentTool(): void
2033  {
2034  if (!is_object($this->object)) {
2035  return;
2036  }
2037  $ass_info = ilExcRepoObjAssignment::getInstance()->getAssignmentInfoOfObj(
2038  $this->object->getRefId(),
2039  $this->user->getId()
2040  );
2041  if (count($ass_info) > 0) {
2042  $ass_ids = array_map(static function ($i): int {
2043  return $i->getId();
2044  }, $ass_info);
2045  $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::SHOW_EXC_ASSIGNMENT_INFO, true);
2046  $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::EXC_ASS_IDS, $ass_ids);
2047  $this->tool_context->current()->addAdditionalData(
2049  $this->getAssignmentButtons()
2050  );
2051  }
2052  }
2053 
2057  protected function getAssignmentButtons(): array
2058  {
2059  $ilCtrl = $this->ctrl;
2060  $ui = $this->ui;
2061  $lng = $this->lng;
2062 
2063  $ass_info = ilExcRepoObjAssignment::getInstance()->getAssignmentInfoOfObj(
2064  $this->object->getRefId(),
2065  $this->user->getId()
2066  );
2067  $buttons = [];
2068  foreach ($ass_info as $i) { // should be only one
2069  $ass = new ilExAssignment($i->getId());
2070  $times_up = $ass->afterDeadlineStrict();
2071 
2072  // submit button
2073  if (!$times_up) {
2074  $ilCtrl->setParameterByClass("ilwikipagegui", "ass", $ass->getId());
2075  $submit_link = $ilCtrl->getLinkTargetByClass("ilwikipagegui", "finalizeAssignment");
2076  $ilCtrl->setParameterByClass("ilwikipagegui", "ass", "");
2077 
2078  $buttons[$i->getId()][] = $ui->factory()->button()->primary($lng->txt("wiki_finalize_wiki"), $submit_link);
2079  }
2080 
2081  // submitted files
2082  $submission = new ilExSubmission($ass, $this->user->getId());
2083  if ($submission->hasSubmitted()) {
2084  $submitted = $submission->getSelectedObject();
2085  if ($submitted["ts"] != "") {
2086  $ilCtrl->setParameterByClass("ilwikipagegui", "ass", $ass->getId());
2087  }
2088  $dl_link = $ilCtrl->getLinkTargetByClass("ilwikipagegui", "downloadExcSubFile");
2089  $ilCtrl->setParameterByClass("ilwikipagegui", "ass", "");
2090  $buttons[$i->getId()][] = $ui->factory()->button()->standard($lng->txt("wiki_download_submission"), $dl_link);
2091  }
2092  }
2093  return $buttons;
2094  }
2095 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
WikiGUIRequest $edit_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Style Content Object ObjectFacade $content_style_domain
ILIAS Wiki Page PageManager $pm
ILIAS HTTP Services $http
exit
Definition: login.php:29
static _lookupComment(int $a_usr_id, int $a_obj_id)
Class ilInfoScreenGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getUserHTMLExportProgressObject()
Get user html export progress.
Exercise assignment.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
initImportForm(string $new_type)
const IL_WIKI_POPULAR_PAGES
static getLogger(string $a_component_id)
Get component logger.
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
Wiki page template gui class.
GUI class for the workflow of copying objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ROOT_FOLDER_ID
Definition: constants.php:32
prepareOutput(bool $show_sub_objects=true)
static _writeStatus(int $a_obj_id, int $a_user_id, int $a_status)
ILIAS DI UIServices $ui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
Wiki statistics GUI class.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _getAllReferences(int $id)
get all reference ids for object ID
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Help GUI class.
static renderSideBlock(int $a_wpg_id, int $a_wiki_ref_id, ?ilWikiPage $a_wp=null)
static lookupTitle(int $a_page_id, string $lang="-")
afterDeadlineStrict(bool $a_include_personal=true)
ILIAS Style Content GUIService $content_style_gui
infoScreenObject()
this one is called from the info button in the repository
static _gotoRepositoryNode(int $ref_id, string $cmd="")
TableGUI class for wiki pages table.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
static _performSearch(int $a_wiki_id, string $a_searchterm)
Search in Wiki.
getSubObjectTitle(int $a_id, string $a_type)
Used for rating export.
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
loadLanguageModule(string $a_module)
Load language module.
setTitle(string $title)
setOptions(array $a_options)
static _lookupRatingCategories(int $a_wiki_id)
Lookup whether rating categories are activated.
static lookupWikiId(int $a_page_id)
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
downloadUserHTMLExportWithCommentsObject()
static lookupSubObjectTitle(int $a_wiki_id, string $a_page_id)
Get title for wiki page (used in ilNotesGUI)
getAllInfo(int $a_type=self::TYPE_ALL, string $lang="-")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Wiki Content GUIService $content_gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHeaderActionMenu(string $a_header)
Set header action menu.
static _getPageIdForWikiTitle(int $a_wiki_id, string $a_title)
global $DIC
Definition: feed.php:28
startUserHTMLExportObject()
Export html (as user)
static _lookupRating(int $a_wiki_id)
Lookup whether rating is activated.
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
static strLen(string $a_string)
Definition: class.ilStr.php:63
$provider
Definition: ltitoken.php:83
Export User Interface Class.
ilLanguage $lng
ContextServices $tool_context
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjectTranslation $ot
GUI class for public user profile presentation.
static checkShortTitleAvailability(string $a_short_title)
static http()
Fetches the global http state from ILIAS.
This class represents a property in a property form.
__construct(VocabulariesInterface $vocabularies)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
$GLOBALS["DIC"]
Definition: wac.php:31
getPrintView(bool $export=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct( $a_data, int $a_id, bool $a_call_by_reference, bool $a_prepare_output=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setScreenIdComponent(string $a_comp)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjectGUI Basic methods of all Output classes.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static lookupAdvancedMetadataHidden(int $a_page_id)
initUserHTMLExportObject()
Current process:
getAssignmentButtons()
Get assignment buttons.
ilToolbarGUI $toolbar
$comments
ILIAS Wiki Navigation ImportantPageManager $imp_pages
static getRandomPage(int $a_wiki_id)
ilObjectService $object_service
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupStartPage(int $a_wiki_id)
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.
static getGotoLink(int $a_ref_id, string $a_page="", string $lang="-")
ILIAS Wiki InternalGUIService $gui
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
setRequired(bool $a_required)
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
ilPropertyFormGUI $form_gui
setCustomRolesForSelection(array $a_roles)
Set custom roles for mapping to LTI roles.
setSettingsSubTabs(string $a_active)
static redirect(string $a_script)
$lang
Definition: xapiexit.php:26
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static _lookupMark(int $a_usr_id, int $a_obj_id)
const IL_WIKI_ALL_PAGES
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeUrlTitle(string $a_par)
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
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
const IL_WIKI_ORPHANED_PAGES
ilAccessHandler $access
ILIAS Wiki InternalDomainService $domain
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
setRightContent(string $a_html)
Sets content of right column.
initCreationForms(string $new_type)
afterSave(ilObject $new_object)
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...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSideBlock(int $a_wpg_id=0)
getSettingsFormValues(string $a_mode="edit")
addHeaderAction()
Add header action menu.
ilLocatorGUI $locator
ilSetting $settings
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
setDescription(string $description)
initSettingsForm(string $a_mode="edit")
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
GUI class for object translation handling.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
gotoPageObject(string $a_page="")
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
static _goto(string $a_target)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$r
const IL_WIKI_NEW_PAGES