24 require_once
"./classes/class.ilObjectGUI.php";
25 require_once
"./Modules/Wiki/classes/class.ilObjWiki.php";
44 function ilObjWikiGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
49 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
50 $lng->loadLanguageModule(
"wiki");
52 if (
$_GET[
"page"] !=
"")
62 $next_class = $this->ctrl->getNextClass($this);
63 $cmd = $this->ctrl->getCmd();
69 case "ilinfoscreengui":
74 case 'ilpermissiongui':
75 include_once(
"./classes/class.ilPermissionGUI.php");
77 $ret =& $this->ctrl->forwardCommand($perm_gui);
81 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
85 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()) &&
86 !$ilAccess->checkAccess(
"edit_content",
"", $this->object->getRefId()))
88 $wpage_gui->setEnableEditing(
false);
90 $ret = $this->ctrl->forwardCommand($wpage_gui);
93 $tpl->setContent(
$ret);
97 case 'ilpublicuserprofilegui':
98 require_once
'./Services/User/classes/class.ilPublicUserProfileGUI.php';
100 $ret = $this->ctrl->forwardCommand($profile_gui);
101 $tpl->setContent(
$ret);
110 if (
$cmd !=
"infoScreenObject")
143 $new_type = $_POST[
"new_type"] ? $_POST[
"new_type"] :
$_GET[
"new_type"];
145 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
147 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
155 $tpl->setContent($this->form_gui->getHtml());
166 global $rbacadmin,
$tpl,
$lng, $rbacsystem;
168 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"],
"wiki"))
170 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
174 if ($this->form_gui->checkInput())
178 $short_item = $this->form_gui->getItemByPostVar(
"shorttitle");
179 $short_item->setAlert($lng->txt(
"wiki_short_title_already_in_use"));
184 $_POST[
"Fobject"][
"title"] = $this->form_gui->getInput(
"title");
185 $_POST[
"Fobject"][
"desc"] = $this->form_gui->getInput(
"description");
190 $newObj->setTitle($this->form_gui->getInput(
"title"));
191 $newObj->setDescription($this->form_gui->getInput(
"description"));
192 $newObj->setIntroduction($this->form_gui->getInput(
"intro"));
193 $newObj->setStartPage($this->form_gui->getInput(
"startpage"));
194 $newObj->setShortTitle($this->form_gui->getInput(
"shorttitle"));
195 $newObj->setRating($this->form_gui->getInput(
"rating"));
196 $newObj->setOnline($this->form_gui->getInput(
"online"));
216 $this->form_gui->setValuesByPost();
217 $tpl->setContent($this->form_gui->getHtml());
228 $this->ctrl->setCmd(
"showSummary");
229 $this->ctrl->setCmdClass(
"ilinfoscreengui");
238 global $ilAccess, $ilUser,
$lng;
240 if (!$ilAccess->checkAccess(
"visible",
"", $this->object->getRefId()))
242 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
245 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
247 $info->enablePrivateNotes();
248 if (trim($this->object->getIntroduction()) !=
"")
250 $info->addSection($lng->txt(
"wiki_introduction"));
251 $info->addProperty(
"", nl2br($this->object->getIntroduction()));
255 include_once(
"./Modules/Wiki/classes/class.ilWikiContributor.php");
256 include_once(
"./Services/Tracking/classes/class.ilLPMarks.php");
262 $info->addSection($this->lng->txt(
"wiki_feedback_from_tutor"));
263 if ($lpcomment !=
"")
265 $info->addProperty($this->lng->txt(
"wiki_comment"),
270 $info->addProperty($this->lng->txt(
"wiki_mark"),
276 $info->addProperty($this->lng->txt(
"status"),
277 $this->lng->txt(
"wiki_passed"));
281 $info->addProperty($this->lng->txt(
"status"),
282 $this->lng->txt(
"wiki_failed"));
294 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()))
300 $this->lng->loadLanguageModule(
"meta");
301 $this->lng->loadLanguageModule(
"wiki");
308 $this->ctrl->forwardCommand($info);
310 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()))
333 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
334 $ilCtrl->setParameter($this,
"wpg_id",
337 $ilTabs->addTarget(
"wiki_what_links_here",
338 $this->ctrl->getLinkTargetByClass(
"ilwikipagegui",
339 "whatLinksHere"),
"whatLinksHere");
340 $ilTabs->addTarget(
"wiki_print_view",
341 $this->ctrl->getLinkTarget($this,
342 "printView"),
"printView");
352 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
353 $ilCtrl->setParameter($this,
"wpg_id",
357 $ilTabs->addSubTabTarget(
"wiki_all_pages",
358 $this->ctrl->getLinkTarget($this,
"allPages"),
"allPages");
359 $ilTabs->addSubTabTarget(
"wiki_recent_changes",
360 $this->ctrl->getLinkTarget($this,
"recentChanges"),
"recentChanges");
361 $ilTabs->addSubTabTarget(
"wiki_new_pages",
362 $this->ctrl->getLinkTarget($this,
"newPages"),
"newPages");
363 $ilTabs->addSubTabTarget(
"wiki_popular_pages",
364 $this->ctrl->getLinkTarget($this,
"popularPages"),
"popularPages");
365 $ilTabs->addSubTabTarget(
"wiki_orphaned_pages",
366 $this->ctrl->getLinkTarget($this,
"orphanedPages"),
"orphanedPages");
379 if (in_array($ilCtrl->getCmdClass(), array(
"",
"ilobjwikigui",
380 "ilinfoscreengui",
"ilpermissiongui")))
382 if (
$_GET[
"page"] !=
"")
384 $tabs_gui->setBackTarget($lng->txt(
"wiki_last_visited_page"),
390 if ($ilAccess->checkAccess(
'visible',
"", $this->object->getRefId()))
392 $force_active = ($ilCtrl->getNextClass() ==
"ilinfoscreengui"
393 ||
$_GET[
"cmd"] ==
"infoScreen")
396 $tabs_gui->addTarget(
"info_short",
397 $this->ctrl->getLinkTargetByClass(
398 "ilinfoscreengui",
"showSummary"),
400 "",
"", $force_active);
404 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
406 $tabs_gui->addTarget(
"settings",
407 $this->ctrl->getLinkTarget($this,
"editSettings"), array(
"editSettings"),
408 array(strtolower(get_class($this)),
""));
412 if ($ilAccess->checkAccess(
'read',
"", $this->object->getRefId()))
414 $tabs_gui->addTarget(
"wiki_pages",
415 $this->ctrl->getLinkTarget($this,
"allPages"),
420 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
422 $tabs_gui->addTarget(
"wiki_contributors",
423 $this->ctrl->getLinkTarget($this,
"listContributors"), array(
"listContributors"),
424 array(strtolower(get_class($this)),
""));
428 if ($ilAccess->checkAccess(
'edit_permission',
"", $this->object->getRefId()))
430 $tabs_gui->addTarget(
"perm_settings",
431 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
448 $tpl->setContent($this->form_gui->getHtml());
459 $lng->loadLanguageModule(
"wiki");
461 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
467 $this->form_gui->addItem($tit);
485 $this->form_gui->addItem($des);
491 $this->form_gui->addItem($intro);
494 $sp =
new ilTextInputGUI($lng->txt(
"wiki_start_page"),
"startpage");
496 $sp->setRequired(
true);
497 $this->form_gui->addItem($sp);
501 $this->form_gui->addItem($online);
504 $this->form_gui->addItem($rating);
508 if ($a_mode !=
"create")
510 $this->form_gui->
setTitle($lng->txt(
"wiki_settings"));
511 $this->form_gui->addCommandButton(
"saveSettings", $lng->txt(
"save"));
515 $this->form_gui->setTitle($lng->txt(
"wiki_new"));
516 $this->form_gui->addCommandButton(
"save", $lng->txt(
"wiki_add"));
517 $this->form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
521 if ($a_mode ==
"create")
523 $ilCtrl->setParameter($this,
"new_type",
"wiki");
526 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
534 if ($a_mode ==
"create")
536 $values[
"startpage"] = $lng->txt(
"wiki_main_page");
537 $this->form_gui->setValuesByArray($values);
541 $values[
"online"] = $this->
object->getOnline();
542 $values[
"title"] = $this->
object->getTitle();
543 $values[
"startpage"] = $this->
object->getStartPage();
544 $values[
"shorttitle"] = $this->
object->getShortTitle();
545 $values[
"description"] = $this->
object->getDescription();
546 $values[
"rating"] = $this->
object->getRating();
547 $values[
"intro"] = $this->
object->getIntroduction();
548 $this->form_gui->setValuesByArray($values);
564 if ($this->form_gui->checkInput())
567 $this->form_gui->getInput(
"shorttitle") != $this->
object->getShortTitle())
569 $short_item = $this->form_gui->getItemByPostVar(
"shorttitle");
570 $short_item->setAlert($lng->txt(
"wiki_short_title_already_in_use"));
574 $this->
object->setTitle($this->form_gui->getInput(
"title"));
575 $this->
object->setDescription($this->form_gui->getInput(
"description"));
576 $this->
object->setOnline($this->form_gui->getInput(
"online"));
577 $this->
object->setStartPage($this->form_gui->getInput(
"startpage"));
578 $this->
object->setShortTitle($this->form_gui->getInput(
"shorttitle"));
579 $this->
object->setRating($this->form_gui->getInput(
"rating"));
580 $this->
object->setIntroduction($this->form_gui->getInput(
"intro"));
581 $this->
object->update();
584 $ilCtrl->redirect($this,
"editSettings");
588 $this->form_gui->setValuesByPost();
589 $this->tpl->setContent($this->form_gui->getHTML());
601 include_once(
"./Modules/Wiki/classes/class.ilWikiContributorsTableGUI.php");
604 $this->object->getId());
606 $tpl->setContent($table_gui->getHTML());
620 $users = (is_array($_POST[
"sel_user_id"]))
621 ? $_POST[
"sel_user_id"]
622 : (is_array($_POST[
"user_id"])
626 include_once(
"./Modules/Wiki/classes/class.ilWikiContributor.php");
627 include_once(
"./Services/Tracking/classes/class.ilLPMarks.php");
628 foreach($users as $user_id)
632 $marks_obj =
new ilLPMarks($this->object->getId(),$user_id);
635 $marks_obj->update();
638 $ilCtrl->redirect($this,
"listContributors");
646 if (is_object($this->
object))
648 $ilLocator->addItem($this->object->getTitle(),
655 global $ilAccess,
$ilErr,
$lng, $ilNavigationHistory;
657 $i = strpos($a_target,
"_");
660 $a_page = substr($a_target, $i+1);
661 $a_target = substr($a_target, 0, $i);
664 if ($ilAccess->checkAccess(
"read",
"", $a_target))
666 $_GET[
"cmd"] =
"viewPage";
667 $_GET[
"ref_id"] = $a_target;
668 $_GET[
"page"] = $a_page;
669 $_GET[
"baseClass"] =
"ilwikihandlergui";
670 $_GET[
"cmdClass"] =
"ilobjwikigui";
677 include(
"ilias.php");
680 else if ($ilAccess->checkAccess(
"visible",
"", $a_target))
682 $_GET[
"cmd"] =
"infoScreen";
683 $_GET[
"ref_id"] = $tarr[0];
684 include(
"repository.php");
687 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
689 $_GET[
"cmd"] =
"frameset";
690 $_GET[
"target"] =
"";
691 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
694 include(
"repository.php");
698 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
711 $goto =
"./goto.php?target=wiki_".$a_ref_id.
"_".
726 $ilTabs->clearTargets();
728 $page = (
$_GET[
"page"] !=
"")
730 : $this->object->getStartPage();
731 $_GET[
"page"] = $page;
733 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
736 $page = $this->
object->getStartPage();
742 $ilCtrl->redirect($this,
"infoScreen");
749 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
755 $ilCtrl->setCmdClass(
"ilwikipagegui");
756 $ilCtrl->setCmd(
"preview");
757 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()) &&
758 !$ilAccess->checkAccess(
"edit_content",
"", $this->object->getRefId()))
760 $wpage_gui->setEnableEditing(
false);
763 $html = $ilCtrl->forwardCommand($wpage_gui);
766 $tpl->setContent($html);
778 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
786 $tpl->setContent($table_gui->getHTML());
794 global
$tpl, $ilTabs;
798 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
801 $ilTabs->setTabActive(
"wiki_pages");
807 $tpl->setContent($table_gui->getHTML());
815 global
$tpl, $ilTabs;
819 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
822 $ilTabs->setTabActive(
"wiki_pages");
828 $tpl->setContent($table_gui->getHTML());
842 $a_page =
$_GET[
"page"];
845 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
856 $page->setWikiId($this->object->getId());
862 $ilCtrl->redirectByClass(
"ilwikipagegui",
"edit");
875 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
885 global
$tpl, $ilTabs;
889 include_once(
"./Modules/Wiki/classes/class.ilWikiRecentChangesTableGUI.php");
892 $ilTabs->setTabActive(
"wiki_pages");
895 $this->object->getId());
898 $tpl->setContent($table_gui->getHTML());
906 include_once(
"./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php");
910 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
911 $wiki_side_block->setPageObject(
new ilWikiPage($a_wpg_id));
915 include_once(
"./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php");
917 $rcontent = $wiki_side_block->getHTML().$wiki_search_block->getHTML();
918 $tpl->setRightContent($rcontent);
926 global
$tpl, $ilTabs;
930 include_once(
"./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
933 $ilTabs->setTabActive(
"wiki_pages");
939 $tpl->setContent($table_gui->getHTML());
949 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
953 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
957 $this->tpl->setCurrentBlock(
"SyntaxStyle");
958 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
960 $this->tpl->parseCurrentBlock();
964 $page_gui->setOutputMode(
"print");
965 $page_content = $page_gui->showPage();
966 $tpl->setVariable(
"CONTENT",
967 '<div class="ilInvisibleBorder">'.$page_content.
'</div>');
977 global
$tpl, $ilTabs;
981 include_once(
"./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php");
983 $ilTabs->setTabActive(
"wiki_search_results");
988 $this->object->getId(), $search_results);
991 $tpl->setContent($table_gui->getHTML());