4 require_once
"./classes/class.ilObjectGUI.php";
5 require_once
"./Modules/Wiki/classes/class.ilObjWiki.php";
25 function ilObjWikiGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
30 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
31 $lng->loadLanguageModule(
"wiki");
33 if (
$_GET[
"page"] !=
"")
43 $next_class = $this->ctrl->getNextClass($this);
44 $cmd = $this->ctrl->getCmd();
50 case "ilinfoscreengui":
55 case 'ilpermissiongui':
56 $ilTabs->activateTab(
"perm_settings");
57 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
59 $ret =& $this->ctrl->forwardCommand($perm_gui);
64 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
67 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
69 $this->object->getStyleSheetId(),
"wiki"));
72 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()) &&
73 !$ilAccess->checkAccess(
"edit_content",
"", $this->object->getRefId()))
75 $wpage_gui->setEnableEditing(
false);
77 $ret = $this->ctrl->forwardCommand($wpage_gui);
80 $tpl->setContent(
$ret);
84 case 'ilpublicuserprofilegui':
85 require_once
'./Services/User/classes/class.ilPublicUserProfileGUI.php';
87 $ret = $this->ctrl->forwardCommand($profile_gui);
88 $tpl->setContent(
$ret);
91 case "ilobjstylesheetgui":
92 include_once (
"./Services/Style/classes/class.ilObjStyleSheetGUI.php");
93 $this->ctrl->setReturn($this,
"editStyleProperties");
94 $style_gui =
new ilObjStyleSheetGUI(
"", $this->object->getStyleSheetId(),
false,
false);
96 if (
$cmd ==
"create" ||
$_GET[
"new_type"]==
"sty")
98 $style_gui->setCreationMode(
true);
101 if (
$cmd ==
"confirmedDelete")
103 $this->
object->setStyleSheetId(0);
104 $this->
object->update();
107 $ret = $this->ctrl->forwardCommand($style_gui);
109 if (
$cmd ==
"save" ||
$cmd ==
"copyStyle" ||
$cmd ==
"importStyle")
112 $this->
object->setStyleSheetId($style_id);
113 $this->
object->update();
114 $this->ctrl->redirectByClass(
"ilobjstylesheetgui",
"edit");
120 $ilTabs->activateTab(
"export");
121 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
123 $exp_gui->addFormat(
"xml");
124 $ret = $this->ctrl->forwardCommand($exp_gui);
135 if (
$cmd !=
"infoScreenObject")
170 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
172 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
180 $html1 = $this->form_gui->getHtml();
183 $html2 = $this->form->getHTML();
185 $tpl->setContent($html1.
"<br/><br/>".$html2);
198 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
200 $this->form->setTarget(
"_top");
203 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
206 $this->form->addItem($fi);
208 $this->form->addCommandButton(
"importFile", $lng->txt(
"import"));
209 $this->form->addCommandButton(
"cancel", $lng->txt(
"cancel"));
210 $this->form->setTitle($lng->txt($a_new_type.
"_import"));
212 $this->form->setFormAction($ilCtrl->getFormAction($this));
227 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
229 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->MESSAGE);
231 $this->ctrl->setParameter($this,
"new_type", $new_type);
233 if ($this->form->checkInput())
236 include_once(
"./Services/Export/classes/class.ilImport.php");
238 $new_id = $imp->importObject($newObj, $_FILES[
"importfile"][
"tmp_name"],
239 $_FILES[
"importfile"][
"name"], $new_type);
245 $newObj->createReference();
246 $newObj->putInTree($_GET[
"ref_id"]);
247 $newObj->setPermissions($_GET[
"ref_id"]);
254 $this->form->setValuesByPost();
255 $tpl->setContent($this->form->getHtml());
276 global $rbacadmin,
$tpl,
$lng, $rbacsystem;
278 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"],
"wiki"))
280 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
284 if ($this->form_gui->checkInput())
288 $short_item = $this->form_gui->getItemByPostVar(
"shorttitle");
289 $short_item->setAlert($lng->txt(
"wiki_short_title_already_in_use"));
294 $_POST[
"Fobject"][
"title"] = $this->form_gui->getInput(
"title");
295 $_POST[
"Fobject"][
"desc"] = $this->form_gui->getInput(
"description");
300 $newObj->setTitle($this->form_gui->getInput(
"title"));
301 $newObj->setDescription($this->form_gui->getInput(
"description"));
302 $newObj->setIntroduction($this->form_gui->getInput(
"intro"));
303 $newObj->setStartPage($this->form_gui->getInput(
"startpage"));
304 $newObj->setShortTitle($this->form_gui->getInput(
"shorttitle"));
305 $newObj->setRating($this->form_gui->getInput(
"rating"));
306 $newObj->setOnline($this->form_gui->getInput(
"online"));
320 $this->form_gui->setValuesByPost();
321 $tpl->setContent($this->form_gui->getHtml());
332 $this->ctrl->setCmd(
"showSummary");
333 $this->ctrl->setCmdClass(
"ilinfoscreengui");
342 global $ilAccess, $ilUser, $ilTabs,
$lng;
344 $ilTabs->activateTab(
"info_short");
346 if (!$ilAccess->checkAccess(
"visible",
"", $this->object->getRefId()))
348 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
351 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
353 $info->enablePrivateNotes();
354 if (trim($this->object->getIntroduction()) !=
"")
356 $info->addSection($lng->txt(
"wiki_introduction"));
357 $info->addProperty(
"", nl2br($this->object->getIntroduction()));
361 include_once(
"./Modules/Wiki/classes/class.ilWikiContributor.php");
362 include_once(
"./Services/Tracking/classes/class.ilLPMarks.php");
368 $info->addSection($this->lng->txt(
"wiki_feedback_from_tutor"));
369 if ($lpcomment !=
"")
371 $info->addProperty($this->lng->txt(
"wiki_comment"),
376 $info->addProperty($this->lng->txt(
"wiki_mark"),
382 $info->addProperty($this->lng->txt(
"status"),
383 $this->lng->txt(
"wiki_passed"));
387 $info->addProperty($this->lng->txt(
"status"),
388 $this->lng->txt(
"wiki_failed"));
400 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()))
406 $this->lng->loadLanguageModule(
"meta");
407 $this->lng->loadLanguageModule(
"wiki");
414 $this->ctrl->forwardCommand($info);
416 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()))
439 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
440 $ilCtrl->setParameter($this,
"wpg_id",
443 $ilTabs->addTarget(
"wiki_what_links_here",
444 $this->ctrl->getLinkTargetByClass(
"ilwikipagegui",
445 "whatLinksHere"),
"whatLinksHere");
449 $ilTabs->addTarget(
"wiki_print_view",
450 $this->ctrl->getLinkTargetByClass(
"ilwikipagegui",
451 "printViewSelection"),
"printViewSelection");
461 $ilTabs->activateTab(
"wiki_pages");
463 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
464 $ilCtrl->setParameter($this,
"wpg_id",
468 $ilTabs->addSubTabTarget(
"wiki_all_pages",
469 $this->ctrl->getLinkTarget($this,
"allPages"),
"allPages");
470 $ilTabs->addSubTabTarget(
"wiki_recent_changes",
471 $this->ctrl->getLinkTarget($this,
"recentChanges"),
"recentChanges");
472 $ilTabs->addSubTabTarget(
"wiki_new_pages",
473 $this->ctrl->getLinkTarget($this,
"newPages"),
"newPages");
474 $ilTabs->addSubTabTarget(
"wiki_popular_pages",
475 $this->ctrl->getLinkTarget($this,
"popularPages"),
"popularPages");
476 $ilTabs->addSubTabTarget(
"wiki_orphaned_pages",
477 $this->ctrl->getLinkTarget($this,
"orphanedPages"),
"orphanedPages");
490 if (in_array($ilCtrl->getCmdClass(), array(
"",
"ilobjwikigui",
491 "ilinfoscreengui",
"ilpermissiongui",
"ilexportgui")))
493 if (
$_GET[
"page"] !=
"")
495 $tabs_gui->setBackTarget($lng->txt(
"wiki_last_visited_page"),
501 if ($ilAccess->checkAccess(
'read',
"", $this->object->getRefId()))
503 $ilTabs->addTab(
"wiki_pages",
504 $lng->txt(
"wiki_pages"),
505 $this->ctrl->getLinkTarget($this,
"allPages"));
509 if ($ilAccess->checkAccess(
'visible',
"", $this->object->getRefId()))
511 $ilTabs->addTab(
"info_short",
512 $lng->txt(
"info_short"),
513 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"));
517 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
519 $ilTabs->addTab(
"settings",
520 $lng->txt(
"settings"),
521 $this->ctrl->getLinkTarget($this,
"editSettings"));
525 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
527 $ilTabs->addTab(
"wiki_contributors",
528 $lng->txt(
"wiki_contributors"),
529 $this->ctrl->getLinkTarget($this,
"listContributors"));
532 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
534 $ilTabs->addTab(
"export",
536 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""));
541 if ($ilAccess->checkAccess(
'edit_permission',
"", $this->object->getRefId()))
543 $ilTabs->addTab(
"perm_settings",
544 $lng->txt(
"perm_settings"),
545 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"));
557 if (in_array($a_active,
558 array(
"general_settings",
"style")))
561 $ilTabs->addSubTab(
"general_settings",
562 $lng->txt(
"wiki_general_settings"),
563 $ilCtrl->getLinkTarget($this,
'editSettings'));
566 $ilTabs->addSubTab(
"style",
567 $lng->txt(
"wiki_style"),
568 $ilCtrl->getLinkTarget($this,
'editStyleProperties'));
570 $ilTabs->activateSubTab($a_active);
588 $tpl->setContent($this->form_gui->getHtml());
599 $lng->loadLanguageModule(
"wiki");
600 $ilTabs->activateTab(
"settings");
602 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
608 $this->form_gui->addItem($tit);
626 $this->form_gui->addItem($des);
632 $this->form_gui->addItem($intro);
635 $sp =
new ilTextInputGUI($lng->txt(
"wiki_start_page"),
"startpage");
637 $sp->setRequired(
true);
638 $this->form_gui->addItem($sp);
642 $this->form_gui->addItem($online);
645 $this->form_gui->addItem($rating);
649 if ($a_mode !=
"create")
651 $this->form_gui->
setTitle($lng->txt(
"wiki_settings"));
652 $this->form_gui->addCommandButton(
"saveSettings", $lng->txt(
"save"));
656 $this->form_gui->setTitle($lng->txt(
"wiki_new"));
657 $this->form_gui->addCommandButton(
"save", $lng->txt(
"wiki_add"));
658 $this->form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
662 if ($a_mode ==
"create")
664 $ilCtrl->setParameter($this,
"new_type",
"wiki");
667 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
672 global
$lng, $ilUser;
675 if ($a_mode ==
"create")
677 $values[
"startpage"] = $lng->txt(
"wiki_main_page");
678 $this->form_gui->setValuesByArray($values);
682 $values[
"online"] = $this->
object->getOnline();
683 $values[
"title"] = $this->
object->getTitle();
684 $values[
"startpage"] = $this->
object->getStartPage();
685 $values[
"shorttitle"] = $this->
object->getShortTitle();
686 $values[
"description"] = $this->
object->getDescription();
687 $values[
"rating"] = $this->
object->getRating();
688 $values[
"intro"] = $this->
object->getIntroduction();
690 $this->form_gui->setValuesByArray($values);
706 if ($this->form_gui->checkInput())
709 $this->form_gui->getInput(
"shorttitle") != $this->
object->getShortTitle())
711 $short_item = $this->form_gui->getItemByPostVar(
"shorttitle");
712 $short_item->setAlert($lng->txt(
"wiki_short_title_already_in_use"));
716 $this->
object->setTitle($this->form_gui->getInput(
"title"));
717 $this->
object->setDescription($this->form_gui->getInput(
"description"));
718 $this->
object->setOnline($this->form_gui->getInput(
"online"));
719 $this->
object->setStartPage($this->form_gui->getInput(
"startpage"));
720 $this->
object->setShortTitle($this->form_gui->getInput(
"shorttitle"));
721 $this->
object->setRating($this->form_gui->getInput(
"rating"));
722 $this->
object->setIntroduction($this->form_gui->getInput(
"intro"));
723 $this->
object->update();
726 $ilCtrl->redirect($this,
"editSettings");
730 $this->form_gui->setValuesByPost();
731 $this->tpl->setContent($this->form_gui->getHTML());
739 global
$tpl, $ilTabs;
742 $ilTabs->activateTab(
"wiki_contributors");
744 include_once(
"./Modules/Wiki/classes/class.ilWikiContributorsTableGUI.php");
747 $this->object->getId());
749 $tpl->setContent($table_gui->getHTML());
763 $users = (is_array(
$_POST[
"sel_user_id"]))
765 : (is_array(
$_POST[
"user_id"])
769 include_once(
"./Modules/Wiki/classes/class.ilWikiContributor.php");
770 include_once(
"./Services/Tracking/classes/class.ilLPMarks.php");
772 foreach($users as $user_id)
778 $marks_obj =
new ilLPMarks($this->object->getId(),$user_id);
781 $marks_obj->update();
790 $ilCtrl->redirect($this,
"listContributors");
798 if (is_object($this->
object))
800 $ilLocator->addItem($this->object->getTitle(),
807 global $ilAccess,
$ilErr,
$lng, $ilNavigationHistory;
809 $i = strpos($a_target,
"_");
812 $a_page = substr($a_target, $i+1);
813 $a_target = substr($a_target, 0, $i);
816 if ($ilAccess->checkAccess(
"read",
"", $a_target))
818 $_GET[
"cmd"] =
"viewPage";
819 $_GET[
"ref_id"] = $a_target;
820 $_GET[
"page"] = $a_page;
821 $_GET[
"baseClass"] =
"ilwikihandlergui";
822 $_GET[
"cmdClass"] =
"ilobjwikigui";
829 include(
"ilias.php");
832 else if ($ilAccess->checkAccess(
"visible",
"", $a_target))
834 $_GET[
"cmd"] =
"infoScreen";
835 $_GET[
"ref_id"] = $tarr[0];
836 include(
"repository.php");
839 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
841 $_GET[
"cmd"] =
"frameset";
842 $_GET[
"target"] =
"";
843 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
846 include(
"repository.php");
850 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
863 $goto =
"goto.php?target=wiki_".$a_ref_id.
"_".
878 $ilTabs->clearTargets();
880 $page = (
$_GET[
"page"] !=
"")
882 : $this->object->getStartPage();
883 $_GET[
"page"] = $page;
885 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
888 $page = $this->
object->getStartPage();
894 $ilCtrl->redirect($this,
"infoScreen");
901 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
904 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
906 $this->object->getStyleSheetId(),
"wiki"));
912 $ilCtrl->setCmdClass(
"ilwikipagegui");
913 $ilCtrl->setCmd(
"preview");
914 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()) &&
915 !$ilAccess->checkAccess(
"edit_content",
"", $this->object->getRefId()))
917 $wpage_gui->setEnableEditing(
false);
920 $html = $ilCtrl->forwardCommand($wpage_gui);
923 $tpl->setContent($html);
935 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
943 $tpl->setContent($table_gui->getHTML());
955 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
963 $tpl->setContent($table_gui->getHTML());
975 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
983 $tpl->setContent($table_gui->getHTML());
997 $a_page =
$_GET[
"page"];
1000 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
1011 $page->setWikiId($this->object->getId());
1017 $ilCtrl->redirectByClass(
"ilwikipagegui",
"edit");
1030 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
1044 include_once(
"./Modules/Wiki/classes/class.ilWikiRecentChangesTableGUI.php");
1049 $this->object->getId());
1052 $tpl->setContent($table_gui->getHTML());
1060 include_once(
"./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php");
1064 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
1065 $wiki_side_block->setPageObject(
new ilWikiPage($a_wpg_id));
1069 include_once(
"./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php");
1071 $rcontent = $wiki_side_block->getHTML().$wiki_search_block->getHTML();
1072 $tpl->setRightContent($rcontent);
1084 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1092 $tpl->setContent($table_gui->getHTML());
1103 switch (
$_POST[
"sel_type"])
1106 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
1108 foreach ($pages as $p)
1110 $pg_ids[] = $p[
"id"];
1115 if (is_array(
$_POST[
"obj_id"]))
1117 $pg_ids =
$_POST[
"obj_id"];
1121 $pg_ids[] =
$_GET[
"wpg_id"];
1126 $pg_ids[] =
$_GET[
"wpg_id"];
1130 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
1137 $tpl->setCurrentBlock(
"SyntaxStyle");
1138 $tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
1140 $tpl->parseCurrentBlock();
1145 foreach ($pg_ids as $p_id)
1148 $page_gui->setOutputMode(
"print");
1149 $page_content.= $page_gui->showPage();
1151 $tpl->setVariable(
"CONTENT",
'<div class="ilInvisibleBorder">'.$page_content.
'</div>'.
1152 '<script type="text/javascript" language="javascript1.2">
1154 // Do print the page
1155 if (typeof(window.print) != \'undefined\')
1174 include_once(
"./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php");
1176 $ilTabs->setTabActive(
"wiki_search_results");
1178 if (trim(
$_POST[
"search_term"]) ==
"")
1181 $ilCtrl->redirectByClass(
"ilwikipagegui",
"preview");
1187 $this->object->getId(), $search_results);
1190 $tpl->setContent($table_gui->getHTML());
1209 $ctpl->setCurrentBlock(
"ContentStyle");
1210 $ctpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
1212 $ctpl->parseCurrentBlock();
1222 global $ilTabs,
$tpl;
1227 $tpl->setContent($this->form->getHTML());
1229 $ilTabs->activateTab(
"settings");
1242 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1243 $lng->loadLanguageModule(
"style");
1245 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1248 $fixed_style = $ilSetting->get(
"fixed_content_style_id");
1249 $style_id = $this->
object->getStyleSheetId();
1251 if ($fixed_style > 0)
1255 $this->lng->txt(
"global_fixed").
")");
1256 $this->form->addItem($st);
1263 $st_styles[0] = $this->lng->txt(
"default");
1273 $this->form->addItem($st);
1278 $this->form->addCommandButton(
"editStyle",
1279 $lng->txt(
"style_edit_style"));
1280 $this->form->addCommandButton(
"deleteStyle",
1281 $lng->txt(
"style_delete_style"));
1289 $st_styles,
false,
true);
1290 $style_sel =
new ilSelectInputGUI($lng->txt(
"style_current_style"),
"style_id");
1292 $style_sel->setValue($style_id);
1293 $this->form->addItem($style_sel);
1295 $this->form->addCommandButton(
"saveStyleSettings",
1297 $this->form->addCommandButton(
"createStyle",
1298 $lng->txt(
"sty_create_ind_style"));
1301 $this->form->setTitle($lng->txt(
"wiki_style"));
1302 $this->form->setFormAction($ilCtrl->getFormAction($this));
1312 $ilCtrl->redirectByClass(
"ilobjstylesheetgui",
"create");
1322 $ilCtrl->redirectByClass(
"ilobjstylesheetgui",
"edit");
1332 $ilCtrl->redirectByClass(
"ilobjstylesheetgui",
"delete");
1342 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1343 if ($ilSetting->get(
"fixed_content_style_id") <= 0 &&
1345 || $this->object->getStyleSheetId() == 0))
1348 $this->
object->update();
1351 $this->ctrl->redirect($this,
"editStyleProperties");