ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjWikiGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5use \ILIAS\Wiki\Export;
6
22{
26 protected $tabs;
27
31 protected $error;
32
36 protected $help;
37
38
42 protected $log;
43
47 protected $tool_context;
48
52 protected $ui;
53
57 protected $req_with_comments = false;
58
63 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
64 {
65 global $DIC;
66
67 $this->ctrl = $DIC->ctrl();
68 $this->lng = $DIC->language();
69 $this->user = $DIC->user();
70 $this->tpl = $DIC["tpl"];
71 $this->tabs = $DIC->tabs();
72 $this->access = $DIC->access();
73 $this->error = $DIC["ilErr"];
74 $this->settings = $DIC->settings();
75 $this->help = $DIC["ilHelp"];
76 $this->locator = $DIC["ilLocator"];
77 $this->toolbar = $DIC->toolbar();
78 $ilCtrl = $DIC->ctrl();
79 $lng = $DIC->language();
80
81 $this->type = "wiki";
82
83 $this->log = ilLoggerFactory::getLogger('wiki');
84
85 $this->tool_context = $DIC->globalScreen()->tool()->context();
86 $this->ui = $DIC->ui();
87
88 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
89 $lng->loadLanguageModule("obj");
90 $lng->loadLanguageModule("wiki");
91
92 if ($_GET["page"] != "") {
93 $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
94 }
95
96 $this->req_with_comments = (bool) $_GET["with_comments"];
97 }
98
99 public function executeCommand()
100 {
102 $ilCtrl = $this->ctrl;
104 $ilTabs = $this->tabs;
105 $ilAccess = $this->access;
106
107 $next_class = $this->ctrl->getNextClass($this);
108 $cmd = $this->ctrl->getCmd();
109
110 $this->triggerAssignmentTool();
111
112 $this->prepareOutput();
113
114 // see ilWikiPageGUI::printViewOrderList()
115 // printView() and pdfExport() cannot be in ilWikiPageGUI because of stylesheet confusion
116 if ($cmd == "printView" || $cmd == "pdfExport") {
117 $next_class = null;
118 }
119
120 switch ($next_class) {
121 case "ilinfoscreengui":
122 $this->checkPermission("visible");
123 $this->addHeaderAction();
124 $this->infoScreen(); // forwards command
125 break;
126
127 case 'ilpermissiongui':
128 $this->addHeaderAction();
129 $ilTabs->activateTab("perm_settings");
130 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
131 $perm_gui = new ilPermissionGUI($this);
132 $ret = $this->ctrl->forwardCommand($perm_gui);
133 break;
134
135 case 'ilsettingspermissiongui':
136 $this->checkPermission("write");
137 $this->addHeaderAction();
138 $ilTabs->activateTab("settings");
139 $this->setSettingsSubTabs("permission_settings");
140 include_once("Services/AccessControl/classes/class.ilSettingsPermissionGUI.php");
141 $perm_gui = new ilSettingsPermissionGUI($this);
142 $perm_gui->setPermissions(array("edit_wiki_navigation", "delete_wiki_pages", "activate_wiki_protection",
143 "wiki_html_export"));
144 $perm_gui->setRoleRequiredPermissions(array("edit_content"));
145 $perm_gui->setRoleProhibitedPermissions(array("write"));
146 $ret = $this->ctrl->forwardCommand($perm_gui);
147 break;
148
149 case 'ilwikipagegui':
150 $this->checkPermission("read");
151 include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
153 $this->object->getId(),
155 $_GET["old_nr"],
156 $this->object->getRefId()
157 );
158 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
159 $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
160 $this->object->getStyleSheetId(),
161 "wiki"
162 ));
163 $this->setContentStyleSheet();
164 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
165 (
166 !$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
167 $wpage_gui->getPageObject()->getBlocked()
168 )) {
169 $wpage_gui->setEnableEditing(false);
170 }
171
172 // alter title and description
173// $tpl->setTitle($wpage_gui->getPageObject()->getTitle());
174// $tpl->setDescription($this->object->getTitle());
175 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
176 $wpage_gui->activateMetaDataEditor($this->object, "wpg", $wpage_gui->getId());
177 }
178
179 $ret = $this->ctrl->forwardCommand($wpage_gui);
180 if ($ret != "") {
181 $tpl->setContent($ret);
182 }
183 break;
184
185 case 'ilobjectcopygui':
186 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
187 $cp = new ilObjectCopyGUI($this);
188 $cp->setType('wiki');
189 $this->ctrl->forwardCommand($cp);
190 break;
191
192 case 'ilpublicuserprofilegui':
193 require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
194 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
195 $ret = $this->ctrl->forwardCommand($profile_gui);
196 $tpl->setContent($ret);
197 break;
198
199 case "ilobjstylesheetgui":
200 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
201 $this->ctrl->setReturn($this, "editStyleProperties");
202 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
203 $style_gui->omitLocator();
204 if ($cmd == "create" || $_GET["new_type"] == "sty") {
205 $style_gui->setCreationMode(true);
206 }
207
208 if ($cmd == "confirmedDelete") {
209 $this->object->setStyleSheetId(0);
210 $this->object->update();
211 }
212
213 $ret = $this->ctrl->forwardCommand($style_gui);
214
215 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
216 $style_id = $ret;
217 $this->object->setStyleSheetId($style_id);
218 $this->object->update();
219 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
220 }
221 break;
222
223 case "ilexportgui":
224// $this->prepareOutput();
225 $this->addHeaderAction();
226 $ilTabs->activateTab("export");
227 include_once("./Services/Export/classes/class.ilExportGUI.php");
228 $exp_gui = new ilExportGUI($this);
229 $exp_gui->addFormat("xml");
230 $exp_gui->addFormat("html", "", $this, "exportHTML");
231 if ($this->object->isCommentsExportPossible()) {
232 $exp_gui->addFormat("html_comments", "HTML (" . $this->lng->txt("wiki_incl_comments") . ")", $this, "exportHTML");
233 }
234 $ret = $this->ctrl->forwardCommand($exp_gui);
235// $this->tpl->show();
236 break;
237
238 case "ilcommonactiondispatchergui":
239 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
241 $this->ctrl->forwardCommand($gui);
242 break;
243
244 case "ilratinggui":
245 // for rating category editing
246 $this->checkPermission("write");
247 $this->addHeaderAction();
248 $ilTabs->activateTab("settings");
249 $this->setSettingsSubTabs("rating_categories");
250 include_once("Services/Rating/classes/class.ilRatingGUI.php");
251 $gui = new ilRatingGUI();
252 $gui->setObject($this->object->getId(), $this->object->getType());
253 $gui->setExportCallback(array($this, "getSubObjectTitle"), $this->lng->txt("page"));
254 $this->ctrl->forwardCommand($gui);
255 break;
256
257 case "ilwikistatgui":
258 $this->checkPermission("statistics_read");
259
260 $this->addHeaderAction();
261 $ilTabs->activateTab("statistics");
262
263 include_once "Modules/Wiki/classes/class.ilWikiStatGUI.php";
264 $gui = new ilWikiStatGUI($this->object->getId());
265 $this->ctrl->forwardCommand($gui);
266 break;
267
268 case "ilwikipagetemplategui":
269 $this->checkPermission("write");
270 $this->addHeaderAction();
271 $ilTabs->activateTab("settings");
272 $this->setSettingsSubTabs("page_templates");
273 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplateGUI.php");
274 $wptgui = new ilWikiPageTemplateGUI($this);
275 $this->ctrl->forwardCommand($wptgui);
276 break;
277
278 case 'ilobjectmetadatagui':
279 $this->checkPermission("write");
280 $this->addHeaderAction();
281 $ilTabs->activateTab("advmd");
282 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
283 $md_gui = new ilObjectMetaDataGUI($this->object, "wpg");
284 $this->ctrl->forwardCommand($md_gui);
285 break;
286
287 case 'ilrepositoryobjectsearchgui':
288 $this->addHeaderAction();
289 $this->setSideBlock();
290 $ilTabs->setTabActive("wiki_search_results");
291 $ilCtrl->setReturn($this, 'view');
292 include_once './Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
293 $search_gui = new ilRepositoryObjectSearchGUI(
294 $this->object->getRefId(),
295 $this,
296 'view'
297 );
298 $ilCtrl->forwardCommand($search_gui);
299 break;
300
301 case 'ilobjnotificationsettingsgui':
302 $this->addHeaderAction();
303 $ilTabs->activateTab("settings");
304 $this->setSettingsSubTabs("notifications");
305 include_once("./Services/Notification/classes/class.ilObjNotificationSettingsGUI.php");
306 $gui = new ilObjNotificationSettingsGUI($this->object->getRefId());
307 $this->ctrl->forwardCommand($gui);
308 break;
309
310 default:
311 $this->addHeaderAction();
312 if (!$cmd) {
313 $cmd = "infoScreen";
314 }
315 $cmd .= "Object";
316 if ($cmd != "cancelObject") {
317 if ($cmd != "infoScreenObject") {
318 if (!in_array($cmd, array("createObject", "saveObject", "importFileObject"))) {
319 $this->checkPermission("read");
320 }
321 } else {
322 $this->checkPermission("visible");
323 }
324 }
325 $this->$cmd();
326 break;
327 }
328
329 return $ret;
330 }
331
337 public function isOnlineHelpWiki()
338 {
339 if (is_object($this->object)) {
340 return ilObjWiki::isOnlineHelpWiki($this->object->getRefId());
341 }
342 return false;
343 }
344
348 public function viewObject()
349 {
350 $this->checkPermission("read");
351 $this->gotoStartPageObject();
352 }
353
354 protected function initCreationForms($a_new_type)
355 {
356 $this->initSettingsForm("create");
357 $this->getSettingsFormValues("create");
358
359 $forms = array(self::CFORM_NEW => $this->form_gui,
360 self::CFORM_IMPORT => $this->initImportForm($a_new_type),
361 self::CFORM_CLONE => $this->fillCloneTemplate(null, $a_new_type));
362
363 return $forms;
364 }
365
370 public function saveObject()
371 {
375
376 if (!$this->checkPermissionBool("create", "", "wiki", $_GET["ref_id"])) {
377 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
378 }
379
380 $this->initSettingsForm("create");
381 if ($this->form_gui->checkInput()) {
382 if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle"))) {
383 $short_item = $this->form_gui->getItemByPostVar("shorttitle");
384 $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
385 } else {
386 // create and insert forum in objecttree
387 $_POST["title"] = $this->form_gui->getInput("title");
388 $_POST["desc"] = $this->form_gui->getInput("description");
389 return parent::saveObject();
390 }
391 }
392
393 $this->form_gui->setValuesByPost();
394 $tpl->setContent($this->form_gui->getHtml());
395 }
396
401 public function afterSave(ilObject $newObj)
402 {
404
405 $newObj->setTitle($this->form_gui->getInput("title"));
406 $newObj->setDescription($this->form_gui->getInput("description"));
407 $newObj->setIntroduction($this->form_gui->getInput("intro"));
408 $newObj->setStartPage($this->form_gui->getInput("startpage"));
409 $newObj->setShortTitle($this->form_gui->getInput("shorttitle"));
410 $newObj->setRating($this->form_gui->getInput("rating"));
411 // $newObj->setRatingAsBlock($this->form_gui->getInput("rating_side"));
412 $newObj->setRatingForNewPages($this->form_gui->getInput("rating_new"));
413 $newObj->setRatingCategories($this->form_gui->getInput("rating_ext"));
414
415 $newObj->setRatingOverall($this->form_gui->getInput("rating_overall"));
416 $newObj->setPageToc($this->form_gui->getInput("page_toc"));
417
418
419
420 if (!$ilSetting->get("disable_comments")) {
421 $newObj->setPublicNotes($this->form_gui->getInput("public_notes"));
422 }
423 $newObj->setOnline($this->form_gui->getInput("online"));
424 $newObj->update();
425
426 // always send a message
427 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
429 }
430
436 public function infoScreenObject()
437 {
438 $this->checkPermission("visible");
439 $this->ctrl->setCmd("showSummary");
440 $this->ctrl->setCmdClass("ilinfoscreengui");
441 $this->infoScreen();
442 }
443
447 public function infoScreen()
448 {
449 $ilAccess = $this->access;
451 $ilTabs = $this->tabs;
454
455 $ilTabs->activateTab("info_short");
456
457 if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId())) {
458 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
459 }
460
461 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
462 $info = new ilInfoScreenGUI($this);
463 $info->enablePrivateNotes();
464 if (trim($this->object->getIntroduction()) != "") {
465 $info->addSection($lng->txt("wiki_introduction"));
466 $info->addProperty("", nl2br($this->object->getIntroduction()));
467 }
468
469 // feedback from tutor; mark, status, comment
470 include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
471 include_once("./Services/Tracking/classes/class.ilLPMarks.php");
472 $lpcomment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId());
473 $mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId());
474 $status = ilWikiContributor::_lookupStatus($this->object->getId(), $ilUser->getId());
475 if ($lpcomment != "" || $mark != "" || $status != ilWikiContributor::STATUS_NOT_GRADED) {
476 $info->addSection($this->lng->txt("wiki_feedback_from_tutor"));
477 if ($lpcomment != "") {
478 $info->addProperty(
479 $this->lng->txt("wiki_comment"),
480 $lpcomment
481 );
482 }
483 if ($mark != "") {
484 $info->addProperty(
485 $this->lng->txt("wiki_mark"),
486 $mark
487 );
488 }
489
490 if ($status == ilWikiContributor::STATUS_PASSED) {
491 $info->addProperty(
492 $this->lng->txt("status"),
493 $this->lng->txt("wiki_passed")
494 );
495 }
496 if ($status == ilWikiContributor::STATUS_FAILED) {
497 $info->addProperty(
498 $this->lng->txt("status"),
499 $this->lng->txt("wiki_failed")
500 );
501 }
502 }
503
504 /*
505 $info->enableNews();
506 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
507 {
508 //$info->enableNewsEditing();
509 $info->setBlockProperty("news", "settings", true);
510 }*/
511
512 if ($ilAccess->checkAccess("read", "", $this->object->getRefId())) {
513 $info->addButton($lng->txt("wiki_start_page"), ilObjWikiGUI::getGotoLink($this->object->getRefId()));
514 }
515
516 // general information
517 $this->lng->loadLanguageModule("meta");
518 $this->lng->loadLanguageModule("wiki");
519
520 //$info->addSection($this->lng->txt("meta_general"));
521 //$info->addProperty($this->lng->txt("mcst_nr_items"),
522 // (int) count($med_items));
523
524 // forward the command
525 $this->ctrl->forwardCommand($info);
526
527 if ($ilAccess->checkAccess("read", "", $this->object->getRefId())) {
528 // $this->setSideBlock();
529 }
530 }
531
535 public function gotoStartPageObject()
536 {
537 $ilCtrl = $this->ctrl;
538
539 ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId()));
540 }
541
545 public function addPageTabs()
546 {
547 $ilTabs = $this->tabs;
548 $ilCtrl = $this->ctrl;
549
550 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
551 $ilCtrl->setParameter(
552 $this,
553 "wpg_id",
554 ilWikiPage::getPageIdForTitle($this->object->getId(), ilWikiUtil::makeDbTitle($_GET["page"]))
555 );
556 $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
557 $ilTabs->addTarget(
558 "wiki_what_links_here",
559 $this->ctrl->getLinkTargetByClass(
560 "ilwikipagegui",
561 "whatLinksHere"
562 ),
563 "whatLinksHere"
564 );
565 $ilTabs->addTarget(
566 "wiki_print_view",
567 $this->ctrl->getLinkTargetByClass(
568 "ilwikipagegui",
569 "printViewSelection"
570 ),
571 "printViewSelection"
572 );
573 }
574
578 public function addPagesSubTabs()
579 {
580 $ilTabs = $this->tabs;
581 $ilCtrl = $this->ctrl;
582
583 $ilTabs->activateTab("wiki_pages");
584
585 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
586 $ilCtrl->setParameter(
587 $this,
588 "wpg_id",
590 $this->object->getId(),
592 )
593 );
594 $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
595 $ilTabs->addSubTabTarget(
596 "wiki_all_pages",
597 $this->ctrl->getLinkTarget($this, "allPages"),
598 "allPages"
599 );
600 $ilTabs->addSubTabTarget(
601 "wiki_recent_changes",
602 $this->ctrl->getLinkTarget($this, "recentChanges"),
603 "recentChanges"
604 );
605 $ilTabs->addSubTabTarget(
606 "wiki_new_pages",
607 $this->ctrl->getLinkTarget($this, "newPages"),
608 "newPages"
609 );
610 $ilTabs->addSubTabTarget(
611 "wiki_popular_pages",
612 $this->ctrl->getLinkTarget($this, "popularPages"),
613 "popularPages"
614 );
615 $ilTabs->addSubTabTarget(
616 "wiki_orphaned_pages",
617 $this->ctrl->getLinkTarget($this, "orphanedPages"),
618 "orphanedPages"
619 );
620 }
621
627 public function getTabs()
628 {
629 $ilCtrl = $this->ctrl;
630 $ilAccess = $this->access;
632 $ilHelp = $this->help;
633
634 $ilHelp->setScreenIdComponent("wiki");
635
636 // wiki tabs
637 if (in_array($ilCtrl->getCmdClass(), array("", "ilobjwikigui",
638 "ilinfoscreengui", "ilpermissiongui", "ilexportgui", "ilratingcategorygui", "ilobjnotificationsettingsgui", "iltaxmdgui",
639 "ilwikistatgui", "ilwikipagetemplategui", "iladvancedmdsettingsgui", "ilsettingspermissiongui", 'ilrepositoryobjectsearchgui'
640 )) || (in_array($ilCtrl->getNextClass(), array("ilpermissiongui")))) {
641 if ($_GET["page"] != "") {
642 $this->tabs_gui->setBackTarget(
643 $lng->txt("wiki_last_visited_page"),
644 $this->getGotoLink(
645 $_GET["ref_id"],
647 )
648 );
649 }
650
651 // pages
652 if ($ilAccess->checkAccess('read', "", $this->object->getRefId())) {
653 $this->tabs_gui->addTab(
654 "wiki_pages",
655 $lng->txt("wiki_pages"),
656 $this->ctrl->getLinkTarget($this, "allPages")
657 );
658 }
659
660 // info screen
661 if ($ilAccess->checkAccess('visible', "", $this->object->getRefId())) {
662 $this->tabs_gui->addTab(
663 "info_short",
664 $lng->txt("info_short"),
665 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
666 );
667 }
668
669 // settings
670 if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
671 $this->tabs_gui->addTab(
672 "settings",
673 $lng->txt("settings"),
674 $this->ctrl->getLinkTarget($this, "editSettings")
675 );
676
677 // metadata
678 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
679 $mdgui = new ilObjectMetaDataGUI($this->object, "wpg");
680 $mdtab = $mdgui->getTab();
681 if ($mdtab) {
682 $this->tabs_gui->addTab(
683 "advmd",
684 $this->lng->txt("meta_data"),
685 $mdtab
686 );
687 }
688 }
689
690 // contributors
691 if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
692 $this->tabs_gui->addTab(
693 "wiki_contributors",
694 $lng->txt("wiki_contributors"),
695 $this->ctrl->getLinkTarget($this, "listContributors")
696 );
697 }
698
699 // statistics
700 if ($ilAccess->checkAccess('statistics_read', "", $this->object->getRefId())) {
701 $this->tabs_gui->addTab(
702 "statistics",
703 $lng->txt("statistics"),
704 $this->ctrl->getLinkTargetByClass("ilWikiStatGUI", "initial")
705 );
706 }
707
708 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
709 $this->tabs_gui->addTab(
710 "export",
711 $lng->txt("export"),
712 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
713 );
714 }
715
716 // edit permissions
717 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
718 $this->tabs_gui->addTab(
719 "perm_settings",
720 $lng->txt("perm_settings"),
721 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
722 );
723 }
724 }
725 }
726
730 public function setSettingsSubTabs($a_active)
731 {
732 $ilTabs = $this->tabs;
733 $ilCtrl = $this->ctrl;
735 $ilAccess = $this->access;
736
737 if (in_array(
738 $a_active,
739 array("general_settings", "style", "imp_pages", "rating_categories",
740 "page_templates", "advmd", "permission_settings", "notifications")
741 )) {
742 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
743 // general properties
744 $ilTabs->addSubTab(
745 "general_settings",
746 $lng->txt("wiki_general_settings"),
747 $ilCtrl->getLinkTarget($this, 'editSettings')
748 );
749
750 // permission settings
751 $ilTabs->addSubTab(
752 "permission_settings",
753 $lng->txt("obj_permission_settings"),
754 $this->ctrl->getLinkTargetByClass("ilsettingspermissiongui", "")
755 );
756
757 // style properties
758 $ilTabs->addSubTab(
759 "style",
760 $lng->txt("wiki_style"),
761 $ilCtrl->getLinkTarget($this, 'editStyleProperties')
762 );
763 }
764
765 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
766 // important pages
767 $ilTabs->addSubTab(
768 "imp_pages",
769 $lng->txt("wiki_navigation"),
770 $ilCtrl->getLinkTarget($this, 'editImportantPages')
771 );
772 }
773
774 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
775 // page templates
776 $ilTabs->addSubTab(
777 "page_templates",
778 $lng->txt("wiki_page_templates"),
779 $ilCtrl->getLinkTargetByClass("ilwikipagetemplategui", "")
780 );
781
782 // rating categories
783 if ($this->object->getRating() && $this->object->getRatingCategories()) {
784 $lng->loadLanguageModule("rating");
785 $ilTabs->addSubTab(
786 "rating_categories",
787 $lng->txt("rating_categories"),
788 $ilCtrl->getLinkTargetByClass(array('ilratinggui', 'ilratingcategorygui'), '')
789 );
790 }
791
792 $ilTabs->addSubTab(
793 'notifications',
794 $lng->txt("notifications"),
795 $ilCtrl->getLinkTargetByClass("ilobjnotificationsettingsgui", '')
796 );
797 }
798
799 $ilTabs->activateSubTab($a_active);
800 }
801 }
802
806 public function editSettingsObject()
807 {
809
810 $this->checkPermission("write");
811
812 $this->setSettingsSubTabs("general_settings");
813
814 $this->initSettingsForm();
815 $this->getSettingsFormValues();
816
817 // Edit ecs export settings
818 include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
819 $ecs = new ilECSWikiSettings($this->object);
820 $ecs->addSettingsToForm($this->form_gui, 'wiki');
821
822 $tpl->setContent($this->form_gui->getHtml());
823 $this->setSideBlock();
824 }
825
829 public function initSettingsForm($a_mode = "edit")
830 {
832 $ilCtrl = $this->ctrl;
833 $ilTabs = $this->tabs;
835 $obj_service = $this->object_service;
836
837 $lng->loadLanguageModule("wiki");
838 $ilTabs->activateTab("settings");
839
840 require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
841 $this->form_gui = new ilPropertyFormGUI();
842
843 // Title
844 $tit = new ilTextInputGUI($lng->txt("title"), "title");
845 $tit->setRequired(true);
846 $this->form_gui->addItem($tit);
847
848 // Short Title
849 // The problem with the short title is, that it is per object
850 // and can't be a substitute for a ref id in the permanent link
851 /*
852 $stit = new ilRegExpInputGUI($lng->txt("wiki_short_title"), "shorttitle");
853 $stit->setPattern("/^[^0-9][^ _\&]+$/");
854 $stit->setRequired(false);
855 $stit->setNoMatchMessage($lng->txt("wiki_msg_short_name_regexp")." &amp; _");
856 $stit->setSize(20);
857 $stit->setMaxLength(20);
858 $stit->setInfo($lng->txt("wiki_short_title_desc2"));
859 $this->form_gui->addItem($stit);
860 */
861
862 // Description
863 $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
864 $this->form_gui->addItem($des);
865
866 // Introduction
867 $intro = new ilTextAreaInputGUI($lng->txt("wiki_introduction"), "intro");
868 $intro->setCols(40);
869 $intro->setRows(4);
870 $this->form_gui->addItem($intro);
871
872 // Start Page
873 if ($a_mode == "edit") {
874 $pages = ilWikiPage::getAllWikiPages($this->object->getId());
875 foreach ($pages as $p) {
876 $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
877 }
878 $si = new ilSelectInputGUI($lng->txt("wiki_start_page"), "startpage_id");
879 $si->setOptions($options);
880 $this->form_gui->addItem($si);
881 } else {
882 $sp = new ilTextInputGUI($lng->txt("wiki_start_page"), "startpage");
883 if ($a_mode == "edit") {
884 $sp->setInfo($lng->txt("wiki_start_page_info"));
885 }
886 $sp->setMaxLength(200);
887 $sp->setRequired(true);
888 $this->form_gui->addItem($sp);
889 }
890
891 // Online
892 $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
893 $this->form_gui->addItem($online);
894
895
896 // rating
897
898 $lng->loadLanguageModule('rating');
899 $rate = new ilCheckboxInputGUI($lng->txt('rating_activate_rating'), 'rating_overall');
900 $rate->setInfo($lng->txt('rating_activate_rating_info'));
901 $this->form_gui->addItem($rate);
902
903 $rating = new ilCheckboxInputGUI($lng->txt("wiki_activate_rating"), "rating");
904 $this->form_gui->addItem($rating);
905
906 /* always active
907 $side = new ilCheckboxInputGUI($lng->txt("wiki_activate_sideblock_rating"), "rating_side");
908 $rating->addSubItem($side);
909 */
910
911 $new = new ilCheckboxInputGUI($lng->txt("wiki_activate_new_page_rating"), "rating_new");
912 $rating->addSubItem($new);
913
914 $extended = new ilCheckboxInputGUI($lng->txt("wiki_activate_extended_rating"), "rating_ext");
915 $rating->addSubItem($extended);
916
917
918 // public comments
919 if (!$ilSetting->get("disable_comments")) {
920 $comments = new ilCheckboxInputGUI($lng->txt("wiki_public_comments"), "public_notes");
921 $this->form_gui->addItem($comments);
922 }
923
924 // important pages
925 // $imp_pages = new ilCheckboxInputGUI($lng->txt("wiki_important_pages"), "imp_pages");
926 // $this->form_gui->addItem($imp_pages);
927
928 // page toc
929 $page_toc = new ilCheckboxInputGUI($lng->txt("wiki_page_toc"), "page_toc");
930 $page_toc->setInfo($lng->txt("wiki_page_toc_info"));
931 $this->form_gui->addItem($page_toc);
932
933 if ($a_mode == "edit") {
934 // advanced metadata auto-linking
935 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
936 if (count(ilAdvancedMDRecord::_getSelectedRecordsByObject("wiki", $this->object->getRefId(), "wpg")) > 0) {
937 $link_md = new ilCheckboxInputGUI($lng->txt("wiki_link_md_values"), "link_md_values");
938 $link_md->setInfo($lng->txt("wiki_link_md_values_info"));
939 $this->form_gui->addItem($link_md);
940 }
941
942
944 $section->setTitle($this->lng->txt('obj_presentation'));
945 $this->form_gui->addItem($section);
946
947 // tile image
948 $obj_service->commonSettings()->legacyForm($this->form_gui, $this->object)->addTileImage();
949
950
951 // additional features
952 $feat = new ilFormSectionHeaderGUI();
953 $feat->setTitle($this->lng->txt('obj_features'));
954 $this->form_gui->addItem($feat);
955
956 include_once './Services/Container/classes/class.ilContainer.php';
957 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
959 $this->object->getId(),
960 $this->form_gui,
961 array(
963 )
964 );
965 }
966
967 // :TODO: sorting
968
969 // Form action and save button
970 $this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_wiki.svg"));
971 if ($a_mode != "create") {
972 $this->form_gui->setTitle($lng->txt("wiki_settings"));
973 $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
974 } else {
975 $this->form_gui->setTitle($lng->txt("wiki_new"));
976 $this->form_gui->addCommandButton("save", $lng->txt("wiki_add"));
977 $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
978 }
979
980 // set values
981 if ($a_mode == "create") {
982 $ilCtrl->setParameter($this, "new_type", "wiki");
983 }
984
985 $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
986 }
987
988 public function getSettingsFormValues($a_mode = "edit")
989 {
992
993 // set values
994 if ($a_mode == "create") {
995 //$values["startpage"] = $lng->txt("wiki_main_page");
996 $values["rating_new"] = true;
997
998 $values["rating_overall"] = ilObject::hasAutoRating("wiki", $_GET["ref_id"]);
999
1000 $this->form_gui->setValuesByArray($values);
1001 } else {
1002 $values["online"] = $this->object->getOnline();
1003 $values["title"] = $this->object->getTitle();
1004 //$values["startpage"] = $this->object->getStartPage();
1005 $values["startpage_id"] = ilWikiPage::_getPageIdForWikiTitle($this->object->getId(), $this->object->getStartPage());
1006 $values["shorttitle"] = $this->object->getShortTitle();
1007 $values["description"] = $this->object->getLongDescription();
1008 $values["rating_overall"] = $this->object->getRatingOverall();
1009 $values["rating"] = $this->object->getRating();
1010 // $values["rating_side"] = $this->object->getRatingAsBlock();
1011 $values["rating_new"] = $this->object->getRatingForNewPages();
1012 $values["rating_ext"] = $this->object->getRatingCategories();
1013 $values["public_notes"] = $this->object->getPublicNotes();
1014 $values["intro"] = $this->object->getIntroduction();
1015 // $values["imp_pages"] = $this->object->getImportantPages();
1016 $values["page_toc"] = $this->object->getPageToc();
1017 $values["link_md_values"] = $this->object->getLinkMetadataValues();
1018
1019 // only set given values (because of adv. metadata)
1020 $this->form_gui->setValuesByArray($values, true);
1021 }
1022 }
1023
1024
1028 public function saveSettingsObject()
1029 {
1030 $ilCtrl = $this->ctrl;
1031 $lng = $this->lng;
1034 $obj_service = $this->object_service;
1035
1036 $this->checkPermission("write");
1037
1038 $this->initSettingsForm();
1039
1040 if ($this->form_gui->checkInput()) {
1041 if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")) &&
1042 $this->form_gui->getInput("shorttitle") != $this->object->getShortTitle()) {
1043 $short_item = $this->form_gui->getItemByPostVar("shorttitle");
1044 $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
1045 } else {
1046 $this->object->setTitle($this->form_gui->getInput("title"));
1047 $this->object->setDescription($this->form_gui->getInput("description"));
1048 $this->object->setOnline($this->form_gui->getInput("online"));
1049 $this->object->setStartPage(ilWikiPage::lookupTitle($this->form_gui->getInput("startpage_id")));
1050 $this->object->setShortTitle($this->form_gui->getInput("shorttitle"));
1051 $this->object->setRatingOverall($this->form_gui->getInput("rating_overall"));
1052 $this->object->setRating($this->form_gui->getInput("rating"));
1053 // $this->object->setRatingAsBlock($this->form_gui->getInput("rating_side"));
1054 $this->object->setRatingForNewPages($this->form_gui->getInput("rating_new"));
1055 $this->object->setRatingCategories($this->form_gui->getInput("rating_ext"));
1056
1057 if (!$ilSetting->get("disable_comments")) {
1058 $this->object->setPublicNotes($this->form_gui->getInput("public_notes"));
1059 }
1060 $this->object->setIntroduction($this->form_gui->getInput("intro"));
1061 // $this->object->setImportantPages($this->form_gui->getInput("imp_pages"));
1062 $this->object->setPageToc($this->form_gui->getInput("page_toc"));
1063 $this->object->setLinkMetadataValues($this->form_gui->getInput("link_md_values"));
1064 $this->object->update();
1065
1066 // tile image
1067 $obj_service->commonSettings()->legacyForm($this->form_gui, $this->object)->saveTileImage();
1068
1069
1070 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
1072 $this->object->getId(),
1073 $this->form_gui,
1074 array(
1076 )
1077 );
1078
1079 // Update ecs export settings
1080 include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
1081 $ecs = new ilECSWikiSettings($this->object);
1082 if ($ecs->handleSettingsUpdate()) {
1083 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1084 $ilCtrl->redirect($this, "editSettings");
1085 }
1086 }
1087 }
1088
1089 $this->form_gui->setValuesByPost();
1090 $this->tpl->setContent($this->form_gui->getHTML());
1091 }
1092
1096 public function listContributorsObject()
1097 {
1098 $tpl = $this->tpl;
1099 $ilTabs = $this->tabs;
1100
1101 $this->checkPermission("write");
1102 $ilTabs->activateTab("wiki_contributors");
1103
1104 include_once("./Modules/Wiki/classes/class.ilWikiContributorsTableGUI.php");
1105
1106 $table_gui = new ilWikiContributorsTableGUI(
1107 $this,
1108 "listContributors",
1109 $this->object->getId()
1110 );
1111
1112 $tpl->setContent($table_gui->getHTML());
1113
1114 $this->setSideBlock();
1115 }
1116
1120 public function saveGradingObject()
1121 {
1122 $ilCtrl = $this->ctrl;
1123 $lng = $this->lng;
1124
1125 $this->checkPermission("write");
1126
1127 $users = (is_array($_POST["user_id"])
1128 ? $_POST["user_id"]
1129 : array());
1130
1131 include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
1132 include_once("./Services/Tracking/classes/class.ilLPMarks.php");
1133 $saved = false;
1134 foreach ($users as $user_id) {
1135 if ($user_id != "") {
1136 $marks_obj = new ilLPMarks($this->object->getId(), $user_id);
1137 $new_mark = ilUtil::stripSlashes($_POST['mark'][$user_id]);
1138 $new_comment = ilUtil::stripSlashes($_POST['lcomment'][$user_id]);
1139 $new_status = ilUtil::stripSlashes($_POST["status"][$user_id]);
1140
1141 if ($marks_obj->getMark() != $new_mark ||
1142 $marks_obj->getComment() != $new_comment ||
1143 ilWikiContributor::_lookupStatus($this->object->getId(), $user_id) != $new_status) {
1144 ilWikiContributor::_writeStatus($this->object->getId(), $user_id, $new_status);
1145 $marks_obj->setMark($new_mark);
1146 $marks_obj->setComment($new_comment);
1147 $marks_obj->update();
1148 $saved = true;
1149 }
1150 }
1151 }
1152 if ($saved) {
1153 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1154 }
1155
1156 $ilCtrl->redirect($this, "listContributors");
1157 }
1158
1159 // add wiki to locator
1160 public function addLocatorItems()
1161 {
1162 $ilLocator = $this->locator;
1163
1164 if (is_object($this->object)) {
1165 $ilLocator->addItem(
1166 $this->object->getTitle(),
1167 $this->getGotoLink($this->object->getRefId()),
1168 "",
1169 $_GET["ref_id"]
1170 );
1171 }
1172 }
1173
1174 public static function _goto($a_target)
1175 {
1176 global $DIC;
1177
1178 $ilAccess = $DIC->access();
1179 $ilErr = $DIC["ilErr"];
1180 $lng = $DIC->language();
1181 $ilNavigationHistory = $DIC["ilNavigationHistory"];
1182
1183 $i = strpos($a_target, "_");
1184 if ($i > 0) {
1185 $a_page = substr($a_target, $i + 1);
1186 $a_target = substr($a_target, 0, $i);
1187 }
1188
1189 if ($a_target == "wpage") {
1190 $a_page_arr = explode("_", $a_page);
1191 $wpg_id = (int) $a_page_arr[0];
1192 $ref_id = (int) $a_page_arr[1];
1193 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1194 $w_id = ilWikiPage::lookupWikiId($wpg_id);
1195 if ($ref_id > 0) {
1196 $refs = array($ref_id);
1197 } else {
1198 $refs = ilObject::_getAllReferences($w_id);
1199 }
1200 foreach ($refs as $r) {
1201 if ($ilAccess->checkAccess("read", "", $r)) {
1202 $a_target = $r;
1203 $a_page = ilWikiPage::lookupTitle($wpg_id);
1204 }
1205 }
1206 }
1207
1208 if ($ilAccess->checkAccess("read", "", $a_target)) {
1209 $_GET["cmd"] = "viewPage";
1210 $_GET["ref_id"] = $a_target;
1211 $_GET["page"] = $a_page;
1212 $_GET["baseClass"] = "ilwikihandlergui";
1213 $_GET["cmdClass"] = "ilobjwikigui";
1214 /* if ($a_page != "")
1215 {
1216 $add = "&amp;page=".rawurlencode($_GET["page"]);
1217 $ilNavigationHistory->addItem($_GET["ref_id"],
1218 "./goto.php?target=wiki_".$_GET["ref_id"].$add, "wiki");
1219 }*/
1220 include("ilias.php");
1221 exit;
1222 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1223 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
1224 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1225 ilUtil::sendFailure(sprintf(
1226 $lng->txt("msg_no_perm_read_item"),
1228 ), true);
1230 }
1231
1232 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1233 }
1234
1238 public static function getGotoLink($a_ref_id, $a_page = "")
1239 {
1240 if ($a_page == "") {
1242 }
1243
1244 $goto = "goto.php?target=wiki_" . $a_ref_id . "_" .
1245 ilWikiUtil::makeUrlTitle($a_page);
1246
1247 return $goto;
1248 }
1249
1253 public function viewPageObject()
1254 {
1255 $lng = $this->lng;
1256 $ilCtrl = $this->ctrl;
1257 $tpl = $this->tpl;
1258 $ilTabs = $this->tabs;
1259 $ilAccess = $this->access;
1260
1261 $this->checkPermission("read");
1262
1263 $ilTabs->clearTargets();
1264 $tpl->setHeaderActionMenu(null);
1265
1266 $page = ($_GET["page"] != "")
1267 ? $_GET["page"]
1268 : $this->object->getStartPage();
1269 $_GET["page"] = $page;
1270
1271 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1272 if (!ilWikiPage::exists($this->object->getId(), $page)) {
1273 $page = $this->object->getStartPage();
1274 }
1275
1276 if (!ilWikiPage::exists($this->object->getId(), $page)) {
1277 ilUtil::sendInfo($lng->txt("wiki_no_start_page"), true);
1278 $ilCtrl->redirect($this, "infoScreen");
1279 return;
1280 }
1281
1282 // page exists, show it !
1283 $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($page));
1284
1285 include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
1286 $wpage_gui = ilWikiPageGUI::getGUIForTitle(
1287 $this->object->getId(),
1289 0,
1290 $this->object->getRefId()
1291 );
1292 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1293 $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
1294 $this->object->getStyleSheetId(),
1295 "wiki"
1296 ));
1297
1298 $this->setContentStyleSheet();
1299
1300 //$wpage_gui->setSideBlock();
1301 $ilCtrl->setCmdClass("ilwikipagegui");
1302 $ilCtrl->setCmd("preview");
1303 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
1304 (
1305 !$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
1306 $wpage_gui->getPageObject()->getBlocked()
1307 )) {
1308 $wpage_gui->setEnableEditing(false);
1309 }
1310
1311 // alter title and description
1312 //$tpl->setTitle($wpage_gui->getPageObject()->getTitle());
1313 //$tpl->setDescription($this->object->getTitle());
1314 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1315 $wpage_gui->activateMetaDataEditor($this->object, "wpg", $wpage_gui->getId());
1316 }
1317
1318
1319 $html = $ilCtrl->forwardCommand($wpage_gui);
1320 //$this->addPageTabs();
1321
1322 $tpl->setContent($html);
1323 }
1324
1328 public function allPagesObject()
1329 {
1330 $tpl = $this->tpl;
1331
1332 $this->checkPermission("read");
1333
1334 include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1335
1336 $this->addPagesSubTabs();
1337
1338 $table_gui = new ilWikiPagesTableGUI(
1339 $this,
1340 "allPages",
1341 $this->object->getId(),
1343 );
1344
1345 $this->setSideBlock();
1346 $tpl->setContent($table_gui->getHTML());
1347 }
1348
1352 public function popularPagesObject()
1353 {
1354 $tpl = $this->tpl;
1355
1356 $this->checkPermission("read");
1357
1358 include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1359
1360 $this->addPagesSubTabs();
1361
1362 $table_gui = new ilWikiPagesTableGUI(
1363 $this,
1364 "popularPages",
1365 $this->object->getId(),
1367 );
1368
1369 $this->setSideBlock();
1370 $tpl->setContent($table_gui->getHTML());
1371 }
1372
1376 public function orphanedPagesObject()
1377 {
1378 $tpl = $this->tpl;
1379
1380 $this->checkPermission("read");
1381
1382 include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1383
1384 $this->addPagesSubTabs();
1385
1386 $table_gui = new ilWikiPagesTableGUI(
1387 $this,
1388 "orphanedPages",
1389 $this->object->getId(),
1391 );
1392
1393 $this->setSideBlock();
1394 $tpl->setContent($table_gui->getHTML());
1395 }
1396
1402 public function gotoPageObject($a_page = "")
1403 {
1404 $ilCtrl = $this->ctrl;
1405
1406 if ($a_page == "") {
1407 $a_page = $_GET["page"];
1408 }
1409
1410 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1412 $this->object->getId(),
1414 )) {
1415 // to do: get rid of this redirect
1416 ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId(), $a_page));
1417 } else {
1418 if (!$this->access->checkAccess("edit_content", "", $this->object->getRefId())) {
1419 ilUtil::sendFailure($this->lng->txt("no_permission"), true);
1420 ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId(), $_GET["from_page"]));
1421 }
1422 if (!$this->object->getTemplateSelectionOnCreation()) {
1423
1424 // check length
1425 include_once("./Services/Utilities/classes/class.ilStr.php");
1426 if (ilStr::strLen(ilWikiUtil::makeDbTitle($a_page)) > 200) {
1427 ilUtil::sendFailure($this->lng->txt("wiki_page_title_too_long") . " (" . $a_page . ")", true);
1428 $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle($_GET["from_page"]));
1429 $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1430 }
1431 $this->object->createWikiPage($a_page);
1432
1433 // redirect to newly created page
1434 $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
1435 $ilCtrl->redirectByClass("ilwikipagegui", "edit");
1436 } else {
1437 $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
1438 $ilCtrl->setParameter($this, "from_page", ilWikiUtil::makeUrlTitle($_GET["from_page"]));
1439 $ilCtrl->redirect($this, "showTemplateSelection");
1440 }
1441 }
1442 }
1443
1449 public function randomPageObject()
1450 {
1451 $this->checkPermission("read");
1452
1453 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1454 $page = ilWikiPage::getRandomPage($this->object->getId());
1455 $this->gotoPageObject($page);
1456 }
1457
1461 public function recentChangesObject()
1462 {
1463 $tpl = $this->tpl;
1464
1465 $this->checkPermission("read");
1466
1467 include_once("./Modules/Wiki/classes/class.ilWikiRecentChangesTableGUI.php");
1468
1469 $this->addPagesSubTabs();
1470
1471 $table_gui = new ilWikiRecentChangesTableGUI(
1472 $this,
1473 "recentChanges",
1474 $this->object->getId()
1475 );
1476
1477 $this->setSideBlock();
1478 $tpl->setContent($table_gui->getHTML());
1479 }
1480
1484 public function setSideBlock($a_wpg_id = 0)
1485 {
1486 ilObjWikiGUI::renderSideBlock($a_wpg_id, $this->object->getRefId());
1487 }
1488
1489
1493 public static function renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp = null)
1494 {
1495 global $DIC;
1496
1497 $tpl = $DIC["tpl"];
1498 $lng = $DIC->language();
1499 $ilAccess = $DIC->access();
1500 $ilCtrl = $DIC->ctrl();
1501
1502 $tpl->addJavaScript("./Modules/Wiki/js/WikiPres.js");
1503
1504 // setting asynch to false fixes #0019457, since otherwise ilBlockGUI would act on asynch and output html when side blocks
1505 // being processed during the export. This is a flaw in ilCtrl and/or ilBlockGUI.
1506 $tpl->addOnLoadCode("il.Wiki.Pres.init('" . $ilCtrl->getLinkTargetByClass("ilobjwikigui", "", "", false, false) . "');");
1507
1508 if ($a_wpg_id > 0 && !$a_wp) {
1509 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1510 $a_wp = ilWikiPage($a_wpg_id);
1511 }
1512
1513 // search block
1514 include_once './Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
1515 $rcontent = ilRepositoryObjectSearchGUI::getSearchBlockHTML($lng->txt('wiki_search'));
1516
1517
1518 // quick navigation
1519 if ($a_wpg_id > 0) {
1520 // rating
1521 $wiki_id = ilObject::_lookupObjId($a_wiki_ref_id);
1522 if (ilObjWiki::_lookupRating($wiki_id) &&
1523 // ilObjWiki::_lookupRatingAsBlock($wiki_id) &&
1524 $a_wp->getRating()) {
1525 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
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
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 include_once("./Services/Object/classes/class.ilObjectMetaDataGUI.php");
1544 $wiki = new ilObjWiki($a_wiki_ref_id);
1545 $callback = $wiki->getLinkMetadataValues()
1546 ? array($wiki, "decorateAdvMDValue")
1547 : null;
1548 $mdgui = new ilObjectMetaDataGUI($wiki, "wpg", $a_wpg_id);
1549 $rcontent .= $mdgui->getBlockHTML($cmd, $callback); // #17291
1550 }
1551 }
1552
1553 // important pages
1554 include_once("./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
1555 $imp_pages_block = new ilWikiImportantPagesBlockGUI();
1556 $rcontent .= $imp_pages_block->getHTML();
1557
1558 // wiki functions block
1559 if ($a_wpg_id > 0) {
1560 include_once("./Modules/Wiki/classes/class.ilWikiFunctionsBlockGUI.php");
1561 $wiki_functions_block = new ilWikiFunctionsBlockGUI();
1562 $wiki_functions_block->setPageObject($a_wp);
1563 $rcontent .= $wiki_functions_block->getHTML();
1564 }
1565
1566 $tpl->setRightContent($rcontent);
1567 }
1568
1572 public function newPagesObject()
1573 {
1574 $tpl = $this->tpl;
1575
1576 $this->checkPermission("read");
1577
1578 include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1579
1580 $this->addPagesSubTabs();
1581
1582 $table_gui = new ilWikiPagesTableGUI(
1583 $this,
1584 "newPages",
1585 $this->object->getId(),
1587 );
1588
1589 $this->setSideBlock();
1590 $tpl->setContent($table_gui->getHTML());
1591 }
1592
1593 protected function getPrintPageIds()
1594 {
1595 // multiple ordered page ids
1596 if (is_array($_POST["wordr"])) {
1597 asort($_POST["wordr"]);
1598 $page_ids = array_keys($_POST["wordr"]);
1599 }
1600 // single page
1601 elseif ((int) $_GET["wpg_id"]) {
1602 $page_ids = array((int) $_GET["wpg_id"]);
1603 }
1604
1605 return $page_ids;
1606 }
1607
1608 public function printViewObject($a_pdf_export = false)
1609 {
1610 global $tpl;
1611 $tpl = $this->tpl;
1612
1614
1615 $tabs->clearTargets();
1616 $tabs->setBackTarget(
1617 $this->lng->txt("back"),
1618 $this->ctrl->getLinkTargetByClass("ilwikipagegui", "printViewSelection")
1619 );
1620
1621 $page_ids = $this->getPrintPageIds();
1622 if (!$page_ids) {
1623 $this->ctrl->redirect($this, "");
1624 }
1625
1626 $this->setContentStyleSheet($tpl);
1627
1628 $page_content = "";
1629 foreach ($page_ids as $p_id) {
1630 $page_gui = new ilWikiPageGUI($p_id);
1631 $page_gui->setWiki($this->object);
1632 $page_gui->setOutputMode("print");
1633 $page_content .= $page_gui->showPage();
1634
1635 if ($a_pdf_export) {
1636 $page_content .= '<p style="page-break-after:always;"></p>';
1637 }
1638 }
1639
1640 //$page_content = '<div class="ilInvisibleBorder">' . $page_content . '</div>';
1641
1642 if (!$a_pdf_export) {
1643 $tpl->addOnLoadCode("il.Util.print();");
1644 }
1645
1646 $tpl->setContent($page_content);
1647
1648 if (!$a_pdf_export) {
1649// $tpl->printToStdout(false);
1650 } else {
1651 return $tpl->printToString();
1652 }
1653 }
1654
1655 public function pdfExportObject()
1656 {
1657
1658 // prepare generation before contents are processed (for mathjax)
1659 ilPDFGeneratorUtils::prepareGenerationRequest("Wiki", "ContentExport");
1660
1661 $html = $this->printViewObject(true);
1662
1663 // :TODO: fixing css dummy parameters
1664 $html = preg_replace("/\?dummy\=[0-9]+/", "", $html);
1665 $html = preg_replace("/\?vers\=[0-9A-Za-z\-]+/", "", $html);
1666 $html = str_replace('.css$Id$', ".css", $html);
1667
1668 if (false) {
1669 include_once "Services/PDFGeneration/classes/class.ilPDFGeneration.php";
1670 include_once "Services/PDFGeneration/classes/class.ilPDFGenerationJob.php";
1671
1672 $job = new ilPDFGenerationJob();
1673 $job->setAutoPageBreak(true)
1674 ->setMarginLeft("10")
1675 ->setMarginRight("10")
1676 ->setMarginTop("10")
1677 ->setMarginBottom("10")
1678 ->setOutputMode("D")// download
1679 ->setFilename("wiki.pdf")// :TODO:
1680 ->setCreator("ILIAS Wiki")// :TODO:
1681 ->setImageScale(1.25)// complete content scaling ?!
1682 ->addPage($html);
1683
1685 } else {
1686 $html = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $html);
1687 $html = preg_replace("/href=\"\\.\\//ims", "href=\"" . ILIAS_HTTP_PATH . "/", $html);
1688 $pdf_factory = new ilHtmlToPdfTransformerFactory();
1689 $pdf_factory->deliverPDFFromHTMLString($html, "wiki.pdf", ilHtmlToPdfTransformerFactory::PDF_OUTPUT_DOWNLOAD, "Wiki", "ContentExport");
1690 }
1691 }
1692
1696 public function performSearchObject()
1697 {
1698 $tpl = $this->tpl;
1699 $ilTabs = $this->tabs;
1700 $ilCtrl = $this->ctrl;
1701 $lng = $this->lng;
1702
1703 $this->checkPermission("read");
1704
1705 include_once("./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php");
1706
1707 $ilTabs->setTabActive("wiki_search_results");
1708
1709 if (trim($_POST["search_term"]) == "") {
1710 ilUtil::sendFailure($lng->txt("wiki_please_enter_search_term"), true);
1711 $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1712 }
1713
1714 $search_results = ilObjWiki::_performSearch(
1715 $this->object->getId(),
1716 ilUtil::stripSlashes($_POST["search_term"])
1717 );
1718 $table_gui = new ilWikiSearchResultsTableGUI(
1719 $this,
1720 "performSearch",
1721 $this->object->getId(),
1722 $search_results,
1723 $_POST["search_term"]
1724 );
1725
1726 $this->setSideBlock();
1727 $tpl->setContent($table_gui->getHTML());
1728 }
1729
1733 public function setContentStyleSheet($tpl = null)
1734 {
1735 $tpl = $this->tpl;
1736
1737 if ($tpl == null) {
1738 $tpl = $this->tpl;
1739 }
1740
1743 $this->object->getStyleSheetId(),
1744 "wiki"
1745 )
1746 ));
1748 }
1749
1750
1755 {
1756 $ilTabs = $this->tabs;
1757 $tpl = $this->tpl;
1758
1759 $this->checkPermission("write");
1760
1761 $this->initStylePropertiesForm();
1762 $tpl->setContent($this->form->getHTML());
1763
1764 $ilTabs->activateTab("settings");
1765 $this->setSettingsSubTabs("style");
1766
1767 $this->setSideBlock();
1768 }
1769
1773 public function initStylePropertiesForm()
1774 {
1775 $ilCtrl = $this->ctrl;
1776 $lng = $this->lng;
1777 $ilTabs = $this->tabs;
1779
1780 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1781 $lng->loadLanguageModule("style");
1782
1783 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1784 $this->form = new ilPropertyFormGUI();
1785
1786 $fixed_style = $ilSetting->get("fixed_content_style_id");
1787 $style_id = $this->object->getStyleSheetId();
1788
1789 if ($fixed_style > 0) {
1790 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1791 $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
1792 $this->lng->txt("global_fixed") . ")");
1793 $this->form->addItem($st);
1794 } else {
1796 true,
1797 false,
1798 $_GET["ref_id"]
1799 );
1800
1801 $st_styles[0] = $this->lng->txt("default");
1802 ksort($st_styles);
1803
1804 if ($style_id > 0) {
1805 // individual style
1806 if (!ilObjStyleSheet::_lookupStandard($style_id)) {
1807 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1808 $st->setValue(ilObject::_lookupTitle($style_id));
1809 $this->form->addItem($st);
1810
1811 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1812
1813 // delete command
1814 $this->form->addCommandButton(
1815 "editStyle",
1816 $lng->txt("style_edit_style")
1817 );
1818 $this->form->addCommandButton(
1819 "deleteStyle",
1820 $lng->txt("style_delete_style")
1821 );
1822 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1823 }
1824 }
1825
1826 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
1827 $style_sel = ilUtil::formSelect(
1828 $style_id,
1829 "style_id",
1830 $st_styles,
1831 false,
1832 true
1833 );
1834 $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
1835 $style_sel->setOptions($st_styles);
1836 $style_sel->setValue($style_id);
1837 $this->form->addItem($style_sel);
1838 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1839 $this->form->addCommandButton(
1840 "saveStyleSettings",
1841 $lng->txt("save")
1842 );
1843 $this->form->addCommandButton(
1844 "createStyle",
1845 $lng->txt("sty_create_ind_style")
1846 );
1847 }
1848 }
1849 $this->form->setTitle($lng->txt("wiki_style"));
1850 $this->form->setFormAction($ilCtrl->getFormAction($this));
1851 }
1852
1856 public function createStyleObject()
1857 {
1858 $ilCtrl = $this->ctrl;
1859
1860 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1861 }
1862
1866 public function editStyleObject()
1867 {
1868 $ilCtrl = $this->ctrl;
1869
1870 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1871 }
1872
1876 public function deleteStyleObject()
1877 {
1878 $ilCtrl = $this->ctrl;
1879
1880 $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1881 }
1882
1886 public function saveStyleSettingsObject()
1887 {
1889
1890 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1891 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1892 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1893 || $this->object->getStyleSheetId() == 0)) {
1894 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1895 $this->object->update();
1896 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1897 }
1898 $this->ctrl->redirect($this, "editStyleProperties");
1899 }
1900
1901 //
1902 // Important pages
1903 //
1904
1909 {
1910 $tpl = $this->tpl;
1911 $ilToolbar = $this->toolbar;
1912 $ilTabs = $this->tabs;
1913 $lng = $this->lng;
1914 $ilCtrl = $this->ctrl;
1915
1916 $this->checkPermission("edit_wiki_navigation");
1917
1918 ilUtil::sendInfo($lng->txt("wiki_navigation_info"));
1919
1920 $ipages = ilObjWiki::_lookupImportantPagesList($this->object->getId());
1921 $ipages_ids = array();
1922 foreach ($ipages as $i) {
1923 $ipages_ids[] = $i["page_id"];
1924 }
1925
1926 // list pages
1927 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1928 $pages = ilWikiPage::getAllWikiPages($this->object->getId());
1929 $options = array("" => $lng->txt("please_select"));
1930 foreach ($pages as $p) {
1931 if (!in_array($p["id"], $ipages_ids)) {
1932 $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
1933 }
1934 }
1935 if (count($options) > 0) {
1936 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1937 $si = new ilSelectInputGUI($lng->txt("wiki_pages"), "imp_page_id");
1938 $si->setOptions($options);
1939 $si->setInfo($lng->txt(""));
1940 $ilToolbar->addInputItem($si);
1941 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1942 $ilToolbar->addFormButton($lng->txt("add"), "addImportantPage");
1943 }
1944
1945
1946 $ilTabs->activateTab("settings");
1947 $this->setSettingsSubTabs("imp_pages");
1948
1949 include_once("./Modules/Wiki/classes/class.ilImportantPagesTableGUI.php");
1950 $imp_table = new ilImportantPagesTableGUI($this, "editImportantPages");
1951
1952 $tpl->setContent($imp_table->getHTML());
1953 }
1954
1961 public function addImportantPageObject()
1962 {
1963 $ilCtrl = $this->ctrl;
1964 $lng = $this->lng;
1965
1966 $this->checkPermission("edit_wiki_navigation");
1967
1968 if ($_POST["imp_page_id"] > 0) {
1969 $this->object->addImportantPage((int) $_POST["imp_page_id"]);
1970 ilUtil::sendSuccess($lng->txt("wiki_imp_page_added"), true);
1971 }
1972 $ilCtrl->redirect($this, "editImportantPages");
1973 }
1974
1979 {
1980 $ilCtrl = $this->ctrl;
1981 $tpl = $this->tpl;
1982 $lng = $this->lng;
1983
1984 if (!is_array($_POST["imp_page_id"]) || count($_POST["imp_page_id"]) == 0) {
1985 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1986 $ilCtrl->redirect($this, "editImportantPages");
1987 } else {
1988 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1989 $cgui = new ilConfirmationGUI();
1990 $cgui->setFormAction($ilCtrl->getFormAction($this));
1991 $cgui->setHeaderText($lng->txt("wiki_sure_remove_imp_pages"));
1992 $cgui->setCancel($lng->txt("cancel"), "editImportantPages");
1993 $cgui->setConfirm($lng->txt("remove"), "removeImportantPages");
1994
1995 foreach ($_POST["imp_page_id"] as $i) {
1996 $cgui->addItem("imp_page_id[]", $i, ilWikiPage::lookupTitle((int) $i));
1997 }
1998
1999 $tpl->setContent($cgui->getHTML());
2000 }
2001 }
2002
2010 {
2011 $ilCtrl = $this->ctrl;
2012 $lng = $this->lng;
2013
2014 $this->checkPermission("edit_wiki_navigation");
2015
2016 if (is_array($_POST["imp_page_id"])) {
2017 foreach ($_POST["imp_page_id"] as $i) {
2018 $this->object->removeImportantPage((int) $i);
2019 }
2020 }
2021 ilUtil::sendSuccess($lng->txt("wiki_removed_imp_pages"), true);
2022 $ilCtrl->redirect($this, "editImportantPages");
2023 }
2024
2029 {
2030 $ilCtrl = $this->ctrl;
2031 $lng = $this->lng;
2032
2033 $this->checkPermission("edit_wiki_navigation");
2034
2035 $this->object->saveOrderingAndIndentation($_POST["ord"], $_POST["indent"]);
2036 ilUtil::sendSuccess($lng->txt("wiki_ordering_and_indent_saved"), true);
2037 $ilCtrl->redirect($this, "editImportantPages");
2038 }
2039
2043 public function setAsStartPageObject()
2044 {
2045 $ilCtrl = $this->ctrl;
2046 $lng = $this->lng;
2047
2048 $this->checkPermission("edit_wiki_navigation");
2049
2050 if (!is_array($_POST["imp_page_id"]) || count($_POST["imp_page_id"]) != 1) {
2051 ilUtil::sendInfo($lng->txt("wiki_select_one_item"), true);
2052 } else {
2053 $this->object->removeImportantPage((int) $_POST["imp_page_id"][0]);
2054 $this->object->setStartPage(ilWikiPage::lookupTitle((int) $_POST["imp_page_id"][0]));
2055 $this->object->update();
2056 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2057 }
2058 $ilCtrl->redirect($this, "editImportantPages");
2059 }
2060
2061
2065 public function exportHTML()
2066 {
2067 $cont_exp = new Export\WikiHtmlExport($this->object);
2068
2069 $format = explode("_", $_POST["format"]);
2070 if ($format[1] == "comments") {
2071 $cont_exp->setMode(Export\WikiHtmlExport::MODE_COMMENTS);
2072 }
2073
2074 $cont_exp->buildExportFile();
2075 }
2076
2084 public static function lookupSubObjectTitle($a_wiki_id, $a_page_id)
2085 {
2086 include_once "Modules/Wiki/classes/class.ilWikiPage.php";
2087 $page = new ilWikiPage($a_page_id);
2088 if ($page->getWikiId() == $a_wiki_id) {
2089 return $page->getTitle();
2090 }
2091 }
2092
2100 public function getSubObjectTitle($a_id, $a_type)
2101 {
2102 include_once "Modules/Wiki/classes/class.ilWikiPage.php";
2103 return ilWikiPage::lookupTitle($a_id);
2104 }
2105
2110 {
2111 $lng = $this->lng;
2112 $tpl = $this->tpl;
2113 $ilTabs = $this->tabs;
2114 $ilCtrl = $this->ctrl;
2115
2116
2117 $ilCtrl->setParameterByClass("ilobjwikigui", "from_page", ilWikiUtil::makeUrlTitle($_GET["from_page"]));
2118 $ilTabs->clearTargets();
2119 ilUtil::sendInfo($lng->txt("wiki_page_not_exist_select_templ"));
2120
2121 $form = $this->initTemplateSelectionForm();
2122 $tpl->setContent($form->getHTML());
2123 }
2124
2129 {
2130 $lng = $this->lng;
2131 $ilCtrl = $this->ctrl;
2132
2133 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2134 $form = new ilPropertyFormGUI();
2135
2136 // page name
2137 $hi = new ilHiddenInputGUI("page");
2138 $hi->setValue($_GET["page"]);
2139 $form->addItem($hi);
2140
2141 // page template
2142 $radg = new ilRadioGroupInputGUI($lng->txt("wiki_page_template"), "page_templ");
2143 $radg->setRequired(true);
2144
2145 if ($this->object->getEmptyPageTemplate()) {
2146 $op1 = new ilRadioOption($lng->txt("wiki_empty_page"), 0);
2147 $radg->addOption($op1);
2148 }
2149
2150 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
2151 $wt = new ilWikiPageTemplate($this->object->getId());
2152 $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
2153 foreach ($ts as $t) {
2154 $op = new ilRadioOption($t["title"], $t["wpage_id"]);
2155 $radg->addOption($op);
2156 }
2157
2158 $form->addItem($radg);
2159
2160 // save and cancel commands
2161 $form->addCommandButton("createPageUsingTemplate", $lng->txt("wiki_create_page"));
2162 $form->addCommandButton("cancelCreationPageUsingTemplate", $lng->txt("cancel"));
2163
2164 $form->setTitle($lng->txt("wiki_new_page") . ": " . $_GET["page"]);
2165 $form->setFormAction($ilCtrl->getFormAction($this));
2166
2167 return $form;
2168 }
2169
2174 {
2175 $tpl = $this->tpl;
2176 $lng = $this->lng;
2177 $ilCtrl = $this->ctrl;
2178
2179 $form = $this->initTemplateSelectionForm();
2180 if ($form->checkInput()) {
2181 $a_page = $_POST["page"];
2182 $this->object->createWikiPage($a_page, (int) $_POST["page_templ"]);
2183
2184 // redirect to newly created page
2185 $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
2186 $ilCtrl->redirectByClass("ilwikipagegui", "edit");
2187
2188 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2189 $ilCtrl->redirect($this, "");
2190 } else {
2191 $form->setValuesByPost();
2192 $tpl->setContent($form->getHtml());
2193 }
2194 }
2195
2200 {
2201 $ilCtrl = $this->ctrl;
2202
2203 // redirect to newly created page
2204 $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($_GET["from_page"])));
2205 $ilCtrl->redirectByClass("ilwikipagegui", "preview");
2206 }
2207
2217 protected function checkPermissionBool($a_perm, $a_cmd = "", $a_type = "", $a_ref_id = null)
2218 {
2219 if ($a_perm == "create") {
2220 return parent::checkPermissionBool($a_perm, $a_cmd, $a_type, $a_ref_id);
2221 } else {
2222 if (!$a_ref_id) {
2223 $a_ref_id = $this->object->getRefId();
2224 }
2225 include_once("./Modules/Wiki/classes/class.ilWikiPerm.php");
2226 return ilWikiPerm::check($a_perm, $a_ref_id, $a_cmd);
2227 }
2228 }
2229
2230
2231 //
2232 // User HTML Export
2233 //
2234
2239 {
2240 $this->log->debug("init: " . $this->req_with_comments);
2241 $this->checkPermission("wiki_html_export");
2242 $this->object->initUserHTMLExport($this->req_with_comments);
2243 }
2244
2249 {
2250 $this->log->debug("start: " . $this->req_with_comments);
2251 $this->checkPermission("wiki_html_export");
2252 $this->object->startUserHTMLExport($this->req_with_comments);
2253 }
2254
2259 {
2260 $this->log->debug("get progress: " . $this->req_with_comments);
2261 $this->checkPermission("wiki_html_export");
2262 $p = $this->object->getUserHTMLExportProgress($this->req_with_comments);
2263
2264 include_once("./Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php");
2266 $pb->setCurrent($p["progress"]);
2267
2268 $r = new stdClass();
2269 $r->progressBar = $pb->render();
2270 $r->status = $p["status"];
2271 include_once("./Services/JSON/classes/class.ilJsonUtil.php");
2272 $this->log->debug("status: " . $r->status);
2273 echo(ilJsonUtil::encode($r));
2274 exit;
2275 }
2276
2281 {
2282 $this->log->debug("download");
2283 $this->checkPermission("wiki_html_export");
2284 $this->object->deliverUserHTMLExport();
2285 }
2286
2291 {
2292 $this->log->debug("download");
2293 $this->checkPermission("wiki_html_export");
2294 $this->object->deliverUserHTMLExport(true);
2295 }
2296
2302 protected function triggerAssignmentTool()
2303 {
2304 if (!is_object($this->object)) {
2305 return;
2306 }
2307 $ass_info = ilExcRepoObjAssignment::getInstance()->getAssignmentInfoOfObj(
2308 $this->object->getRefId(),
2309 $this->user->getId()
2310 );
2311 if (count($ass_info) > 0) {
2312 $ass_ids = array_map(function ($i) {
2313 return $i->getId();
2314 }, $ass_info);
2315 $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::SHOW_EXC_ASSIGNMENT_INFO, true);
2316 $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::EXC_ASS_IDS, $ass_ids);
2317 $this->tool_context->current()->addAdditionalData(
2319 $this->getAssignmentButtons()
2320 );
2321 }
2322 }
2323
2327 protected function getAssignmentButtons()
2328 {
2329 $ilCtrl = $this->ctrl;
2330 $ui = $this->ui;
2331 $lng = $this->lng;
2332
2333 $ass_info = ilExcRepoObjAssignment::getInstance()->getAssignmentInfoOfObj(
2334 $this->object->getRefId(),
2335 $this->user->getId()
2336 );
2337 $buttons = [];
2338 foreach ($ass_info as $i) { // should be only one
2339 $ass = new ilExAssignment($i->getId());
2340 $times_up = $ass->afterDeadlineStrict();
2341
2342 // submit button
2343 if (!$times_up) {
2344 $ilCtrl->setParameterByClass("ilwikipagegui", "ass", $ass->getId());
2345 $submit_link = $ilCtrl->getLinkTargetByClass("ilwikipagegui", "finalizeAssignment");
2346 $ilCtrl->setParameterByClass("ilwikipagegui", "ass", "");
2347
2348 $buttons[$i->getId()][] = $ui->factory()->button()->primary($lng->txt("wiki_finalize_wiki"), $submit_link);
2349 }
2350
2351 // submitted files
2352 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
2353 $submission = new ilExSubmission($ass, $this->user->getId());
2354 if ($submission->hasSubmitted()) {
2355 $submitted = $submission->getSelectedObject();
2356 if ($submitted["ts"] != "") {
2357 $ilCtrl->setParameterByClass("ilwikipagegui", "ass", $ass->getId());
2358 }
2359 $dl_link = $ilCtrl->getLinkTargetByClass("ilwikipagegui", "downloadExcSubFile");
2360 $ilCtrl->setParameterByClass("ilwikipagegui", "ass", "");
2361 $buttons[$i->getId()][] = $ui->factory()->button()->standard($lng->txt("wiki_download_submission"), $dl_link);
2362 }
2363 }
2364 return $buttons;
2365 }
2366}
user()
Definition: user.php:4
$section
Definition: Utf8Test.php:83
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Wiki HTML exporter class.
error($a_errmsg)
set error message @access public
const IL_WIKI_ALL_PAGES
const IL_WIKI_POPULAR_PAGES
const IL_WIKI_NEW_PAGES
const IL_WIKI_ORPHANED_PAGES
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
Class ilECSWikiSettings.
Exercise assignment.
Exercise submission //TODO: This class has to much static methods related to delivered "files".
Export User Interface Class.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
Class ilHtmlToPdfTransformerFactory.
Class ilInfoScreenGUI.
static encode($mixed, $suppress_native=false)
static _lookupMark($a_usr_id, $a_obj_id)
static _lookupComment($a_usr_id, $a_obj_id)
static getLogger($a_component_id)
Get component logger.
This class represents a non editable value in a property form.
Handles general notification settings, see e.g.
Class ilObjStyleSheetGUI.
static _lookupStandard($a_id)
Lookup standard flag.
static getSyntaxStylePath()
get syntax style path
static _getStandardStyles( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
Class ilObjWikiGUI.
orphanedPagesObject()
Orphaned pages.
popularPagesObject()
Popular pages.
setSettingsSubTabs($a_active)
Set sub tabs.
afterSave(ilObject $newObj)
save object @access public
gotoStartPageObject()
Go to start page.
saveSettingsObject()
Save Settings.
editSettingsObject()
Edit settings.
getAssignmentButtons()
Get assignment buttons.
setContentStyleSheet($tpl=null)
Set content style sheet.
allPagesObject()
All pages of wiki.
getTabs()
get tabs @access public
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
downloadUserHTMLExportObject()
Download user html export file.
cancelCreationPageUsingTemplateObject()
Cancel page creation using a template.
createStyleObject()
Create Style.
static renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp=null)
Side column.
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
editStylePropertiesObject()
Edit style properties.
deleteStyleObject()
Delete Style.
saveObject()
save object @access public
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
editStyleObject()
Edit Style.
addImportantPageObject()
Add important pages.
infoScreen()
show information screen
addPagesSubTabs()
Add Pages SubTabs.
downloadUserHTMLExportWithCommentsObject()
Download user html export file.
saveStyleSettingsObject()
Save style settings.
initStylePropertiesForm()
Init style properties form.
getSubObjectTitle($a_id, $a_type)
Used for rating export.
initSettingsForm($a_mode="edit")
Init Settings Form.
executeCommand()
execute command
viewPageObject()
view wiki page
printViewObject($a_pdf_export=false)
randomPageObject()
Go to random page.
viewObject()
Start page.
isOnlineHelpWiki()
Is wiki an online help wiki?
performSearchObject()
Search.
getSettingsFormValues($a_mode="edit")
initTemplateSelectionForm()
Init template selection form.
static _goto($a_target)
newPagesObject()
Latest pages.
showTemplateSelectionObject()
Show template selection.
startUserHTMLExportObject()
Export html (as user)
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor @access public.
createPageUsingTemplateObject()
Save creation with template form.
saveOrderingAndIndentObject()
Save important pages ordering and indentation.
triggerAssignmentTool()
Trigger assignment tool.
saveGradingObject()
Save grading.
initCreationForms($a_new_type)
Init creation froms.
removeImportantPagesObject()
Remove important pages.
listContributorsObject()
List all contributors.
exportHTML()
Create html package.
setSideBlock($a_wpg_id=0)
Side column.
setAsStartPageObject()
Confirm important pages deletion.
editImportantPagesObject()
List important pages.
getUserHTMLExportProgressObject()
Get user html export progress.
initUserHTMLExportObject()
Export html (as user)
gotoPageObject($a_page="")
Go to specific page.
addPageTabs()
Add Page Tabs.
static lookupSubObjectTitle($a_wiki_id, $a_page_id)
Get title for wiki page (used in ilNotesGUI)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
recentChangesObject()
Recent Changes.
confirmRemoveImportantPagesObject()
Confirm important pages deletion.
Class ilObjWiki.
static _lookupRatingCategories($a_wiki_id)
Lookup whether rating categories are activated.
static _performSearch($a_wiki_id, $a_searchterm)
Search in Wiki.
static isOnlineHelpWiki($a_ref_id)
Is wiki an online help wiki?
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
static checkShortTitleAvailability($a_short_title)
Check availability of short title.
static _lookupStartPage($a_wiki_id)
Lookup start page.
static _lookupRating($a_wiki_id)
Lookup whether rating is activated.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
initImportForm($a_new_type)
Init object import form.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
fillCloneTemplate($a_tpl_varname, $a_type)
Fill object clone template This method can be called from any object GUI class that wants to offer ob...
addHeaderAction()
Add header action menu.
Class ilObjectMetaDataGUI.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Class ilObject Basic functions for all objects.
static hasAutoRating($a_type, $a_ref_id)
Check if auto rating is active for parent group/course.
static _lookupObjId($a_id)
update()
update object in db
static _lookupTitle($a_id)
lookup object title
setTitle($a_title)
set object title
setDescription($a_desc)
set object description
getRefId()
get reference id @access public
static _getAllReferences($a_id)
get all reference ids of object
Class ilPDFGenerationJob.
static doJob(ilPDFGenerationJob $job)
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getInstance()
Factory.
This class represents a property form user interface.
GUI class for public user profile presentation.
This class represents a property in a property form.
This class represents an option in a radio group.
Class ilRatingGUI.
static getSearchBlockHTML($a_title)
Get standar search block html.
This class represents a selection list property in a property form.
UI class for handling permissions that can be configured having the write permission for an object.
static strLen($a_string)
Definition: class.ilStr.php:78
This class represents a text area property in a property form.
This class represents a text property in a property form.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _writeStatus($a_obj_id, $a_user_id, $a_status)
Write success status.
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
TableGUI class for listing users that contributed to the wiki.
BlockGUI class for wiki functions block.
Class ilWikiPage GUI class.
static getGUIForTitle($a_wiki_id, $a_title, $a_old_nr=0, $a_wiki_ref_id=0)
Get wiki page gui for id and title.
Wiki page template gui class.
Class ilWikiPage.
static lookupAdvancedMetadataHidden($a_page_id)
static exists($a_wiki_id, $a_title)
Checks whether a page with given title exists.
static getPageIdForTitle($a_wiki_id, $a_title)
Get wiki page object for id and title.
static _wikiPageExists($a_wiki_id, $a_title)
Check whether page exists for wiki or not.
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
static _getPageIdForWikiTitle($a_wiki_id, $a_title)
Checks whether a page with given title exists.
static getRandomPage($a_wiki_id)
Get a random page.
static lookupWikiId($a_page_id)
Lookup wiki id.
TableGUI class for wiki pages table.
static check($a_perm, $a_ref_id, $a_cmd="")
Check permission.
TableGUI class for recent changes in wiki.
TableGUI class for recent changes in wiki.
Wiki statistics GUI class.
static makeUrlTitle($a_par)
Set page parameter for Url Embedding.
static makeDbTitle($a_par)
Handle page GET parameter.
const ROOT_FOLDER_ID
Definition: constants.php:30
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
$ilUser
Definition: imgupload.php:18
exit
Definition: login.php:29
$format
Definition: metadata.php:218
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
settings()
Definition: settings.php:2
ui()
Definition: ui.php:5