ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjWikiGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObjectGUI.php";
5 require_once "./Modules/Wiki/classes/class.ilObjWiki.php";
6 
7 
21 {
26  function ilObjWikiGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
27  {
28  global $ilCtrl, $lng;
29 
30  $this->type = "wiki";
31 
32  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
33  $lng->loadLanguageModule("wiki");
34 
35  if ($_GET["page"] != "")
36  {
37  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
38  }
39  }
40 
41  function executeCommand()
42  {
43  global $ilUser, $ilCtrl, $tpl, $ilTabs, $ilAccess;
44 
45  $next_class = $this->ctrl->getNextClass($this);
46  $cmd = $this->ctrl->getCmd();
47 
48  $this->prepareOutput();
49 
50  switch($next_class)
51  {
52  case "ilinfoscreengui":
53  $this->checkPermission("visible");
54  $this->addHeaderAction();
55  $this->infoScreen(); // forwards command
56  break;
57 
58  case 'ilpermissiongui':
59  $this->addHeaderAction();
60  $ilTabs->activateTab("perm_settings");
61  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
62  $perm_gui =& new ilPermissionGUI($this);
63  $ret =& $this->ctrl->forwardCommand($perm_gui);
64  break;
65 
66  case 'ilwikipagegui':
67  $this->checkPermission("read");
68  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
69  $wpage_gui = ilWikiPageGUI::getGUIForTitle($this->object->getId(),
70  ilWikiUtil::makeDbTitle($_GET["page"]), $_GET["old_nr"], $this->object->getRefId());
71  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
72  $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
73  $this->object->getStyleSheetId(), "wiki"));
74  $this->setContentStyleSheet();
75  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
76  (!$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
77  $wpage_gui->getPageObject()->getBlocked()
78  ))
79  {
80  $wpage_gui->setEnableEditing(false);
81  }
82 
83  // alter title and description
84 // $tpl->setTitle($wpage_gui->getPageObject()->getTitle());
85 // $tpl->setDescription($this->object->getTitle());
86 
87  $ret = $this->ctrl->forwardCommand($wpage_gui);
88  if ($ret != "")
89  {
90  $tpl->setContent($ret);
91  }
92  break;
93 
94  case 'ilpublicuserprofilegui':
95  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
96  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
97  $ret = $this->ctrl->forwardCommand($profile_gui);
98  $tpl->setContent($ret);
99  break;
100 
101  case "ilobjstylesheetgui":
102  include_once ("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
103  $this->ctrl->setReturn($this, "editStyleProperties");
104  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
105  $style_gui->omitLocator();
106  if ($cmd == "create" || $_GET["new_type"]=="sty")
107  {
108  $style_gui->setCreationMode(true);
109  }
110 
111  if ($cmd == "confirmedDelete")
112  {
113  $this->object->setStyleSheetId(0);
114  $this->object->update();
115  }
116 
117  $ret = $this->ctrl->forwardCommand($style_gui);
118 
119  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
120  {
121  $style_id = $ret;
122  $this->object->setStyleSheetId($style_id);
123  $this->object->update();
124  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
125  }
126  break;
127 
128  case "ilexportgui":
129 // $this->prepareOutput();
130  $this->addHeaderAction();
131  $ilTabs->activateTab("export");
132  include_once("./Services/Export/classes/class.ilExportGUI.php");
133  $exp_gui = new ilExportGUI($this);
134  $exp_gui->addFormat("xml");
135  $exp_gui->addFormat("html", "", $this, "exportHTML");
136  $ret = $this->ctrl->forwardCommand($exp_gui);
137 // $this->tpl->show();
138  break;
139 
140  case "ilcommonactiondispatchergui":
141  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
143  $this->ctrl->forwardCommand($gui);
144  break;
145 
146  case "ilratinggui":
147  $this->checkPermission("write");
148  $this->addHeaderAction();
149  $ilTabs->activateTab("settings");
150  $this->setSettingsSubTabs("rating_categories");
151  include_once("Services/Rating/classes/class.ilRatingGUI.php");
152  $gui = new ilRatingGUI();
153  $gui->setObject($this->object->getId(), $this->object->getType());
154  $gui->setExportCallback(array($this, "getSubObjectTitle"), $this->lng->txt("page"));
155  $this->ctrl->forwardCommand($gui);
156  break;
157 
158  default:
159  $this->addHeaderAction();
160  if(!$cmd)
161  {
162  $cmd = "infoScreen";
163  }
164  $cmd .= "Object";
165  if ($cmd != "infoScreenObject")
166  {
167  $this->checkPermission("read");
168  }
169  else
170  {
171  $this->checkPermission("visible");
172  }
173  $this->$cmd();
174  break;
175  }
176 
177  return $ret;
178  }
179 
185  function isOnlineHelpWiki()
186  {
187  if (is_object($this->object))
188  {
189  return ilObjWiki::isOnlineHelpWiki($this->object->getRefId());
190  }
191  return false;
192  }
193 
197  function viewObject()
198  {
199  $this->checkPermission("read");
200  $this->gotoStartPageObject();
201  }
202 
203  protected function initCreationForms($a_new_type)
204  {
205  $this->initSettingsForm("create");
206  $this->getSettingsFormValues("create");
207 
208  $forms = array(self::CFORM_NEW => $this->form_gui,
209  self::CFORM_IMPORT => $this->initImportForm($a_new_type));
210 
211  return $forms;
212  }
213 
218  function saveObject()
219  {
220  global $tpl, $lng, $rbacsystem;
221 
222  if (!$this->checkPermissionBool("create", "", "wiki", $_GET["ref_id"]))
223  {
224  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
225  }
226 
227  $this->initSettingsForm("create");
228  if ($this->form_gui->checkInput())
229  {
230  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")))
231  {
232  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
233  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
234  }
235  else
236  {
237  // create and insert forum in objecttree
238  $_POST["title"] = $this->form_gui->getInput("title");
239  $_POST["desc"] = $this->form_gui->getInput("description");
240  return parent::saveObject();
241  }
242  }
243 
244  $this->form_gui->setValuesByPost();
245  $tpl->setContent($this->form_gui->getHtml());
246  }
247 
252  function afterSave($newObj)
253  {
254  global $ilSetting;
255 
256  $newObj->setTitle($this->form_gui->getInput("title"));
257  $newObj->setDescription($this->form_gui->getInput("description"));
258  $newObj->setIntroduction($this->form_gui->getInput("intro"));
259  $newObj->setStartPage($this->form_gui->getInput("startpage"));
260  $newObj->setShortTitle($this->form_gui->getInput("shorttitle"));
261  $newObj->setRating($this->form_gui->getInput("rating"));
262  $newObj->setRatingAsBlock($this->form_gui->getInput("rating_side"));
263  $newObj->setRatingForNewPages($this->form_gui->getInput("rating_new"));
264  $newObj->setRatingCategories($this->form_gui->getInput("rating_ext"));
265  if (!$ilSetting->get("disable_comments"))
266  {
267  $newObj->setPublicNotes($this->form_gui->getInput("public_notes"));
268  }
269  $newObj->setOnline($this->form_gui->getInput("online"));
270  $newObj->update();
271 
272  // always send a message
273  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
274  ilUtil::redirect(ilObjWikiGUI::getGotoLink($newObj->getRefId()));
275  }
276 
282  function infoScreenObject()
283  {
284  $this->checkPermission("visible");
285  $this->ctrl->setCmd("showSummary");
286  $this->ctrl->setCmdClass("ilinfoscreengui");
287  $this->infoScreen();
288  }
289 
293  function infoScreen()
294  {
295  global $ilAccess, $ilUser, $ilTabs, $lng;
296 
297  $ilTabs->activateTab("info_short");
298 
299  if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId()))
300  {
301  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
302  }
303 
304  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
305  $info = new ilInfoScreenGUI($this);
306  $info->enablePrivateNotes();
307  if (trim($this->object->getIntroduction()) != "")
308  {
309  $info->addSection($lng->txt("wiki_introduction"));
310  $info->addProperty("", nl2br($this->object->getIntroduction()));
311  }
312 
313  // feedback from tutor; mark, status, comment
314  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
315  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
316  $lpcomment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId());
317  $mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId());
318  $status = ilWikiContributor::_lookupStatus($this->object->getId(), $ilUser->getId());
319  if ($lpcomment != "" || $mark != "" || $status != ilWikiContributor::STATUS_NOT_GRADED)
320  {
321  $info->addSection($this->lng->txt("wiki_feedback_from_tutor"));
322  if ($lpcomment != "")
323  {
324  $info->addProperty($this->lng->txt("wiki_comment"),
325  $lpcomment);
326  }
327  if ($mark != "")
328  {
329  $info->addProperty($this->lng->txt("wiki_mark"),
330  $mark);
331  }
332 
333  if ($status == ilWikiContributor::STATUS_PASSED)
334  {
335  $info->addProperty($this->lng->txt("status"),
336  $this->lng->txt("wiki_passed"));
337  }
338  if ($status == ilWikiContributor::STATUS_FAILED)
339  {
340  $info->addProperty($this->lng->txt("status"),
341  $this->lng->txt("wiki_failed"));
342  }
343  }
344 
345  /*
346  $info->enableNews();
347  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
348  {
349  //$info->enableNewsEditing();
350  $info->setBlockProperty("news", "settings", true);
351  }*/
352 
353  if ($ilAccess->checkAccess("read", "", $this->object->getRefId()))
354  {
355  $info->addButton($lng->txt("wiki_start_page"), ilObjWikiGUI::getGotoLink($this->object->getRefId()));
356  }
357 
358  // general information
359  $this->lng->loadLanguageModule("meta");
360  $this->lng->loadLanguageModule("wiki");
361 
362  //$info->addSection($this->lng->txt("meta_general"));
363  //$info->addProperty($this->lng->txt("mcst_nr_items"),
364  // (int) count($med_items));
365 
366  // forward the command
367  $this->ctrl->forwardCommand($info);
368 
369  if ($ilAccess->checkAccess("read", "", $this->object->getRefId()))
370  {
371 // $this->setSideBlock();
372  }
373  }
374 
379  {
380  global $ilCtrl;
381 
382  ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId()));
383  }
384 
388  function addPageTabs()
389  {
390  global $ilTabs, $ilCtrl;
391 
392  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
393  $ilCtrl->setParameter($this, "wpg_id",
394  ilWikiPage::getPageIdForTitle($this->object->getId(), ilWikiUtil::makeDbTitle($_GET["page"])));
395  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
396  $ilTabs->addTarget("wiki_what_links_here",
397  $this->ctrl->getLinkTargetByClass("ilwikipagegui",
398  "whatLinksHere"), "whatLinksHere");
399  //$ilTabs->addTarget("wiki_print_view",
400  // $this->ctrl->getLinkTarget($this,
401  // "printViewSelection"), "printViewSelection");
402  $ilTabs->addTarget("wiki_print_view",
403  $this->ctrl->getLinkTargetByClass("ilwikipagegui",
404  "printViewSelection"), "printViewSelection");
405  }
406 
410  function addPagesSubTabs()
411  {
412  global $ilTabs, $ilCtrl;
413 
414  $ilTabs->activateTab("wiki_pages");
415 
416  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
417  $ilCtrl->setParameter($this, "wpg_id",
418  ilWikiPage::getPageIdForTitle($this->object->getId(),
419  ilWikiUtil::makeDbTitle($_GET["page"])));
420  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
421  $ilTabs->addSubTabTarget("wiki_all_pages",
422  $this->ctrl->getLinkTarget($this, "allPages"), "allPages");
423  $ilTabs->addSubTabTarget("wiki_recent_changes",
424  $this->ctrl->getLinkTarget($this, "recentChanges"), "recentChanges");
425  $ilTabs->addSubTabTarget("wiki_new_pages",
426  $this->ctrl->getLinkTarget($this, "newPages"), "newPages");
427  $ilTabs->addSubTabTarget("wiki_popular_pages",
428  $this->ctrl->getLinkTarget($this, "popularPages"), "popularPages");
429  $ilTabs->addSubTabTarget("wiki_orphaned_pages",
430  $this->ctrl->getLinkTarget($this, "orphanedPages"), "orphanedPages");
431  }
432 
438  function getTabs($tabs_gui)
439  {
440  global $ilCtrl, $ilAccess, $ilTabs, $lng, $ilHelp;
441 
442  $ilHelp->setScreenIdComponent("wiki");
443 
444  // wiki tabs
445  if (in_array($ilCtrl->getCmdClass(), array("", "ilobjwikigui",
446  "ilinfoscreengui", "ilpermissiongui", "ilexportgui", "ilratingcategorygui")))
447  {
448  if ($_GET["page"] != "")
449  {
450  $tabs_gui->setBackTarget($lng->txt("wiki_last_visited_page"),
451  $this->getGotoLink($_GET["ref_id"],
452  ilWikiUtil::makeDbTitle($_GET["page"])));
453  }
454 
455  // pages
456  if ($ilAccess->checkAccess('read', "", $this->object->getRefId()))
457  {
458  $ilTabs->addTab("wiki_pages",
459  $lng->txt("wiki_pages"),
460  $this->ctrl->getLinkTarget($this, "allPages"));
461  }
462 
463  // info screen
464  if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()))
465  {
466  $ilTabs->addTab("info_short",
467  $lng->txt("info_short"),
468  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
469  }
470 
471  // settings
472  if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
473  {
474  $ilTabs->addTab("settings",
475  $lng->txt("settings"),
476  $this->ctrl->getLinkTarget($this, "editSettings"));
477  }
478 
479  // contributors
480  if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
481  {
482  $ilTabs->addTab("wiki_contributors",
483  $lng->txt("wiki_contributors"),
484  $this->ctrl->getLinkTarget($this, "listContributors"));
485  }
486 
487  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
488  {
489  $ilTabs->addTab("export",
490  $lng->txt("export"),
491  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
492  }
493 
494 
495  // edit permissions
496  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
497  {
498  $ilTabs->addTab("perm_settings",
499  $lng->txt("perm_settings"),
500  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
501  }
502  }
503  }
504 
508  function setSettingsSubTabs($a_active)
509  {
510  global $ilTabs, $ilCtrl, $lng;
511 
512  if (in_array($a_active,
513  array("general_settings", "style", "imp_pages", "rating_categories")))
514  {
515  // general properties
516  $ilTabs->addSubTab("general_settings",
517  $lng->txt("wiki_general_settings"),
518  $ilCtrl->getLinkTarget($this, 'editSettings'));
519 
520  // style properties
521  $ilTabs->addSubTab("style",
522  $lng->txt("wiki_style"),
523  $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
524 
525  // important pages
526  $ilTabs->addSubTab("imp_pages",
527  $lng->txt("wiki_navigation"),
528  $ilCtrl->getLinkTarget($this, 'editImportantPages'));
529 
530  // rating categories
531  if($this->object->getRating() && $this->object->getRatingCategories())
532  {
533  $lng->loadLanguageModule("rating");
534  $ilTabs->addSubTab("rating_categories",
535  $lng->txt("rating_categories"),
536  $ilCtrl->getLinkTargetByClass(array('ilratinggui', 'ilratingcategorygui'), ''));
537  }
538 
539  $ilTabs->activateSubTab($a_active);
540  }
541  }
542 
547  {
548  global $tpl;
549 
550  $this->checkPermission("write");
551 
552  $this->setSettingsSubTabs("general_settings");
553 
554  $this->initSettingsForm();
555  $this->getSettingsFormValues();
556 
557  // Edit ecs export settings
558  include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
559  $ecs = new ilECSWikiSettings($this->object);
560  $ecs->addSettingsToForm($this->form_gui, 'wiki');
561 
562  $tpl->setContent($this->form_gui->getHtml());
563  $this->setSideBlock();
564  }
565 
569  function initSettingsForm($a_mode = "edit")
570  {
571  global $lng, $ilCtrl, $ilTabs, $ilSetting;
572 
573  $lng->loadLanguageModule("wiki");
574  $ilTabs->activateTab("settings");
575 
576  include("Services/Form/classes/class.ilPropertyFormGUI.php");
577  $this->form_gui = new ilPropertyFormGUI();
578 
579  // Title
580  $tit = new ilTextInputGUI($lng->txt("title"), "title");
581  $tit->setRequired(true);
582  $this->form_gui->addItem($tit);
583 
584  // Short Title
585  // The problem with the short title is, that it is per object
586  // and can't be a substitute for a ref id in the permanent link
587 /*
588  $stit = new ilRegExpInputGUI($lng->txt("wiki_short_title"), "shorttitle");
589  $stit->setPattern("/^[^0-9][^ _\&]+$/");
590  $stit->setRequired(false);
591  $stit->setNoMatchMessage($lng->txt("wiki_msg_short_name_regexp")." &amp; _");
592  $stit->setSize(20);
593  $stit->setMaxLength(20);
594  $stit->setInfo($lng->txt("wiki_short_title_desc2"));
595  $this->form_gui->addItem($stit);
596 */
597 
598  // Description
599  $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
600  $this->form_gui->addItem($des);
601 
602  // Introduction
603  $intro = new ilTextAreaInputGUI($lng->txt("wiki_introduction"), "intro");
604  $intro->setCols(40);
605  $intro->setRows(4);
606  $this->form_gui->addItem($intro);
607 
608  // Start Page
609  $sp = new ilTextInputGUI($lng->txt("wiki_start_page"), "startpage");
610  if ($a_mode == "edit")
611  {
612  $sp->setInfo($lng->txt("wiki_start_page_info"));
613  }
614  $sp->setMaxLength(200);
615  $sp->setRequired(true);
616  $this->form_gui->addItem($sp);
617 
618  // Online
619  $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
620  $this->form_gui->addItem($online);
621 
622 
623  // rating
624  $rating = new ilCheckboxInputGUI($lng->txt("wiki_activate_rating"), "rating");
625  $this->form_gui->addItem($rating);
626 
627  $side = new ilCheckboxInputGUI($lng->txt("wiki_activate_sideblock_rating"), "rating_side");
628  $rating->addSubItem($side);
629 
630  $new = new ilCheckboxInputGUI($lng->txt("wiki_activate_new_page_rating"), "rating_new");
631  $rating->addSubItem($new);
632 
633  $extended = new ilCheckboxInputGUI($lng->txt("wiki_activate_extended_rating"), "rating_ext");
634  $rating->addSubItem($extended);
635 
636 
637  // public comments
638  if (!$ilSetting->get("disable_comments"))
639  {
640  $comments = new ilCheckboxInputGUI($lng->txt("wiki_public_comments"), "public_notes");
641  $this->form_gui->addItem($comments);
642  }
643 
644  // important pages
645 // $imp_pages = new ilCheckboxInputGUI($lng->txt("wiki_important_pages"), "imp_pages");
646 // $this->form_gui->addItem($imp_pages);
647 
648  // page toc
649  $page_toc = new ilCheckboxInputGUI($lng->txt("wiki_page_toc"), "page_toc");
650  $page_toc->setInfo($lng->txt("wiki_page_toc_info"));
651  $this->form_gui->addItem($page_toc);
652 
653  // Form action and save button
654  $this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_wiki.png"));
655  if ($a_mode != "create")
656  {
657  $this->form_gui->setTitle($lng->txt("wiki_settings"));
658  $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
659  }
660  else
661  {
662  $this->form_gui->setTitle($lng->txt("wiki_new"));
663  $this->form_gui->addCommandButton("save", $lng->txt("wiki_add"));
664  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
665  }
666 
667  // set values
668  if ($a_mode == "create")
669  {
670  $ilCtrl->setParameter($this, "new_type", "wiki");
671  }
672 
673  $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
674  }
675 
676  function getSettingsFormValues($a_mode = "edit")
677  {
678  global $lng, $ilUser;
679 
680  // set values
681  if ($a_mode == "create")
682  {
683  $values["startpage"] = $lng->txt("wiki_main_page");
684  $values["rating_new"] = true;
685  $this->form_gui->setValuesByArray($values);
686  }
687  else
688  {
689  $values["online"] = $this->object->getOnline();
690  $values["title"] = $this->object->getTitle();
691  $values["startpage"] = $this->object->getStartPage();
692  $values["shorttitle"] = $this->object->getShortTitle();
693  $values["description"] = $this->object->getLongDescription();
694  $values["rating"] = $this->object->getRating();
695  $values["rating_side"] = $this->object->getRatingAsBlock();
696  $values["rating_new"] = $this->object->getRatingForNewPages();
697  $values["rating_ext"] = $this->object->getRatingCategories();
698  $values["public_notes"] = $this->object->getPublicNotes();
699  $values["intro"] = $this->object->getIntroduction();
700 // $values["imp_pages"] = $this->object->getImportantPages();
701  $values["page_toc"] = $this->object->getPageToc();
702 
703  $this->form_gui->setValuesByArray($values);
704  }
705  }
706 
707 
712  {
713  global $ilCtrl, $lng, $ilUser, $ilSetting;
714 
715  $this->checkPermission("write");
716 
717  $this->initSettingsForm();
718 
719  if ($this->form_gui->checkInput())
720  {
721  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")) &&
722  $this->form_gui->getInput("shorttitle") != $this->object->getShortTitle())
723  {
724  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
725  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
726  }
727  else
728  {
729  $this->object->setTitle($this->form_gui->getInput("title"));
730  $this->object->setDescription($this->form_gui->getInput("description"));
731  $this->object->setOnline($this->form_gui->getInput("online"));
732  $this->object->setStartPage($this->form_gui->getInput("startpage"));
733  $this->object->setShortTitle($this->form_gui->getInput("shorttitle"));
734  $this->object->setRating($this->form_gui->getInput("rating"));
735  $this->object->setRatingAsBlock($this->form_gui->getInput("rating_side"));
736  $this->object->setRatingForNewPages($this->form_gui->getInput("rating_new"));
737  $this->object->setRatingCategories($this->form_gui->getInput("rating_ext"));
738 
739  if (!$ilSetting->get("disable_comments"))
740  {
741  $this->object->setPublicNotes($this->form_gui->getInput("public_notes"));
742  }
743  $this->object->setIntroduction($this->form_gui->getInput("intro"));
744 // $this->object->setImportantPages($this->form_gui->getInput("imp_pages"));
745  $this->object->setPageToc($this->form_gui->getInput("page_toc"));
746  $this->object->update();
747 
748  // Update ecs export settings
749  include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
750  $ecs = new ilECSWikiSettings($this->object);
751  if($ecs->handleSettingsUpdate())
752  {
753  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
754  $ilCtrl->redirect($this, "editSettings");
755  }
756  }
757  }
758 
759  $this->form_gui->setValuesByPost();
760  $this->tpl->setContent($this->form_gui->getHTML());
761  }
762 
767  {
768  global $tpl, $ilTabs;
769 
770  $this->checkPermission("write");
771  $ilTabs->activateTab("wiki_contributors");
772 
773  include_once("./Modules/Wiki/classes/class.ilWikiContributorsTableGUI.php");
774 
775  $table_gui = new ilWikiContributorsTableGUI($this, "listContributors",
776  $this->object->getId());
777 
778  $tpl->setContent($table_gui->getHTML());
779 
780  $this->setSideBlock();
781  }
782 
786  function saveGradingObject()
787  {
788  global $ilCtrl, $lng;
789 
790  $this->checkPermission("write");
791 
792  $users = (is_array($_POST["sel_user_id"]))
793  ? $_POST["sel_user_id"]
794  : (is_array($_POST["user_id"])
795  ? $_POST["user_id"]
796  : array());
797 
798  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
799  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
800  $saved = false;
801  foreach($users as $user_id)
802  {
803  if ($user_id != "")
804  {
805  ilWikiContributor::_writeStatus($this->object->getId(), $user_id,
806  ilUtil::stripSlashes($_POST["status"][$user_id]));
807  $marks_obj = new ilLPMarks($this->object->getId(),$user_id);
808  $marks_obj->setMark(ilUtil::stripSlashes($_POST['mark'][$user_id]));
809  $marks_obj->setComment(ilUtil::stripSlashes($_POST['lcomment'][$user_id]));
810  $marks_obj->update();
811  $saved = true;
812  }
813  }
814  if ($saved)
815  {
816  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
817  }
818 
819  $ilCtrl->redirect($this, "listContributors");
820  }
821 
822  // add wiki to locator
823  function addLocatorItems()
824  {
825  global $ilLocator;
826 
827  if (is_object($this->object))
828  {
829  $ilLocator->addItem($this->object->getTitle(),
830  $this->getGotoLink($this->object->getRefId()), "", $_GET["ref_id"]);
831  }
832  }
833 
834  function _goto($a_target)
835  {
836  global $ilAccess, $ilErr, $lng, $ilNavigationHistory;
837 
838  $i = strpos($a_target, "_");
839  if ($i > 0)
840  {
841  $a_page = substr($a_target, $i+1);
842  $a_target = substr($a_target, 0, $i);
843  }
844 
845  if ($ilAccess->checkAccess("read", "", $a_target))
846  {
847  $_GET["cmd"] = "viewPage";
848  $_GET["ref_id"] = $a_target;
849  $_GET["page"] = $a_page;
850  $_GET["baseClass"] = "ilwikihandlergui";
851  $_GET["cmdClass"] = "ilobjwikigui";
852 /* if ($a_page != "")
853  {
854  $add = "&amp;page=".rawurlencode($_GET["page"]);
855  $ilNavigationHistory->addItem($_GET["ref_id"],
856  "./goto.php?target=wiki_".$_GET["ref_id"].$add, "wiki");
857  }*/
858  include("ilias.php");
859  exit;
860  }
861  else if ($ilAccess->checkAccess("visible", "", $a_target))
862  {
863  ilObjectGUI::_gotoRepositoryNode($tarr[0], "infoScreen");
864  }
865  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
866  {
867  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
870  }
871 
872  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
873  }
874 
878  static function getGotoLink($a_ref_id, $a_page = "")
879  {
880  if ($a_page == "")
881  {
883  }
884 
885  $goto = "goto.php?target=wiki_".$a_ref_id."_".
886  ilWikiUtil::makeUrlTitle($a_page);
887 
888  return $goto;
889  }
890 
894  function viewPageObject()
895  {
896  global $lng, $ilCtrl, $tpl, $ilTabs, $ilAccess;
897 
898  $this->checkPermission("read");
899 
900  $ilTabs->clearTargets();
901  $tpl->setHeaderActionMenu(null);
902 
903  $page = ($_GET["page"] != "")
904  ? $_GET["page"]
905  : $this->object->getStartPage();
906  $_GET["page"] = $page;
907 
908  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
909  if (!ilWikiPage::exists($this->object->getId(), $page))
910  {
911  $page = $this->object->getStartPage();
912  }
913 
914  if (!ilWikiPage::exists($this->object->getId(), $page))
915  {
916  ilUtil::sendInfo($lng->txt("wiki_no_start_page"), true);
917  $ilCtrl->redirect($this, "infoScreen");
918  return;
919  }
920 
921  // page exists, show it !
922  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($page));
923 
924  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
925  $wpage_gui = ilWikiPageGUI::getGUIForTitle($this->object->getId(),
926  ilWikiUtil::makeDbTitle($page), 0, $this->object->getRefId());
927  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
928  $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
929  $this->object->getStyleSheetId(), "wiki"));
930 
931  $this->setContentStyleSheet();
932  //$wpage_gui->setOutputMode(IL_PAGE_PREVIEW);
933 
934  //$wpage_gui->setSideBlock();
935  $ilCtrl->setCmdClass("ilwikipagegui");
936  $ilCtrl->setCmd("preview");
937  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
938  (!$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
939  $wpage_gui->getPageObject()->getBlocked()
940  ))
941  {
942  $wpage_gui->setEnableEditing(false);
943  }
944 
945  // alter title and description
946  //$tpl->setTitle($wpage_gui->getPageObject()->getTitle());
947  //$tpl->setDescription($this->object->getTitle());
948 
949 
950  $html = $ilCtrl->forwardCommand($wpage_gui);
951  //$this->addPageTabs();
952 
953  $tpl->setContent($html);
954  }
955 
959  function allPagesObject()
960  {
961  global $tpl;
962 
963  $this->checkPermission("read");
964 
965  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
966 
967  $this->addPagesSubTabs();
968 
969  $table_gui = new ilWikiPagesTableGUI($this, "allPages",
970  $this->object->getId(), IL_WIKI_ALL_PAGES);
971 
972  $this->setSideBlock();
973  $tpl->setContent($table_gui->getHTML());
974  }
975 
980  {
981  global $tpl;
982 
983  $this->checkPermission("read");
984 
985  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
986 
987  $this->addPagesSubTabs();
988 
989  $table_gui = new ilWikiPagesTableGUI($this, "popularPages",
990  $this->object->getId(), IL_WIKI_POPULAR_PAGES);
991 
992  $this->setSideBlock();
993  $tpl->setContent($table_gui->getHTML());
994  }
995 
1000  {
1001  global $tpl;
1002 
1003  $this->checkPermission("read");
1004 
1005  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1006 
1007  $this->addPagesSubTabs();
1008 
1009  $table_gui = new ilWikiPagesTableGUI($this, "orphanedPages",
1010  $this->object->getId(), IL_WIKI_ORPHANED_PAGES);
1011 
1012  $this->setSideBlock();
1013  $tpl->setContent($table_gui->getHTML());
1014  }
1015 
1021  function gotoPageObject($a_page = "")
1022  {
1023  global $ilCtrl;
1024 
1025  if ($a_page == "")
1026  {
1027  $a_page = $_GET["page"];
1028  }
1029 
1030  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1031  if (ilWikiPage::_wikiPageExists($this->object->getId(),
1032  ilWikiUtil::makeDbTitle($a_page)))
1033  {
1034  // to do: get rid of this redirect
1035  ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId(), $a_page));
1036  }
1037  else
1038  {
1039  // create the page
1040  $page = new ilWikiPage();
1041  $page->setWikiId($this->object->getId());
1042  $page->setTitle(ilWikiUtil::makeDbTitle($_GET["page"]));
1043 
1044  if($this->object->getRating() && $this->object->getRatingForNewPages())
1045  {
1046  $page->setRating(true);
1047  }
1048 
1049  // needed for notification
1050  $page->setWikiRefId($this->object->getRefId());
1051 
1052  $page->create();
1053 
1054  // redirect to newly created page
1055  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
1056  $ilCtrl->redirectByClass("ilwikipagegui", "edit");
1057  }
1058  }
1059 
1065  function randomPageObject()
1066  {
1067  $this->checkPermission("read");
1068 
1069  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1070  $page = ilWikiPage::getRandomPage($this->object->getId());
1071  $this->gotoPageObject($page);
1072  }
1073 
1078  {
1079  global $tpl;
1080 
1081  $this->checkPermission("read");
1082 
1083  include_once("./Modules/Wiki/classes/class.ilWikiRecentChangesTableGUI.php");
1084 
1085  $this->addPagesSubTabs();
1086 
1087  $table_gui = new ilWikiRecentChangesTableGUI($this, "recentChanges",
1088  $this->object->getId());
1089 
1090  $this->setSideBlock();
1091  $tpl->setContent($table_gui->getHTML());
1092  }
1093 
1097  function setSideBlock($a_wpg_id = 0)
1098  {
1099  ilObjWikiGUI::renderSideBlock($a_wpg_id, $this->object->getRefId());
1100  }
1101 
1102 
1106  static function renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp = null)
1107  {
1108  global $tpl, $lng;
1109 
1110  if ($a_wpg_id > 0 && !$a_wp)
1111  {
1112  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1113  $a_wp = ilWikiPage($a_wpg_id);
1114  }
1115 
1116  // search block
1117  include_once("./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php");
1118  $wiki_search_block = new ilWikiSearchBlockGUI();
1119  $rcontent = $wiki_search_block->getHTML();
1120 
1121  // quick navigation
1122  if ($a_wpg_id > 0)
1123  {
1124 // include_once("./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php");
1125 // $wiki_side_block = new ilWikiSideBlockGUI();
1126 // $wiki_side_block->setPageObject($a_wp);
1127 // $rcontent.= $wiki_side_block->getHTML();
1128 
1129  // rating
1130  $wiki_id =ilObject::_lookupObjId($a_wiki_ref_id);
1131  if(ilObjWiki::_lookupRating($wiki_id) &&
1132  ilObjWiki::_lookupRatingAsBlock($wiki_id) &&
1133  $a_wp->getRating())
1134  {
1135  include_once("./Services/Rating/classes/class.ilRatingGUI.php");
1136  $rgui = new ilRatingGUI();
1137  $rgui->setObject($wiki_id, "wiki", $a_wpg_id, "wpg");
1138  $rgui->enableCategories(ilObjWiki::_lookupRatingCategories($wiki_id));
1139  $rcontent .= $rgui->getBlockHTML($lng->txt("wiki_rate_page"));
1140  }
1141  }
1142 
1143  // important pages
1144 // if (ilObjWiki::_lookupImportantPages(ilObject::_lookupObjId($a_wiki_ref_id)))
1145 // {
1146  include_once("./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
1147  $imp_pages_block = new ilWikiImportantPagesBlockGUI();
1148  $rcontent.= $imp_pages_block->getHTML();
1149 // }
1150 
1151  // wiki functions block
1152  if ($a_wpg_id > 0)
1153  {
1154  include_once("./Modules/Wiki/classes/class.ilWikiFunctionsBlockGUI.php");
1155  $wiki_functions_block = new ilWikiFunctionsBlockGUI();
1156  $wiki_functions_block->setPageObject($a_wp);
1157  $rcontent .= $wiki_functions_block->getHTML();
1158  }
1159 
1160  $tpl->setRightContent($rcontent);
1161  }
1162 
1166  function newPagesObject()
1167  {
1168  global $tpl;
1169 
1170  $this->checkPermission("read");
1171 
1172  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1173 
1174  $this->addPagesSubTabs();
1175 
1176  $table_gui = new ilWikiPagesTableGUI($this, "newPages",
1177  $this->object->getId(), IL_WIKI_NEW_PAGES);
1178 
1179  $this->setSideBlock();
1180  $tpl->setContent($table_gui->getHTML());
1181  }
1182 
1186  function printViewObject()
1187  {
1188  $this->checkPermission("read");
1189 
1190  switch ($_POST["sel_type"])
1191  {
1192  case "wiki":
1193  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1194  $pages = ilWikiPage::getAllPages($this->object->getId());
1195  foreach ($pages as $p)
1196  {
1197  $pg_ids[] = $p["id"];
1198  }
1199  break;
1200 
1201  case "selection":
1202  if (is_array($_POST["obj_id"]))
1203  {
1204  $pg_ids = $_POST["obj_id"];
1205  }
1206  else
1207  {
1208  $pg_ids[] = $_GET["wpg_id"];
1209  }
1210  break;
1211 
1212  default:
1213  $pg_ids[] = $_GET["wpg_id"];
1214  break;
1215  }
1216 
1217  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
1218 
1219  global $tpl;
1220 
1221  $tpl = new ilTemplate("tpl.main.html", true, true);
1222  $tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle());
1223  $this->setContentStyleSheet($tpl);
1224 
1225  // syntax style
1226  $tpl->setCurrentBlock("SyntaxStyle");
1227  $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1229  $tpl->parseCurrentBlock();
1230 
1231 
1232  // determine target frames for internal links
1233 
1234  foreach ($pg_ids as $p_id)
1235  {
1236  $page_gui = new ilWikiPageGUI($p_id);
1237  $page_gui->setOutputMode("print");
1238  $page_content.= $page_gui->showPage();
1239  }
1240  $tpl->setVariable("CONTENT", '<div class="ilInvisibleBorder">'.$page_content.'</div>'.
1241  '<script type="text/javascript" language="javascript1.2">
1242  <!--
1243  il.Util.addOnLoad(function () {
1244  il.Util.print();
1245  });
1246  //-->
1247  </script>');
1248  $tpl->show(false);
1249  exit;
1250  }
1251 
1256  {
1257  global $tpl, $ilTabs, $ilCtrl, $lng;
1258 
1259  $this->checkPermission("read");
1260 
1261  include_once("./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php");
1262 
1263  $ilTabs->setTabActive("wiki_search_results");
1264 
1265  if (trim($_POST["search_term"]) == "")
1266  {
1267  ilUtil::sendFailure($lng->txt("wiki_please_enter_search_term"), true);
1268  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1269  }
1270 
1271  $search_results = ilObjWiki::_performSearch($this->object->getId(),
1272  ilUtil::stripSlashes($_POST["search_term"]));
1273  $table_gui = new ilWikiSearchResultsTableGUI($this, "performSearch",
1274  $this->object->getId(), $search_results);
1275 
1276  $this->setSideBlock();
1277  $tpl->setContent($table_gui->getHTML());
1278  }
1279 
1283  function setContentStyleSheet($a_tpl = null)
1284  {
1285  global $tpl;
1286 
1287  if ($a_tpl != null)
1288  {
1289  $ctpl = $a_tpl;
1290  }
1291  else
1292  {
1293  $ctpl = $tpl;
1294  }
1295 
1296  $ctpl->setCurrentBlock("ContentStyle");
1297  $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
1298  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
1299  $ctpl->parseCurrentBlock();
1300 
1301  }
1302 
1303 
1308  {
1309  global $ilTabs, $tpl;
1310 
1311  $this->checkPermission("write");
1312 
1313  $this->initStylePropertiesForm();
1314  $tpl->setContent($this->form->getHTML());
1315 
1316  $ilTabs->activateTab("settings");
1317  $this->setSettingsSubTabs("style");
1318 
1319  $this->setSideBlock();
1320  }
1321 
1326  {
1327  global $ilCtrl, $lng, $ilTabs, $ilSetting;
1328 
1329  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1330  $lng->loadLanguageModule("style");
1331 
1332  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1333  $this->form = new ilPropertyFormGUI();
1334 
1335  $fixed_style = $ilSetting->get("fixed_content_style_id");
1336  $style_id = $this->object->getStyleSheetId();
1337 
1338  if ($fixed_style > 0)
1339  {
1340  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1341  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
1342  $this->lng->txt("global_fixed").")");
1343  $this->form->addItem($st);
1344  }
1345  else
1346  {
1347  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
1348  $_GET["ref_id"]);
1349 
1350  $st_styles[0] = $this->lng->txt("default");
1351  ksort($st_styles);
1352 
1353  if ($style_id > 0)
1354  {
1355  // individual style
1356  if (!ilObjStyleSheet::_lookupStandard($style_id))
1357  {
1358  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1359  $st->setValue(ilObject::_lookupTitle($style_id));
1360  $this->form->addItem($st);
1361 
1362 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1363 
1364  // delete command
1365  $this->form->addCommandButton("editStyle",
1366  $lng->txt("style_edit_style"));
1367  $this->form->addCommandButton("deleteStyle",
1368  $lng->txt("style_delete_style"));
1369 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1370  }
1371  }
1372 
1373  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1374  {
1375  $style_sel = ilUtil::formSelect ($style_id, "style_id",
1376  $st_styles, false, true);
1377  $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
1378  $style_sel->setOptions($st_styles);
1379  $style_sel->setValue($style_id);
1380  $this->form->addItem($style_sel);
1381 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1382  $this->form->addCommandButton("saveStyleSettings",
1383  $lng->txt("save"));
1384  $this->form->addCommandButton("createStyle",
1385  $lng->txt("sty_create_ind_style"));
1386  }
1387  }
1388  $this->form->setTitle($lng->txt("wiki_style"));
1389  $this->form->setFormAction($ilCtrl->getFormAction($this));
1390  }
1391 
1396  {
1397  global $ilCtrl;
1398 
1399  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1400  }
1401 
1405  function editStyleObject()
1406  {
1407  global $ilCtrl;
1408 
1409  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1410  }
1411 
1416  {
1417  global $ilCtrl;
1418 
1419  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1420  }
1421 
1426  {
1427  global $ilSetting;
1428 
1429  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1430  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1431  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1432  || $this->object->getStyleSheetId() == 0))
1433  {
1434  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1435  $this->object->update();
1436  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1437  }
1438  $this->ctrl->redirect($this, "editStyleProperties");
1439  }
1440 
1441  //
1442  // Important pages
1443  //
1444 
1449  {
1450  global $tpl, $ilToolbar, $ilTabs, $lng, $ilCtrl;
1451 
1452  $this->checkPermission("write");
1453 
1454  ilUtil::sendInfo($lng->txt("wiki_navigation_info"));
1455 
1456  $ipages = ilObjWiki::_lookupImportantPagesList($this->object->getId());
1457  $ipages_ids = array();
1458  foreach ($ipages as $i)
1459  {
1460  $ipages_ids[] = $i["page_id"];
1461  }
1462 
1463  // list pages
1464  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1465  $pages = ilWikiPage::getAllPages($this->object->getId());
1466  $options = array("" => $lng->txt("please_select"));
1467  foreach ($pages as $p)
1468  {
1469  if (!in_array($p["id"], $ipages_ids))
1470  {
1471  $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
1472  }
1473  }
1474  if (count($options) > 0)
1475  {
1476  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1477  $si = new ilSelectInputGUI($lng->txt("wiki_pages"), "imp_page_id");
1478  $si->setOptions($options);
1479  $si->setInfo($lng->txt(""));
1480  $ilToolbar->addInputItem($si);
1481  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1482  $ilToolbar->addFormButton($lng->txt("add"), "addImportantPage");
1483  }
1484 
1485 
1486  $ilTabs->activateTab("settings");
1487  $this->setSettingsSubTabs("imp_pages");
1488 
1489  include_once("./Modules/Wiki/classes/class.ilImportantPagesTableGUI.php");
1490  $imp_table = new ilImportantPagesTableGUI($this, "editImportantPages");
1491 
1492  $tpl->setContent($imp_table->getHTML());
1493  }
1494 
1502  {
1503  global $ilCtrl, $lng;
1504 
1505  $this->checkPermission("write");
1506 
1507  if ($_POST["imp_page_id"] > 0)
1508  {
1509  $this->object->addImportantPage((int) $_POST["imp_page_id"]);
1510  ilUtil::sendSuccess($lng->txt("wiki_imp_page_added"), true);
1511  }
1512  $ilCtrl->redirect($this, "editImportantPages");
1513  }
1514 
1519  {
1520  global $ilCtrl, $tpl, $lng;
1521 
1522  if (!is_array($_POST["imp_page_id"]) || count($_POST["imp_page_id"]) == 0)
1523  {
1524  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1525  $ilCtrl->redirect($this, "editImportantPages");
1526  }
1527  else
1528  {
1529  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1530  $cgui = new ilConfirmationGUI();
1531  $cgui->setFormAction($ilCtrl->getFormAction($this));
1532  $cgui->setHeaderText($lng->txt("wiki_sure_remove_imp_pages"));
1533  $cgui->setCancel($lng->txt("cancel"), "editImportantPages");
1534  $cgui->setConfirm($lng->txt("remove"), "removeImportantPages");
1535 
1536  foreach ($_POST["imp_page_id"] as $i)
1537  {
1538  $cgui->addItem("imp_page_id[]", $i, ilWikiPage::lookupTitle((int) $i));
1539  }
1540 
1541  $tpl->setContent($cgui->getHTML());
1542  }
1543  }
1544 
1552  {
1553  global $ilCtrl, $lng;
1554 
1555  $this->checkPermission("write");
1556 
1557  if (is_array($_POST["imp_page_id"]))
1558  {
1559  foreach ($_POST["imp_page_id"] as $i)
1560  {
1561  $this->object->removeImportantPage((int) $i);
1562  }
1563  }
1564  ilUtil::sendSuccess($lng->txt("wiki_removed_imp_pages"), true);
1565  $ilCtrl->redirect($this, "editImportantPages");
1566  }
1567 
1575  {
1576  global $ilCtrl, $lng;
1577 
1578  $this->checkPermission("write");
1579 
1580  $this->object->saveOrderingAndIndentation($_POST["ord"], $_POST["indent"]);
1581  ilUtil::sendSuccess($lng->txt("wiki_ordering_and_indent_saved"), true);
1582  $ilCtrl->redirect($this, "editImportantPages");
1583  }
1584 
1588  function exportHTML()
1589  {
1590  require_once("./Modules/Wiki/classes/class.ilWikiHTMLExport.php");
1591  $cont_exp = new ilWikiHTMLExport($this);
1592  $cont_exp->buildExportFile();
1593  }
1594 
1602  static function lookupSubObjectTitle($a_wiki_id, $a_page_id)
1603  {
1604  include_once "Modules/Wiki/classes/class.ilWikiPage.php";
1605  $page = new ilWikiPage($a_page_id);
1606  if($page->getWikiId() == $a_wiki_id)
1607  {
1608  return $page->getTitle();
1609  }
1610  }
1611 
1619  function getSubObjectTitle($a_id, $a_type)
1620  {
1621  include_once "Modules/Wiki/classes/class.ilWikiPage.php";
1622  return ilWikiPage::lookupTitle($a_id);
1623  }
1624 }
1625 
1626 ?>