4 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
5 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
24 function __construct($a_id = 0, $a_old_nr = 0, $a_wiki_ref_id = 0)
35 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
37 $tpl->setCurrentBlock(
"SyntaxStyle");
38 $tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
40 $tpl->parseCurrentBlock();
53 $ilHelp->setScreenIdComponent(
"copgwpg");
58 $this->wiki_ref_id = $a_ref_id;
63 return $this->wiki_ref_id;
73 $next_class = $this->ctrl->getNextClass($this);
74 $cmd = $this->ctrl->getCmd();
80 $ilTabs->setTabActive(
"pg");
86 include_once(
"./Services/Rating/classes/class.ilRatingGUI.php");
88 $rating_gui->setObject($this->
getPageObject()->getParentId(),
"wiki",
90 $rating_gui->setUpdateCallback(array($this,
"updateStatsRating"));
91 $this->ctrl->forwardCommand($rating_gui);
92 $ilCtrl->redirect($this,
"preview");
95 case "ilpageobjectgui":
96 die(
"Deprecated. Wikipage gui forwarding to ilpageobject");
99 case "ilcommonactiondispatchergui":
100 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
102 $gui->enableCommentsSettings(
false);
103 $gui->setRatingCallback($this,
"preview");
104 $this->ctrl->forwardCommand($gui);
107 case "ilwikistatgui":
108 if($ilAccess->checkAccess(
"statistics_read",
"", $this->wiki_ref_id))
110 $this->tabs_gui->clearTargets();
113 include_once
"Modules/Wiki/classes/class.ilWikiStatGUI.php";
116 $this->ctrl->forwardCommand($gui);
122 if (strtolower($ilCtrl->getNextClass()) ==
"ilpageeditorgui")
129 include_once
"./Services/Notification/classes/class.ilNotification.php";
149 $ilCtrl->redirect($this,
"preview");
180 static function getGUIForTitle($a_wiki_id, $a_title, $a_old_nr = 0, $a_wiki_ref_id = 0)
184 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
186 $page_gui =
new ilWikiPageGUI($id, $a_old_nr, $a_wiki_ref_id);
204 include_once
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
206 $ilAccess,
"wiki",
$_GET[
"ref_id"], $wiki_id);
207 $dispatcher->setSubObject(
"wpg", $page_id);
209 include_once
"Services/Object/classes/class.ilObjectListGUI.php";
210 ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this,
"redrawHeaderAction",
"",
true),
211 $this->ctrl->getLinkTargetByClass(array(
"ilcommonactiondispatchergui",
"ilnotegui"),
"",
"",
true,
false),
212 $this->ctrl->getLinkTargetByClass(array(
"ilcommonactiondispatchergui",
"iltagginggui"),
"",
"",
true,
false));
214 $lg = $dispatcher->initHeaderAction();
215 $lg->enableNotes(
true);
221 $lg->enableRating(
true, $this->lng->txt(
"wiki_rate_overall"),
224 array(
"ilcommonactiondispatchergui",
"ilratinggui"));
228 if ($ilUser->getId() != ANONYMOUS_USER_ID)
230 include_once
"./Services/Notification/classes/class.ilNotification.php";
233 $this->ctrl->setParameter($this,
"ntf", 1);
234 $lg->addCustomCommand($this->ctrl->getLinkTarget($this),
"wiki_notification_deactivate_wiki");
236 $lg->addHeaderIcon(
"not_icon",
238 $this->lng->txt(
"wiki_notification_activated"));
242 $this->ctrl->setParameter($this,
"ntf", 2);
243 $lg->addCustomCommand($this->ctrl->getLinkTarget($this),
"wiki_notification_activate_wiki");
247 $this->ctrl->setParameter($this,
"ntf", 3);
248 $lg->addCustomCommand($this->ctrl->getLinkTarget($this),
"wiki_notification_deactivate_page");
250 $lg->addHeaderIcon(
"not_icon",
252 $this->lng->txt(
"wiki_page_notification_activated"));
256 $this->ctrl->setParameter($this,
"ntf", 4);
257 $lg->addCustomCommand($this->ctrl->getLinkTarget($this),
"wiki_notification_activate_page");
259 $lg->addHeaderIcon(
"not_icon",
261 $this->lng->txt(
"wiki_notification_deactivated"));
264 $this->ctrl->setParameter($this,
"ntf",
"");
269 $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
274 return $lg->getHeaderAction().
275 $this->tpl->getOnLoadCodeForAsynch();
305 $wtpl =
new ilTemplate(
"tpl.wiki_page_view_main_column.html",
306 true,
true,
"Modules/Wiki");
308 $callback = array($this,
"observeNoteAction");
311 if (!$ilSetting->get(
"disable_comments") &&
314 $may_delete = ($ilSetting->get(
"comments_del_tutor", 1) &&
315 $ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]));
318 $may_delete, $callback));
322 $append = (
$_GET[
"page"] !=
"")
327 if (
$_GET[
"page"] !=
"")
333 $tpl->setPermanentLink(
"wiki",
$_GET[
"ref_id"]);
341 $wtpl->setVariable(
"PAGE", $this->
showPage());
343 $tpl->setLoginTargetPar(
"wiki_".
$_GET[
"ref_id"].$append);
346 include_once(
"./Services/User/classes/class.ilUserUtil.php");
347 $wtpl->setVariable(
"LAST_EDITED_INFO",
348 $lng->txt(
"wiki_last_edited").
": ".
352 false,
true, $ilCtrl->getLinkTarget($this,
"preview")));
354 $tpl->setLoginTargetPar(
"wiki_".
$_GET[
"ref_id"].$append);
357 if (
$_GET[
"srcstring"] !=
"")
359 include_once
'./Services/Search/classes/class.ilUserSearchCache.php';
362 $search_string = $cache->getQuery();
365 if(is_array($search_string))
367 $search_string = $search_string[
"lom_content"];
370 include_once(
"./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php");
371 include_once(
"./Services/Search/classes/class.ilQueryParser.php");
375 $words = $p->getQuotedWords();
376 if (is_array($words))
378 foreach ($words as $w)
383 $this->fill_on_load_code =
true;
420 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
422 $this->
getWikiPage()->getWikiId(), $ilUser->getId());
424 include_once
"./Modules/Wiki/classes/class.ilWikiStat.php";
436 include_once(
"./Modules/Wiki/classes/class.ilWikiUtil.php");
442 $ilCtrl->setParameterByClass(
"ilobjwikigui",
"from_page",
$_GET[
"from_page"]);
454 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
460 $tpl->setContent($table_gui->getHTML());
465 global $ilTabs,
$ilCtrl, $ilAccess;
469 if($ilAccess->checkAccess(
"statistics_read",
"",
$_GET[
"ref_id"]))
471 $ilTabs->addTarget(
"statistics",
472 $this->ctrl->getLinkTargetByClass(array(
"ilwikipagegui",
"ilwikistatgui"),
473 "initial"),
"",
"ilwikistatgui");
476 $ilCtrl->setParameterByClass(
"ilobjwikigui",
"wpg_id",
481 $ilTabs->addTarget(
"wiki_what_links_here",
482 $this->ctrl->getLinkTargetByClass(
"ilwikipagegui",
483 "whatLinksHere"),
"whatLinksHere");
487 $ilTabs->addTarget(
"wiki_print_view",
488 $this->ctrl->getLinkTargetByClass(
"ilwikipagegui",
489 "printViewSelection"),
"printViewSelection");
500 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
502 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
504 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
505 $confirmation_gui->setHeaderText($lng->txt(
"wiki_page_deletion_confirmation"));
506 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"cancelWikiPageDeletion");
507 $confirmation_gui->setConfirm($lng->txt(
"delete"),
"confirmWikiPageDeletion");
509 $dtpl =
new ilTemplate(
"tpl.wiki_page_deletion_confirmation.html",
true,
510 true,
"Modules/Wiki");
512 $dtpl->setVariable(
"PAGE_TITLE", $this->
getWikiPage()->getTitle());
515 $dtpl->setVariable(
"TXT_OTHER_PAGES", $lng->txt(
"wiki_other_pages_linking"));
518 if (count($pages) > 0)
520 foreach($pages as $page)
522 $dtpl->setCurrentBlock(
"lpage");
523 $dtpl->setVariable(
"TXT_LINKING_PAGE", $page[
"title"]);
524 $dtpl->parseCurrentBlock();
529 $dtpl->setCurrentBlock(
"lpage");
530 $dtpl->setVariable(
"TXT_LINKING_PAGE",
"-");
531 $dtpl->parseCurrentBlock();
535 $dtpl->setVariable(
"TXT_CONTRIBUTORS", $lng->txt(
"wiki_contributors"));
537 foreach($contributors as $contributor)
539 $dtpl->setCurrentBlock(
"contributor");
540 $dtpl->setVariable(
"TXT_CONTRIBUTOR",
541 $contributor[
"lastname"].
", ".$contributor[
"firstname"]);
542 $dtpl->parseCurrentBlock();
546 include_once(
"./Services/Notes/classes/class.ilNote.php");
549 $dtpl->setVariable(
"TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
550 $lng->txt(
"wiki_number_users_notes_or_comments"));
551 $dtpl->setVariable(
"TXT_NR_NOTES_COMMENTS", $cnt_note_users);
553 $confirmation_gui->addItem(
"",
"", $dtpl->get());
555 $tpl->setContent($confirmation_gui->getHTML());
566 $ilCtrl->redirect($this,
"preview");
577 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
584 $ilCtrl->redirectByClass(
"ilobjwikigui",
"allPages");
608 $tpl->setContent($this->form->getHTML());
620 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
624 $this->form->setPreventDoubleSubmission(
false);
630 $op1 =
new ilRadioOption($lng->txt(
"cont_current_page"),
"page");
631 $radg->addOption($op1);
633 .
" (".$lng->txt(
"wiki_pages").
": ".count($pages).
")",
"wiki");
634 $radg->addOption($op2);
635 $op3=
new ilRadioOption($lng->txt(
"wiki_selected_pages"),
"selection");
636 $radg->addOption($op3);
638 include_once(
"./Services/Form/classes/class.ilNestedListInputGUI.php");
640 $op3->addSubItem($nl);
642 foreach ($pages as $p)
644 $nl->addListNode($p[
"id"], $p[
"title"], 0,
false,
false,
648 $this->form->addItem($radg);
650 $this->form->addCommandButton(
"printViewOrder", $lng->txt(
"wiki_show_print_view"));
651 $this->form->addCommandButton(
"pdfExportOrder", $lng->txt(
"wiki_show_pdf_export"));
655 $this->form->setTitle($lng->txt(
"cont_print_selection"));
656 $this->form->setFormAction($ilCtrl->getFormAction($this,
"printViewOrder"));
673 $pg_ids = $all_pages = array();
676 if(!is_array(
$_POST[
"wordr"]))
678 switch(trim(
$_POST[
"sel_type"]))
681 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
683 foreach ($all_pages as $p)
685 $pg_ids[] = $p[
"id"];
690 if (is_array(
$_POST[
"obj_id"]))
692 $pg_ids =
$_POST[
"obj_id"];
696 $pg_ids[] =
$_GET[
"wpg_id"];
698 if(
sizeof($pg_ids) > 1)
704 $_GET[
"wpg_id"] = array_pop($pg_ids);
711 $this->ctrl->setParameterByClass(
"ilObjWikiGUI",
"wpg_id",
$_GET[
"wpg_id"]);
714 $this->ctrl->redirectByClass(
"ilObjWikiGUI",
"pdfExport");
718 $this->ctrl->redirectByClass(
"ilObjWikiGUI",
"printView");
725 $this->ctrl->setParameter($this,
"pexp", 1);
731 $a_pdf_export = (bool)
$_GET[
"pexp"];
734 $pg_ids = array_keys(
$_POST[
"wordr"]);
737 $ilTabs->clearTargets();
738 $ilTabs->setBackTarget($this->lng->txt(
"back"),
739 $this->ctrl->getLinkTarget($this,
"preview"));
741 if(!
sizeof($all_pages))
743 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
747 include_once
"Modules/Wiki/classes/class.ilWikiExportOrderTableGUI.php";
749 $this->tpl->setContent($tbl->getHTML());
764 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
772 $ilCtrl->redirect($this,
"preview");
782 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
790 $ilCtrl->redirect($this,
"preview");
805 if (($ilAccess->checkAccess(
"edit_content",
"",
$_GET[
"ref_id"]) && !$this->
getPageObject()->getBlocked())
806 || $ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
809 $tpl->setContent($this->form->getHTML());
822 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
826 $ti =
new ilTextInputGUI($lng->txt(
"wiki_new_page_name"),
"new_page_name");
830 $ti->setRequired(
true);
831 $this->form->addItem($ti);
833 $this->form->addCommandButton(
"renamePage", $lng->txt(
"wiki_rename"));
834 $this->form->addCommandButton(
"preview", $lng->txt(
"cancel"));
836 $this->form->setTitle($lng->txt(
"wiki_rename_page"));
837 $this->form->setFormAction($ilCtrl->getFormAction($this));
848 if ($this->form->checkInput())
850 if (($ilAccess->checkAccess(
"edit_content",
"",
$_GET[
"ref_id"]) && !$this->
getPageObject()->getBlocked())
851 || $ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
853 $new_name = $this->form->getInput(
"new_page_name");
870 $ilCtrl->redirect($this,
"preview");
875 $this->form->setValuesByPost();
876 $tpl->setContent($this->form->getHtml());
891 $ilCtrl->redirect($this,
"preview");
902 $ilCtrl->redirect($this,
"preview");
909 include_once
"Services/Notes/classes/class.ilNote.php";
910 $note =
new ilNote($a_note_id);
911 $note = $note->getText();
913 include_once
"./Services/Notification/classes/class.ilNotification.php";
919 include_once
"./Modules/Wiki/classes/class.ilWikiStat.php";
934 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
936 $form->setFormAction($ilCtrl->getFormAction($this,
"updateAdvancedMetaData"));
939 $form->setTitle($lng->txt(
"wiki_advmd_block_title").
": ".$page->getTitle());
941 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
944 $this->record_gui->setSelectedOnly(
true);
945 $this->record_gui->parse();
947 $form->addCommandButton(
"updateAdvancedMetaData", $lng->txt(
"save"));
948 $form->addCommandButton(
"preview", $lng->txt(
"cancel"));
957 $ilTabs->clearTargets();
958 $ilTabs->setBackTarget($lng->txt(
"back"),
959 $ilCtrl->getLinkTarget($this,
"preview"));
966 $tpl->setContent($a_form->getHTML());
977 if(!$this->record_gui->importEditFormPostValues())
979 $this->editInfoObject($form);
983 if($this->record_gui->writeEditForm())
987 $ilCtrl->redirect($this,
"preview");
998 $ilCtrl->redirect($this,
"preview");
1009 $ilCtrl->redirect($this,
"preview");
1036 $a_tpl->addJavascript(
"./Modules/Wiki/js/WikiEdit.js");
1037 $a_tpl->
addOnLoadCode(
"il.Wiki.Edit.txt.page_exists = '".$lng->txt(
"wiki_page_exists").
"';");
1038 $a_tpl->
addOnLoadCode(
"il.Wiki.Edit.txt.new_page = '".$lng->txt(
"wiki_new_page").
"';");
1049 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1051 $form->addCommandButton(
"addWikiLink", $lng->txt(
"wiki_add_link"));
1052 $form->addCommandButton(
"searchWikiLink", $lng->txt(
"search"));
1055 $tp =
new ilTextInputGUI($this->lng->txt(
"wiki_target_page"),
"target_page");
1057 $tp->setRequired(
true);
1058 $tp->setInfo(
"...");
1059 $tp->setDataSource($ilCtrl->getLinkTarget($this,
"insertWikiLinkAC",
"",
true));
1060 $form->addItem($tp);
1063 $lt =
new ilTextInputGUI($this->lng->txt(
"wiki_link_text"),
"link_text");
1065 $form->addItem($lt);
1069 echo $form->getHTML();
1080 $term =
$_GET[
"term"];
1085 $entry =
new stdClass();
1086 $entry->value = $term;
1087 $entry->label = $term;
1094 foreach (
$res as $r)
1104 $entry =
new stdClass();
1110 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
1122 $lng->loadLanguageModule(
"wiki");
1124 $tpl =
new ilTemplate(
"tpl.wiki_ac_search_result.html",
true,
true,
"Modules/Wiki");
1125 $term = trim(
$_GET[
"term"]);
1130 foreach ($pages as $page)
1141 foreach ($found as $f)
1143 $tpl->setCurrentBlock(
"item");
1144 $tpl->setVariable(
"WIKI_TITLE", $f[
"title"]);
1145 $tpl->parseCurrentBlock();
1148 if (count($pages) == 0)
1150 $tpl->setVariable(
"INFOTEXT", str_replace(
"$1", $term, $lng->txt(
"wiki_no_page_found")));
1152 else if ($term ==
'')
1154 $tpl->setVariable(
"INFOTEXT", $lng->txt(
"wiki_no_search_term"), $term);
1158 $tpl->setVariable(
"INFOTEXT", str_replace(
"$1", $term, $lng->txt(
"wiki_pages_found")));
1161 $tpl->setVariable(
"TXT_BACK", $lng->txt(
"back"));