4 require_once
"./classes/class.ilObjectGUI.php";
5 require_once
"./Modules/Wiki/classes/class.ilObjWiki.php";
24 function ilObjWikiGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
29 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
30 $lng->loadLanguageModule(
"wiki");
32 if (
$_GET[
"page"] !=
"")
42 $next_class = $this->ctrl->getNextClass($this);
43 $cmd = $this->ctrl->getCmd();
49 case "ilinfoscreengui":
54 case 'ilpermissiongui':
55 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
57 $ret =& $this->ctrl->forwardCommand($perm_gui);
62 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
65 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
67 $this->object->getStyleSheetId(),
"wiki"));
70 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()) &&
71 !$ilAccess->checkAccess(
"edit_content",
"", $this->object->getRefId()))
73 $wpage_gui->setEnableEditing(
false);
75 $ret = $this->ctrl->forwardCommand($wpage_gui);
78 $tpl->setContent(
$ret);
82 case 'ilpublicuserprofilegui':
83 require_once
'./Services/User/classes/class.ilPublicUserProfileGUI.php';
85 $ret = $this->ctrl->forwardCommand($profile_gui);
86 $tpl->setContent(
$ret);
89 case "ilobjstylesheetgui":
90 include_once (
"./Services/Style/classes/class.ilObjStyleSheetGUI.php");
91 $this->ctrl->setReturn($this,
"editStyleProperties");
92 $style_gui =
new ilObjStyleSheetGUI(
"", $this->object->getStyleSheetId(),
false,
false);
94 if (
$cmd ==
"create" ||
$_GET[
"new_type"]==
"sty")
96 $style_gui->setCreationMode(
true);
99 if (
$cmd ==
"confirmedDelete")
101 $this->
object->setStyleSheetId(0);
102 $this->
object->update();
105 $ret = $this->ctrl->forwardCommand($style_gui);
107 if (
$cmd ==
"save" ||
$cmd ==
"copyStyle" ||
$cmd ==
"importStyle")
110 $this->
object->setStyleSheetId($style_id);
111 $this->
object->update();
112 $this->ctrl->redirectByClass(
"ilobjstylesheetgui",
"edit");
122 if (
$cmd !=
"infoScreenObject")
157 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
159 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
167 $tpl->setContent($this->form_gui->getHtml());
178 global $rbacadmin,
$tpl,
$lng, $rbacsystem;
180 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"],
"wiki"))
182 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
186 if ($this->form_gui->checkInput())
190 $short_item = $this->form_gui->getItemByPostVar(
"shorttitle");
191 $short_item->setAlert($lng->txt(
"wiki_short_title_already_in_use"));
196 $_POST[
"Fobject"][
"title"] = $this->form_gui->getInput(
"title");
197 $_POST[
"Fobject"][
"desc"] = $this->form_gui->getInput(
"description");
202 $newObj->setTitle($this->form_gui->getInput(
"title"));
203 $newObj->setDescription($this->form_gui->getInput(
"description"));
204 $newObj->setIntroduction($this->form_gui->getInput(
"intro"));
205 $newObj->setStartPage($this->form_gui->getInput(
"startpage"));
206 $newObj->setShortTitle($this->form_gui->getInput(
"shorttitle"));
207 $newObj->setRating($this->form_gui->getInput(
"rating"));
208 $newObj->setOnline($this->form_gui->getInput(
"online"));
228 $this->form_gui->setValuesByPost();
229 $tpl->setContent($this->form_gui->getHtml());
240 $this->ctrl->setCmd(
"showSummary");
241 $this->ctrl->setCmdClass(
"ilinfoscreengui");
250 global $ilAccess, $ilUser,
$lng;
252 if (!$ilAccess->checkAccess(
"visible",
"", $this->object->getRefId()))
254 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
257 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
259 $info->enablePrivateNotes();
260 if (trim($this->object->getIntroduction()) !=
"")
262 $info->addSection($lng->txt(
"wiki_introduction"));
263 $info->addProperty(
"", nl2br($this->object->getIntroduction()));
267 include_once(
"./Modules/Wiki/classes/class.ilWikiContributor.php");
268 include_once(
"./Services/Tracking/classes/class.ilLPMarks.php");
274 $info->addSection($this->lng->txt(
"wiki_feedback_from_tutor"));
275 if ($lpcomment !=
"")
277 $info->addProperty($this->lng->txt(
"wiki_comment"),
282 $info->addProperty($this->lng->txt(
"wiki_mark"),
288 $info->addProperty($this->lng->txt(
"status"),
289 $this->lng->txt(
"wiki_passed"));
293 $info->addProperty($this->lng->txt(
"status"),
294 $this->lng->txt(
"wiki_failed"));
306 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()))
312 $this->lng->loadLanguageModule(
"meta");
313 $this->lng->loadLanguageModule(
"wiki");
320 $this->ctrl->forwardCommand($info);
322 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()))
345 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
346 $ilCtrl->setParameter($this,
"wpg_id",
349 $ilTabs->addTarget(
"wiki_what_links_here",
350 $this->ctrl->getLinkTargetByClass(
"ilwikipagegui",
351 "whatLinksHere"),
"whatLinksHere");
352 $ilTabs->addTarget(
"wiki_print_view",
353 $this->ctrl->getLinkTarget($this,
354 "printView"),
"printView");
364 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
365 $ilCtrl->setParameter($this,
"wpg_id",
369 $ilTabs->addSubTabTarget(
"wiki_all_pages",
370 $this->ctrl->getLinkTarget($this,
"allPages"),
"allPages");
371 $ilTabs->addSubTabTarget(
"wiki_recent_changes",
372 $this->ctrl->getLinkTarget($this,
"recentChanges"),
"recentChanges");
373 $ilTabs->addSubTabTarget(
"wiki_new_pages",
374 $this->ctrl->getLinkTarget($this,
"newPages"),
"newPages");
375 $ilTabs->addSubTabTarget(
"wiki_popular_pages",
376 $this->ctrl->getLinkTarget($this,
"popularPages"),
"popularPages");
377 $ilTabs->addSubTabTarget(
"wiki_orphaned_pages",
378 $this->ctrl->getLinkTarget($this,
"orphanedPages"),
"orphanedPages");
391 if (in_array($ilCtrl->getCmdClass(), array(
"",
"ilobjwikigui",
392 "ilinfoscreengui",
"ilpermissiongui")))
394 if (
$_GET[
"page"] !=
"")
396 $tabs_gui->setBackTarget($lng->txt(
"wiki_last_visited_page"),
402 if ($ilAccess->checkAccess(
'visible',
"", $this->object->getRefId()))
404 $force_active = ($ilCtrl->getNextClass() ==
"ilinfoscreengui"
405 ||
$_GET[
"cmd"] ==
"infoScreen")
408 $tabs_gui->addTarget(
"info_short",
409 $this->ctrl->getLinkTargetByClass(
410 "ilinfoscreengui",
"showSummary"),
412 "",
"", $force_active);
416 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
418 $tabs_gui->addTarget(
"settings",
419 $this->ctrl->getLinkTarget($this,
"editSettings"), array(
"editSettings"),
420 array(strtolower(get_class($this)),
""));
424 if ($ilAccess->checkAccess(
'read',
"", $this->object->getRefId()))
426 $tabs_gui->addTarget(
"wiki_pages",
427 $this->ctrl->getLinkTarget($this,
"allPages"),
432 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
434 $tabs_gui->addTarget(
"wiki_contributors",
435 $this->ctrl->getLinkTarget($this,
"listContributors"), array(
"listContributors"),
436 array(strtolower(get_class($this)),
""));
440 if ($ilAccess->checkAccess(
'edit_permission',
"", $this->object->getRefId()))
442 $tabs_gui->addTarget(
"perm_settings",
443 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
455 if (in_array($a_active,
456 array(
"general_settings",
"style")))
459 $ilTabs->addSubTab(
"general_settings",
460 $lng->txt(
"wiki_general_settings"),
461 $ilCtrl->getLinkTarget($this,
'editSettings'));
464 $ilTabs->addSubTab(
"style",
465 $lng->txt(
"wiki_style"),
466 $ilCtrl->getLinkTarget($this,
'editStyleProperties'));
468 $ilTabs->activateSubTab($a_active);
486 $tpl->setContent($this->form_gui->getHtml());
497 $lng->loadLanguageModule(
"wiki");
499 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
505 $this->form_gui->addItem($tit);
523 $this->form_gui->addItem($des);
529 $this->form_gui->addItem($intro);
532 $sp =
new ilTextInputGUI($lng->txt(
"wiki_start_page"),
"startpage");
534 $sp->setRequired(
true);
535 $this->form_gui->addItem($sp);
539 $this->form_gui->addItem($online);
542 $this->form_gui->addItem($rating);
546 if ($a_mode !=
"create")
548 $this->form_gui->
setTitle($lng->txt(
"wiki_settings"));
549 $this->form_gui->addCommandButton(
"saveSettings", $lng->txt(
"save"));
553 $this->form_gui->setTitle($lng->txt(
"wiki_new"));
554 $this->form_gui->addCommandButton(
"save", $lng->txt(
"wiki_add"));
555 $this->form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
559 if ($a_mode ==
"create")
561 $ilCtrl->setParameter($this,
"new_type",
"wiki");
564 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
572 if ($a_mode ==
"create")
574 $values[
"startpage"] = $lng->txt(
"wiki_main_page");
575 $this->form_gui->setValuesByArray($values);
579 $values[
"online"] = $this->
object->getOnline();
580 $values[
"title"] = $this->
object->getTitle();
581 $values[
"startpage"] = $this->
object->getStartPage();
582 $values[
"shorttitle"] = $this->
object->getShortTitle();
583 $values[
"description"] = $this->
object->getDescription();
584 $values[
"rating"] = $this->
object->getRating();
585 $values[
"intro"] = $this->
object->getIntroduction();
586 $this->form_gui->setValuesByArray($values);
602 if ($this->form_gui->checkInput())
605 $this->form_gui->getInput(
"shorttitle") != $this->
object->getShortTitle())
607 $short_item = $this->form_gui->getItemByPostVar(
"shorttitle");
608 $short_item->setAlert($lng->txt(
"wiki_short_title_already_in_use"));
612 $this->
object->setTitle($this->form_gui->getInput(
"title"));
613 $this->
object->setDescription($this->form_gui->getInput(
"description"));
614 $this->
object->setOnline($this->form_gui->getInput(
"online"));
615 $this->
object->setStartPage($this->form_gui->getInput(
"startpage"));
616 $this->
object->setShortTitle($this->form_gui->getInput(
"shorttitle"));
617 $this->
object->setRating($this->form_gui->getInput(
"rating"));
618 $this->
object->setIntroduction($this->form_gui->getInput(
"intro"));
619 $this->
object->update();
622 $ilCtrl->redirect($this,
"editSettings");
626 $this->form_gui->setValuesByPost();
627 $this->tpl->setContent($this->form_gui->getHTML());
639 include_once(
"./Modules/Wiki/classes/class.ilWikiContributorsTableGUI.php");
642 $this->object->getId());
644 $tpl->setContent($table_gui->getHTML());
658 $users = (is_array(
$_POST[
"sel_user_id"]))
660 : (is_array(
$_POST[
"user_id"])
664 include_once(
"./Modules/Wiki/classes/class.ilWikiContributor.php");
665 include_once(
"./Services/Tracking/classes/class.ilLPMarks.php");
667 foreach($users as $user_id)
673 $marks_obj =
new ilLPMarks($this->object->getId(),$user_id);
676 $marks_obj->update();
685 $ilCtrl->redirect($this,
"listContributors");
693 if (is_object($this->
object))
695 $ilLocator->addItem($this->object->getTitle(),
702 global $ilAccess,
$ilErr,
$lng, $ilNavigationHistory;
704 $i = strpos($a_target,
"_");
707 $a_page = substr($a_target, $i+1);
708 $a_target = substr($a_target, 0, $i);
711 if ($ilAccess->checkAccess(
"read",
"", $a_target))
713 $_GET[
"cmd"] =
"viewPage";
714 $_GET[
"ref_id"] = $a_target;
715 $_GET[
"page"] = $a_page;
716 $_GET[
"baseClass"] =
"ilwikihandlergui";
717 $_GET[
"cmdClass"] =
"ilobjwikigui";
724 include(
"ilias.php");
727 else if ($ilAccess->checkAccess(
"visible",
"", $a_target))
729 $_GET[
"cmd"] =
"infoScreen";
730 $_GET[
"ref_id"] = $tarr[0];
731 include(
"repository.php");
734 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
736 $_GET[
"cmd"] =
"frameset";
737 $_GET[
"target"] =
"";
738 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
741 include(
"repository.php");
745 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
758 $goto =
"./goto.php?target=wiki_".$a_ref_id.
"_".
773 $ilTabs->clearTargets();
775 $page = (
$_GET[
"page"] !=
"")
777 : $this->object->getStartPage();
778 $_GET[
"page"] = $page;
780 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
783 $page = $this->
object->getStartPage();
789 $ilCtrl->redirect($this,
"infoScreen");
796 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
799 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
801 $this->object->getStyleSheetId(),
"wiki"));
807 $ilCtrl->setCmdClass(
"ilwikipagegui");
808 $ilCtrl->setCmd(
"preview");
809 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()) &&
810 !$ilAccess->checkAccess(
"edit_content",
"", $this->object->getRefId()))
812 $wpage_gui->setEnableEditing(
false);
815 $html = $ilCtrl->forwardCommand($wpage_gui);
818 $tpl->setContent($html);
830 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
838 $tpl->setContent($table_gui->getHTML());
846 global
$tpl, $ilTabs;
850 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
853 $ilTabs->setTabActive(
"wiki_pages");
859 $tpl->setContent($table_gui->getHTML());
867 global
$tpl, $ilTabs;
871 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
874 $ilTabs->setTabActive(
"wiki_pages");
880 $tpl->setContent($table_gui->getHTML());
894 $a_page =
$_GET[
"page"];
897 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
908 $page->setWikiId($this->object->getId());
914 $ilCtrl->redirectByClass(
"ilwikipagegui",
"edit");
927 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
937 global
$tpl, $ilTabs;
941 include_once(
"./Modules/Wiki/classes/class.ilWikiRecentChangesTableGUI.php");
944 $ilTabs->setTabActive(
"wiki_pages");
947 $this->object->getId());
950 $tpl->setContent($table_gui->getHTML());
958 include_once(
"./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php");
962 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
963 $wiki_side_block->setPageObject(
new ilWikiPage($a_wpg_id));
967 include_once(
"./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php");
969 $rcontent = $wiki_side_block->getHTML().$wiki_search_block->getHTML();
970 $tpl->setRightContent($rcontent);
978 global
$tpl, $ilTabs;
982 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
985 $ilTabs->setTabActive(
"wiki_pages");
991 $tpl->setContent($table_gui->getHTML());
1001 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
1008 $this->tpl->setCurrentBlock(
"SyntaxStyle");
1009 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
1011 $this->tpl->parseCurrentBlock();
1015 $page_gui->setOutputMode(
"print");
1016 $page_content = $page_gui->showPage();
1017 $tpl->setVariable(
"CONTENT",
'<div class="ilInvisibleBorder">'.$page_content.
'</div>'.
1018 '<script type="text/javascript" language="javascript1.2">
1020 // Do print the page
1021 if (typeof(window.print) != \'undefined\')
1040 include_once(
"./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php");
1042 $ilTabs->setTabActive(
"wiki_search_results");
1044 if (trim(
$_POST[
"search_term"]) ==
"")
1047 $ilCtrl->redirectByClass(
"ilwikipagegui",
"preview");
1053 $this->object->getId(), $search_results);
1056 $tpl->setContent($table_gui->getHTML());
1066 $tpl->setCurrentBlock(
"ContentStyle");
1067 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
1069 $tpl->parseCurrentBlock();
1079 global $ilTabs,
$tpl;
1084 $tpl->setContent($this->form->getHTML());
1086 $ilTabs->activateTab(
"settings");
1099 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1100 $lng->loadLanguageModule(
"style");
1102 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1105 $fixed_style = $ilSetting->get(
"fixed_content_style_id");
1106 $style_id = $this->
object->getStyleSheetId();
1108 if ($fixed_style > 0)
1112 $this->lng->txt(
"global_fixed").
")");
1113 $this->form->addItem($st);
1120 $st_styles[0] = $this->lng->txt(
"default");
1130 $this->form->addItem($st);
1135 $this->form->addCommandButton(
"editStyle",
1136 $lng->txt(
"style_edit_style"));
1137 $this->form->addCommandButton(
"deleteStyle",
1138 $lng->txt(
"style_delete_style"));
1146 $st_styles,
false,
true);
1147 $style_sel =
new ilSelectInputGUI($lng->txt(
"style_current_style"),
"style_id");
1149 $style_sel->setValue($style_id);
1150 $this->form->addItem($style_sel);
1152 $this->form->addCommandButton(
"saveStyleSettings",
1154 $this->form->addCommandButton(
"createStyle",
1155 $lng->txt(
"sty_create_ind_style"));
1158 $this->form->setTitle($lng->txt(
"wiki_style"));
1159 $this->form->setFormAction($ilCtrl->getFormAction($this));
1169 $ilCtrl->redirectByClass(
"ilobjstylesheetgui",
"create");
1179 $ilCtrl->redirectByClass(
"ilobjstylesheetgui",
"edit");
1189 $ilCtrl->redirectByClass(
"ilobjstylesheetgui",
"delete");
1199 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1200 if ($ilSetting->get(
"fixed_content_style_id") <= 0 &&
1202 || $this->object->getStyleSheetId() == 0))
1205 $this->
object->update();
1208 $this->ctrl->redirect($this,
"editStyleProperties");