ILIAS  release_4-4 Revision
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  // for rating category editing
148  $this->checkPermission("write");
149  $this->addHeaderAction();
150  $ilTabs->activateTab("settings");
151  $this->setSettingsSubTabs("rating_categories");
152  include_once("Services/Rating/classes/class.ilRatingGUI.php");
153  $gui = new ilRatingGUI();
154  $gui->setObject($this->object->getId(), $this->object->getType());
155  $gui->setExportCallback(array($this, "getSubObjectTitle"), $this->lng->txt("page"));
156  $this->ctrl->forwardCommand($gui);
157  break;
158 
159  default:
160  $this->addHeaderAction();
161  if(!$cmd)
162  {
163  $cmd = "infoScreen";
164  }
165  $cmd .= "Object";
166  if ($cmd != "infoScreenObject")
167  {
168  $this->checkPermission("read");
169  }
170  else
171  {
172  $this->checkPermission("visible");
173  }
174  $this->$cmd();
175  break;
176  }
177 
178  return $ret;
179  }
180 
186  function isOnlineHelpWiki()
187  {
188  if (is_object($this->object))
189  {
190  return ilObjWiki::isOnlineHelpWiki($this->object->getRefId());
191  }
192  return false;
193  }
194 
198  function viewObject()
199  {
200  $this->checkPermission("read");
201  $this->gotoStartPageObject();
202  }
203 
204  protected function initCreationForms($a_new_type)
205  {
206  $this->initSettingsForm("create");
207  $this->getSettingsFormValues("create");
208 
209  $forms = array(self::CFORM_NEW => $this->form_gui,
210  self::CFORM_IMPORT => $this->initImportForm($a_new_type));
211 
212  return $forms;
213  }
214 
219  function saveObject()
220  {
221  global $tpl, $lng, $rbacsystem;
222 
223  if (!$this->checkPermissionBool("create", "", "wiki", $_GET["ref_id"]))
224  {
225  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
226  }
227 
228  $this->initSettingsForm("create");
229  if ($this->form_gui->checkInput())
230  {
231  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")))
232  {
233  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
234  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
235  }
236  else
237  {
238  // create and insert forum in objecttree
239  $_POST["title"] = $this->form_gui->getInput("title");
240  $_POST["desc"] = $this->form_gui->getInput("description");
241  return parent::saveObject();
242  }
243  }
244 
245  $this->form_gui->setValuesByPost();
246  $tpl->setContent($this->form_gui->getHtml());
247  }
248 
253  function afterSave($newObj)
254  {
255  global $ilSetting;
256 
257  $newObj->setTitle($this->form_gui->getInput("title"));
258  $newObj->setDescription($this->form_gui->getInput("description"));
259  $newObj->setIntroduction($this->form_gui->getInput("intro"));
260  $newObj->setStartPage($this->form_gui->getInput("startpage"));
261  $newObj->setShortTitle($this->form_gui->getInput("shorttitle"));
262  $newObj->setRating($this->form_gui->getInput("rating"));
263  // $newObj->setRatingAsBlock($this->form_gui->getInput("rating_side"));
264  $newObj->setRatingForNewPages($this->form_gui->getInput("rating_new"));
265  $newObj->setRatingCategories($this->form_gui->getInput("rating_ext"));
266 
267  $newObj->setRatingOverall($this->form_gui->getInput("rating_overall"));
268  $newObj->setPageToc($this->form_gui->getInput("page_toc"));
269 
270 
271 
272  if (!$ilSetting->get("disable_comments"))
273  {
274  $newObj->setPublicNotes($this->form_gui->getInput("public_notes"));
275  }
276  $newObj->setOnline($this->form_gui->getInput("online"));
277  $newObj->update();
278 
279  // always send a message
280  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
281  ilUtil::redirect(ilObjWikiGUI::getGotoLink($newObj->getRefId()));
282  }
283 
289  function infoScreenObject()
290  {
291  $this->checkPermission("visible");
292  $this->ctrl->setCmd("showSummary");
293  $this->ctrl->setCmdClass("ilinfoscreengui");
294  $this->infoScreen();
295  }
296 
300  function infoScreen()
301  {
302  global $ilAccess, $ilUser, $ilTabs, $lng;
303 
304  $ilTabs->activateTab("info_short");
305 
306  if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId()))
307  {
308  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
309  }
310 
311  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
312  $info = new ilInfoScreenGUI($this);
313  $info->enablePrivateNotes();
314  if (trim($this->object->getIntroduction()) != "")
315  {
316  $info->addSection($lng->txt("wiki_introduction"));
317  $info->addProperty("", nl2br($this->object->getIntroduction()));
318  }
319 
320  // feedback from tutor; mark, status, comment
321  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
322  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
323  $lpcomment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId());
324  $mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId());
325  $status = ilWikiContributor::_lookupStatus($this->object->getId(), $ilUser->getId());
326  if ($lpcomment != "" || $mark != "" || $status != ilWikiContributor::STATUS_NOT_GRADED)
327  {
328  $info->addSection($this->lng->txt("wiki_feedback_from_tutor"));
329  if ($lpcomment != "")
330  {
331  $info->addProperty($this->lng->txt("wiki_comment"),
332  $lpcomment);
333  }
334  if ($mark != "")
335  {
336  $info->addProperty($this->lng->txt("wiki_mark"),
337  $mark);
338  }
339 
340  if ($status == ilWikiContributor::STATUS_PASSED)
341  {
342  $info->addProperty($this->lng->txt("status"),
343  $this->lng->txt("wiki_passed"));
344  }
345  if ($status == ilWikiContributor::STATUS_FAILED)
346  {
347  $info->addProperty($this->lng->txt("status"),
348  $this->lng->txt("wiki_failed"));
349  }
350  }
351 
352  /*
353  $info->enableNews();
354  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
355  {
356  //$info->enableNewsEditing();
357  $info->setBlockProperty("news", "settings", true);
358  }*/
359 
360  if ($ilAccess->checkAccess("read", "", $this->object->getRefId()))
361  {
362  $info->addButton($lng->txt("wiki_start_page"), ilObjWikiGUI::getGotoLink($this->object->getRefId()));
363  }
364 
365  // general information
366  $this->lng->loadLanguageModule("meta");
367  $this->lng->loadLanguageModule("wiki");
368 
369  //$info->addSection($this->lng->txt("meta_general"));
370  //$info->addProperty($this->lng->txt("mcst_nr_items"),
371  // (int) count($med_items));
372 
373  // forward the command
374  $this->ctrl->forwardCommand($info);
375 
376  if ($ilAccess->checkAccess("read", "", $this->object->getRefId()))
377  {
378 // $this->setSideBlock();
379  }
380  }
381 
386  {
387  global $ilCtrl;
388 
389  ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId()));
390  }
391 
395  function addPageTabs()
396  {
397  global $ilTabs, $ilCtrl;
398 
399  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
400  $ilCtrl->setParameter($this, "wpg_id",
401  ilWikiPage::getPageIdForTitle($this->object->getId(), ilWikiUtil::makeDbTitle($_GET["page"])));
402  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
403  $ilTabs->addTarget("wiki_what_links_here",
404  $this->ctrl->getLinkTargetByClass("ilwikipagegui",
405  "whatLinksHere"), "whatLinksHere");
406  //$ilTabs->addTarget("wiki_print_view",
407  // $this->ctrl->getLinkTarget($this,
408  // "printViewSelection"), "printViewSelection");
409  $ilTabs->addTarget("wiki_print_view",
410  $this->ctrl->getLinkTargetByClass("ilwikipagegui",
411  "printViewSelection"), "printViewSelection");
412  }
413 
417  function addPagesSubTabs()
418  {
419  global $ilTabs, $ilCtrl;
420 
421  $ilTabs->activateTab("wiki_pages");
422 
423  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
424  $ilCtrl->setParameter($this, "wpg_id",
425  ilWikiPage::getPageIdForTitle($this->object->getId(),
426  ilWikiUtil::makeDbTitle($_GET["page"])));
427  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
428  $ilTabs->addSubTabTarget("wiki_all_pages",
429  $this->ctrl->getLinkTarget($this, "allPages"), "allPages");
430  $ilTabs->addSubTabTarget("wiki_recent_changes",
431  $this->ctrl->getLinkTarget($this, "recentChanges"), "recentChanges");
432  $ilTabs->addSubTabTarget("wiki_new_pages",
433  $this->ctrl->getLinkTarget($this, "newPages"), "newPages");
434  $ilTabs->addSubTabTarget("wiki_popular_pages",
435  $this->ctrl->getLinkTarget($this, "popularPages"), "popularPages");
436  $ilTabs->addSubTabTarget("wiki_orphaned_pages",
437  $this->ctrl->getLinkTarget($this, "orphanedPages"), "orphanedPages");
438  }
439 
445  function getTabs($tabs_gui)
446  {
447  global $ilCtrl, $ilAccess, $ilTabs, $lng, $ilHelp;
448 
449  $ilHelp->setScreenIdComponent("wiki");
450 
451  // wiki tabs
452  if (in_array($ilCtrl->getCmdClass(), array("", "ilobjwikigui",
453  "ilinfoscreengui", "ilpermissiongui", "ilexportgui", "ilratingcategorygui")))
454  {
455  if ($_GET["page"] != "")
456  {
457  $tabs_gui->setBackTarget($lng->txt("wiki_last_visited_page"),
458  $this->getGotoLink($_GET["ref_id"],
459  ilWikiUtil::makeDbTitle($_GET["page"])));
460  }
461 
462  // pages
463  if ($ilAccess->checkAccess('read', "", $this->object->getRefId()))
464  {
465  $ilTabs->addTab("wiki_pages",
466  $lng->txt("wiki_pages"),
467  $this->ctrl->getLinkTarget($this, "allPages"));
468  }
469 
470  // info screen
471  if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()))
472  {
473  $ilTabs->addTab("info_short",
474  $lng->txt("info_short"),
475  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
476  }
477 
478  // settings
479  if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
480  {
481  $ilTabs->addTab("settings",
482  $lng->txt("settings"),
483  $this->ctrl->getLinkTarget($this, "editSettings"));
484  }
485 
486  // contributors
487  if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
488  {
489  $ilTabs->addTab("wiki_contributors",
490  $lng->txt("wiki_contributors"),
491  $this->ctrl->getLinkTarget($this, "listContributors"));
492  }
493 
494  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
495  {
496  $ilTabs->addTab("export",
497  $lng->txt("export"),
498  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
499  }
500 
501 
502  // edit permissions
503  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
504  {
505  $ilTabs->addTab("perm_settings",
506  $lng->txt("perm_settings"),
507  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
508  }
509  }
510  }
511 
515  function setSettingsSubTabs($a_active)
516  {
517  global $ilTabs, $ilCtrl, $lng;
518 
519  if (in_array($a_active,
520  array("general_settings", "style", "imp_pages", "rating_categories")))
521  {
522  // general properties
523  $ilTabs->addSubTab("general_settings",
524  $lng->txt("wiki_general_settings"),
525  $ilCtrl->getLinkTarget($this, 'editSettings'));
526 
527  // style properties
528  $ilTabs->addSubTab("style",
529  $lng->txt("wiki_style"),
530  $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
531 
532  // important pages
533  $ilTabs->addSubTab("imp_pages",
534  $lng->txt("wiki_navigation"),
535  $ilCtrl->getLinkTarget($this, 'editImportantPages'));
536 
537  // rating categories
538  if($this->object->getRating() && $this->object->getRatingCategories())
539  {
540  $lng->loadLanguageModule("rating");
541  $ilTabs->addSubTab("rating_categories",
542  $lng->txt("rating_categories"),
543  $ilCtrl->getLinkTargetByClass(array('ilratinggui', 'ilratingcategorygui'), ''));
544  }
545 
546  $ilTabs->activateSubTab($a_active);
547  }
548  }
549 
554  {
555  global $tpl;
556 
557  $this->checkPermission("write");
558 
559  $this->setSettingsSubTabs("general_settings");
560 
561  $this->initSettingsForm();
562  $this->getSettingsFormValues();
563 
564  // Edit ecs export settings
565  include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
566  $ecs = new ilECSWikiSettings($this->object);
567  $ecs->addSettingsToForm($this->form_gui, 'wiki');
568 
569  $tpl->setContent($this->form_gui->getHtml());
570  $this->setSideBlock();
571  }
572 
576  function initSettingsForm($a_mode = "edit")
577  {
578  global $lng, $ilCtrl, $ilTabs, $ilSetting;
579 
580  $lng->loadLanguageModule("wiki");
581  $ilTabs->activateTab("settings");
582 
583  include("Services/Form/classes/class.ilPropertyFormGUI.php");
584  $this->form_gui = new ilPropertyFormGUI();
585 
586  // Title
587  $tit = new ilTextInputGUI($lng->txt("title"), "title");
588  $tit->setRequired(true);
589  $this->form_gui->addItem($tit);
590 
591  // Short Title
592  // The problem with the short title is, that it is per object
593  // and can't be a substitute for a ref id in the permanent link
594 /*
595  $stit = new ilRegExpInputGUI($lng->txt("wiki_short_title"), "shorttitle");
596  $stit->setPattern("/^[^0-9][^ _\&]+$/");
597  $stit->setRequired(false);
598  $stit->setNoMatchMessage($lng->txt("wiki_msg_short_name_regexp")." &amp; _");
599  $stit->setSize(20);
600  $stit->setMaxLength(20);
601  $stit->setInfo($lng->txt("wiki_short_title_desc2"));
602  $this->form_gui->addItem($stit);
603 */
604 
605  // Description
606  $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
607  $this->form_gui->addItem($des);
608 
609  // Introduction
610  $intro = new ilTextAreaInputGUI($lng->txt("wiki_introduction"), "intro");
611  $intro->setCols(40);
612  $intro->setRows(4);
613  $this->form_gui->addItem($intro);
614 
615  // Start Page
616  $sp = new ilTextInputGUI($lng->txt("wiki_start_page"), "startpage");
617  if ($a_mode == "edit")
618  {
619  $sp->setInfo($lng->txt("wiki_start_page_info"));
620  }
621  $sp->setMaxLength(200);
622  $sp->setRequired(true);
623  $this->form_gui->addItem($sp);
624 
625  // Online
626  $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
627  $this->form_gui->addItem($online);
628 
629 
630  // rating
631 
632  $lng->loadLanguageModule('rating');
633  $rate = new ilCheckboxInputGUI($lng->txt('rating_activate_rating'), 'rating_overall');
634  $rate->setInfo($lng->txt('rating_activate_rating_info'));
635  $this->form_gui->addItem($rate);
636 
637  $rating = new ilCheckboxInputGUI($lng->txt("wiki_activate_rating"), "rating");
638  $this->form_gui->addItem($rating);
639 
640  /* always active
641  $side = new ilCheckboxInputGUI($lng->txt("wiki_activate_sideblock_rating"), "rating_side");
642  $rating->addSubItem($side);
643  */
644 
645  $new = new ilCheckboxInputGUI($lng->txt("wiki_activate_new_page_rating"), "rating_new");
646  $rating->addSubItem($new);
647 
648  $extended = new ilCheckboxInputGUI($lng->txt("wiki_activate_extended_rating"), "rating_ext");
649  $rating->addSubItem($extended);
650 
651 
652  // public comments
653  if (!$ilSetting->get("disable_comments"))
654  {
655  $comments = new ilCheckboxInputGUI($lng->txt("wiki_public_comments"), "public_notes");
656  $this->form_gui->addItem($comments);
657  }
658 
659  // important pages
660 // $imp_pages = new ilCheckboxInputGUI($lng->txt("wiki_important_pages"), "imp_pages");
661 // $this->form_gui->addItem($imp_pages);
662 
663  // page toc
664  $page_toc = new ilCheckboxInputGUI($lng->txt("wiki_page_toc"), "page_toc");
665  $page_toc->setInfo($lng->txt("wiki_page_toc_info"));
666  $this->form_gui->addItem($page_toc);
667 
668  // Form action and save button
669  $this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_wiki.png"));
670  if ($a_mode != "create")
671  {
672  $this->form_gui->setTitle($lng->txt("wiki_settings"));
673  $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
674  }
675  else
676  {
677  $this->form_gui->setTitle($lng->txt("wiki_new"));
678  $this->form_gui->addCommandButton("save", $lng->txt("wiki_add"));
679  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
680  }
681 
682  // set values
683  if ($a_mode == "create")
684  {
685  $ilCtrl->setParameter($this, "new_type", "wiki");
686  }
687 
688  $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
689  }
690 
691  function getSettingsFormValues($a_mode = "edit")
692  {
693  global $lng, $ilUser;
694 
695  // set values
696  if ($a_mode == "create")
697  {
698  $values["startpage"] = $lng->txt("wiki_main_page");
699  $values["rating_new"] = true;
700 
701  $values["rating_overall"] = ilObject::hasAutoRating("wiki", $_GET["ref_id"]);
702 
703  $this->form_gui->setValuesByArray($values);
704  }
705  else
706  {
707  $values["online"] = $this->object->getOnline();
708  $values["title"] = $this->object->getTitle();
709  $values["startpage"] = $this->object->getStartPage();
710  $values["shorttitle"] = $this->object->getShortTitle();
711  $values["description"] = $this->object->getLongDescription();
712  $values["rating_overall"] = $this->object->getRatingOverall();
713  $values["rating"] = $this->object->getRating();
714  // $values["rating_side"] = $this->object->getRatingAsBlock();
715  $values["rating_new"] = $this->object->getRatingForNewPages();
716  $values["rating_ext"] = $this->object->getRatingCategories();
717  $values["public_notes"] = $this->object->getPublicNotes();
718  $values["intro"] = $this->object->getIntroduction();
719 // $values["imp_pages"] = $this->object->getImportantPages();
720  $values["page_toc"] = $this->object->getPageToc();
721 
722  $this->form_gui->setValuesByArray($values);
723  }
724  }
725 
726 
731  {
732  global $ilCtrl, $lng, $ilUser, $ilSetting;
733 
734  $this->checkPermission("write");
735 
736  $this->initSettingsForm();
737 
738  if ($this->form_gui->checkInput())
739  {
740  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")) &&
741  $this->form_gui->getInput("shorttitle") != $this->object->getShortTitle())
742  {
743  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
744  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
745  }
746  else
747  {
748  $this->object->setTitle($this->form_gui->getInput("title"));
749  $this->object->setDescription($this->form_gui->getInput("description"));
750  $this->object->setOnline($this->form_gui->getInput("online"));
751  $this->object->setStartPage($this->form_gui->getInput("startpage"));
752  $this->object->setShortTitle($this->form_gui->getInput("shorttitle"));
753  $this->object->setRatingOverall($this->form_gui->getInput("rating_overall"));
754  $this->object->setRating($this->form_gui->getInput("rating"));
755  // $this->object->setRatingAsBlock($this->form_gui->getInput("rating_side"));
756  $this->object->setRatingForNewPages($this->form_gui->getInput("rating_new"));
757  $this->object->setRatingCategories($this->form_gui->getInput("rating_ext"));
758 
759  if (!$ilSetting->get("disable_comments"))
760  {
761  $this->object->setPublicNotes($this->form_gui->getInput("public_notes"));
762  }
763  $this->object->setIntroduction($this->form_gui->getInput("intro"));
764 // $this->object->setImportantPages($this->form_gui->getInput("imp_pages"));
765  $this->object->setPageToc($this->form_gui->getInput("page_toc"));
766  $this->object->update();
767 
768  // Update ecs export settings
769  include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
770  $ecs = new ilECSWikiSettings($this->object);
771  if($ecs->handleSettingsUpdate())
772  {
773  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
774  $ilCtrl->redirect($this, "editSettings");
775  }
776  }
777  }
778 
779  $this->form_gui->setValuesByPost();
780  $this->tpl->setContent($this->form_gui->getHTML());
781  }
782 
787  {
788  global $tpl, $ilTabs;
789 
790  $this->checkPermission("write");
791  $ilTabs->activateTab("wiki_contributors");
792 
793  include_once("./Modules/Wiki/classes/class.ilWikiContributorsTableGUI.php");
794 
795  $table_gui = new ilWikiContributorsTableGUI($this, "listContributors",
796  $this->object->getId());
797 
798  $tpl->setContent($table_gui->getHTML());
799 
800  $this->setSideBlock();
801  }
802 
806  function saveGradingObject()
807  {
808  global $ilCtrl, $lng;
809 
810  $this->checkPermission("write");
811 
812  $users = (is_array($_POST["user_id"])
813  ? $_POST["user_id"]
814  : array());
815 
816  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
817  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
818  $saved = false;
819  foreach($users as $user_id)
820  {
821  if ($user_id != "")
822  {
823  $marks_obj = new ilLPMarks($this->object->getId(),$user_id);
824  $new_mark = ilUtil::stripSlashes($_POST['mark'][$user_id]);
825  $new_comment = ilUtil::stripSlashes($_POST['lcomment'][$user_id]);
826  $new_status = ilUtil::stripSlashes($_POST["status"][$user_id]);
827 
828  if ($marks_obj->getMark() != $new_mark ||
829  $marks_obj->getComment() != $new_comment ||
830  ilWikiContributor::_lookupStatus($this->object->getId(), $user_id) != $new_status)
831  {
832  ilWikiContributor::_writeStatus($this->object->getId(), $user_id, $new_status);
833  $marks_obj->setMark($new_mark);
834  $marks_obj->setComment($new_comment);
835  $marks_obj->update();
836  $saved = true;
837  }
838  }
839  }
840  if ($saved)
841  {
842  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
843  }
844 
845  $ilCtrl->redirect($this, "listContributors");
846  }
847 
848  // add wiki to locator
849  function addLocatorItems()
850  {
851  global $ilLocator;
852 
853  if (is_object($this->object))
854  {
855  $ilLocator->addItem($this->object->getTitle(),
856  $this->getGotoLink($this->object->getRefId()), "", $_GET["ref_id"]);
857  }
858  }
859 
860  function _goto($a_target)
861  {
862  global $ilAccess, $ilErr, $lng, $ilNavigationHistory;
863 
864  $i = strpos($a_target, "_");
865  if ($i > 0)
866  {
867  $a_page = substr($a_target, $i+1);
868  $a_target = substr($a_target, 0, $i);
869  }
870 
871  if ($a_target == "wpage")
872  {
873  $wpg_id = (int) $a_page;
874  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
875  $w_id = ilWikiPage::lookupWikiId($wpg_id);
876  $refs = ilObject::_getAllReferences($w_id);
877  foreach ($refs as $r)
878  {
879  if ($ilAccess->checkAccess("read", "", $r))
880  {
881  $a_target = $r;
882  $a_page = ilWikiPage::lookupTitle($wpg_id);
883  }
884  }
885  }
886 
887  if ($ilAccess->checkAccess("read", "", $a_target))
888  {
889  $_GET["cmd"] = "viewPage";
890  $_GET["ref_id"] = $a_target;
891  $_GET["page"] = $a_page;
892  $_GET["baseClass"] = "ilwikihandlergui";
893  $_GET["cmdClass"] = "ilobjwikigui";
894 /* if ($a_page != "")
895  {
896  $add = "&amp;page=".rawurlencode($_GET["page"]);
897  $ilNavigationHistory->addItem($_GET["ref_id"],
898  "./goto.php?target=wiki_".$_GET["ref_id"].$add, "wiki");
899  }*/
900  include("ilias.php");
901  exit;
902  }
903  else if ($ilAccess->checkAccess("visible", "", $a_target))
904  {
905  ilObjectGUI::_gotoRepositoryNode($tarr[0], "infoScreen");
906  }
907  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
908  {
909  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
912  }
913 
914  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
915  }
916 
920  static function getGotoLink($a_ref_id, $a_page = "")
921  {
922  if ($a_page == "")
923  {
925  }
926 
927  $goto = "goto.php?target=wiki_".$a_ref_id."_".
928  ilWikiUtil::makeUrlTitle($a_page);
929 
930  return $goto;
931  }
932 
936  function viewPageObject()
937  {
938  global $lng, $ilCtrl, $tpl, $ilTabs, $ilAccess;
939 
940  $this->checkPermission("read");
941 
942  $ilTabs->clearTargets();
943  $tpl->setHeaderActionMenu(null);
944 
945  $page = ($_GET["page"] != "")
946  ? $_GET["page"]
947  : $this->object->getStartPage();
948  $_GET["page"] = $page;
949 
950  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
951  if (!ilWikiPage::exists($this->object->getId(), $page))
952  {
953  $page = $this->object->getStartPage();
954  }
955 
956  if (!ilWikiPage::exists($this->object->getId(), $page))
957  {
958  ilUtil::sendInfo($lng->txt("wiki_no_start_page"), true);
959  $ilCtrl->redirect($this, "infoScreen");
960  return;
961  }
962 
963  // page exists, show it !
964  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($page));
965 
966  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
967  $wpage_gui = ilWikiPageGUI::getGUIForTitle($this->object->getId(),
968  ilWikiUtil::makeDbTitle($page), 0, $this->object->getRefId());
969  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
970  $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
971  $this->object->getStyleSheetId(), "wiki"));
972 
973  $this->setContentStyleSheet();
974  //$wpage_gui->setOutputMode(IL_PAGE_PREVIEW);
975 
976  //$wpage_gui->setSideBlock();
977  $ilCtrl->setCmdClass("ilwikipagegui");
978  $ilCtrl->setCmd("preview");
979  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
980  (!$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
981  $wpage_gui->getPageObject()->getBlocked()
982  ))
983  {
984  $wpage_gui->setEnableEditing(false);
985  }
986 
987  // alter title and description
988  //$tpl->setTitle($wpage_gui->getPageObject()->getTitle());
989  //$tpl->setDescription($this->object->getTitle());
990 
991 
992  $html = $ilCtrl->forwardCommand($wpage_gui);
993  //$this->addPageTabs();
994 
995  $tpl->setContent($html);
996  }
997 
1001  function allPagesObject()
1002  {
1003  global $tpl;
1004 
1005  $this->checkPermission("read");
1006 
1007  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1008 
1009  $this->addPagesSubTabs();
1010 
1011  $table_gui = new ilWikiPagesTableGUI($this, "allPages",
1012  $this->object->getId(), IL_WIKI_ALL_PAGES);
1013 
1014  $this->setSideBlock();
1015  $tpl->setContent($table_gui->getHTML());
1016  }
1017 
1022  {
1023  global $tpl;
1024 
1025  $this->checkPermission("read");
1026 
1027  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1028 
1029  $this->addPagesSubTabs();
1030 
1031  $table_gui = new ilWikiPagesTableGUI($this, "popularPages",
1032  $this->object->getId(), IL_WIKI_POPULAR_PAGES);
1033 
1034  $this->setSideBlock();
1035  $tpl->setContent($table_gui->getHTML());
1036  }
1037 
1042  {
1043  global $tpl;
1044 
1045  $this->checkPermission("read");
1046 
1047  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1048 
1049  $this->addPagesSubTabs();
1050 
1051  $table_gui = new ilWikiPagesTableGUI($this, "orphanedPages",
1052  $this->object->getId(), IL_WIKI_ORPHANED_PAGES);
1053 
1054  $this->setSideBlock();
1055  $tpl->setContent($table_gui->getHTML());
1056  }
1057 
1063  function gotoPageObject($a_page = "")
1064  {
1065  global $ilCtrl;
1066 
1067  if ($a_page == "")
1068  {
1069  $a_page = $_GET["page"];
1070  }
1071 
1072  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1073  if (ilWikiPage::_wikiPageExists($this->object->getId(),
1074  ilWikiUtil::makeDbTitle($a_page)))
1075  {
1076  // to do: get rid of this redirect
1077  ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId(), $a_page));
1078  }
1079  else
1080  {
1081  // create the page
1082  $page = new ilWikiPage();
1083  $page->setWikiId($this->object->getId());
1084  $page->setTitle(ilWikiUtil::makeDbTitle($_GET["page"]));
1085 
1086  if($this->object->getRating() && $this->object->getRatingForNewPages())
1087  {
1088  $page->setRating(true);
1089  }
1090 
1091  // needed for notification
1092  $page->setWikiRefId($this->object->getRefId());
1093 
1094  $page->create();
1095 
1096  // redirect to newly created page
1097  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
1098  $ilCtrl->redirectByClass("ilwikipagegui", "edit");
1099  }
1100  }
1101 
1107  function randomPageObject()
1108  {
1109  $this->checkPermission("read");
1110 
1111  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1112  $page = ilWikiPage::getRandomPage($this->object->getId());
1113  $this->gotoPageObject($page);
1114  }
1115 
1120  {
1121  global $tpl;
1122 
1123  $this->checkPermission("read");
1124 
1125  include_once("./Modules/Wiki/classes/class.ilWikiRecentChangesTableGUI.php");
1126 
1127  $this->addPagesSubTabs();
1128 
1129  $table_gui = new ilWikiRecentChangesTableGUI($this, "recentChanges",
1130  $this->object->getId());
1131 
1132  $this->setSideBlock();
1133  $tpl->setContent($table_gui->getHTML());
1134  }
1135 
1139  function setSideBlock($a_wpg_id = 0)
1140  {
1141  ilObjWikiGUI::renderSideBlock($a_wpg_id, $this->object->getRefId());
1142  }
1143 
1144 
1148  static function renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp = null)
1149  {
1150  global $tpl, $lng;
1151 
1152  if ($a_wpg_id > 0 && !$a_wp)
1153  {
1154  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1155  $a_wp = ilWikiPage($a_wpg_id);
1156  }
1157 
1158  // search block
1159  include_once("./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php");
1160  $wiki_search_block = new ilWikiSearchBlockGUI();
1161  $rcontent = $wiki_search_block->getHTML();
1162 
1163  // quick navigation
1164  if ($a_wpg_id > 0)
1165  {
1166 // include_once("./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php");
1167 // $wiki_side_block = new ilWikiSideBlockGUI();
1168 // $wiki_side_block->setPageObject($a_wp);
1169 // $rcontent.= $wiki_side_block->getHTML();
1170 
1171  // rating
1172  $wiki_id =ilObject::_lookupObjId($a_wiki_ref_id);
1173  if(ilObjWiki::_lookupRating($wiki_id) &&
1174  // ilObjWiki::_lookupRatingAsBlock($wiki_id) &&
1175  $a_wp->getRating())
1176  {
1177  include_once("./Services/Rating/classes/class.ilRatingGUI.php");
1178  $rgui = new ilRatingGUI();
1179  $rgui->setObject($wiki_id, "wiki", $a_wpg_id, "wpg");
1180  $rgui->enableCategories(ilObjWiki::_lookupRatingCategories($wiki_id));
1181  $rgui->setYourRatingText("#");
1182  $rcontent .= $rgui->getBlockHTML($lng->txt("wiki_rate_page"));
1183  }
1184  }
1185 
1186  // important pages
1187 // if (ilObjWiki::_lookupImportantPages(ilObject::_lookupObjId($a_wiki_ref_id)))
1188 // {
1189  include_once("./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
1190  $imp_pages_block = new ilWikiImportantPagesBlockGUI();
1191  $rcontent.= $imp_pages_block->getHTML();
1192 // }
1193 
1194  // wiki functions block
1195  if ($a_wpg_id > 0)
1196  {
1197  include_once("./Modules/Wiki/classes/class.ilWikiFunctionsBlockGUI.php");
1198  $wiki_functions_block = new ilWikiFunctionsBlockGUI();
1199  $wiki_functions_block->setPageObject($a_wp);
1200  $rcontent .= $wiki_functions_block->getHTML();
1201  }
1202 
1203  $tpl->setRightContent($rcontent);
1204  }
1205 
1209  function newPagesObject()
1210  {
1211  global $tpl;
1212 
1213  $this->checkPermission("read");
1214 
1215  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1216 
1217  $this->addPagesSubTabs();
1218 
1219  $table_gui = new ilWikiPagesTableGUI($this, "newPages",
1220  $this->object->getId(), IL_WIKI_NEW_PAGES);
1221 
1222  $this->setSideBlock();
1223  $tpl->setContent($table_gui->getHTML());
1224  }
1225 
1229  function printViewObject()
1230  {
1231  $this->checkPermission("read");
1232 
1233  switch ($_POST["sel_type"])
1234  {
1235  case "wiki":
1236  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1237  $pages = ilWikiPage::getAllPages($this->object->getId());
1238  foreach ($pages as $p)
1239  {
1240  $pg_ids[] = $p["id"];
1241  }
1242  break;
1243 
1244  case "selection":
1245  if (is_array($_POST["obj_id"]))
1246  {
1247  $pg_ids = $_POST["obj_id"];
1248  }
1249  else
1250  {
1251  $pg_ids[] = $_GET["wpg_id"];
1252  }
1253  break;
1254 
1255  default:
1256  $pg_ids[] = $_GET["wpg_id"];
1257  break;
1258  }
1259 
1260  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
1261 
1262  global $tpl;
1263 
1264  $tpl = new ilTemplate("tpl.main.html", true, true);
1265  $tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle());
1266  $this->setContentStyleSheet($tpl);
1267 
1268  // syntax style
1269  $tpl->setCurrentBlock("SyntaxStyle");
1270  $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1272  $tpl->parseCurrentBlock();
1273 
1274 
1275  // determine target frames for internal links
1276 
1277  foreach ($pg_ids as $p_id)
1278  {
1279  $page_gui = new ilWikiPageGUI($p_id);
1280  $page_gui->setOutputMode("print");
1281  $page_content.= $page_gui->showPage();
1282  }
1283  $tpl->setVariable("CONTENT", '<div class="ilInvisibleBorder">'.$page_content.'</div>'.
1284  '<script type="text/javascript" language="javascript1.2">
1285  <!--
1286  il.Util.addOnLoad(function () {
1287  il.Util.print();
1288  });
1289  //-->
1290  </script>');
1291  $tpl->show(false);
1292  exit;
1293  }
1294 
1299  {
1300  global $tpl, $ilTabs, $ilCtrl, $lng;
1301 
1302  $this->checkPermission("read");
1303 
1304  include_once("./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php");
1305 
1306  $ilTabs->setTabActive("wiki_search_results");
1307 
1308  if (trim($_POST["search_term"]) == "")
1309  {
1310  ilUtil::sendFailure($lng->txt("wiki_please_enter_search_term"), true);
1311  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1312  }
1313 
1314  $search_results = ilObjWiki::_performSearch($this->object->getId(),
1315  ilUtil::stripSlashes($_POST["search_term"]));
1316  $table_gui = new ilWikiSearchResultsTableGUI($this, "performSearch",
1317  $this->object->getId(), $search_results, $_POST["search_term"]);
1318 
1319  $this->setSideBlock();
1320  $tpl->setContent($table_gui->getHTML());
1321  }
1322 
1326  function setContentStyleSheet($a_tpl = null)
1327  {
1328  global $tpl;
1329 
1330  if ($a_tpl != null)
1331  {
1332  $ctpl = $a_tpl;
1333  }
1334  else
1335  {
1336  $ctpl = $tpl;
1337  }
1338 
1339  $ctpl->setCurrentBlock("ContentStyle");
1340  $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
1341  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
1342  $ctpl->parseCurrentBlock();
1343 
1344  }
1345 
1346 
1351  {
1352  global $ilTabs, $tpl;
1353 
1354  $this->checkPermission("write");
1355 
1356  $this->initStylePropertiesForm();
1357  $tpl->setContent($this->form->getHTML());
1358 
1359  $ilTabs->activateTab("settings");
1360  $this->setSettingsSubTabs("style");
1361 
1362  $this->setSideBlock();
1363  }
1364 
1369  {
1370  global $ilCtrl, $lng, $ilTabs, $ilSetting;
1371 
1372  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1373  $lng->loadLanguageModule("style");
1374 
1375  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1376  $this->form = new ilPropertyFormGUI();
1377 
1378  $fixed_style = $ilSetting->get("fixed_content_style_id");
1379  $style_id = $this->object->getStyleSheetId();
1380 
1381  if ($fixed_style > 0)
1382  {
1383  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1384  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
1385  $this->lng->txt("global_fixed").")");
1386  $this->form->addItem($st);
1387  }
1388  else
1389  {
1390  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
1391  $_GET["ref_id"]);
1392 
1393  $st_styles[0] = $this->lng->txt("default");
1394  ksort($st_styles);
1395 
1396  if ($style_id > 0)
1397  {
1398  // individual style
1399  if (!ilObjStyleSheet::_lookupStandard($style_id))
1400  {
1401  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1402  $st->setValue(ilObject::_lookupTitle($style_id));
1403  $this->form->addItem($st);
1404 
1405 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1406 
1407  // delete command
1408  $this->form->addCommandButton("editStyle",
1409  $lng->txt("style_edit_style"));
1410  $this->form->addCommandButton("deleteStyle",
1411  $lng->txt("style_delete_style"));
1412 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1413  }
1414  }
1415 
1416  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1417  {
1418  $style_sel = ilUtil::formSelect ($style_id, "style_id",
1419  $st_styles, false, true);
1420  $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
1421  $style_sel->setOptions($st_styles);
1422  $style_sel->setValue($style_id);
1423  $this->form->addItem($style_sel);
1424 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1425  $this->form->addCommandButton("saveStyleSettings",
1426  $lng->txt("save"));
1427  $this->form->addCommandButton("createStyle",
1428  $lng->txt("sty_create_ind_style"));
1429  }
1430  }
1431  $this->form->setTitle($lng->txt("wiki_style"));
1432  $this->form->setFormAction($ilCtrl->getFormAction($this));
1433  }
1434 
1439  {
1440  global $ilCtrl;
1441 
1442  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1443  }
1444 
1448  function editStyleObject()
1449  {
1450  global $ilCtrl;
1451 
1452  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1453  }
1454 
1459  {
1460  global $ilCtrl;
1461 
1462  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1463  }
1464 
1469  {
1470  global $ilSetting;
1471 
1472  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1473  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1474  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1475  || $this->object->getStyleSheetId() == 0))
1476  {
1477  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1478  $this->object->update();
1479  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1480  }
1481  $this->ctrl->redirect($this, "editStyleProperties");
1482  }
1483 
1484  //
1485  // Important pages
1486  //
1487 
1492  {
1493  global $tpl, $ilToolbar, $ilTabs, $lng, $ilCtrl;
1494 
1495  $this->checkPermission("write");
1496 
1497  ilUtil::sendInfo($lng->txt("wiki_navigation_info"));
1498 
1499  $ipages = ilObjWiki::_lookupImportantPagesList($this->object->getId());
1500  $ipages_ids = array();
1501  foreach ($ipages as $i)
1502  {
1503  $ipages_ids[] = $i["page_id"];
1504  }
1505 
1506  // list pages
1507  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1508  $pages = ilWikiPage::getAllPages($this->object->getId());
1509  $options = array("" => $lng->txt("please_select"));
1510  foreach ($pages as $p)
1511  {
1512  if (!in_array($p["id"], $ipages_ids))
1513  {
1514  $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
1515  }
1516  }
1517  if (count($options) > 0)
1518  {
1519  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1520  $si = new ilSelectInputGUI($lng->txt("wiki_pages"), "imp_page_id");
1521  $si->setOptions($options);
1522  $si->setInfo($lng->txt(""));
1523  $ilToolbar->addInputItem($si);
1524  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1525  $ilToolbar->addFormButton($lng->txt("add"), "addImportantPage");
1526  }
1527 
1528 
1529  $ilTabs->activateTab("settings");
1530  $this->setSettingsSubTabs("imp_pages");
1531 
1532  include_once("./Modules/Wiki/classes/class.ilImportantPagesTableGUI.php");
1533  $imp_table = new ilImportantPagesTableGUI($this, "editImportantPages");
1534 
1535  $tpl->setContent($imp_table->getHTML());
1536  }
1537 
1545  {
1546  global $ilCtrl, $lng;
1547 
1548  $this->checkPermission("write");
1549 
1550  if ($_POST["imp_page_id"] > 0)
1551  {
1552  $this->object->addImportantPage((int) $_POST["imp_page_id"]);
1553  ilUtil::sendSuccess($lng->txt("wiki_imp_page_added"), true);
1554  }
1555  $ilCtrl->redirect($this, "editImportantPages");
1556  }
1557 
1562  {
1563  global $ilCtrl, $tpl, $lng;
1564 
1565  if (!is_array($_POST["imp_page_id"]) || count($_POST["imp_page_id"]) == 0)
1566  {
1567  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1568  $ilCtrl->redirect($this, "editImportantPages");
1569  }
1570  else
1571  {
1572  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1573  $cgui = new ilConfirmationGUI();
1574  $cgui->setFormAction($ilCtrl->getFormAction($this));
1575  $cgui->setHeaderText($lng->txt("wiki_sure_remove_imp_pages"));
1576  $cgui->setCancel($lng->txt("cancel"), "editImportantPages");
1577  $cgui->setConfirm($lng->txt("remove"), "removeImportantPages");
1578 
1579  foreach ($_POST["imp_page_id"] as $i)
1580  {
1581  $cgui->addItem("imp_page_id[]", $i, ilWikiPage::lookupTitle((int) $i));
1582  }
1583 
1584  $tpl->setContent($cgui->getHTML());
1585  }
1586  }
1587 
1595  {
1596  global $ilCtrl, $lng;
1597 
1598  $this->checkPermission("write");
1599 
1600  if (is_array($_POST["imp_page_id"]))
1601  {
1602  foreach ($_POST["imp_page_id"] as $i)
1603  {
1604  $this->object->removeImportantPage((int) $i);
1605  }
1606  }
1607  ilUtil::sendSuccess($lng->txt("wiki_removed_imp_pages"), true);
1608  $ilCtrl->redirect($this, "editImportantPages");
1609  }
1610 
1618  {
1619  global $ilCtrl, $lng;
1620 
1621  $this->checkPermission("write");
1622 
1623  $this->object->saveOrderingAndIndentation($_POST["ord"], $_POST["indent"]);
1624  ilUtil::sendSuccess($lng->txt("wiki_ordering_and_indent_saved"), true);
1625  $ilCtrl->redirect($this, "editImportantPages");
1626  }
1627 
1631  function exportHTML()
1632  {
1633  require_once("./Modules/Wiki/classes/class.ilWikiHTMLExport.php");
1634  $cont_exp = new ilWikiHTMLExport($this);
1635  $cont_exp->buildExportFile();
1636  }
1637 
1645  static function lookupSubObjectTitle($a_wiki_id, $a_page_id)
1646  {
1647  include_once "Modules/Wiki/classes/class.ilWikiPage.php";
1648  $page = new ilWikiPage($a_page_id);
1649  if($page->getWikiId() == $a_wiki_id)
1650  {
1651  return $page->getTitle();
1652  }
1653  }
1654 
1662  function getSubObjectTitle($a_id, $a_type)
1663  {
1664  include_once "Modules/Wiki/classes/class.ilWikiPage.php";
1665  return ilWikiPage::lookupTitle($a_id);
1666  }
1667 }
1668 
1669 ?>
static renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp=null)
Side column.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
isOnlineHelpWiki()
Is wiki an online help wiki?
setSideBlock($a_wpg_id=0)
Side column.
infoScreen()
show information screen
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
exportHTML()
Create html package.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
initStylePropertiesForm()
Init style properties form.
exit
Definition: login.php:54
Class ilInfoScreenGUI.
editStylePropertiesObject()
Edit style properties.
allPagesObject()
All pages of wiki.
TableGUI class for listing users that contributed to the wiki.
$_POST['username']
Definition: cron.php:12
saveStyleSettingsObject()
Save style settings.
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
const IL_WIKI_POPULAR_PAGES
This class represents a selection list property in a property form.
This class represents a property form user interface.
TableGUI class for recent changes in wiki.
addImportantPageObject()
Add important pages.
$_GET["client_id"]
orphanedPagesObject()
Orphaned pages.
_lookupMark($a_usr_id, $a_obj_id)
static checkShortTitleAvailability($a_short_title)
Check availability of short title.
static lookupSubObjectTitle($a_wiki_id, $a_page_id)
Get title for wiki page (used in ilNotesGUI)
saveGradingObject()
Save grading.
static _lookupStartPage($a_wiki_id)
Lookup start page.
BlockGUI class for wiki searchblock.
$cmd
Definition: sahs_server.php:35
gotoStartPageObject()
Go to start page.
static getGUIForTitle($a_wiki_id, $a_title, $a_old_nr=0, $a_wiki_ref_id=0)
Get wiki page gui for id and title.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
TableGUI class for wiki pages table.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
This class represents a checkbox property in a property form.
printViewObject()
Show printable view of a wiki page.
addPageTabs()
Add Page Tabs.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static _lookupTitle($a_id)
lookup object title
afterSave($newObj)
save object public
initCreationForms($a_new_type)
static _lookupRatingCategories($a_wiki_id)
Lookup whether rating categories are activated.
getTabs($tabs_gui)
get tabs public
static getPageIdForTitle($a_wiki_id, $a_title)
Get wiki page object for id and title.
getSyntaxStylePath()
get syntax style path
confirmRemoveImportantPagesObject()
Confirm important pages deletion.
static _getAllReferences($a_id)
get all reference ids of object
saveObject()
save object public
popularPagesObject()
Popular pages.
createStyleObject()
Create Style.
static getRandomPage($a_wiki_id)
Get a random page.
global $ilCtrl
Definition: ilias.php:18
BlockGUI class for wiki functions block.
setInfo($a_info)
Set Information Text.
static _lookupRating($a_wiki_id)
Lookup whether rating is activated.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static hasAutoRating($a_type, $a_ref_id)
Check if auto rating is active for parent group/course.
Export User Interface Class.
static lookupWikiId($a_page_id)
Lookup wiki id.
initImportForm($a_new_type)
Init object import form.
setSettingsSubTabs($a_active)
Set sub tabs.
Class ilECSWikiSettings.
static _performSearch($a_wiki_id, $a_searchterm)
Search in Wiki.
GUI class for public user profile presentation.
_writeStatus($a_obj_id, $a_user_id, $a_status)
Write success status.
editImportantPagesObject()
List important pages.
Class ilRatingGUI.
if(!is_array($argv)) $options
saveSettingsObject()
Save Settings.
static makeUrlTitle($a_par)
Set page parameter for Url Embedding.
addPagesSubTabs()
Add Pages SubTabs.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getSubObjectTitle($a_id, $a_type)
Used for rating export.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
listContributorsObject()
List all contributors.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
omitLocator($a_omit=true)
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
This class represents a text property in a property form.
Class ilWikiPage GUI class.
_getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
redirection script todo: (a better solution should control the processing via a xml file) ...
Class ilWikiPage.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setOptions($a_options)
Set Options.
prepareOutput()
prepare output
static makeDbTitle($a_par)
Handle page GET parameter.
getContentPrintStyle()
get content print style
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getSettingsFormValues($a_mode="edit")
_lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
static _wikiPageExists($a_wiki_id, $a_title)
Check whether page exists for wiki or not.
const IL_WIKI_ALL_PAGES
_lookupStandard($a_id)
Lookup standard flag.
randomPageObject()
Go to random page.
deleteStyleObject()
Delete Style.
_lookupComment($a_usr_id, $a_obj_id)
initSettingsForm($a_mode="edit")
Init Settings Form.
global $ilUser
Definition: imgupload.php:15
static exists($a_wiki_id, $a_title)
Checks whether a page with given title exists.
editSettingsObject()
Edit settings.
This class represents a non editable value in a property form.
setContentStyleSheet($a_tpl=null)
Set content style sheet.
getContentStylePath($a_style_id)
get content style path
Class ilObjStyleSheetGUI.
global $ilSetting
Definition: privfeed.php:40
This class represents a text area property in a property form.
const IL_WIKI_ORPHANED_PAGES
gotoPageObject($a_page="")
Go to specific page.
performSearchObject()
Search.
static isOnlineHelpWiki($a_ref_id)
Is wiki an online help wiki?
Wiki HTML exporter class.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
newPagesObject()
Latest pages.
TableGUI class for recent changes in wiki.
removeImportantPagesObject()
Remove important pages.
static redirect($a_script)
http redirect to other script
saveOrderingAndIndentObject()
Save important pages ordering and indentation.
addHeaderAction()
Add header action menu.
viewObject()
Start page.
ilObjWikiGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor public.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
static getAllPages($a_wiki_id)
Get all pages of wiki.
editStyleObject()
Edit Style.
recentChangesObject()
Recent Changes.
Class ilObjWikiGUI.
setRequired($a_required)
Set Required.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
viewPageObject()
view wiki page
Confirmation screen class.
$r
const IL_WIKI_NEW_PAGES