ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
24 {
25 
29  protected $log;
30 
35  function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
36  {
37  global $ilCtrl, $lng;
38 
39  $this->type = "wiki";
40 
41  $this->log = ilLoggerFactory::getLogger('wiki');
42 
43  parent::__construct($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
44  $lng->loadLanguageModule("obj");
45  $lng->loadLanguageModule("wiki");
46 
47  if ($_GET["page"] != "")
48  {
49  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
50  }
51  }
52 
53  function executeCommand()
54  {
55  global $ilUser, $ilCtrl, $tpl, $ilTabs, $ilAccess;
56 
57  $next_class = $this->ctrl->getNextClass($this);
58  $cmd = $this->ctrl->getCmd();
59 
60  $this->prepareOutput();
61 
62  // see ilWikiPageGUI::printViewOrderList()
63  // printView() and pdfExport() cannot be in ilWikiPageGUI because of stylesheet confusion
64  if($cmd == "printView" || $cmd == "pdfExport")
65  {
66  $next_class = null;
67  }
68 
69  switch($next_class)
70  {
71  case "ilinfoscreengui":
72  $this->checkPermission("visible");
73  $this->addHeaderAction();
74  $this->infoScreen(); // forwards command
75  break;
76 
77  case 'ilpermissiongui':
78  $this->addHeaderAction();
79  $ilTabs->activateTab("perm_settings");
80  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
81  $perm_gui = new ilPermissionGUI($this);
82  $ret = $this->ctrl->forwardCommand($perm_gui);
83  break;
84 
85  case 'ilsettingspermissiongui':
86  $this->checkPermission("write");
87  $this->addHeaderAction();
88  $ilTabs->activateTab("settings");
89  $this->setSettingsSubTabs("permission_settings");
90  include_once("Services/AccessControl/classes/class.ilSettingsPermissionGUI.php");
91  $perm_gui = new ilSettingsPermissionGUI($this);
92  $perm_gui->setPermissions(array("edit_wiki_navigation", "delete_wiki_pages", "activate_wiki_protection",
93  "wiki_html_export"));
94  $perm_gui->setRoleRequiredPermissions(array("edit_content"));
95  $perm_gui->setRoleProhibitedPermissions(array("write"));
96  $ret = $this->ctrl->forwardCommand($perm_gui);
97  break;
98 
99  case 'ilwikipagegui':
100  $this->checkPermission("read");
101  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
102  $wpage_gui = ilWikiPageGUI::getGUIForTitle($this->object->getId(),
103  ilWikiUtil::makeDbTitle($_GET["page"]), $_GET["old_nr"], $this->object->getRefId());
104  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
105  $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
106  $this->object->getStyleSheetId(), "wiki"));
107  $this->setContentStyleSheet();
108  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
109  (!$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
110  $wpage_gui->getPageObject()->getBlocked()
111  ))
112  {
113  $wpage_gui->setEnableEditing(false);
114  }
115 
116  // alter title and description
117 // $tpl->setTitle($wpage_gui->getPageObject()->getTitle());
118 // $tpl->setDescription($this->object->getTitle());
119  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
120  {
121  $wpage_gui->activateMetaDataEditor($this->object, "wpg", $wpage_gui->getId());
122  }
123 
124  $ret = $this->ctrl->forwardCommand($wpage_gui);
125  if ($ret != "")
126  {
127  $tpl->setContent($ret);
128  }
129  break;
130 
131  case 'ilobjectcopygui':
132  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
133  $cp = new ilObjectCopyGUI($this);
134  $cp->setType('wiki');
135  $this->ctrl->forwardCommand($cp);
136  break;
137 
138  case 'ilpublicuserprofilegui':
139  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
140  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
141  $ret = $this->ctrl->forwardCommand($profile_gui);
142  $tpl->setContent($ret);
143  break;
144 
145  case "ilobjstylesheetgui":
146  include_once ("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
147  $this->ctrl->setReturn($this, "editStyleProperties");
148  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
149  $style_gui->omitLocator();
150  if ($cmd == "create" || $_GET["new_type"]=="sty")
151  {
152  $style_gui->setCreationMode(true);
153  }
154 
155  if ($cmd == "confirmedDelete")
156  {
157  $this->object->setStyleSheetId(0);
158  $this->object->update();
159  }
160 
161  $ret = $this->ctrl->forwardCommand($style_gui);
162 
163  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
164  {
165  $style_id = $ret;
166  $this->object->setStyleSheetId($style_id);
167  $this->object->update();
168  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
169  }
170  break;
171 
172  case "ilexportgui":
173 // $this->prepareOutput();
174  $this->addHeaderAction();
175  $ilTabs->activateTab("export");
176  include_once("./Services/Export/classes/class.ilExportGUI.php");
177  $exp_gui = new ilExportGUI($this);
178  $exp_gui->addFormat("xml");
179  $exp_gui->addFormat("html", "", $this, "exportHTML");
180  $ret = $this->ctrl->forwardCommand($exp_gui);
181 // $this->tpl->show();
182  break;
183 
184  case "ilcommonactiondispatchergui":
185  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
187  $this->ctrl->forwardCommand($gui);
188  break;
189 
190  case "ilratinggui":
191  // for rating category editing
192  $this->checkPermission("write");
193  $this->addHeaderAction();
194  $ilTabs->activateTab("settings");
195  $this->setSettingsSubTabs("rating_categories");
196  include_once("Services/Rating/classes/class.ilRatingGUI.php");
197  $gui = new ilRatingGUI();
198  $gui->setObject($this->object->getId(), $this->object->getType());
199  $gui->setExportCallback(array($this, "getSubObjectTitle"), $this->lng->txt("page"));
200  $this->ctrl->forwardCommand($gui);
201  break;
202 
203  case "ilwikistatgui":
204  $this->checkPermission("statistics_read");
205 
206  $this->addHeaderAction();
207  $ilTabs->activateTab("statistics");
208 
209  include_once "Modules/Wiki/classes/class.ilWikiStatGUI.php";
210  $gui = new ilWikiStatGUI($this->object->getId());
211  $this->ctrl->forwardCommand($gui);
212  break;
213 
214  case "ilwikipagetemplategui":
215  $this->checkPermission("write");
216  $this->addHeaderAction();
217  $ilTabs->activateTab("settings");
218  $this->setSettingsSubTabs("page_templates");
219  include_once("./Modules/Wiki/classes/class.ilWikiPageTemplateGUI.php");
220  $wptgui = new ilWikiPageTemplateGUI($this);
221  $this->ctrl->forwardCommand($wptgui);
222  break;
223 
224  case 'ilobjectmetadatagui';
225  $this->checkPermission("write");
226  $this->addHeaderAction();
227  $ilTabs->activateTab("advmd");
228  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
229  $md_gui = new ilObjectMetaDataGUI($this->object, "wpg");
230  $this->ctrl->forwardCommand($md_gui);
231  break;
232 
233  case 'ilrepositoryobjectsearchgui':
234  $this->addHeaderAction();
235  $this->setSideBlock();
236  $ilTabs->setTabActive("wiki_search_results");
237  $ilCtrl->setReturn($this,'view');
238  include_once './Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
239  $search_gui = new ilRepositoryObjectSearchGUI(
240  $this->object->getRefId(),
241  $this,
242  'view'
243  );
244  $ilCtrl->forwardCommand($search_gui);
245  break;
246 
247  default:
248  $this->addHeaderAction();
249  if(!$cmd)
250  {
251  $cmd = "infoScreen";
252  }
253  $cmd .= "Object";
254  if ($cmd != "infoScreenObject")
255  {
256  if (!in_array($cmd, array("createObject", "saveObject", "importFileObject")))
257  {
258  $this->checkPermission("read");
259  }
260  }
261  else
262  {
263  $this->checkPermission("visible");
264  }
265  $this->$cmd();
266  break;
267  }
268 
269  return $ret;
270  }
271 
277  function isOnlineHelpWiki()
278  {
279  if (is_object($this->object))
280  {
281  return ilObjWiki::isOnlineHelpWiki($this->object->getRefId());
282  }
283  return false;
284  }
285 
289  function viewObject()
290  {
291  $this->checkPermission("read");
292  $this->gotoStartPageObject();
293  }
294 
295  protected function initCreationForms($a_new_type)
296  {
297  $this->initSettingsForm("create");
298  $this->getSettingsFormValues("create");
299 
300  $forms = array(self::CFORM_NEW => $this->form_gui,
301  self::CFORM_IMPORT => $this->initImportForm($a_new_type),
302  self::CFORM_CLONE => $this->fillCloneTemplate(null, $a_new_type));
303 
304  return $forms;
305  }
306 
311  function saveObject()
312  {
313  global $tpl, $lng, $rbacsystem;
314 
315  if (!$this->checkPermissionBool("create", "", "wiki", $_GET["ref_id"]))
316  {
317  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
318  }
319 
320  $this->initSettingsForm("create");
321  if ($this->form_gui->checkInput())
322  {
323  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")))
324  {
325  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
326  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
327  }
328  else
329  {
330  // create and insert forum in objecttree
331  $_POST["title"] = $this->form_gui->getInput("title");
332  $_POST["desc"] = $this->form_gui->getInput("description");
333  return parent::saveObject();
334  }
335  }
336 
337  $this->form_gui->setValuesByPost();
338  $tpl->setContent($this->form_gui->getHtml());
339  }
340 
345  function afterSave(ilObject $newObj)
346  {
347  global $ilSetting;
348 
349  $newObj->setTitle($this->form_gui->getInput("title"));
350  $newObj->setDescription($this->form_gui->getInput("description"));
351  $newObj->setIntroduction($this->form_gui->getInput("intro"));
352  $newObj->setStartPage($this->form_gui->getInput("startpage"));
353  $newObj->setShortTitle($this->form_gui->getInput("shorttitle"));
354  $newObj->setRating($this->form_gui->getInput("rating"));
355  // $newObj->setRatingAsBlock($this->form_gui->getInput("rating_side"));
356  $newObj->setRatingForNewPages($this->form_gui->getInput("rating_new"));
357  $newObj->setRatingCategories($this->form_gui->getInput("rating_ext"));
358 
359  $newObj->setRatingOverall($this->form_gui->getInput("rating_overall"));
360  $newObj->setPageToc($this->form_gui->getInput("page_toc"));
361 
362 
363 
364  if (!$ilSetting->get("disable_comments"))
365  {
366  $newObj->setPublicNotes($this->form_gui->getInput("public_notes"));
367  }
368  $newObj->setOnline($this->form_gui->getInput("online"));
369  $newObj->update();
370 
371  // always send a message
372  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
374  }
375 
381  function infoScreenObject()
382  {
383  $this->checkPermission("visible");
384  $this->ctrl->setCmd("showSummary");
385  $this->ctrl->setCmdClass("ilinfoscreengui");
386  $this->infoScreen();
387  }
388 
392  function infoScreen()
393  {
394  global $ilAccess, $ilUser, $ilTabs, $lng;
395 
396  $ilTabs->activateTab("info_short");
397 
398  if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId()))
399  {
400  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
401  }
402 
403  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
404  $info = new ilInfoScreenGUI($this);
405  $info->enablePrivateNotes();
406  if (trim($this->object->getIntroduction()) != "")
407  {
408  $info->addSection($lng->txt("wiki_introduction"));
409  $info->addProperty("", nl2br($this->object->getIntroduction()));
410  }
411 
412  // feedback from tutor; mark, status, comment
413  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
414  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
415  $lpcomment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId());
416  $mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId());
417  $status = ilWikiContributor::_lookupStatus($this->object->getId(), $ilUser->getId());
418  if ($lpcomment != "" || $mark != "" || $status != ilWikiContributor::STATUS_NOT_GRADED)
419  {
420  $info->addSection($this->lng->txt("wiki_feedback_from_tutor"));
421  if ($lpcomment != "")
422  {
423  $info->addProperty($this->lng->txt("wiki_comment"),
424  $lpcomment);
425  }
426  if ($mark != "")
427  {
428  $info->addProperty($this->lng->txt("wiki_mark"),
429  $mark);
430  }
431 
432  if ($status == ilWikiContributor::STATUS_PASSED)
433  {
434  $info->addProperty($this->lng->txt("status"),
435  $this->lng->txt("wiki_passed"));
436  }
437  if ($status == ilWikiContributor::STATUS_FAILED)
438  {
439  $info->addProperty($this->lng->txt("status"),
440  $this->lng->txt("wiki_failed"));
441  }
442  }
443 
444  /*
445  $info->enableNews();
446  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
447  {
448  //$info->enableNewsEditing();
449  $info->setBlockProperty("news", "settings", true);
450  }*/
451 
452  if ($ilAccess->checkAccess("read", "", $this->object->getRefId()))
453  {
454  $info->addButton($lng->txt("wiki_start_page"), ilObjWikiGUI::getGotoLink($this->object->getRefId()));
455  }
456 
457  // general information
458  $this->lng->loadLanguageModule("meta");
459  $this->lng->loadLanguageModule("wiki");
460 
461  //$info->addSection($this->lng->txt("meta_general"));
462  //$info->addProperty($this->lng->txt("mcst_nr_items"),
463  // (int) count($med_items));
464 
465  // forward the command
466  $this->ctrl->forwardCommand($info);
467 
468  if ($ilAccess->checkAccess("read", "", $this->object->getRefId()))
469  {
470 // $this->setSideBlock();
471  }
472  }
473 
478  {
479  global $ilCtrl;
480 
482  }
483 
487  function addPageTabs()
488  {
489  global $ilTabs, $ilCtrl;
490 
491  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
492  $ilCtrl->setParameter($this, "wpg_id",
494  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
495  $ilTabs->addTarget("wiki_what_links_here",
496  $this->ctrl->getLinkTargetByClass("ilwikipagegui",
497  "whatLinksHere"), "whatLinksHere");
498  $ilTabs->addTarget("wiki_print_view",
499  $this->ctrl->getLinkTargetByClass("ilwikipagegui",
500  "printViewSelection"), "printViewSelection");
501  }
502 
506  function addPagesSubTabs()
507  {
508  global $ilTabs, $ilCtrl;
509 
510  $ilTabs->activateTab("wiki_pages");
511 
512  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
513  $ilCtrl->setParameter($this, "wpg_id",
514  ilWikiPage::getPageIdForTitle($this->object->getId(),
515  ilWikiUtil::makeDbTitle($_GET["page"])));
516  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
517  $ilTabs->addSubTabTarget("wiki_all_pages",
518  $this->ctrl->getLinkTarget($this, "allPages"), "allPages");
519  $ilTabs->addSubTabTarget("wiki_recent_changes",
520  $this->ctrl->getLinkTarget($this, "recentChanges"), "recentChanges");
521  $ilTabs->addSubTabTarget("wiki_new_pages",
522  $this->ctrl->getLinkTarget($this, "newPages"), "newPages");
523  $ilTabs->addSubTabTarget("wiki_popular_pages",
524  $this->ctrl->getLinkTarget($this, "popularPages"), "popularPages");
525  $ilTabs->addSubTabTarget("wiki_orphaned_pages",
526  $this->ctrl->getLinkTarget($this, "orphanedPages"), "orphanedPages");
527  }
528 
534  function getTabs()
535  {
536  global $ilCtrl, $ilAccess, $lng, $ilHelp;
537 
538  $ilHelp->setScreenIdComponent("wiki");
539 
540  // wiki tabs
541  if (in_array($ilCtrl->getCmdClass(), array("", "ilobjwikigui",
542  "ilinfoscreengui", "ilpermissiongui", "ilexportgui", "ilratingcategorygui",
543  "ilwikistatgui", "ilwikipagetemplategui", "iladvancedmdsettingsgui", "ilsettingspermissiongui", 'ilrepositoryobjectsearchgui'
544  )) || (in_array($ilCtrl->getNextClass(), array("ilpermissiongui"))))
545  {
546  if ($_GET["page"] != "")
547  {
548  $this->tabs_gui->setBackTarget($lng->txt("wiki_last_visited_page"),
549  $this->getGotoLink($_GET["ref_id"],
550  ilWikiUtil::makeDbTitle($_GET["page"])));
551  }
552 
553  // pages
554  if ($ilAccess->checkAccess('read', "", $this->object->getRefId()))
555  {
556  $this->tabs_gui->addTab("wiki_pages",
557  $lng->txt("wiki_pages"),
558  $this->ctrl->getLinkTarget($this, "allPages"));
559  }
560 
561  // info screen
562  if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()))
563  {
564  $this->tabs_gui->addTab("info_short",
565  $lng->txt("info_short"),
566  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
567  }
568 
569  // settings
570  if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
571  {
572  $this->tabs_gui->addTab("settings",
573  $lng->txt("settings"),
574  $this->ctrl->getLinkTarget($this, "editSettings"));
575 
576  // metadata
577  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
578  $mdgui = new ilObjectMetaDataGUI($this->object, "wpg");
579  $mdtab = $mdgui->getTab();
580  if($mdtab)
581  {
582  $this->tabs_gui->addTab("advmd",
583  $this->lng->txt("meta_data"),
584  $mdtab);
585  }
586  }
587 
588  // contributors
589  if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
590  {
591  $this->tabs_gui->addTab("wiki_contributors",
592  $lng->txt("wiki_contributors"),
593  $this->ctrl->getLinkTarget($this, "listContributors"));
594  }
595 
596  // statistics
597  if ($ilAccess->checkAccess('statistics_read', "", $this->object->getRefId()))
598  {
599  $this->tabs_gui->addTab("statistics",
600  $lng->txt("statistics"),
601  $this->ctrl->getLinkTargetByClass("ilWikiStatGUI", "initial"));
602  }
603 
604  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
605  {
606  $this->tabs_gui->addTab("export",
607  $lng->txt("export"),
608  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
609  }
610 
611  // edit permissions
612  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
613  {
614  $this->tabs_gui->addTab("perm_settings",
615  $lng->txt("perm_settings"),
616  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
617  }
618  }
619  }
620 
624  function setSettingsSubTabs($a_active)
625  {
626  global $ilTabs, $ilCtrl, $lng, $ilAccess;
627 
628  if (in_array($a_active,
629  array("general_settings", "style", "imp_pages", "rating_categories",
630  "page_templates", "advmd", "permission_settings")))
631  {
632  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
633  {
634  // general properties
635  $ilTabs->addSubTab("general_settings",
636  $lng->txt("wiki_general_settings"),
637  $ilCtrl->getLinkTarget($this, 'editSettings'));
638 
639  // permission settings
640  $ilTabs->addSubTab("permission_settings",
641  $lng->txt("obj_permission_settings"),
642  $this->ctrl->getLinkTargetByClass("ilsettingspermissiongui", ""));
643 
644  // style properties
645  $ilTabs->addSubTab("style",
646  $lng->txt("wiki_style"),
647  $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
648  }
649 
650  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
651  {
652  // important pages
653  $ilTabs->addSubTab("imp_pages",
654  $lng->txt("wiki_navigation"),
655  $ilCtrl->getLinkTarget($this, 'editImportantPages'));
656  }
657 
658  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
659  {
660  // page templates
661  $ilTabs->addSubTab("page_templates",
662  $lng->txt("wiki_page_templates"),
663  $ilCtrl->getLinkTargetByClass("ilwikipagetemplategui", ""));
664 
665  // rating categories
666  if ($this->object->getRating() && $this->object->getRatingCategories())
667  {
668  $lng->loadLanguageModule("rating");
669  $ilTabs->addSubTab("rating_categories",
670  $lng->txt("rating_categories"),
671  $ilCtrl->getLinkTargetByClass(array('ilratinggui', 'ilratingcategorygui'), ''));
672  }
673  }
674 
675  $ilTabs->activateSubTab($a_active);
676  }
677  }
678 
683  {
684  global $tpl;
685 
686  $this->checkPermission("write");
687 
688  $this->setSettingsSubTabs("general_settings");
689 
690  $this->initSettingsForm();
691  $this->getSettingsFormValues();
692 
693  // Edit ecs export settings
694  include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
695  $ecs = new ilECSWikiSettings($this->object);
696  $ecs->addSettingsToForm($this->form_gui, 'wiki');
697 
698  $tpl->setContent($this->form_gui->getHtml());
699  $this->setSideBlock();
700  }
701 
705  function initSettingsForm($a_mode = "edit")
706  {
707  global $lng, $ilCtrl, $ilTabs, $ilSetting;
708 
709  $lng->loadLanguageModule("wiki");
710  $ilTabs->activateTab("settings");
711 
712  require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
713  $this->form_gui = new ilPropertyFormGUI();
714 
715  // Title
716  $tit = new ilTextInputGUI($lng->txt("title"), "title");
717  $tit->setRequired(true);
718  $this->form_gui->addItem($tit);
719 
720  // Short Title
721  // The problem with the short title is, that it is per object
722  // and can't be a substitute for a ref id in the permanent link
723 /*
724  $stit = new ilRegExpInputGUI($lng->txt("wiki_short_title"), "shorttitle");
725  $stit->setPattern("/^[^0-9][^ _\&]+$/");
726  $stit->setRequired(false);
727  $stit->setNoMatchMessage($lng->txt("wiki_msg_short_name_regexp")." &amp; _");
728  $stit->setSize(20);
729  $stit->setMaxLength(20);
730  $stit->setInfo($lng->txt("wiki_short_title_desc2"));
731  $this->form_gui->addItem($stit);
732 */
733 
734  // Description
735  $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
736  $this->form_gui->addItem($des);
737 
738  // Introduction
739  $intro = new ilTextAreaInputGUI($lng->txt("wiki_introduction"), "intro");
740  $intro->setCols(40);
741  $intro->setRows(4);
742  $this->form_gui->addItem($intro);
743 
744  // Start Page
745  if ($a_mode == "edit")
746  {
747  $pages = ilWikiPage::getAllWikiPages($this->object->getId());
748  foreach ($pages as $p)
749  {
750  $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
751  }
752  $si = new ilSelectInputGUI($lng->txt("wiki_start_page"), "startpage_id");
753  $si->setOptions($options);
754  $this->form_gui->addItem($si);
755  }
756  else
757  {
758  $sp = new ilTextInputGUI($lng->txt("wiki_start_page"), "startpage");
759  if ($a_mode == "edit")
760  {
761  $sp->setInfo($lng->txt("wiki_start_page_info"));
762  }
763  $sp->setMaxLength(200);
764  $sp->setRequired(true);
765  $this->form_gui->addItem($sp);
766  }
767 
768  // Online
769  $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
770  $this->form_gui->addItem($online);
771 
772 
773  // rating
774 
775  $lng->loadLanguageModule('rating');
776  $rate = new ilCheckboxInputGUI($lng->txt('rating_activate_rating'), 'rating_overall');
777  $rate->setInfo($lng->txt('rating_activate_rating_info'));
778  $this->form_gui->addItem($rate);
779 
780  $rating = new ilCheckboxInputGUI($lng->txt("wiki_activate_rating"), "rating");
781  $this->form_gui->addItem($rating);
782 
783  /* always active
784  $side = new ilCheckboxInputGUI($lng->txt("wiki_activate_sideblock_rating"), "rating_side");
785  $rating->addSubItem($side);
786  */
787 
788  $new = new ilCheckboxInputGUI($lng->txt("wiki_activate_new_page_rating"), "rating_new");
789  $rating->addSubItem($new);
790 
791  $extended = new ilCheckboxInputGUI($lng->txt("wiki_activate_extended_rating"), "rating_ext");
792  $rating->addSubItem($extended);
793 
794 
795  // public comments
796  if (!$ilSetting->get("disable_comments"))
797  {
798  $comments = new ilCheckboxInputGUI($lng->txt("wiki_public_comments"), "public_notes");
799  $this->form_gui->addItem($comments);
800  }
801 
802  // important pages
803 // $imp_pages = new ilCheckboxInputGUI($lng->txt("wiki_important_pages"), "imp_pages");
804 // $this->form_gui->addItem($imp_pages);
805 
806  // page toc
807  $page_toc = new ilCheckboxInputGUI($lng->txt("wiki_page_toc"), "page_toc");
808  $page_toc->setInfo($lng->txt("wiki_page_toc_info"));
809  $this->form_gui->addItem($page_toc);
810 
811  if($a_mode == "edit")
812  {
813  // advanced metadata auto-linking
814  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
815  if(count(ilAdvancedMDRecord::_getSelectedRecordsByObject("wiki", $this->object->getId(), "wpg")) > 0)
816  {
817  $link_md = new ilCheckboxInputGUI($lng->txt("wiki_link_md_values"), "link_md_values");
818  $link_md->setInfo($lng->txt("wiki_link_md_values_info"));
819  $this->form_gui->addItem($link_md);
820  }
821 
822  // additional features
823  $feat = new ilFormSectionHeaderGUI();
824  $feat->setTitle($this->lng->txt('obj_features'));
825  $this->form_gui->addItem($feat);
826 
827  include_once './Services/Container/classes/class.ilContainer.php';
828  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
830  $this->object->getId(),
831  $this->form_gui,
832  array(
834  )
835  );
836  }
837 
838  // :TODO: sorting
839 
840  // Form action and save button
841  $this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_wiki.svg"));
842  if ($a_mode != "create")
843  {
844  $this->form_gui->setTitle($lng->txt("wiki_settings"));
845  $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
846  }
847  else
848  {
849  $this->form_gui->setTitle($lng->txt("wiki_new"));
850  $this->form_gui->addCommandButton("save", $lng->txt("wiki_add"));
851  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
852  }
853 
854  // set values
855  if ($a_mode == "create")
856  {
857  $ilCtrl->setParameter($this, "new_type", "wiki");
858  }
859 
860  $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
861  }
862 
863  function getSettingsFormValues($a_mode = "edit")
864  {
865  global $lng, $ilUser;
866 
867  // set values
868  if ($a_mode == "create")
869  {
870  //$values["startpage"] = $lng->txt("wiki_main_page");
871  $values["rating_new"] = true;
872 
873  $values["rating_overall"] = ilObject::hasAutoRating("wiki", $_GET["ref_id"]);
874 
875  $this->form_gui->setValuesByArray($values);
876  }
877  else
878  {
879  $values["online"] = $this->object->getOnline();
880  $values["title"] = $this->object->getTitle();
881  //$values["startpage"] = $this->object->getStartPage();
882  $values["startpage_id"] = ilWikiPage::_getPageIdForWikiTitle($this->object->getId(), $this->object->getStartPage());
883  $values["shorttitle"] = $this->object->getShortTitle();
884  $values["description"] = $this->object->getLongDescription();
885  $values["rating_overall"] = $this->object->getRatingOverall();
886  $values["rating"] = $this->object->getRating();
887  // $values["rating_side"] = $this->object->getRatingAsBlock();
888  $values["rating_new"] = $this->object->getRatingForNewPages();
889  $values["rating_ext"] = $this->object->getRatingCategories();
890  $values["public_notes"] = $this->object->getPublicNotes();
891  $values["intro"] = $this->object->getIntroduction();
892 // $values["imp_pages"] = $this->object->getImportantPages();
893  $values["page_toc"] = $this->object->getPageToc();
894  $values["link_md_values"] = $this->object->getLinkMetadataValues();
895 
896  // only set given values (because of adv. metadata)
897  $this->form_gui->setValuesByArray($values, true);
898  }
899  }
900 
901 
906  {
907  global $ilCtrl, $lng, $ilUser, $ilSetting;
908 
909  $this->checkPermission("write");
910 
911  $this->initSettingsForm();
912 
913  if ($this->form_gui->checkInput())
914  {
915  if (!ilObjWiki::checkShortTitleAvailability($this->form_gui->getInput("shorttitle")) &&
916  $this->form_gui->getInput("shorttitle") != $this->object->getShortTitle())
917  {
918  $short_item = $this->form_gui->getItemByPostVar("shorttitle");
919  $short_item->setAlert($lng->txt("wiki_short_title_already_in_use"));
920  }
921  else
922  {
923  $this->object->setTitle($this->form_gui->getInput("title"));
924  $this->object->setDescription($this->form_gui->getInput("description"));
925  $this->object->setOnline($this->form_gui->getInput("online"));
926  $this->object->setStartPage(ilWikiPage::lookupTitle($this->form_gui->getInput("startpage_id")));
927  $this->object->setShortTitle($this->form_gui->getInput("shorttitle"));
928  $this->object->setRatingOverall($this->form_gui->getInput("rating_overall"));
929  $this->object->setRating($this->form_gui->getInput("rating"));
930  // $this->object->setRatingAsBlock($this->form_gui->getInput("rating_side"));
931  $this->object->setRatingForNewPages($this->form_gui->getInput("rating_new"));
932  $this->object->setRatingCategories($this->form_gui->getInput("rating_ext"));
933 
934  if (!$ilSetting->get("disable_comments"))
935  {
936  $this->object->setPublicNotes($this->form_gui->getInput("public_notes"));
937  }
938  $this->object->setIntroduction($this->form_gui->getInput("intro"));
939 // $this->object->setImportantPages($this->form_gui->getInput("imp_pages"));
940  $this->object->setPageToc($this->form_gui->getInput("page_toc"));
941  $this->object->setLinkMetadataValues($this->form_gui->getInput("link_md_values"));
942  $this->object->update();
943 
944  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
946  $this->object->getId(),
947  $this->form_gui,
948  array(
950  )
951  );
952 
953  // Update ecs export settings
954  include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
955  $ecs = new ilECSWikiSettings($this->object);
956  if($ecs->handleSettingsUpdate())
957  {
958  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
959  $ilCtrl->redirect($this, "editSettings");
960  }
961  }
962  }
963 
964  $this->form_gui->setValuesByPost();
965  $this->tpl->setContent($this->form_gui->getHTML());
966  }
967 
972  {
973  global $tpl, $ilTabs;
974 
975  $this->checkPermission("write");
976  $ilTabs->activateTab("wiki_contributors");
977 
978  include_once("./Modules/Wiki/classes/class.ilWikiContributorsTableGUI.php");
979 
980  $table_gui = new ilWikiContributorsTableGUI($this, "listContributors",
981  $this->object->getId());
982 
983  $tpl->setContent($table_gui->getHTML());
984 
985  $this->setSideBlock();
986  }
987 
991  function saveGradingObject()
992  {
993  global $ilCtrl, $lng;
994 
995  $this->checkPermission("write");
996 
997  $users = (is_array($_POST["user_id"])
998  ? $_POST["user_id"]
999  : array());
1000 
1001  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
1002  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
1003  $saved = false;
1004  foreach($users as $user_id)
1005  {
1006  if ($user_id != "")
1007  {
1008  $marks_obj = new ilLPMarks($this->object->getId(),$user_id);
1009  $new_mark = ilUtil::stripSlashes($_POST['mark'][$user_id]);
1010  $new_comment = ilUtil::stripSlashes($_POST['lcomment'][$user_id]);
1011  $new_status = ilUtil::stripSlashes($_POST["status"][$user_id]);
1012 
1013  if ($marks_obj->getMark() != $new_mark ||
1014  $marks_obj->getComment() != $new_comment ||
1015  ilWikiContributor::_lookupStatus($this->object->getId(), $user_id) != $new_status)
1016  {
1017  ilWikiContributor::_writeStatus($this->object->getId(), $user_id, $new_status);
1018  $marks_obj->setMark($new_mark);
1019  $marks_obj->setComment($new_comment);
1020  $marks_obj->update();
1021  $saved = true;
1022  }
1023  }
1024  }
1025  if ($saved)
1026  {
1027  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1028  }
1029 
1030  $ilCtrl->redirect($this, "listContributors");
1031  }
1032 
1033  // add wiki to locator
1034  function addLocatorItems()
1035  {
1036  global $ilLocator;
1037 
1038  if (is_object($this->object))
1039  {
1040  $ilLocator->addItem($this->object->getTitle(),
1041  $this->getGotoLink($this->object->getRefId()), "", $_GET["ref_id"]);
1042  }
1043  }
1044 
1045  public static function _goto($a_target)
1046  {
1047  global $ilAccess, $ilErr, $lng, $ilNavigationHistory;
1048 
1049  $i = strpos($a_target, "_");
1050  if ($i > 0)
1051  {
1052  $a_page = substr($a_target, $i+1);
1053  $a_target = substr($a_target, 0, $i);
1054  }
1055 
1056  if ($a_target == "wpage")
1057  {
1058  $a_page_arr = explode("_", $a_page);
1059  $wpg_id = (int) $a_page_arr[0];
1060  $ref_id = (int) $a_page_arr[1];
1061  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1062  $w_id = ilWikiPage::lookupWikiId($wpg_id);
1063  if ($ref_id > 0)
1064  {
1065  $refs = array($ref_id);
1066  }
1067  else
1068  {
1069  $refs = ilObject::_getAllReferences($w_id);
1070  }
1071  foreach ($refs as $r)
1072  {
1073  if ($ilAccess->checkAccess("read", "", $r))
1074  {
1075  $a_target = $r;
1076  $a_page = ilWikiPage::lookupTitle($wpg_id);
1077  }
1078  }
1079  }
1080 
1081  if ($ilAccess->checkAccess("read", "", $a_target))
1082  {
1083  $_GET["cmd"] = "viewPage";
1084  $_GET["ref_id"] = $a_target;
1085  $_GET["page"] = $a_page;
1086  $_GET["baseClass"] = "ilwikihandlergui";
1087  $_GET["cmdClass"] = "ilobjwikigui";
1088 /* if ($a_page != "")
1089  {
1090  $add = "&amp;page=".rawurlencode($_GET["page"]);
1091  $ilNavigationHistory->addItem($_GET["ref_id"],
1092  "./goto.php?target=wiki_".$_GET["ref_id"].$add, "wiki");
1093  }*/
1094  include("ilias.php");
1095  exit;
1096  }
1097  else if ($ilAccess->checkAccess("visible", "", $a_target))
1098  {
1099  ilObjectGUI::_gotoRepositoryNode($tarr[0], "infoScreen");
1100  }
1101  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1102  {
1103  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1106  }
1107 
1108  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1109  }
1110 
1114  static function getGotoLink($a_ref_id, $a_page = "")
1115  {
1116  if ($a_page == "")
1117  {
1119  }
1120 
1121  $goto = "goto.php?target=wiki_".$a_ref_id."_".
1122  ilWikiUtil::makeUrlTitle($a_page);
1123 
1124  return $goto;
1125  }
1126 
1130  function viewPageObject()
1131  {
1132  global $lng, $ilCtrl, $tpl, $ilTabs, $ilAccess;
1133 
1134  $this->checkPermission("read");
1135 
1136  $ilTabs->clearTargets();
1137  $tpl->setHeaderActionMenu(null);
1138 
1139  $page = ($_GET["page"] != "")
1140  ? $_GET["page"]
1141  : $this->object->getStartPage();
1142  $_GET["page"] = $page;
1143 
1144  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1145  if (!ilWikiPage::exists($this->object->getId(), $page))
1146  {
1147  $page = $this->object->getStartPage();
1148  }
1149 
1150  if (!ilWikiPage::exists($this->object->getId(), $page))
1151  {
1152  ilUtil::sendInfo($lng->txt("wiki_no_start_page"), true);
1153  $ilCtrl->redirect($this, "infoScreen");
1154  return;
1155  }
1156 
1157  // page exists, show it !
1158  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($page));
1159 
1160  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
1161  $wpage_gui = ilWikiPageGUI::getGUIForTitle($this->object->getId(),
1162  ilWikiUtil::makeDbTitle($page), 0, $this->object->getRefId());
1163  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1164  $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
1165  $this->object->getStyleSheetId(), "wiki"));
1166 
1167  $this->setContentStyleSheet();
1168  //$wpage_gui->setOutputMode(IL_PAGE_PREVIEW);
1169 
1170  //$wpage_gui->setSideBlock();
1171  $ilCtrl->setCmdClass("ilwikipagegui");
1172  $ilCtrl->setCmd("preview");
1173  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
1174  (!$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) ||
1175  $wpage_gui->getPageObject()->getBlocked()
1176  ))
1177  {
1178  $wpage_gui->setEnableEditing(false);
1179  }
1180 
1181  // alter title and description
1182  //$tpl->setTitle($wpage_gui->getPageObject()->getTitle());
1183  //$tpl->setDescription($this->object->getTitle());
1184  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1185  {
1186  $wpage_gui->activateMetaDataEditor($this->object, "wpg", $wpage_gui->getId());
1187  }
1188 
1189 
1190  $html = $ilCtrl->forwardCommand($wpage_gui);
1191  //$this->addPageTabs();
1192 
1193  $tpl->setContent($html);
1194  }
1195 
1199  function allPagesObject()
1200  {
1201  global $tpl;
1202 
1203  $this->checkPermission("read");
1204 
1205  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1206 
1207  $this->addPagesSubTabs();
1208 
1209  $table_gui = new ilWikiPagesTableGUI($this, "allPages",
1210  $this->object->getId(), IL_WIKI_ALL_PAGES);
1211 
1212  $this->setSideBlock();
1213  $tpl->setContent($table_gui->getHTML());
1214  }
1215 
1220  {
1221  global $tpl;
1222 
1223  $this->checkPermission("read");
1224 
1225  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1226 
1227  $this->addPagesSubTabs();
1228 
1229  $table_gui = new ilWikiPagesTableGUI($this, "popularPages",
1230  $this->object->getId(), IL_WIKI_POPULAR_PAGES);
1231 
1232  $this->setSideBlock();
1233  $tpl->setContent($table_gui->getHTML());
1234  }
1235 
1240  {
1241  global $tpl;
1242 
1243  $this->checkPermission("read");
1244 
1245  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1246 
1247  $this->addPagesSubTabs();
1248 
1249  $table_gui = new ilWikiPagesTableGUI($this, "orphanedPages",
1250  $this->object->getId(), IL_WIKI_ORPHANED_PAGES);
1251 
1252  $this->setSideBlock();
1253  $tpl->setContent($table_gui->getHTML());
1254  }
1255 
1261  function gotoPageObject($a_page = "")
1262  {
1263  global $ilCtrl;
1264 
1265  if ($a_page == "")
1266  {
1267  $a_page = $_GET["page"];
1268  }
1269 
1270  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1271  if (ilWikiPage::_wikiPageExists($this->object->getId(),
1272  ilWikiUtil::makeDbTitle($a_page)))
1273  {
1274  // to do: get rid of this redirect
1275  ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId(), $a_page));
1276  }
1277  else
1278  {
1279  if (!$this->object->getTemplateSelectionOnCreation())
1280  {
1281  // check length
1282  include_once("./Services/Utilities/classes/class.ilStr.php");
1283  if (ilStr::strLen(ilWikiUtil::makeDbTitle($a_page)) > 200)
1284  {
1285  ilUtil::sendFailure($this->lng->txt("wiki_page_title_too_long")." (".$a_page.")", true);
1286  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle($_GET["from_page"]));
1287  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1288  }
1289  $this->object->createWikiPage($a_page);
1290 
1291  // redirect to newly created page
1292  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
1293  $ilCtrl->redirectByClass("ilwikipagegui", "edit");
1294  }
1295  else
1296  {
1297  $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
1298  $ilCtrl->setParameter($this, "from_page", ilWikiUtil::makeUrlTitle($_GET["from_page"]));
1299  $ilCtrl->redirect($this, "showTemplateSelection");
1300  }
1301  }
1302  }
1303 
1309  function randomPageObject()
1310  {
1311  $this->checkPermission("read");
1312 
1313  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1314  $page = ilWikiPage::getRandomPage($this->object->getId());
1315  $this->gotoPageObject($page);
1316  }
1317 
1322  {
1323  global $tpl;
1324 
1325  $this->checkPermission("read");
1326 
1327  include_once("./Modules/Wiki/classes/class.ilWikiRecentChangesTableGUI.php");
1328 
1329  $this->addPagesSubTabs();
1330 
1331  $table_gui = new ilWikiRecentChangesTableGUI($this, "recentChanges",
1332  $this->object->getId());
1333 
1334  $this->setSideBlock();
1335  $tpl->setContent($table_gui->getHTML());
1336  }
1337 
1341  function setSideBlock($a_wpg_id = 0)
1342  {
1343  ilObjWikiGUI::renderSideBlock($a_wpg_id, $this->object->getRefId());
1344  }
1345 
1346 
1350  static function renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp = null)
1351  {
1352  global $tpl, $lng, $ilAccess, $ilCtrl;
1353 
1354  $tpl->addJavaScript("./Modules/Wiki/js/WikiPres.js");
1355 
1356  // setting asynch to false fixes #0019457, since otherwise ilBlockGUI would act on asynch and output html when side blocks
1357  // being processed during the export. This is a flaw in ilCtrl and/or ilBlockGUI.
1358  $tpl->addOnLoadCode("il.Wiki.Pres.init('".$ilCtrl->getLinkTargetByClass("ilobjwikigui", "", "", false, false)."');");
1359 
1360  if ($a_wpg_id > 0 && !$a_wp)
1361  {
1362  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1363  $a_wp = ilWikiPage($a_wpg_id);
1364  }
1365 
1366  // search block
1367  include_once './Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
1368  $rcontent = ilRepositoryObjectSearchGUI::getSearchBlockHTML($lng->txt('wiki_search'));
1369 
1370  #include_once("./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php");
1371  #$wiki_search_block = new ilWikiSearchBlockGUI();
1372  #$rcontent = $wiki_search_block->getHTML();
1373 
1374  // quick navigation
1375  if ($a_wpg_id > 0)
1376  {
1377 // include_once("./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php");
1378 // $wiki_side_block = new ilWikiSideBlockGUI();
1379 // $wiki_side_block->setPageObject($a_wp);
1380 // $rcontent.= $wiki_side_block->getHTML();
1381 
1382  // rating
1383  $wiki_id =ilObject::_lookupObjId($a_wiki_ref_id);
1384  if(ilObjWiki::_lookupRating($wiki_id) &&
1385  // ilObjWiki::_lookupRatingAsBlock($wiki_id) &&
1386  $a_wp->getRating())
1387  {
1388  include_once("./Services/Rating/classes/class.ilRatingGUI.php");
1389  $rgui = new ilRatingGUI();
1390  $rgui->setObject($wiki_id, "wiki", $a_wpg_id, "wpg");
1391  $rgui->enableCategories(ilObjWiki::_lookupRatingCategories($wiki_id));
1392  $rgui->setYourRatingText("#");
1393  $rcontent .= $rgui->getBlockHTML($lng->txt("wiki_rate_page"));
1394  }
1395 
1396  // advanced metadata
1398  {
1399  $cmd = null;
1400  if($ilAccess->checkAccess("write", "", $a_wiki_ref_id))
1401  {
1402  $cmd = array(
1403  "edit" => $ilCtrl->getLinkTargetByClass("ilwikipagegui", "editAdvancedMetaData"),
1404  "hide" => $ilCtrl->getLinkTargetByClass("ilwikipagegui", "hideAdvancedMetaData")
1405  );
1406  }
1407  include_once("./Services/Object/classes/class.ilObjectMetaDataGUI.php");
1408  $wiki = new ilObjWiki($a_wiki_ref_id);
1409  $callback = $wiki->getLinkMetadataValues()
1410  ? array($wiki, "decorateAdvMDValue")
1411  : null;
1412  $mdgui = new ilObjectMetaDataGUI($wiki, "wpg", $a_wpg_id);
1413  $rcontent .= $mdgui->getBlockHTML($cmd, $callback); // #17291
1414  }
1415  }
1416 
1417  // important pages
1418 // if (ilObjWiki::_lookupImportantPages(ilObject::_lookupObjId($a_wiki_ref_id)))
1419 // {
1420  include_once("./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
1421  $imp_pages_block = new ilWikiImportantPagesBlockGUI();
1422  $rcontent.= $imp_pages_block->getHTML();
1423 // }
1424 
1425  // wiki functions block
1426  if ($a_wpg_id > 0)
1427  {
1428  include_once("./Modules/Wiki/classes/class.ilWikiFunctionsBlockGUI.php");
1429  $wiki_functions_block = new ilWikiFunctionsBlockGUI();
1430  $wiki_functions_block->setPageObject($a_wp);
1431  $rcontent .= $wiki_functions_block->getHTML();
1432  }
1433 
1434  $tpl->setRightContent($rcontent);
1435  }
1436 
1440  function newPagesObject()
1441  {
1442  global $tpl;
1443 
1444  $this->checkPermission("read");
1445 
1446  include_once("./Modules/Wiki/classes/class.ilWikiPagesTableGUI.php");
1447 
1448  $this->addPagesSubTabs();
1449 
1450  $table_gui = new ilWikiPagesTableGUI($this, "newPages",
1451  $this->object->getId(), IL_WIKI_NEW_PAGES);
1452 
1453  $this->setSideBlock();
1454  $tpl->setContent($table_gui->getHTML());
1455  }
1456 
1457  protected function getPrintPageIds()
1458  {
1459  // multiple ordered page ids
1460  if(is_array($_POST["wordr"]))
1461  {
1462  asort($_POST["wordr"]);
1463  $page_ids = array_keys($_POST["wordr"]);
1464  }
1465  // single page
1466  else if((int)$_GET["wpg_id"])
1467  {
1468  $page_ids = array((int)$_GET["wpg_id"]);
1469  }
1470 
1471  return $page_ids;
1472  }
1473 
1474  public function printViewObject($a_pdf_export = false)
1475  {
1476  global $tpl;
1477 
1478  $page_ids = $this->getPrintPageIds();
1479  if(!$page_ids)
1480  {
1481  $this->ctrl->redirect($this, "");
1482  }
1483 
1484  $tpl = new ilTemplate("tpl.main.html", true, true);
1485  $tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle());
1486  $this->setContentStyleSheet($tpl);
1487 
1488  // syntax style
1489  $tpl->setCurrentBlock("SyntaxStyle");
1490  $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1492  $tpl->parseCurrentBlock();
1493 
1494 
1495  // determine target frames for internal links
1496 
1497  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
1498 
1499  $page_content = "";
1500 
1501  foreach ($page_ids as $p_id)
1502  {
1503  $page_gui = new ilWikiPageGUI($p_id);
1504  $page_gui->setWiki($this->object);
1505  $page_gui->setOutputMode("print");
1506  $page_content.= $page_gui->showPage();
1507 
1508  if($a_pdf_export)
1509  {
1510  $page_content .= '<p style="page-break-after:always;"></p>';
1511  }
1512  }
1513 
1514  $page_content = '<div class="ilInvisibleBorder">'.$page_content.'</div>';
1515 
1516  if(!$a_pdf_export)
1517  {
1518  $page_content .= '<script type="text/javascript" language="javascript1.2">
1519  <!--
1520  il.Util.addOnLoad(function () {
1521  il.Util.print();
1522  });
1523  //-->
1524  </script>';
1525  }
1526 
1527  $tpl->setVariable("CONTENT", $page_content);
1528 
1529  if(!$a_pdf_export)
1530  {
1531  $tpl->show(false);
1532  exit;
1533  }
1534  else
1535  {
1536  return $tpl->get("DEFAULT", false, false, false, true, false, false);
1537  }
1538  }
1539 
1540  public function pdfExportObject()
1541  {
1542 
1543  // prepare generation before contents are processed (for mathjax)
1544  require_once 'Services/PDFGeneration/classes/class.ilPDFGeneration.php';
1546 
1547  $html = $this->printViewObject(true);
1548 
1549  // :TODO: fixing css dummy parameters
1550  $html = preg_replace("/\?dummy\=[0-9]+/", "", $html);
1551  $html = preg_replace("/\?vers\=[0-9A-Za-z\-]+/", "", $html);
1552 
1553  include_once "Services/PDFGeneration/classes/class.ilPDFGeneration.php";
1554  include_once "Services/PDFGeneration/classes/class.ilPDFGenerationJob.php";
1555 
1556  $job = new ilPDFGenerationJob();
1557  $job->setAutoPageBreak(true)
1558  ->setMarginLeft("10")
1559  ->setMarginRight("10")
1560  ->setMarginTop("10")
1561  ->setMarginBottom("10")
1562  ->setOutputMode("D") // download
1563  ->setFilename("wiki.pdf") // :TODO:
1564  ->setCreator("ILIAS Wiki") // :TODO:
1565  ->setImageScale(1.25) // complete content scaling ?!
1566  ->addPage($html);
1567 
1568  ilPDFGeneration::doJob($job);
1569  }
1570 
1575  {
1576  global $tpl, $ilTabs, $ilCtrl, $lng;
1577 
1578  $this->checkPermission("read");
1579 
1580  include_once("./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php");
1581 
1582  $ilTabs->setTabActive("wiki_search_results");
1583 
1584  if (trim($_POST["search_term"]) == "")
1585  {
1586  ilUtil::sendFailure($lng->txt("wiki_please_enter_search_term"), true);
1587  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
1588  }
1589 
1590  $search_results = ilObjWiki::_performSearch($this->object->getId(),
1591  ilUtil::stripSlashes($_POST["search_term"]));
1592  $table_gui = new ilWikiSearchResultsTableGUI($this, "performSearch",
1593  $this->object->getId(), $search_results, $_POST["search_term"]);
1594 
1595  $this->setSideBlock();
1596  $tpl->setContent($table_gui->getHTML());
1597  }
1598 
1602  function setContentStyleSheet($a_tpl = null)
1603  {
1604  global $tpl;
1605 
1606  if ($a_tpl != null)
1607  {
1608  $ctpl = $a_tpl;
1609  }
1610  else
1611  {
1612  $ctpl = $tpl;
1613  }
1614 
1615  $ctpl->setCurrentBlock("ContentStyle");
1616  $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
1617  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
1618  $ctpl->parseCurrentBlock();
1619 
1620  }
1621 
1622 
1627  {
1628  global $ilTabs, $tpl;
1629 
1630  $this->checkPermission("write");
1631 
1632  $this->initStylePropertiesForm();
1633  $tpl->setContent($this->form->getHTML());
1634 
1635  $ilTabs->activateTab("settings");
1636  $this->setSettingsSubTabs("style");
1637 
1638  $this->setSideBlock();
1639  }
1640 
1645  {
1646  global $ilCtrl, $lng, $ilTabs, $ilSetting;
1647 
1648  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1649  $lng->loadLanguageModule("style");
1650 
1651  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1652  $this->form = new ilPropertyFormGUI();
1653 
1654  $fixed_style = $ilSetting->get("fixed_content_style_id");
1655  $style_id = $this->object->getStyleSheetId();
1656 
1657  if ($fixed_style > 0)
1658  {
1659  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1660  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
1661  $this->lng->txt("global_fixed").")");
1662  $this->form->addItem($st);
1663  }
1664  else
1665  {
1666  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
1667  $_GET["ref_id"]);
1668 
1669  $st_styles[0] = $this->lng->txt("default");
1670  ksort($st_styles);
1671 
1672  if ($style_id > 0)
1673  {
1674  // individual style
1675  if (!ilObjStyleSheet::_lookupStandard($style_id))
1676  {
1677  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1678  $st->setValue(ilObject::_lookupTitle($style_id));
1679  $this->form->addItem($st);
1680 
1681 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1682 
1683  // delete command
1684  $this->form->addCommandButton("editStyle",
1685  $lng->txt("style_edit_style"));
1686  $this->form->addCommandButton("deleteStyle",
1687  $lng->txt("style_delete_style"));
1688 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1689  }
1690  }
1691 
1692  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1693  {
1694  $style_sel = ilUtil::formSelect ($style_id, "style_id",
1695  $st_styles, false, true);
1696  $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
1697  $style_sel->setOptions($st_styles);
1698  $style_sel->setValue($style_id);
1699  $this->form->addItem($style_sel);
1700 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1701  $this->form->addCommandButton("saveStyleSettings",
1702  $lng->txt("save"));
1703  $this->form->addCommandButton("createStyle",
1704  $lng->txt("sty_create_ind_style"));
1705  }
1706  }
1707  $this->form->setTitle($lng->txt("wiki_style"));
1708  $this->form->setFormAction($ilCtrl->getFormAction($this));
1709  }
1710 
1715  {
1716  global $ilCtrl;
1717 
1718  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1719  }
1720 
1724  function editStyleObject()
1725  {
1726  global $ilCtrl;
1727 
1728  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1729  }
1730 
1735  {
1736  global $ilCtrl;
1737 
1738  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1739  }
1740 
1745  {
1746  global $ilSetting;
1747 
1748  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1749  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1750  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1751  || $this->object->getStyleSheetId() == 0))
1752  {
1753  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1754  $this->object->update();
1755  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1756  }
1757  $this->ctrl->redirect($this, "editStyleProperties");
1758  }
1759 
1760  //
1761  // Important pages
1762  //
1763 
1768  {
1769  global $tpl, $ilToolbar, $ilTabs, $lng, $ilCtrl;
1770 
1771  $this->checkPermission("edit_wiki_navigation");
1772 
1773  ilUtil::sendInfo($lng->txt("wiki_navigation_info"));
1774 
1775  $ipages = ilObjWiki::_lookupImportantPagesList($this->object->getId());
1776  $ipages_ids = array();
1777  foreach ($ipages as $i)
1778  {
1779  $ipages_ids[] = $i["page_id"];
1780  }
1781 
1782  // list pages
1783  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1784  $pages = ilWikiPage::getAllWikiPages($this->object->getId());
1785  $options = array("" => $lng->txt("please_select"));
1786  foreach ($pages as $p)
1787  {
1788  if (!in_array($p["id"], $ipages_ids))
1789  {
1790  $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
1791  }
1792  }
1793  if (count($options) > 0)
1794  {
1795  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1796  $si = new ilSelectInputGUI($lng->txt("wiki_pages"), "imp_page_id");
1797  $si->setOptions($options);
1798  $si->setInfo($lng->txt(""));
1799  $ilToolbar->addInputItem($si);
1800  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1801  $ilToolbar->addFormButton($lng->txt("add"), "addImportantPage");
1802  }
1803 
1804 
1805  $ilTabs->activateTab("settings");
1806  $this->setSettingsSubTabs("imp_pages");
1807 
1808  include_once("./Modules/Wiki/classes/class.ilImportantPagesTableGUI.php");
1809  $imp_table = new ilImportantPagesTableGUI($this, "editImportantPages");
1810 
1811  $tpl->setContent($imp_table->getHTML());
1812  }
1813 
1821  {
1822  global $ilCtrl, $lng;
1823 
1824  $this->checkPermission("edit_wiki_navigation");
1825 
1826  if ($_POST["imp_page_id"] > 0)
1827  {
1828  $this->object->addImportantPage((int) $_POST["imp_page_id"]);
1829  ilUtil::sendSuccess($lng->txt("wiki_imp_page_added"), true);
1830  }
1831  $ilCtrl->redirect($this, "editImportantPages");
1832  }
1833 
1838  {
1839  global $ilCtrl, $tpl, $lng;
1840 
1841  if (!is_array($_POST["imp_page_id"]) || count($_POST["imp_page_id"]) == 0)
1842  {
1843  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1844  $ilCtrl->redirect($this, "editImportantPages");
1845  }
1846  else
1847  {
1848  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1849  $cgui = new ilConfirmationGUI();
1850  $cgui->setFormAction($ilCtrl->getFormAction($this));
1851  $cgui->setHeaderText($lng->txt("wiki_sure_remove_imp_pages"));
1852  $cgui->setCancel($lng->txt("cancel"), "editImportantPages");
1853  $cgui->setConfirm($lng->txt("remove"), "removeImportantPages");
1854 
1855  foreach ($_POST["imp_page_id"] as $i)
1856  {
1857  $cgui->addItem("imp_page_id[]", $i, ilWikiPage::lookupTitle((int) $i));
1858  }
1859 
1860  $tpl->setContent($cgui->getHTML());
1861  }
1862  }
1863 
1871  {
1872  global $ilCtrl, $lng;
1873 
1874  $this->checkPermission("edit_wiki_navigation");
1875 
1876  if (is_array($_POST["imp_page_id"]))
1877  {
1878  foreach ($_POST["imp_page_id"] as $i)
1879  {
1880  $this->object->removeImportantPage((int) $i);
1881  }
1882  }
1883  ilUtil::sendSuccess($lng->txt("wiki_removed_imp_pages"), true);
1884  $ilCtrl->redirect($this, "editImportantPages");
1885  }
1886 
1891  {
1892  global $ilCtrl, $lng;
1893 
1894  $this->checkPermission("edit_wiki_navigation");
1895 
1896  $this->object->saveOrderingAndIndentation($_POST["ord"], $_POST["indent"]);
1897  ilUtil::sendSuccess($lng->txt("wiki_ordering_and_indent_saved"), true);
1898  $ilCtrl->redirect($this, "editImportantPages");
1899  }
1900 
1905  {
1906  global $ilCtrl, $lng;
1907 
1908  $this->checkPermission("edit_wiki_navigation");
1909 
1910  if (!is_array($_POST["imp_page_id"]) || count($_POST["imp_page_id"]) != 1)
1911  {
1912  ilUtil::sendInfo($lng->txt("wiki_select_one_item"), true);
1913  }
1914  else
1915  {
1916  $this->object->removeImportantPage((int) $_POST["imp_page_id"][0]);
1917  $this->object->setStartPage(ilWikiPage::lookupTitle((int) $_POST["imp_page_id"][0]));
1918  $this->object->update();
1919  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1920  }
1921  $ilCtrl->redirect($this, "editImportantPages");
1922  }
1923 
1924 
1928  function exportHTML()
1929  {
1930  require_once("./Modules/Wiki/classes/class.ilWikiHTMLExport.php");
1931  $cont_exp = new ilWikiHTMLExport($this->object);
1932  $cont_exp->buildExportFile();
1933  }
1934 
1942  static function lookupSubObjectTitle($a_wiki_id, $a_page_id)
1943  {
1944  include_once "Modules/Wiki/classes/class.ilWikiPage.php";
1945  $page = new ilWikiPage($a_page_id);
1946  if($page->getWikiId() == $a_wiki_id)
1947  {
1948  return $page->getTitle();
1949  }
1950  }
1951 
1959  function getSubObjectTitle($a_id, $a_type)
1960  {
1961  include_once "Modules/Wiki/classes/class.ilWikiPage.php";
1962  return ilWikiPage::lookupTitle($a_id);
1963  }
1964 
1969  {
1970  global $lng, $tpl, $ilTabs, $ilCtrl;
1971 
1972 
1973  $ilCtrl->setParameterByClass("ilobjwikigui", "from_page", ilWikiUtil::makeUrlTitle($_GET["from_page"]));
1974  $ilTabs->clearTargets();
1975  ilUtil::sendInfo($lng->txt("wiki_page_not_exist_select_templ"));
1976 
1977  $form = $this->initTemplateSelectionForm();
1978  $tpl->setContent($form->getHTML());
1979  }
1980 
1984  public function initTemplateSelectionForm()
1985  {
1986  global $lng, $ilCtrl;
1987 
1988  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1989  $form = new ilPropertyFormGUI();
1990 
1991  // page name
1992  $hi = new ilHiddenInputGUI("page");
1993  $hi->setValue($_GET["page"]);
1994  $form->addItem($hi);
1995 
1996  // page template
1997  $radg = new ilRadioGroupInputGUI($lng->txt("wiki_page_template"), "page_templ");
1998  $radg->setRequired(true);
1999 
2000  if ($this->object->getEmptyPageTemplate())
2001  {
2002  $op1 = new ilRadioOption($lng->txt("wiki_empty_page"), 0);
2003  $radg->addOption($op1);
2004  }
2005 
2006  include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
2007  $wt = new ilWikiPageTemplate($this->object->getId());
2009  foreach ($ts as $t)
2010  {
2011  $op = new ilRadioOption($t["title"], $t["wpage_id"]);
2012  $radg->addOption($op);
2013  }
2014 
2015  $form->addItem($radg);
2016 
2017  // save and cancel commands
2018  $form->addCommandButton("createPageUsingTemplate", $lng->txt("wiki_create_page"));
2019  $form->addCommandButton("cancelCreationPageUsingTemplate", $lng->txt("cancel"));
2020 
2021  $form->setTitle($lng->txt("wiki_new_page").": ".$_GET["page"]);
2022  $form->setFormAction($ilCtrl->getFormAction($this));
2023 
2024  return $form;
2025  }
2026 
2031  {
2032  global $tpl, $lng, $ilCtrl;
2033 
2034  $form = $this->initTemplateSelectionForm();
2035  if ($form->checkInput())
2036  {
2037  $a_page = $_POST["page"];
2038  $this->object->createWikiPage($a_page, (int) $_POST["page_templ"]);
2039 
2040  // redirect to newly created page
2041  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($a_page)));
2042  $ilCtrl->redirectByClass("ilwikipagegui", "edit");
2043 
2044  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2045  $ilCtrl->redirect($this, "");
2046  }
2047  else
2048  {
2049  $form->setValuesByPost();
2050  $tpl->setContent($form->getHtml());
2051  }
2052  }
2053 
2058  {
2059  global $ilCtrl;
2060 
2061  // redirect to newly created page
2062  $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle(($_GET["from_page"])));
2063  $ilCtrl->redirectByClass("ilwikipagegui", "preview");
2064  }
2065 
2075  protected function checkPermissionBool($a_perm, $a_cmd = "", $a_type = "", $a_ref_id = null)
2076  {
2077  if($a_perm == "create")
2078  {
2079  return parent::checkPermissionBool($a_perm, $a_cmd, $a_type, $a_ref_id);
2080  }
2081  else
2082  {
2083  if (!$a_ref_id)
2084  {
2085  $a_ref_id = $this->object->getRefId();
2086  }
2087  include_once("./Modules/Wiki/classes/class.ilWikiPerm.php");
2088  return ilWikiPerm::check($a_perm, $a_ref_id, $a_cmd);
2089  }
2090  }
2091 
2092 
2093  //
2094  // User HTML Export
2095  //
2096 
2101  {
2102  $this->log->debug("init");
2103  $this->checkPermission("wiki_html_export");
2104  $this->object->initUserHTMLExport();
2105  }
2106 
2111  {
2112  $this->log->debug("start");
2113  $this->checkPermission("wiki_html_export");
2114  $this->object->startUserHTMLExport();
2115  }
2116 
2121  {
2122  $this->log->debug("get progress");
2123  $this->checkPermission("wiki_html_export");
2124  $p = $this->object->getUserHTMLExportProgress();
2125 
2126  include_once("./Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php");
2128  $pb->setCurrent($p["progress"]);
2129 
2130  $r = new stdClass();
2131  $r->progressBar = $pb->render();
2132  $r->status = $p["status"];
2133  include_once("./Services/JSON/classes/class.ilJsonUtil.php");
2134  $this->log->debug("status: ".$r->status);
2136  exit;
2137  }
2138 
2143  {
2144  $this->log->debug("download");
2145  $this->checkPermission("wiki_html_export");
2146  $this->object->deliverUserHTMLExport();
2147  }
2148 
2149 
2150 }
2151 
2152 ?>
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.
UI class for handling permissions that can be configured having the write permission for an object...
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.
global $ilErr
Definition: raiseError.php:16
exportHTML()
Create html package.
This class represents an option in a radio group.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
Class ilObjectMetaDataGUI.
static getContentPrintStyle()
get content print style
initStylePropertiesForm()
Init style properties form.
getAllInfo($a_type=self::TYPE_ALL)
Get all info.
Class ilInfoScreenGUI.
editStylePropertiesObject()
Edit style properties.
allPagesObject()
All pages of wiki.
TableGUI class for listing users that contributed to the wiki.
static strLen($a_string)
Definition: class.ilStr.php:91
getUserHTMLExportProgressObject()
Get user html export progress.
static check($a_perm, $a_ref_id, $a_cmd="")
Check permission.
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.
Wiki page template gui class.
This class represents a property form user interface.
GUI class for the workflow of copying objects.
TableGUI class for recent changes in wiki.
addImportantPageObject()
Add important pages.
$_GET["client_id"]
orphanedPagesObject()
Orphaned pages.
static checkShortTitleAvailability($a_short_title)
Check availability of short title.
This class represents a section header in a property form.
static lookupSubObjectTitle($a_wiki_id, $a_page_id)
Get title for wiki page (used in ilNotesGUI)
Wiki statistics GUI class.
Class ilObject Basic functions for all objects.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
saveGradingObject()
Save grading.
static _getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static _writeStatus($a_obj_id, $a_user_id, $a_status)
Write success status.
static _lookupStartPage($a_wiki_id)
Lookup start page.
$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.
addPageTabs()
Add Page Tabs.
static _lookupTitle($a_id)
lookup object title
downloadUserHTMLExportObject()
Download user html export file.
initCreationForms($a_new_type)
static _lookupRatingCategories($a_wiki_id)
Lookup whether rating categories are activated.
fillCloneTemplate($a_tpl_varname, $a_type)
Fill object clone template This method can be called from any object GUI class that wants to offer ob...
static lookupAdvancedMetadataHidden($a_page_id)
static getPageIdForTitle($a_wiki_id, $a_title)
Get wiki page object for id and title.
confirmRemoveImportantPagesObject()
Confirm important pages deletion.
static _getAllReferences($a_id)
get all reference ids of object
setTitle($a_title)
set object title
saveObject()
save object public
popularPagesObject()
Popular pages.
createStyleObject()
Create Style.
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
static getRandomPage($a_wiki_id)
Get a random page.
static _lookupStandard($a_id)
Lookup standard flag.
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.
startUserHTMLExportObject()
Export html (as user)
static hasAutoRating($a_type, $a_ref_id)
Check if auto rating is active for parent group/course.
printViewObject($a_pdf_export=false)
$a_type
Definition: workflow.php:93
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.
This class represents a hidden form property in a property form.
$info
Definition: example_052.php:80
prepareOutput($a_show_subobjects=true)
prepare output
Class ilECSWikiSettings.
static _performSearch($a_wiki_id, $a_searchterm)
Search in Wiki.
GUI class for public user profile presentation.
$r
Definition: example_031.php:79
This class represents a property in a property form.
static _getPageIdForWikiTitle($a_wiki_id, $a_title)
Checks whether a page with given title exists.
static encode($mixed, $suppress_native=false)
editImportantPagesObject()
List important pages.
Class ilRatingGUI.
static getInstance()
Factory.
if(!is_array($argv)) $options
saveSettingsObject()
Save Settings.
static makeUrlTitle($a_par)
Set page parameter for Url Embedding.
addPagesSubTabs()
Add Pages SubTabs.
initTemplateSelectionForm()
Init template selection form.
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 ilObjWiki.
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.
cancelCreationPageUsingTemplateObject()
Cancel page creation using a template.
setAsStartPageObject()
Confirm important pages deletion.
initUserHTMLExportObject()
Export html (as user)
This class represents a text property in a property form.
createPageUsingTemplateObject()
Save creation with template form.
Class ilWikiPage GUI class.
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
Class ilWikiPage.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSyntaxStylePath()
get syntax style path
setOptions($a_options)
Set Options.
showTemplateSelectionObject()
Show template selection.
getTabs()
get tabs public
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
static makeDbTitle($a_par)
Handle page GET parameter.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getSettingsFormValues($a_mode="edit")
static _wikiPageExists($a_wiki_id, $a_title)
Check whether page exists for wiki or not.
static getContentStylePath($a_style_id)
get content style path
static prepareGeneration()
Prepare the PDF generation This initializes the purpose for MathJax rendering It has to be called bef...
static getSearchBlockHTML($a_title)
Get standar search block html.
const IL_WIKI_ALL_PAGES
randomPageObject()
Go to random page.
deleteStyleObject()
Delete Style.
initSettingsForm($a_mode="edit")
Init Settings Form.
static exists($a_wiki_id, $a_title)
Checks whether a page with given title exists.
Class ilPDFGenerationJob.
editSettingsObject()
Edit settings.
This class represents a non editable value in a property form.
setContentStyleSheet($a_tpl=null)
Set content style sheet.
Create new PHPExcel object
obj_idprivate
Class ilObjStyleSheetGUI.
global $ilSetting
Definition: privfeed.php:17
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.
$ret
Definition: parser.php:6
static isOnlineHelpWiki($a_ref_id)
Is wiki an online help wiki?
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
getRefId()
get reference id public
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.
setDescription($a_desc)
set object description
static getLogger($a_component_id)
Get component logger.
static _lookupMark($a_usr_id, $a_obj_id)
update()
update object in db
static _lookupComment($a_usr_id, $a_obj_id)
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor public.
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.
static doJob(ilPDFGenerationJob $job)
$_POST["username"]
editStyleObject()
Edit Style.
$html
Definition: example_001.php:87
recentChangesObject()
Recent Changes.
Class ilObjWikiGUI.
setRequired($a_required)
Set Required.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
viewPageObject()
view wiki page
static _goto($a_target)
Confirmation screen class.
afterSave(ilObject $newObj)
save object public
const IL_WIKI_NEW_PAGES