ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilContainerGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObjectGUI.php";
5 require_once "./Services/Container/classes/class.ilContainer.php";
6 include_once './Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
7 
20 {
21  var $bl_cnt = 1; // block counter
23 
28  function ilContainerGUI($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
29  {
30  global $rbacsystem, $lng, $tree;
31 
32  $this->rbacsystem =& $rbacsystem;
33 
34  $lng->loadLanguageModule("cntr");
35 
36  //$this->ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
37 
38  // Activate tree cache when rendering the container to improve performance
39  //$tree->useCache(false);
40 
41  // prepare output things should generally be made in executeCommand
42  // method (maybe dependent on current class/command
43  $this->ilObjectGUI($a_data, $a_id, $a_call_by_reference, false);
44  }
45 
50  function &executeCommand()
51  {
52  global $tpl;
53 
54  $next_class = $this->ctrl->getNextClass();
55  $cmd = $this->ctrl->getCmd("render");
56 
57  switch($next_class)
58  {
59  // page editing
60  case "ilcontainerpagegui":
61  if ($_GET["redirectSource"] != "ilinternallinkgui")
62  {
63  $ret = $this->forwardToPageObject();
64  $tpl->setContent($ret);
65  }
66  else
67  {
68  return "";
69  }
70  break;
71 
72  case "ilobjstylesheetgui":
73  $this->forwardToStyleSheet();
74  break;
75 
76  default:
77  $this->prepareOutput();
78  $cmd .= "Object";
79  $this->$cmd();
80  break;
81  }
82  return true;
83  }
84 
90  protected function getEditFormValues()
91  {
92  $values = parent::getEditFormValues();
93 
94  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
95  $values['didactic_type'] =
96  'dtpl_'.ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
97 
98  return $values;
99  }
100 
104  protected function afterUpdate()
105  {
106  // check if template is changed
107  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
108  $current_tpl_id = (int) ilDidacticTemplateObjSettings::lookupTemplateId(
109  $this->object->getRefId()
110  );
111  $new_tpl_id = (int) $this->getDidacticTemplateVar('dtpl');
112 
113  if($new_tpl_id != $current_tpl_id)
114  {
115  $_REQUEST['tplid'] = $new_tpl_id;
116 
117  // redirect to didactic template confirmation
118  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
119  $this->ctrl->setReturn($this,'edit');
120  $this->ctrl->setCmdClass('ildidactictemplategui');
121  $this->ctrl->setCmd('confirmTemplateSwitch');
122  $dtpl_gui = new ilDidacticTemplateGUI($this);
123  return $this->ctrl->forwardCommand($dtpl_gui);
124  }
125  parent::afterUpdate();
126  }
127 
128 
133  {
134  global $ilCtrl, $ilTabs;
135 
136  $ilTabs->clearTargets();
137 
138  $cmd = $ilCtrl->getCmd();
139  include_once ("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
140  $this->ctrl->setReturn($this, "editStyleProperties");
141  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
142  $style_gui->omitLocator();
143  if ($cmd == "create" || $_GET["new_type"]=="sty")
144  {
145  $style_gui->setCreationMode(true);
146  }
147 
148  if ($cmd == "confirmedDelete")
149  {
150  $this->object->setStyleSheetId(0);
151  $this->object->update();
152  }
153 
154  $ret = $this->ctrl->forwardCommand($style_gui);
155 
156  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
157  {
158  $style_id = $ret;
159  $this->object->setStyleSheetId($style_id);
160  $this->object->update();
161  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
162  }
163  }
164 
165 
170  {
171  global $lng, $ilTabs, $ilCtrl;
172 
173  $cmd = $ilCtrl->getCmd();
174 
175  if (in_array($cmd, array("displayMediaFullscreen", "downloadFile", "displayMedia")))
176  {
177  $this->checkPermission("read");
178  }
179  else
180  {
181  $this->checkPermission("write");
182  }
183 
184  $ilTabs->clearTargets();
185 
186  if ($_GET["redirectSource"] == "ilinternallinkgui")
187  {
188  exit;
189  }
190 
191  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
192  "xhtml_page");
193  if ($xpage_id > 0)
194  {
195  $ilTabs->setBackTarget($lng->txt("cntr_back_to_old_editor"),
196  $ilCtrl->getLinkTarget($this, "switchToOldEditor"), "_top");
197  }
198  else
199  {
200  $ilTabs->setBackTarget($lng->txt("back"), "./goto.php?target=".$this->object->getType()."_".
201  $this->object->getRefId(), "_top");
202  }
203 
204  // page object
205  include_once("./Services/Container/classes/class.ilContainerPage.php");
206  include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
207 
208  $lng->loadLanguageModule("content");
209 
210  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
211  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
212  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
213  $this->tpl->setCurrentBlock("SyntaxStyle");
214  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
216  $this->tpl->parseCurrentBlock();
217 
218  if (!ilContainerPage::_exists("cont",
219  $this->object->getId()))
220  {
221  // doesn't exist -> create new one
222  $new_page_object = new ilContainerPage();
223  $new_page_object->setParentId($this->object->getId());
224  $new_page_object->setId($this->object->getId());
225  $new_page_object->createFromXML();
226  }
227 
228  // get page object
229  $this->ctrl->setReturnByClass("ilcontainerpagegui", "edit");
230  $page_gui = new ilContainerPageGUI($this->object->getId());
231  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
232  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
233  $this->object->getStyleSheetId(), $this->object->getType()));
234 
235  $page_gui->setTemplateTargetVar("ADM_CONTENT");
236  $page_gui->setLinkXML($link_xml);
237  $page_gui->setFileDownloadLink("");
238  $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "showMediaFullscreen"));
239  //$page_gui->setLinkParams($this->ctrl->getUrlParameterString()); // todo
240  $page_gui->setPresentationTitle("");
241  $page_gui->setTemplateOutput(false);
242 
243  // old editor information text
244  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
245  "xhtml_page");
246  if ($xpage_id > 0)
247  {
248  $wtpl = new ilTemplate("tpl.cntr_old_editor_message.html", true,
249  true, "Services/Container");
250  $wtpl->setVariable("ALT_WARNING", $lng->txt("warning"));
251  $wtpl->setVariable("IMG_WARNING",
252  ilUtil::getImagePath("icon_alert.svg"));
253  $wtpl->setVariable("TXT_MIGRATION_INFO", $lng->txt("cntr_switch_to_new_editor_message"));
254  $wtpl->setVariable("TXT_MIGRATION_INFO", $lng->txt("cntr_switch_to_new_editor_message"));
255  $wtpl->setVariable("HREF_SWITCH_TO_NEW_EDITOR",
256  $ilCtrl->getLinkTarget($this, "useNewEditor"));
257  $wtpl->setVariable("TXT_MIGRATION_SWITCH",
258  $lng->txt("cntr_switch_to_new_editor_cmd"));
259  $page_gui->setPrependingHtml($wtpl->get());
260  }
261 
262  // style tab
263  $page_gui->setTabHook($this, "addPageTabs");
264 
265  $ret = $this->ctrl->forwardCommand($page_gui);
266 
267  //$ret =& $page_gui->executeCommand();
268  return $ret;
269  }
270 
274  function addPageTabs()
275  {
276  global $ilTabs, $ilCtrl;
277 
278  $ilTabs->addTarget("obj_sty",
279  $ilCtrl->getLinkTarget($this, 'editStyleProperties'), "editStyleProperties");
280  }
281 
286  {
287  global $ilSetting, $ilUser;
288 
289  if (!$ilSetting->get("enable_cat_page_edit"))
290  {
291  return;
292  }
293 
294  // old page editor content
295  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
296  "xhtml_page");
297  if ($xpage_id > 0)
298  {
299  include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
300  $xpage = new ilXHTMLPage($xpage_id);
301  return $xpage->getContent();
302  }
303 
304 
305  // page object
306 
307 
308  // if page does not exist, return nothing
309  include_once("./Services/COPage/classes/class.ilPageUtil.php");
310  if (!ilPageUtil::_existsAndNotEmpty("cont",
311  $this->object->getId()))
312  {
313  return "";
314  }
315  include_once("./Services/Container/classes/class.ilContainerPage.php");
316  include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
317 
318  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
319  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
320  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
321  $this->tpl->setCurrentBlock("SyntaxStyle");
322  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
324  $this->tpl->parseCurrentBlock();
325 
326  // get page object
327  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
328  $ot = ilObjectTranslation::getInstance($this->object->getId());
329  $lang = $ot->getEffectiveContentLang($ilUser->getCurrentLanguage(), "cont");
330  $page_gui = new ilContainerPageGUI($this->object->getId(), 0, $lang);
331  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
332  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
333  $this->object->getStyleSheetId(), $this->object->getType()));
334 
335  $page_gui->setPresentationTitle("");
336  $page_gui->setTemplateOutput(false);
337  $page_gui->setHeader("");
338  $ret = $page_gui->showPage();
339 
340  //$ret = "<div style='background-color: white; padding:5px; margin-bottom: 30px;'>".$ret."</div>";
341 
342  //$ret =& $page_gui->executeCommand();
343  return $ret;
344  }
345 
349  function prepareOutput($a_show_subobjects = true)
350  {
351  if (parent::prepareOutput()) // return false in admin mode
352  {
353  if ($this->getCreationMode() != true && $a_show_subobjects)
354  {
355  // This method is called directly from ilContainerGUI::renderObject
356  #$this->showPossibleSubObjects();
357  $this->showTreeFlatIcon();
358 
359  // Member view
360  include_once './Services/Container/classes/class.ilMemberViewGUI.php';
361  ilMemberViewGUI::showMemberViewSwitch($this->object->getRefId());
362  }
363  }
364  }
365 
366  function showTreeFlatIcon()
367  {
368  global $tpl;
369 
370  // dont show icon, if role (permission gui->rolegui) is edited
371  if ($_GET["obj_id"] != "")
372  {
373  return;
374  }
375  // hide for member view
376  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
377  if(ilMemberViewSettings::getInstance()->isActive())
378  {
379  return;
380  }
381 
382  $mode = ($_SESSION["il_rep_mode"] == "flat")
383  ? "tree"
384  : "flat";
385  $link = "ilias.php?baseClass=ilRepositoryGUI&amp;cmd=frameset&amp;set_mode=".$mode."&amp;ref_id=".$this->object->getRefId();
386  $tpl->setTreeFlatIcon($link, $mode);
387  }
388 
393  {
394  global $ilias;
395 
396  if (!ilContainer::_lookupContainerSetting($this->object->getId(), "hide_header_icon_and_title"))
397  {
398  $this->tpl->setTitle($this->object->getTitle());
399  $this->tpl->setDescription($this->object->getLongDescription());
400 
401  // set tile icon
402  $icon = ilObject::_getIcon($this->object->getId(), "big", $this->object->getType());
403  if ($ilias->getSetting("custom_icons") &&
404  in_array($this->object->getType(), array("cat","grp","crs", "root")))
405  {
406  require_once("./Services/Container/classes/class.ilContainer.php");
407  if (($path = ilContainer::_lookupIconPath($this->object->getId(), "big")) != "")
408  {
409  $icon = $path;
410  }
411  }
412  $this->tpl->setTitleIcon($icon, $this->lng->txt("obj_".$this->object->getType()));
413 
414  include_once './Services/Object/classes/class.ilObjectListGUIFactory.php';
415  $lgui = ilObjectListGUIFactory::_getListGUIByType($this->object->getType());
416  $lgui->initItem($this->object->getRefId(), $this->object->getId());
417  $this->tpl->setAlertProperties($lgui->getAlertProperties());
418  }
419  }
420 
425  {
426  include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
427  $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
428  $gui->render();
429  }
430 
437  function getContentGUI()
438  {
439  switch ($this->object->getViewMode())
440  {
441  // all items in one block
443  include_once("./Services/Container/classes/class.ilContainerSimpleContentGUI.php");
444  $container_view = new ilContainerSimpleContentGUI($this);
445  break;
446 
448  include_once('./Services/Container/classes/class.ilContainerObjectiveGUI.php');
449  $container_view = new ilContainerObjectiveGUI($this);
450  break;
451 
452  // all items in one block
454  case IL_CRS_VIEW_TIMING: // not nice this workaround
455  include_once("./Services/Container/classes/class.ilContainerSessionsContentGUI.php");
456  $container_view = new ilContainerSessionsContentGUI($this);
457  break;
458 
459  // ILinc courses
461  include_once 'Services/Container/classes/class.ilContainerILincContentGUI.php';
462  $container_view = new ilContainerILincContentGUI($this);
463  break;
464 
465  // all items in one block
467  default:
468  include_once("./Services/Container/classes/class.ilContainerByTypeContentGUI.php");
469  $container_view = new ilContainerByTypeContentGUI($this);
470  break;
471  }
472 
473  return $container_view;
474  }
475 
476 
477 
481  function renderObject()
482  {
483  global $ilDB, $tpl, $ilTabs, $ilCtrl, $ilSetting;
484 
485  $container_view = $this->getContentGUI();
486 
487  $this->setContentSubTabs();
488  if ($this->isActiveAdministrationPanel())
489  {
490  $ilTabs->activateSubTab("manage");
491  }
492  else
493  {
494  $ilTabs->activateSubTab("view_content");
495  }
496 
497  $container_view->setOutput();
498 
499  $this->adminCommands = $container_view->adminCommands;
500 
501  // it is important not to show the subobjects/admin panel here, since
502  // we will create nested forms in case, e.g. a news/calendar item is added
503  if ($ilCtrl->getNextClass() != "ilcolumngui")
504  {
505  $this->showAdministrationPanel($tpl);
506  $this->showPossibleSubObjects();
507  }
508 
509  $this->showPermanentLink($tpl);
510 
511  // add tree updater javascript
512  if ((int) $_GET["ref_id"] > 1 && $ilSetting->get("rep_tree_synchronize"))
513  {
514  $ilCtrl->setParameter($this, "active_node", (int) $_GET["ref_id"]);
515  /*$tpl->addOnloadCode("
516  if (parent && parent.tree && parent.tree.updater)
517  {
518  parent.tree.updater('tree_div', '".
519  $ilCtrl->getLinkTarget($this, "showTree", "", true, false)
520  ."');
521  }");*/
522  }
523  }
524 
528  function setContentSubTabs()
529  {
531  }
532 
537  {
538  global $ilAccess, $lng;
539 
540  $lng->loadLanguageModule('cntr');
541 
542  if ($this->isActiveAdministrationPanel())
543  {
544  // #11545
545  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
546 
547  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
548  $toolbar = new ilToolbarGUI();
549  $this->ctrl->setParameter($this, "type", "");
550  $this->ctrl->setParameter($this, "item_ref_id", "");
551 
552  if (!$_SESSION["clipboard"])
553  {
554  if ($this->object->gotItems())
555  {
556  $toolbar->setLeadingImage(
557  ilUtil::getImagePath("arrow_upright.svg"),
558  $lng->txt("actions")
559  );
560  $toolbar->addFormButton(
561  $this->lng->txt('delete_selected_items'),
562  'delete'
563  );
564  $toolbar->addFormButton(
565  $this->lng->txt('move_selected_items'),
566  'cut'
567  );
568  $toolbar->addFormButton(
569  $this->lng->txt('copy_selected_items'),
570  'copy'
571  );
572  $toolbar->addFormButton(
573  $this->lng->txt('link_selected_items'),
574  'link'
575  );
576  // add download button if multi download enabled
577  $folder_set = new ilSetting("fold");
578  if ($folder_set->get("enable_multi_download") == true)
579  {
580  $toolbar->addSeparator();
581  $toolbar->addFormButton(
582  $this->lng->txt('download_selected_items'),
583  'download'
584  );
585  }
586  }
587  if($this->object->getType() == 'crs')
588  {
589  if($this->object->gotItems())
590  {
591  $toolbar->addSeparator();
592  }
593 
594  $toolbar->addButton(
595  $this->lng->txt('cntr_adopt_content'),
596  $this->ctrl->getLinkTargetByClass(
597  'ilObjectCopyGUI',
598  'initSourceSelection')
599  );
600  }
601  }
602  else
603  {
604  //$GLOBALS["tpl"]->addAdminPanelCommand("paste",
605  // $this->lng->txt("paste_clipboard_items"));
606 
607  $toolbar->addFormButton(
608  $this->lng->txt('paste_clipboard_items'),
609  'paste'
610  );
611 
612  if($_SESSION["clipboard"]["cmd"] == "link")
613  {
614  //$GLOBALS["tpl"]->addAdminPanelCommand("initAndDisplayLinkIntoMultipleObjects",
615  // $this->lng->txt("paste_clipboard_items_into_multiple_objects"));
616  /*$toolbar->addFormButton(
617  $this->lng->txt('paste_clipboard_items_into_multiple_objects'),
618  'initAndDisplayLinkIntoMultipleObjects'
619  );*/
620  }
621 
622  $toolbar->addFormButton(
623  $this->lng->txt('clear_clipboard'),
624  'clear'
625  );
626 
627  if ($this->isMultiDownloadEnabled())
628  {
629  $toolbar->addSeparator();
630  $toolbar->addFormButton(
631  $this->lng->txt('download_selected_items'),
632  'download'
633  );
634  }
635  }
636 
637  $GLOBALS['tpl']->addAdminPanelToolbar(
638  $toolbar,
639  ($this->object->gotItems() && !$_SESSION["clipboard"]) ? true : false,
640  ($this->object->gotItems() && !$_SESSION["clipboard"]) ? true : false
641  );
642 
643  // form action needed, see http://www.ilias.de/mantis/view.php?id=9630
644  if ($this->object->gotItems())
645  {
646  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
647  }
648  }
649  else
650  {
651  if ($this->edit_order)
652  {
653  if($this->object->gotItems() and $ilAccess->checkAccess("write", "", $this->object->getRefId()))
654  {
655  include_once('./Services/Container/classes/class.ilContainer.php');
656 
657  if ($this->isActiveOrdering())
658  {
659  // #11843
660  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
661 
662  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
663  $toolbar = new ilToolbarGUI();
664  $this->ctrl->setParameter($this, "type", "");
665  $this->ctrl->setParameter($this, "item_ref_id", "");
666 
667  $toolbar->addFormButton(
668  $this->lng->txt('sorting_save'),
669  'saveSorting'
670  );
671 
672  $GLOBALS['tpl']->addAdminPanelToolbar($toolbar, true, false);
673 
674  /*
675  $GLOBALS["tpl"]->addAdminPanelCommand("saveSorting",
676  $this->lng->txt('sorting_save'));
677 
678  // button should appear at bottom, too
679  $GLOBALS["tpl"]->admin_panel_bottom = true;
680  */
681  }
682  }
683  }
684  else if ($this->isMultiDownloadEnabled())
685  {
686  // #11843
687  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
688 
689  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
690  $toolbar = new ilToolbarGUI();
691  $this->ctrl->setParameter($this, "type", "");
692  $this->ctrl->setParameter($this, "item_ref_id", "");
693 
694  $toolbar->addFormButton(
695  $this->lng->txt('download_selected_items'),
696  'download'
697  );
698 
699  $GLOBALS['tpl']->addAdminPanelToolbar(
700  $toolbar,
701  $this->object->gotItems() ? true : false,
702  $this->object->gotItems() ? true : false
703  );
704  }
705  }
706  }
707 
709  {
710  global $tree;
711 
712  if(!$tree->checkForParentType($this->object->getRefId(),'crs'))
713  {
714  return false;
715  }
716  $tpl->setCurrentBlock("custom_button");
717  $tpl->setVariable("ADMIN_MODE_LINK",$this->ctrl->getLinkTargetByClass('ilcoursecontentgui','editTimings'));
718  $tpl->setVariable("TXT_ADMIN_MODE",$this->lng->txt('timings_edit'));
719  $tpl->parseCurrentBlock();
720  return true;
721  }
726  {
727  $GLOBALS["tpl"]->setPermanentLink($this->object->getType(),
728  $this->object->getRefId(), "", "_top");
729  }
730 
735  {
736  global $ilCtrl;
737 
738  $_SESSION["il_cntr_editor"] = "std";
739  $ilCtrl->redirect($this, "editPageFrame");
740  }
741 
746  {
747  global $ilCtrl;
748 
749  $_SESSION["il_cntr_editor"] = "old";
750  $ilCtrl->redirect($this, "editPageFrame");
751  }
752 
757  {
758  global $ilCtrl, $ilAccess, $lng, $ilCtrl;
759 
760  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
761  {
762  include_once("./Services/XHTMLPage/classes/class.ilXHTMLPage.php");
763 
764  /* keep old page content for now...
765  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
766  "xhtml_page");
767  if ($xpage_id)
768  {
769  $xpage = new ilXHTMLPage($xpage_id);
770  }
771  */
772 
773  ilContainer::_writeContainerSetting($this->object->getId(),
774  "xhtml_page", 0);
775 
776  ilUtil::sendSuccess($lng->txt("cntr_switched_editor"), true);
777  }
778 
779  $ilCtrl->redirect($this, "editPageFrame");
780  }
781 
786  {
787  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
788  $fs_gui = new ilFramesetGUI();
789 
790  $fs_gui->setFramesetTitle($this->object->getTitle());
791  $fs_gui->setMainFrameName("content");
792  $fs_gui->setSideFrameName("tree");
793 
794  // old tiny stuff
795  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
796  "xhtml_page");
797  if ($xpage_id > 0 && $_SESSION["il_cntr_editor"] != "std")
798  {
799  $fs_gui->setMainFrameSource(
800  $this->ctrl->getLinkTarget(
801  $this, "editPageContent"));
802  $fs_gui->setSideFrameSource(
803  $this->ctrl->getLinkTarget($this, "showLinkList"));
804  }
805  else
806  {
807  $this->ctrl->redirectByClass(array("ilcontainerpagegui"), "edit");
808  exit;
809  }
810 
811  $fs_gui->show();
812  exit;
813  }
814 
821  {
822  global $rbacsystem, $tpl, $lng, $ilCtrl;
823 
824  if (!$rbacsystem->checkAccess("write", $this->ref_id))
825  {
826  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
827  }
828 
829  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
830  "xhtml_page");
831  if ($xpage_id > 0)
832  {
833  include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
834  $xpage = new ilXHTMLPage($xpage_id);
835  $content = $xpage->getContent();
836  }
837 
838  // get template
839  $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.container_edit_page_content.html",
840  "Services/Container");
841  $tpl->setVariable("VAL_CONTENT", ilUtil::prepareFormOutput($content));
842  $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
843  $tpl->setVariable("TXT_EDIT_PAGE_CONTENT",
844  $this->lng->txt("edit_page_content"));
845  $tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
846  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
847  $tpl->setVariable("TXT_MIGRATION_INFO", $lng->txt("cntr_old_editor_warning"));
848  $tpl->setVariable("TXT_MIGRATION_OPEN_STD_EDITOR", $lng->txt("cntr_old_editor_open_standard_editor"));
849  $tpl->setVariable("IMG_WARNING", ilUtil::getImagePath("icon_alert.svg"));
850  $tpl->setVariable("HREF_OPEN_STD_EDITOR", $ilCtrl->getLinkTarget($this, "switchToStdEditor"));
851  $tpl->setVariable("ALT_WARNING", $lng->txt("warning"));
852 
853  include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
854  include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
855  //$ta = new ilTextAreaInputGUI();
856  //$tags = $ta->getRteTagSet("extended_table_img");
857 
858  // add rte support
859  include_once "./Services/RTE/classes/class.ilRTE.php";
860  $rtestring = ilRTE::_getRTEClassname();
861  include_once "./Services/RTE/classes/class.$rtestring.php";
862  $rte = new $rtestring();
863  //$rte->addPlugin("latex");
864  include_once "./Services/Object/classes/class.ilObject.php";
866  $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
867  $rte->addRTESupport($obj_id, $obj_type);
868  //$rte->setStyleSelect(true);
869  //$rte->addCustomRTESupport($obj_id, $obj_type, $tags);
870  }
871 
873  {
874  include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
875  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
876  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
877  "xhtml_page");
878 
879  /*include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
880  include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
881  $ta = new ilTextAreaInputGUI();
882  $ta->setRteTagSet("extended_table_img");
883  $tags = $ta->getRteTagString();*/
884 
885  //$text = ilUtil::stripSlashes($_POST["page_content"],
886  // true,
887  // $tags);
888 
889  $text = ilUtil::stripSlashes($_POST["page_content"],
890  true,
892  if ($xpage_id > 0)
893  {
894  $xpage = new ilXHTMLPage($xpage_id);
895  $xpage->setContent($text);
896  $xpage->save();
897  }
898  else
899  {
900  $xpage = new ilXHTMLPage();
901  $xpage->setContent($text);
902  $xpage->save();
903  ilContainer::_writeContainerSetting($this->object->getId(),
904  "xhtml_page", $xpage->getId());
905  }
906 
907  include_once("Services/RTE/classes/class.ilRTE.php");
908  ilRTE::_cleanupMediaObjectUsage($text, $this->object->getType().":html",
909  $this->object->getId());
910 
911  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
912  $this->ctrl->redirect($this, "");
913  }
914 
916  {
917  $this->ctrl->redirect($this, "");
918  }
919 
921  {
922  global $lng, $tree;
923 
924  $tpl = new ilTemplate("tpl.container_link_help.html", true, true,
925  "Services/Container");
926 
927  $type_ordering = array(
928  "cat", "fold", "crs", "icrs", "icla", "grp", "chat", "frm", "lres",
929  "glo", "webr", "file", "exc",
930  "tst", "svy", "mep", "qpl", "spl");
931 
932  $childs = $tree->getChilds($_GET["ref_id"]);
933  foreach($childs as $child)
934  {
935  if (in_array($child["type"], array("lm", "dbk", "sahs", "htlm")))
936  {
937  $cnt["lres"]++;
938  }
939  else
940  {
941  $cnt[$child["type"]]++;
942  }
943  }
944 
945  $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
946  $tpl->setVariable("TXT_HELP_HEADER", $lng->txt("help"));
947  foreach($type_ordering as $type)
948  {
949  $tpl->setCurrentBlock("row");
950  $tpl->setVariable("ROWCOL", "tblrow".((($i++)%2)+1));
951  if ($type != "lres")
952  {
953  $tpl->setVariable("TYPE", $lng->txt("objs_".$type).
954  " (".((int)$cnt[$type]).")");
955  }
956  else
957  {
958  $tpl->setVariable("TYPE", $lng->txt("learning_resources").
959  " (".((int)$cnt["lres"]).")");
960  }
961  $tpl->setVariable("TXT_LINK", "[list-".$type."]");
962  $tpl->parseCurrentBlock();
963  }
964  $tpl->show();
965  exit;
966 
967  }
968 
973  {
974  $this->adminCommands = false;
975  }
976 
980 /* function determineAdminCommands($a_ref_id, $a_admin_com_included_in_list = false)
981  {
982  if (!$this->adminCommands)
983  {
984  if (!$this->isActiveAdministrationPanel())
985  {
986  if ($this->rbacsystem->checkAccess("delete", $a_ref_id))
987  {
988  $this->adminCommands = true;
989  }
990  }
991  else
992  {
993  $this->adminCommands = $a_admin_com_included_in_list;
994  }
995  }
996  }*/
997 
1004  function &newBlockTemplate()
1005  {
1006  $tpl = new ilTemplate("tpl.container_list_block.html", true, true,
1007  "Services/Container");
1008  $this->cur_row_type = "row_type_1";
1009  return $tpl;
1010  }
1011 
1019  function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true)
1020  {
1021  $icon = ilUtil::getImagePath("icon_".$a_type.".svg");
1022  $title = $this->lng->txt("objs_".$a_type);
1023 
1024  if ($a_show_image)
1025  {
1026  $a_tpl->setCurrentBlock("container_header_row_image");
1027  $a_tpl->setVariable("HEADER_IMG", $icon);
1028  $a_tpl->setVariable("HEADER_ALT", $title);
1029  }
1030  else
1031  {
1032  $a_tpl->setCurrentBlock("container_header_row");
1033  }
1034 
1035  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
1036  $a_tpl->parseCurrentBlock();
1037  $a_tpl->touchBlock("container_row");
1038  }
1039 
1047  function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "",
1048  $a_image_type = "")
1049  {
1050  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1051  ? "row_type_2"
1052  : "row_type_1";
1053 
1054  $a_tpl->touchBlock($this->cur_row_type);
1055 
1056  $nbsp = true;
1057  if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows")
1058  {
1059  $icon = ilUtil::getImagePath("icon_".$a_image_type.".svg");
1060  $alt = $this->lng->txt("obj_".$a_image_type);
1061 
1062  // custom icon
1063  if ($this->ilias->getSetting("custom_icons") &&
1064  in_array($a_image_type, array("cat","grp","crs")))
1065  {
1066  require_once("./Services/Container/classes/class.ilContainer.php");
1067  if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
1068  {
1069  $icon = $path;
1070  }
1071  }
1072 
1073  $a_tpl->setCurrentBlock("block_row_image");
1074  $a_tpl->setVariable("ROW_IMG", $icon);
1075  $a_tpl->setVariable("ROW_ALT", $alt);
1076  $a_tpl->parseCurrentBlock();
1077  $nbsp = false;
1078  }
1079 
1080  if ($this->isActiveAdministrationPanel())
1081  {
1082  $a_tpl->setCurrentBlock("block_row_check");
1083  $a_tpl->setVariable("ITEM_ID", $a_item_ref_id);
1084  $a_tpl->parseCurrentBlock();
1085  $nbsp = false;
1086  }
1087  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
1088  if($this->isActiveAdministrationPanel() &&
1090  {
1091  $a_tpl->setCurrentBlock('block_position');
1092  $a_tpl->setVariable('POS_TYPE',$a_image_type);
1093  $a_tpl->setVariable('POS_ID',$a_item_ref_id);
1094  $a_tpl->setVariable('POSITION',sprintf('%.1f',$this->current_position++));
1095  $a_tpl->parseCurrentBlock();
1096  }
1097  if ($nbsp)
1098  {
1099  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1100  }
1101  $a_tpl->setCurrentBlock("container_standard_row");
1102  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
1103  $a_tpl->parseCurrentBlock();
1104  $a_tpl->touchBlock("container_row");
1105  }
1106 
1110  function addMessageRow(&$a_tpl, $a_message, $a_type)
1111  {
1112  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1113  ? "row_type_2"
1114  : "row_type_1";
1115 
1116  $a_tpl->touchBlock($this->cur_row_type);
1117 
1118  $type = $this->lng->txt("obj_".$a_type);
1119  $a_message = str_replace("[type]", $type, $a_message);
1120 
1121  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1122 
1123  $a_tpl->setCurrentBlock("container_standard_row");
1124  $a_tpl->setVariable("BLOCK_ROW_CONTENT",
1125  $a_message);
1126  $a_tpl->parseCurrentBlock();
1127  $a_tpl->touchBlock("container_row");
1128  }
1129 
1130  function resetRowType()
1131  {
1132  $this->cur_row_type = "";
1133  }
1134 
1135 
1140  {
1141  global $lng;
1142 
1143  if (!$this->isActiveAdministrationPanel()
1144  || strtolower($this->ctrl->getCmdClass()) != "ilcontainerpagegui")
1145  {
1146  return;
1147  }
1148 
1149  $lng->loadLanguageModule("content");
1150  //$tabs_gui = new ilTabsGUI();
1151  //$tabs_gui->setSubTabs();
1152 
1153  // back to upper context
1154  $this->tabs_gui->setBackTarget($this->lng->txt("obj_cat"),
1155  $this->ctrl->getLinkTarget($this, "frameset"),
1156  ilFrameTargetInfo::_getFrame("MainContent"));
1157 
1158  $this->tabs_gui->addTarget("edit", $this->ctrl->getLinkTargetByClass("ilcontainerpagegui", "view")
1159  , array("", "view"), "ilcontainerpagegui");
1160 
1161  //$this->tpl->setTabs($tabs_gui->getHTML());
1162  }
1163 
1167  function addStandardContainerSubTabs($a_include_view = true)
1168  {
1169  global $ilTabs, $ilAccess, $lng, $ilCtrl, $ilUser, $ilSetting;
1170 
1171  if (!is_object($this->object))
1172  {
1173  return;
1174  }
1175 
1176  if ($a_include_view && $ilAccess->checkAccess("read", "", $this->object->getRefId()))
1177  {
1178  if (!$this->isActiveAdministrationPanel())
1179  {
1180  $ilTabs->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTarget($this, ""));
1181  }
1182  else
1183  {
1184  $ilTabs->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTarget($this, "disableAdministrationPanel"));
1185  }
1186  }
1187 
1188  if ( $ilUser->getId() != ANONYMOUS_USER_ID &&
1189  ($this->adminCommands ||
1190  (is_object($this->object) &&
1191  ($ilAccess->checkAccess("write", "", $this->object->getRefId())))
1192  ||
1193  (is_object($this->object) &&
1194  ($this->object->getHiddenFilesFound())) ||
1195  $_SESSION["clipboard"]
1196  )
1197  )
1198  {
1199  if ($this->isActiveAdministrationPanel())
1200  {
1201  $ilTabs->addSubTab("manage", $lng->txt("cntr_manage"), $ilCtrl->getLinkTarget($this, ""));
1202  }
1203  else
1204  {
1205  $ilTabs->addSubTab("manage", $lng->txt("cntr_manage"), $ilCtrl->getLinkTarget($this, "enableAdministrationPanel"));
1206  }
1207  }
1208  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1209  is_object($this->object) &&
1210  $ilAccess->checkAccess("write", "", $this->object->getRefId()) /* &&
1211  $this->object->getOrderType() == ilContainer::SORT_MANUAL */ // always on because of custom block order
1212  )
1213  {
1214  $ilTabs->addSubTab("ordering", $lng->txt("cntr_ordering"), $ilCtrl->getLinkTarget($this, "editOrder"));
1215  }
1216  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1217  is_object($this->object) &&
1218  $ilAccess->checkAccess("write", "", $this->object->getRefId())
1219  )
1220  {
1221  if ($ilSetting->get("enable_cat_page_edit"))
1222  {
1223  $ilTabs->addSubTab("page_editor", $lng->txt("cntr_text_media_editor"), $ilCtrl->getLinkTarget($this, "editPageFrame"),
1224  ilFrameTargetInfo::_getFrame("MainContent"));
1225  }
1226  }
1227  }
1228 
1229 
1234  function getTabs(&$tabs_gui)
1235  {
1236  global $rbacsystem, $ilCtrl;
1237 
1238  // edit permissions
1239  if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
1240  {
1241  $tabs_gui->addTarget("perm_settings",
1242  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1243  array("perm","info","owner"), 'ilpermissiongui');
1244  if ($ilCtrl->getNextClass() == "ilpermissiongui")
1245  {
1246  $tabs_gui->activateTab("perm_settings");
1247  }
1248  }
1249 
1250  // show clipboard
1251  if (strtolower($_GET["baseClass"]) == "ilrepositorygui" && !empty($_SESSION["clipboard"]))
1252  {
1253  $tabs_gui->addTarget("clipboard",
1254  $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
1255  }
1256 
1257  }
1258 
1259  //*****************
1260  // COMMON METHODS (may be overwritten in derived classes
1261  // if special handling is necessary)
1262  //*****************
1263 
1268  {
1269  $_SESSION["il_cont_admin_panel"] = true;
1270  $this->ctrl->redirect($this, "render");
1271  }
1272 
1277  {
1278  $_SESSION["il_cont_admin_panel"] = false;
1279  $this->ctrl->redirect($this, "render");
1280  }
1281 
1285  function editOrderObject()
1286  {
1287  global $ilTabs;
1288 
1289  $this->edit_order = true;
1290  $_SESSION["il_cont_admin_panel"] = false;
1291  $this->renderObject();
1292 
1293  $ilTabs->activateSubTab("ordering");
1294  }
1295 
1300  public function isActiveOrdering()
1301  {
1302  return $this->edit_order ? true : false;
1303  }
1304 
1309  public function isActiveItemOrdering()
1310  {
1311  if($this->isActiveOrdering())
1312  {
1313  return (ilContainerSortingSettings::_lookupSortMode($this->object->getId()) == ilContainer::SORT_MANUAL);
1314  }
1315  return false;
1316  }
1317 
1321  public function addToDeskObject()
1322  {
1323  global $ilSetting, $lng;
1324 
1325  if((int)$ilSetting->get('disable_my_offers'))
1326  {
1327  return $this->renderObject();
1328  }
1329 
1330  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
1332  ilUtil::sendSuccess($lng->txt("added_to_desktop"));
1333  $this->renderObject();
1334  }
1335 
1339  public function removeFromDeskObject()
1340  {
1341  global $ilSetting, $lng;
1342 
1343  if((int)$ilSetting->get('disable_my_offers'))
1344  {
1345  return $this->renderObject();
1346  }
1347 
1348  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
1350  ilUtil::sendSuccess($lng->txt("removed_from_desktop"));
1351  $this->renderObject();
1352  }
1353 
1355  {
1356  $this->multi_download_enabled = true;
1357  $this->renderObject();
1358  }
1359 
1361  {
1363  }
1364 
1365  // BEGIN WebDAV: Lock/Unlock objects
1366  function lockObject()
1367  {
1368  global $tree, $ilUser, $rbacsystem;
1369 
1370  if (!$rbacsystem->checkAccess("write",$_GET['item_ref_id']))
1371  {
1372  $this->ilErr->raiseError($this->lng->txt('err_no_permission'),$this->ilErr->MESSAGE);
1373  }
1374 
1375 
1376  require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
1378  {
1379  require_once 'Services/WebDAV/classes/class.ilDAVLocks.php';
1380  $locks = new ilDAVLocks();
1381 
1382  $result = $locks->lockRef($_GET['item_ref_id'],
1383  $ilUser->getId(), $ilUser->getLogin(),
1384  'ref_'.$_GET['item_ref_id'].'_usr_'.$ilUser->getId(),
1385  time() + /*30*24*60**/60, 0, 'exclusive'
1386  );
1387 
1389  $this->lng->txt(
1390  ($result === true) ? 'object_locked' : $result
1391  ),
1392  true);
1393  }
1394  $this->renderObject();
1395  }
1396  // END WebDAV: Lock/Unlock objects
1397 
1404  function cutObject()
1405  {
1406  global $rbacsystem, $ilCtrl;
1407 
1408  if ($_GET["item_ref_id"] != "")
1409  {
1410  $_POST["id"] = array($_GET["item_ref_id"]);
1411  }
1412 
1413  //$this->ilias->raiseError("move operation does not work at the moment and is disabled",$this->ilias->error_obj->MESSAGE);
1414 
1415  if (!isset($_POST["id"]))
1416  {
1417  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1418  }
1419 
1420  // FOR ALL OBJECTS THAT SHOULD BE COPIED
1421  foreach ($_POST["id"] as $ref_id)
1422  {
1423  // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
1424  $node_data = $this->tree->getNodeData($ref_id);
1425  $subtree_nodes = $this->tree->getSubTree($node_data);
1426 
1427  $all_node_data[] = $node_data;
1428  $all_subtree_nodes[] = $subtree_nodes;
1429 
1430  // CHECK DELETE PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1431  foreach ($subtree_nodes as $node)
1432  {
1433  if($node['type'] == 'rolf')
1434  {
1435  continue;
1436  }
1437 
1438  if (!$rbacsystem->checkAccess('delete',$node["ref_id"]))
1439  {
1440  $no_cut[] = $node["ref_id"];
1441  }
1442  }
1443  }
1444  // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1445  if (count($no_cut))
1446  {
1447  $this->ilias->raiseError($this->lng->txt("msg_no_perm_cut")." ".implode(',',$this->getTitlesByRefId($no_cut)),
1448  $this->ilias->error_obj->MESSAGE);
1449  }
1450  $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
1451  $_SESSION["clipboard"]["cmd"] = $ilCtrl->getCmd();
1452  $_SESSION["clipboard"]["ref_ids"] = $_POST["id"];
1453 
1454  ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"),true);
1455 
1456  return $this->initAndDisplayMoveIntoObjectObject();
1457  } // END CUT
1458 
1466  function copyObject()
1467  {
1468  global $rbacsystem, $ilCtrl, $objDefinition;
1469 
1470  if ($_GET["item_ref_id"] != "")
1471  {
1472  $_POST["id"] = array($_GET["item_ref_id"]);
1473  }
1474 
1475  if (!isset($_POST["id"]))
1476  {
1477  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1478  }
1479 
1480  // FOR ALL OBJECTS THAT SHOULD BE COPIED
1481  $containers = 0;
1482  foreach ($_POST["id"] as $ref_id)
1483  {
1484  // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
1485  $node_data = $this->tree->getNodeData($ref_id);
1486 
1487  // count containers
1488  if ($objDefinition->isContainer($node_data["type"]))
1489  {
1490  $containers++;
1491  }
1492 
1493  $subtree_nodes = $this->tree->getSubTree($node_data);
1494 
1495  $all_node_data[] = $node_data;
1496  $all_subtree_nodes[] = $subtree_nodes;
1497 
1498  // CHECK COPY PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1499  foreach ($subtree_nodes as $node)
1500  {
1501  if($node['type'] == 'rolf')
1502  {
1503  continue;
1504  }
1505 
1506  if (!$rbacsystem->checkAccess('visible,read,copy',$node["ref_id"]))
1507  {
1508  $no_copy[] = $node["ref_id"];
1509  }
1510  }
1511  }
1512 
1513  if ($containers > 0 && count($_POST["id"]) > 1)
1514  {
1515  $this->ilias->raiseError($this->lng->txt("cntr_container_only_on_their_own"), $this->ilias->error_obj->MESSAGE);
1516  }
1517 
1518  // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1519  if (count($no_copy))
1520  {
1521  $this->ilias->raiseError(
1522  $this->lng->txt("msg_no_perm_copy") . " " . implode(',',$this->getTitlesByRefId($no_copy)),
1523  $this->ilias->error_obj->MESSAGE);
1524  }
1525 
1526  // if we have a single container, set it as source id and redirect to ilObjectCopyGUI
1527  if (count($_POST["id"]) == 1)
1528  {
1529  $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $_POST["id"][0]);
1530  $ilCtrl->redirectByClass("ilobjectcopygui", "initTargetSelection");
1531  }
1532  else
1533  {
1534  $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode($_POST["id"],"_"));
1535  $ilCtrl->redirectByClass("ilobjectcopygui", "initTargetSelection");
1536  }
1537 
1538  $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
1539  $_SESSION["clipboard"]["cmd"] = $ilCtrl->getCmd();
1540  $_SESSION["clipboard"]["ref_ids"] = $_POST["id"];
1541 
1542  ilUtil::sendInfo($this->lng->txt("msg_copy_clipboard"), true);
1543 
1545  } // END COPY
1546 
1547  function downloadObject()
1548  {
1549  global $rbacsystem, $ilCtrl;
1550 
1551  if ($_GET["item_ref_id"] != "")
1552  {
1553  $_POST["id"] = array($_GET["item_ref_id"]);
1554  }
1555 
1556  if (!isset($_POST["id"]))
1557  {
1558  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1559  }
1560 
1561  // FOR ALL OBJECTS THAT SHOULD BE DOWNLOADED
1562  foreach ($_POST["id"] as $ref_id)
1563  {
1564  $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1565  $obj_type = $object->getType();
1566  if (!in_array($obj_type, array("fold", "file")))
1567  {
1568  $no_download[] = $object->getType();
1569  }
1570  else if (!$rbacsystem->checkAccess('read', $ref_id))
1571  {
1572  $no_perm[] = $ref_id;
1573  }
1574  }
1575 
1576  // IF THERE IS ANY OBJECT THAT CANNOT BE DOWNLOADED
1577  if (count($no_download))
1578  {
1579  $no_download = array_unique($no_download);
1580  foreach ($no_download as $type)
1581  {
1582  $txt_objs[] = $this->lng->txt("objs_".$type);
1583  }
1584  $this->ilias->raiseError(implode(', ',$txt_objs)." ".$this->lng->txt("msg_obj_no_download"),$this->ilias->error_obj->MESSAGE);
1585  }
1586 
1587  // NO ACCESS
1588  if (count($no_perm))
1589  {
1590  $this->ilias->raiseError(
1591  $this->lng->txt("msg_obj_perm_download")." ".implode(',',$no_perm),
1592  $this->ilias->error_obj->MESSAGE);
1593  }
1594 
1595  // download the objects
1596  $this->downloadMultipleObjects($_POST["id"]);
1597  }
1598 
1599  private function downloadMultipleObjects($a_ref_ids)
1600  {
1601  global $lng, $rbacsystem, $ilAccess;
1602 
1603  include_once "./Services/Utilities/classes/class.ilUtil.php";
1604  include_once 'Modules/Folder/classes/class.ilObjFolder.php';
1605  include_once 'Modules/File/classes/class.ilObjFile.php';
1606  include_once 'Modules/File/classes/class.ilFileException.php';
1607 
1608  // create temporary file to download
1609  $zip = PATH_TO_ZIP;
1610  $tmpdir = ilUtil::ilTempnam();
1611  ilUtil::makeDir($tmpdir);
1612 
1613  try
1614  {
1615  // copy each selected object
1616  foreach ($a_ref_ids as $ref_id)
1617  {
1618  if (!$ilAccess->checkAccess("read", "", $ref_id))
1619  continue;
1620 
1621  if (ilObject::_isInTrash($ref_id))
1622  continue;
1623 
1624  // get object
1625  $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1626  $obj_type = $object->getType();
1627  if ($obj_type == "fold")
1628  {
1629  // copy folder to temp directory
1630  self::recurseFolder($ref_id, $object->getTitle(), $tmpdir);
1631  }
1632  else if ($obj_type == "file")
1633  {
1634  // copy file to temp directory
1635  self::copyFile($object->getId(), $object->getTitle(), $tmpdir);
1636  }
1637  }
1638 
1639  // compress the folder
1640  $deliverFilename = ilUtil::getAsciiFilename($this->object->getTitle()) . ".zip";
1641  $tmpzipfile = ilUtil::ilTempnam() . ".zip";
1642  ilUtil::zip($tmpdir, $tmpzipfile, true);
1643  ilUtil::delDir($tmpdir);
1644  ilUtil::deliverFile($tmpzipfile, $deliverFilename, '', false, true, true);
1645  }
1646  catch (ilFileException $e)
1647  {
1648  ilUtil::sendInfo($e->getMessage(), true);
1649  }
1650  }
1651 
1660  private static function recurseFolder($refid, $title, $tmpdir)
1661  {
1662  global $rbacsystem, $tree, $ilAccess;
1663 
1664  $tmpdir = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
1665  ilUtil::makeDir($tmpdir);
1666 
1667  $subtree = $tree->getChildsByTypeFilter($refid, array("fold","file"));
1668 
1669  foreach ($subtree as $child)
1670  {
1671  if (!$ilAccess->checkAccess("read", "", $child["ref_id"]))
1672  continue;
1673 
1674  if (ilObject::_isInTrash($child["ref_id"]))
1675  continue;
1676 
1677  if ($child["type"] == "fold")
1678  self::recurseFolder($child["ref_id"], $child["title"], $tmpdir);
1679  else
1680  self::copyFile($child["obj_id"], $child["title"], $tmpdir);
1681  }
1682  }
1683 
1684  private static function copyFile($obj_id, $title, $tmpdir)
1685  {
1686  $newFilename = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
1687 
1688  // copy to temporary directory
1689  $oldFilename = ilObjFile::_lookupAbsolutePath($obj_id);
1690  if (!copy($oldFilename, $newFilename))
1691  throw new ilFileException("Could not copy ".$oldFilename." to ".$newFilename);
1692 
1693  touch($newFilename, filectime($oldFilename));
1694  }
1695 
1702  function linkObject()
1703  {
1704  global $clipboard, $rbacsystem, $rbacadmin, $ilCtrl;
1705 
1706  if ($_GET["item_ref_id"] != "")
1707  {
1708  $_POST["id"] = array($_GET["item_ref_id"]);
1709  }
1710 
1711  if (!isset($_POST["id"]))
1712  {
1713  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1714  }
1715 
1716  // CHECK ACCESS
1717  foreach ($_POST["id"] as $ref_id)
1718  {
1719  if (!$rbacsystem->checkAccess('delete',$ref_id))
1720  {
1721  $no_cut[] = $ref_id;
1722  }
1723 
1724  $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1725 
1726  if (!$this->objDefinition->allowLink($object->getType()))
1727  {
1728  $no_link[] = $object->getType();
1729  }
1730  }
1731 
1732  // NO ACCESS
1733  if (count($no_cut))
1734  {
1735  $this->ilias->raiseError($this->lng->txt("msg_no_perm_link")." ".
1736  implode(',',$no_cut),$this->ilias->error_obj->MESSAGE);
1737  }
1738 
1739  if (count($no_link))
1740  {
1741  //#12203
1742  $this->ilias->raiseError($this->lng->txt("msg_obj_no_link"),$this->ilias->error_obj->MESSAGE);
1743 
1744  //$this->ilias->raiseError($this->lng->txt("msg_not_possible_link")." ".
1745  // implode(',',$no_link),$this->ilias->error_obj->MESSAGE);
1746  }
1747 
1748  // WRITE TO CLIPBOARD
1749  $clipboard["parent"] = $_GET["ref_id"];
1750  $clipboard["cmd"] = $ilCtrl->getCmd();
1751 
1752  foreach ($_POST["id"] as $ref_id)
1753  {
1754  $clipboard["ref_ids"][] = $ref_id;
1755  }
1756 
1757  $_SESSION["clipboard"] = $clipboard;
1758 
1759  $suffix = 'p';
1760  if(count($clipboard["ref_ids"]) == 1)
1761  {
1762  $suffix = 's';
1763  }
1764  ilUtil::sendInfo($this->lng->txt("msg_link_clipboard_" . $suffix),true);
1765 
1767 
1768  } // END LINK
1769 
1770 
1776  function clearObject()
1777  {
1778  unset($_SESSION["clipboard"]);
1779  unset($_SESSION["il_rep_clipboard"]);
1780 
1781  //var_dump($this->getReturnLocation("clear",$this->ctrl->getLinkTarget($this)),get_class($this));
1782 
1783  // only redirect if clipboard was cleared
1784  if (isset($_POST["cmd"]["clear"]))
1785  {
1786  ilUtil::sendSuccess($this->lng->txt("msg_clear_clipboard"),true);
1787 
1788  //$this->ctrl->returnToParent($this);
1789  //ilUtil::redirect($this->getReturnLocation("clear",$this->ctrl->getLinkTarget($this)),get_class($this));
1791  }
1792  }
1793 
1795  {
1796  global $rbacsystem, $rbacadmin, $rbacreview, $log, $tree, $ilObjDataCache, $ilUser;
1797 
1798  $command = $_SESSION['clipboard']['cmd'];
1799  if(!in_array($command, array('cut', 'link', 'copy')))
1800  {
1801  $message = __METHOD__.": cmd was neither 'cut', 'link' nor 'copy'; may be a hack attempt!";
1802  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
1803  }
1804 
1805  if($command == 'cut')
1806  {
1807  if(isset($_POST['node']) && (int)$_POST['node'])
1808  $_POST['nodes'] = array($_POST['node']);
1809  }
1810 
1811  if(!is_array($_POST['nodes']) || !count($_POST['nodes']))
1812  {
1813  ilUtil::sendFailure($this->lng->txt('select_at_least_one_object'));
1814  switch ($command)
1815  {
1816  case 'cut':
1817  $this->showPasteTreeObject();
1818  break;
1819  case 'copy':
1820  $this->showPasteTreeObject();
1821  break;
1822  case 'link':
1823  $this->showPasteTreeObject();
1824  break;
1825  }
1826  return;
1827  }
1828 
1829  // this loop does all checks
1830  $folder_objects_cache = array();
1831  foreach($_SESSION['clipboard']['ref_ids'] as $ref_id)
1832  {
1833  $obj_data = ilObjectFactory::getInstanceByRefId($ref_id);
1834  $current_parent_id = $tree->getParentId($obj_data->getRefId());
1835 
1836  foreach($_POST['nodes'] as $folder_ref_id)
1837  {
1838  if(!array_key_exists($folder_ref_id, $folder_objects_cache))
1839  {
1840  $folder_objects_cache[$folder_ref_id] = ilObjectFactory::getInstanceByRefId($folder_ref_id);
1841  }
1842 
1843  // CHECK ACCESS
1844  if(!$rbacsystem->checkAccess('create', $folder_ref_id, $obj_data->getType()))
1845  {
1846  $no_paste[] = sprintf($this->lng->txt('msg_no_perm_paste_object_in_folder'), $obj_data->getTitle().' ['.$obj_data->getRefId().']', $folder_objects_cache[$folder_ref_id]->getTitle().' ['.$folder_objects_cache[$folder_ref_id]->getRefId().']');
1847  }
1848 
1849  // CHECK IF REFERENCE ALREADY EXISTS
1850  if($folder_ref_id == $current_parent_id)
1851  {
1852  $exists[] = sprintf($this->lng->txt('msg_obj_exists_in_folder'), $obj_data->getTitle().' ['.$obj_data->getRefId().']', $folder_objects_cache[$folder_ref_id]->getTitle().' ['.$folder_objects_cache[$folder_ref_id]->getRefId().']');
1853  }
1854 
1855  // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
1856  if ($tree->isGrandChild($ref_id, $folder_ref_id) ||
1857  $ref_id == $folder_ref_id)
1858  {
1859  $is_child[] = sprintf($this->lng->txt('msg_paste_object_not_in_itself'), $obj_data->getTitle().' ['.$obj_data->getRefId().']');
1860  }
1861 
1862  // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT
1863  if(!in_array($obj_data->getType(), array_keys($this->objDefinition->getSubObjects($folder_objects_cache[$folder_ref_id]->getType()))))
1864  {
1865  $not_allowed_subobject[] = sprintf($this->lng->txt('msg_obj_may_not_contain_objects_of_type'), $folder_objects_cache[$folder_ref_id]->getTitle().' ['.$folder_objects_cache[$folder_ref_id]->getRefId().']',
1866  $GLOBALS['lng']->txt('obj_'.$obj_data->getType()));
1867  }
1868  }
1869  }
1870 
1872  // process checking results
1873  if(count($exists) && $command != "copy")
1874  {
1875  $error .= implode('<br />', $exists);
1876  }
1877 
1878  if(count($is_child))
1879  {
1880  $error .= $error != '' ? '<br />' : '';
1881  $error .= implode('<br />', $is_child);
1882  }
1883 
1884  if(count($not_allowed_subobject))
1885  {
1886  $error .= $error != '' ? '<br />' : '';
1887  $error .= implode('<br />', $not_allowed_subobject);
1888  }
1889 
1890  if(count($no_paste))
1891  {
1892  $error .= $error != '' ? '<br />' : '';
1893  $error .= implode('<br />', $no_paste);
1894  }
1895 
1896  if($error != '')
1897  {
1898  ilUtil::sendFailure($error);
1899  switch ($command)
1900  {
1901  case 'cut':
1902  $this->showPasteTreeObject();
1903  break;
1904  case 'copy':
1905  $this->showPasteTreeObject();
1906  break;
1907  case 'link':
1908  $this->showPasteTreeObject();
1909  break;
1910  }
1911  return;
1912  }
1913 
1914  // log pasteObject call
1915  $log->write(__METHOD__.", cmd: ".$command);
1916 
1918  // everything ok: now paste the objects to new location
1919 
1920  // to prevent multiple actions via back/reload button
1921  $ref_ids = $_SESSION['clipboard']['ref_ids'];
1922  unset($_SESSION['clipboard']['ref_ids']);
1923 
1924  // BEGIN ChangeEvent: Record paste event.
1925  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1926  // END ChangeEvent: Record paste event.
1927 
1928  // process COPY command
1929  if($command == 'copy')
1930  {
1931  foreach($_POST['nodes'] as $folder_ref_id)
1932  {
1933  foreach($ref_ids as $ref_id)
1934  {
1935  $revIdMapping = array();
1936 
1937  $oldNode_data = $tree->getNodeData($ref_id);
1938  if ($oldNode_data['parent'] == $folder_ref_id)
1939  {
1940  require_once 'Modules/File/classes/class.ilObjFileAccess.php';
1941  $newTitle = ilObjFileAccess::_appendNumberOfCopyToFilename($oldNode_data['title'],null);
1942  $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, $newTitle);
1943  }
1944  else
1945  {
1946  $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, null);
1947  }
1948 
1949  // BEGIN ChangeEvent: Record copy event.
1950  $old_parent_data = $tree->getParentNodeData($ref_id);
1951  $newNode_data = $tree->getNodeData($newRef);
1952  ilChangeEvent::_recordReadEvent($oldNode_data['type'], $ref_id,
1953  $oldNode_data['obj_id'], $ilUser->getId());
1954  ilChangeEvent::_recordWriteEvent($newNode_data['obj_id'], $ilUser->getId(), 'add',
1955  $ilObjDataCache->lookupObjId($folder_ref_id));
1956  ilChangeEvent::_catchupWriteEvents($newNode_data['obj_id'], $ilUser->getId());
1957  // END PATCH ChangeEvent: Record cut event.
1958  }
1959  }
1960 
1961  ilUtil::sendSuccess($this->lng->txt('msg_cloned'), true);
1962  } // END COPY
1963 
1964  // process CUT command
1965  if($command == 'cut')
1966  {
1967  foreach($_POST['nodes'] as $folder_ref_id)
1968  {
1969  foreach($ref_ids as $ref_id)
1970  {
1971  // Store old parent
1972  $old_parent = $tree->getParentId($ref_id);
1973  $tree->moveTree($ref_id, $folder_ref_id);
1974  $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1975 
1976  include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
1978 
1979  // BEGIN ChangeEvent: Record cut event.
1980  $node_data = $tree->getNodeData($ref_id);
1981  $old_parent_data = $tree->getNodeData($old_parent);
1982  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'remove',
1983  $old_parent_data['obj_id']);
1984  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
1985  $ilObjDataCache->lookupObjId($folder_ref_id));
1986  ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
1987  // END PATCH ChangeEvent: Record cut event.
1988  }
1989 
1990  // prevent multiple iterations for cut cmommand
1991  break;
1992  }
1993 
1994  ilUtil::sendSuccess($this->lng->txt('msg_cut_copied'), true);
1995  } // END CUT
1996 
1997  // process LINK command
1998  if($command == 'link')
1999  {
2000  $linked_to_folders = array();
2001 
2002  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
2003  $rbac_log_active = ilRbacLog::isActive();
2004 
2005  foreach($_POST['nodes'] as $folder_ref_id)
2006  {
2007  $linked_to_folders[$folder_ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($folder_ref_id));
2008 
2009  foreach($ref_ids as $ref_id)
2010  {
2011  // get node data
2012  $top_node = $tree->getNodeData($ref_id);
2013 
2014  // get subnodes of top nodes
2015  $subnodes[$ref_id] = $tree->getSubtree($top_node);
2016  }
2017 
2018  // now move all subtrees to new location
2019  foreach($subnodes as $key => $subnode)
2020  {
2021  // first paste top_node....
2022  $obj_data = ilObjectFactory::getInstanceByRefId($key);
2023  $new_ref_id = $obj_data->createReference();
2024  $obj_data->putInTree($folder_ref_id);
2025  $obj_data->setPermissions($folder_ref_id);
2026 
2027  // rbac log
2028  if($rbac_log_active)
2029  {
2030  $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id, false);
2031  $rbac_log = ilRbacLog::gatherFaPa($new_ref_id, array_keys($rbac_log_roles), true);
2032  ilRbacLog::add(ilRbacLog::LINK_OBJECT, $new_ref_id, $rbac_log, $key);
2033  }
2034 
2035  // BEGIN ChangeEvent: Record link event.
2036  $node_data = $tree->getNodeData($new_ref_id);
2037  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2038  $ilObjDataCache->lookupObjId($folder_ref_id));
2039  ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2040  // END PATCH ChangeEvent: Record link event.
2041  }
2042 
2043  $log->write(__METHOD__.', link finished');
2044  }
2045 
2046  $linked_targets = array();
2047  if(count($linked_to_folders))
2048  {
2049  require_once 'Services/Link/classes/class.ilLink.php';
2050  foreach($linked_to_folders as $ref_id => $title)
2051  {
2052  $linked_targets[] = '<a href="' . ilLink::_getLink($ref_id) . '">' . $title . '</a>';
2053  }
2054  }
2055 
2056  $suffix = 'p';
2057  if(count($ref_ids) == 1)
2058  {
2059  $suffix = 's';
2060  }
2061  ilUtil::sendSuccess(sprintf($this->lng->txt('mgs_objects_linked_to_the_following_folders_' . $suffix), implode(', ', $linked_targets)), true);
2062  } // END LINK
2063 
2064  // clear clipboard
2065  $this->clearObject();
2066 
2067  $this->ctrl->returnToParent($this);
2068  }
2069 
2071  {
2072  global $tree;
2073 
2074  // empty session on init
2075  $_SESSION['paste_linked_repexpand'] = array();
2076 
2077  // copy opend nodes from repository explorer
2078  $_SESSION['paste_linked_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
2079 
2080  // open current position
2081  $path = $tree->getPathId((int)$_GET['ref_id']);
2082  foreach((array)$path as $node_id)
2083  {
2084  if(!in_array($node_id, $_SESSION['paste_linked_repexpand']))
2085  $_SESSION['paste_linked_repexpand'][] = $node_id;
2086  }
2087 
2088  return $this->showPasteTreeObject();
2089  }
2090 
2094  public function showPasteTreeObject()
2095  {
2096  global $ilTabs, $ilToolbar;
2097 
2098  $ilTabs->setTabActive('view_content');
2099 
2100  if(!in_array($_SESSION['clipboard']['cmd'], array('link', 'copy', 'cut')))
2101  {
2102  $message = __METHOD__.": Unknown action.";
2103  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2104  }
2105  $cmd = $_SESSION['clipboard']['cmd'];
2106 
2107  //
2108  $exp = $this->getTreeSelectorGUI($cmd);
2109  if ($exp->handleCommand())
2110  {
2111  return;
2112  }
2113  $output = $exp->getHTML();
2114 
2115  $txt_var = ($cmd == "copy")
2116  ? "copy"
2117  : "paste";
2118 
2119  // toolbars
2120  $t = new ilToolbarGUI();
2121  $t->setFormAction($this->ctrl->getFormAction($this, "performPasteIntoMultipleObjects"));
2122  $t->addFormButton($this->lng->txt($txt_var), "performPasteIntoMultipleObjects");
2123  $t->addSeparator();
2124 
2125  $GLOBALS['lng']->loadLanguageModule('obj');
2126  $t->addFormButton($this->lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
2127 
2128  $t->addFormButton($this->lng->txt("cancel"), "cancelMoveLink");
2129  $t->setCloseFormTag(false);
2130  $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
2131  $output = $t->getHTML().$output;
2132  $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
2133  $t->setCloseFormTag(true);
2134  $t->setOpenFormTag(false);
2135  $output.= "<br />".$t->getHTML();
2136 
2137  $this->tpl->setContent($output);
2138  }
2139 
2140 
2141 
2142 /* public function showLinkIntoMultipleObjectsTreeObject()
2143  {
2144  global $ilTabs, $ilToolbar;
2145 
2146  $ilTabs->setTabActive('view_content');
2147 
2148  if(!in_array($_SESSION['clipboard']['cmd'], array('link')))
2149  {
2150  $message = __METHOD__.": cmd was not 'link'; may be a hack attempt!";
2151  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2152  }
2153 
2154  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
2155  "Services/Object");
2156 
2157  require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
2158  $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_CHECK,
2159  'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_linked_repexpand');
2160  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showLinkIntoMultipleObjectsTree'));
2161  $exp->setTargetGet('ref_id');
2162  $exp->setPostVar('nodes[]');
2163  $exp->highlightNode($_GET['ref_id']);
2164  is_array($_POST['nodes']) ? $exp->setCheckedItems((array)$_POST['nodes']) : $exp->setCheckedItems(array());
2165 
2166  if($_GET['paste_linked_repexpand'] == '')
2167  {
2168  $expanded = $this->tree->readRootId();
2169  }
2170  else
2171  {
2172  $expanded = $_GET['paste_linked_repexpand'];
2173  }
2174 
2175  $this->tpl->setVariable('FORM_TARGET', '_top');
2176  $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects'));
2177 
2178  $exp->setExpand($expanded);
2179  // build html-output
2180  $exp->setOutput(0);
2181  $output = $exp->getOutput();
2182 
2183  $this->tpl->setVariable('OBJECT_TREE', $output);
2184 
2185  $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
2186  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('paste'));
2187 
2188  $ilToolbar->addButton($this->lng->txt('cancel'), $this->ctrl->getLinkTarget($this,'cancelMoveLink'));
2189  }*/
2190 
2195  public function cancelMoveLinkObject()
2196  {
2197  unset($_SESSION['clipboard']);
2198  $GLOBALS['ilCtrl']->returnToParent($this);
2199  }
2200 
2205  {
2206  ilUtil::sendSuccess($this->lng->txt("obj_inserted_clipboard"), true);
2207  $GLOBALS['ilCtrl']->returnToParent($this);
2208  }
2209 
2210 
2212  {
2213  global $tree;
2214 
2215  // empty session on init
2216  $_SESSION['paste_copy_repexpand'] = array();
2217 
2218  // copy opend nodes from repository explorer
2219  $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
2220 
2221  // open current position
2222  $path = $tree->getPathId((int)$_GET['ref_id']);
2223  foreach((array)$path as $node_id)
2224  {
2225  if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
2226  $_SESSION['paste_copy_repexpand'][] = $node_id;
2227  }
2228 
2229  return $this->showPasteTreeObject();
2230  }
2231 
2232  /*public function showCopyIntoMultipleObjectsTreeObject()
2233  {
2234  global $ilTabs, $ilToolbar;
2235 
2236  $ilTabs->setTabActive('view_content');
2237 
2238  if(!in_array($_SESSION['clipboard']['cmd'], array('copy')))
2239  {
2240  $message = __METHOD__.": cmd was not 'copy'; may be a hack attempt!";
2241  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2242  }
2243 
2244  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html', "Services/Object");
2245 
2246  require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
2247  $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_CHECK,
2248  'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_copy_repexpand');
2249  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showCopyIntoMultipleObjectsTree'));
2250  $exp->setTargetGet('ref_id');
2251  $exp->setPostVar('nodes[]');
2252  $exp->highlightNode($_GET['ref_id']);
2253  is_array($_POST['nodes']) ? $exp->setCheckedItems((array)$_POST['nodes']) : $exp->setCheckedItems(array());
2254 
2255  if($_GET['paste_copy_repexpand'] == '')
2256  {
2257  $expanded = $this->tree->readRootId();
2258  }
2259  else
2260  {
2261  $expanded = $_GET['paste_copy_repexpand'];
2262  }
2263 
2264  $this->tpl->setVariable('FORM_TARGET', '_top');
2265  $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects'));
2266 
2267  $exp->setExpand($expanded);
2268  // build html-output
2269  $exp->setOutput(0);
2270  $output = $exp->getOutput();
2271 
2272  $this->tpl->setVariable('OBJECT_TREE', $output);
2273 
2274  $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
2275  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('copy'));
2276 
2277  $ilToolbar->addButton($this->lng->txt('cancel'), $this->ctrl->getLinkTarget($this,'cancelMoveLink'));
2278  }*/
2279 
2281  {
2282  global $tree;
2283 
2284  // empty session on init
2285  $_SESSION['paste_cut_repexpand'] = array();
2286 
2287  // copy opend nodes from repository explorer
2288  $_SESSION['paste_cut_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
2289 
2290  // open current position
2291  $path = $tree->getPathId((int)$_GET['ref_id']);
2292  foreach((array)$path as $node_id)
2293  {
2294  if(!in_array($node_id, $_SESSION['paste_cut_repexpand']))
2295  $_SESSION['paste_cut_repexpand'][] = $node_id;
2296  }
2297 
2298  return $this->showPasteTreeObject();
2299  }
2300 
2301  /*public function showMoveIntoObjectTreeObject()
2302  {
2303  global $ilTabs, $ilToolbar;
2304 
2305  $ilTabs->setTabActive('view_content');
2306 
2307  if(!in_array($_SESSION['clipboard']['cmd'], array('cut')))
2308  {
2309  $message = __METHOD__.": cmd was not 'cut'; may be a hack attempt!";
2310  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2311  }
2312 
2313  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
2314  "Services/Object");
2315 
2316  require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
2317  $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_RADIO,
2318  'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_cut_repexpand');
2319  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showMoveIntoObjectTree'));
2320  $exp->setTargetGet('ref_id');
2321  $exp->setPostVar('node');
2322  $exp->setCheckedItems(array((int)$_POST['node']));
2323  $exp->highlightNode($_GET['ref_id']);
2324 
2325  if($_GET['paste_cut_repexpand'] == '')
2326  {
2327  $expanded = $this->tree->readRootId();
2328  }
2329  else
2330  {
2331  $expanded = $_GET['paste_cut_repexpand'];
2332  }
2333 
2334  $this->tpl->setVariable('FORM_TARGET', '_top');
2335  $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects'));
2336 
2337  $exp->setExpand($expanded);
2338  // build html-output
2339  $exp->setOutput(0);
2340  $output = $exp->getOutput();
2341 
2342  $this->tpl->setVariable('OBJECT_TREE', $output);
2343 
2344  $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
2345  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('paste'));
2346 
2347  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this,'cancelMoveLink'));
2348  }*/
2349 
2356  function pasteObject()
2357  {
2358  global $rbacsystem, $rbacadmin, $rbacreview, $log,$tree;
2359  global $ilUser, $lng, $ilCtrl;
2360 
2361  // BEGIN ChangeEvent: Record paste event.
2362  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
2363  // END ChangeEvent: Record paste event.
2364 
2365 //var_dump($_SESSION["clipboard"]);exit;
2366  if (!in_array($_SESSION["clipboard"]["cmd"],array("cut","link","copy")))
2367  {
2368  $message = get_class($this)."::pasteObject(): cmd was neither 'cut','link' or 'copy'; may be a hack attempt!";
2369  $this->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
2370  }
2371 
2372  // this loop does all checks
2373  foreach ($_SESSION["clipboard"]["ref_ids"] as $ref_id)
2374  {
2375  $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
2376 
2377  // CHECK ACCESS
2378  if (!$rbacsystem->checkAccess('create',$this->object->getRefId(), $obj_data->getType()))
2379  {
2380  $no_paste[] = $ref_id;
2381  $no_paste_titles[] = $obj_data->getTitle();
2382  }
2383 
2384  // CHECK IF REFERENCE ALREADY EXISTS
2385  if ($this->object->getRefId() == $this->tree->getParentId($obj_data->getRefId()))
2386  {
2387  $exists[] = $ref_id;
2388  break;
2389  }
2390 
2391  // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
2392  if ($this->tree->isGrandChild($ref_id,$this->object->getRefId()))
2393  {
2394  $is_child[] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
2395  }
2396 
2397  if ($ref_id == $this->object->getRefId())
2398  {
2399  $is_child[] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
2400  }
2401 
2402  // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT
2403  $obj_type = $obj_data->getType();
2404 
2405  if (!in_array($obj_type, array_keys($this->objDefinition->getSubObjects($this->object->getType()))))
2406  {
2407  $not_allowed_subobject[] = $obj_data->getType();
2408  }
2409  }
2410 
2412  // process checking results
2413  // BEGIN WebDAV: Copying an object into the same container is allowed
2414  if (count($exists) && $_SESSION["clipboard"]["cmd"] != "copy")
2415  // END WebDAV: Copying an object into the same container is allowed
2416  {
2417  $this->ilias->raiseError($this->lng->txt("msg_obj_exists"),$this->ilias->error_obj->MESSAGE);
2418  }
2419 
2420  if (count($is_child))
2421  {
2422  $this->ilias->raiseError($this->lng->txt("msg_not_in_itself")." ".implode(',',$is_child),
2423  $this->ilias->error_obj->MESSAGE);
2424  }
2425 
2426  if (count($not_allowed_subobject))
2427  {
2428  $this->ilias->raiseError($this->lng->txt("msg_may_not_contain")." ".implode(',',$not_allowed_subobject),
2429  $this->ilias->error_obj->MESSAGE);
2430  }
2431 
2432  if (count($no_paste))
2433  {
2434  $this->ilias->raiseError($this->lng->txt("msg_no_perm_paste")." ".
2435  implode(',',$no_paste),$this->ilias->error_obj->MESSAGE);
2436  }
2437 
2438  // log pasteObject call
2439  $log->write("ilObjectGUI::pasteObject(), cmd: ".$_SESSION["clipboard"]["cmd"]);
2440 
2442  // everything ok: now paste the objects to new location
2443 
2444  // to prevent multiple actions via back/reload button
2445  $ref_ids = $_SESSION["clipboard"]["ref_ids"];
2446  unset($_SESSION["clipboard"]["ref_ids"]);
2447 
2448  // BEGIN WebDAV: Support a copy command in the repository
2449  // process COPY command
2450  if ($_SESSION["clipboard"]["cmd"] == "copy")
2451  {
2452  unset($_SESSION["clipboard"]["cmd"]);
2453 
2454  // new implementation, redirects to ilObjectCopyGUI
2455  if (count($ref_ids) == 1)
2456  {
2457  $ilCtrl->setParameterByClass("ilobjectcopygui", "target", $this->object->getRefId());
2458  $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $ref_ids[0]);
2459  $ilCtrl->redirectByClass("ilobjectcopygui", "saveTarget");
2460  }
2461  else
2462  {
2463  $ilCtrl->setParameterByClass("ilobjectcopygui", "target", $this->object->getRefId());
2464  $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode($ref_ids, "_"));
2465  $ilCtrl->redirectByClass("ilobjectcopygui", "saveTarget");
2466  }
2467 
2468 
2469 
2470  /* old implementation
2471 
2472  foreach($ref_ids as $ref_id)
2473  {
2474  $revIdMapping = array();
2475 
2476  $oldNode_data = $tree->getNodeData($ref_id);
2477  if ($oldNode_data['parent'] == $this->object->getRefId())
2478  {
2479  require_once 'Modules/File/classes/class.ilObjFileAccess.php';
2480  $newTitle = ilObjFileAccess::_appendNumberOfCopyToFilename($oldNode_data['title'],null);
2481  $newRef = $this->cloneNodes($ref_id, $this->object->getRefId(), $refIdMapping, $newTitle);
2482  }
2483  else
2484  {
2485  $newRef = $this->cloneNodes($ref_id, $this->object->getRefId(), $refIdMapping, null);
2486  }
2487 
2488  // BEGIN ChangeEvent: Record copy event.
2489  $old_parent_data = $tree->getParentNodeData($ref_id);
2490  $newNode_data = $tree->getNodeData($newRef);
2491  ilChangeEvent::_recordReadEvent($oldNode_data['type'], $ref_id,
2492  $oldNode_data['obj_id'], $ilUser->getId());
2493  ilChangeEvent::_recordWriteEvent($newNode_data['obj_id'], $ilUser->getId(), 'add',
2494  $this->object->getId());
2495  ilChangeEvent::_catchupWriteEvents($newNode_data['obj_id'], $ilUser->getId());
2496  // END ChangeEvent: Record copy event.
2497  }*/
2498 
2499  $log->write("ilObjectGUI::pasteObject(), copy finished");
2500  }
2501  // END WebDAV: Support a Copy command in the repository
2502 
2503  // process CUT command
2504  if ($_SESSION["clipboard"]["cmd"] == "cut")
2505  {
2506 
2507  foreach($ref_ids as $ref_id)
2508  {
2509  // Store old parent
2510  $old_parent = $tree->getParentId($ref_id);
2511  $this->tree->moveTree($ref_id,$this->object->getRefId());
2512  $rbacadmin->adjustMovedObjectPermissions($ref_id,$old_parent);
2513 
2514  include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
2516 
2517  // BEGIN ChangeEvent: Record cut event.
2518  $node_data = $tree->getNodeData($ref_id);
2519  $old_parent_data = $tree->getNodeData($old_parent);
2520  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'remove',
2521  $old_parent_data['obj_id']);
2522  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2523  $this->object->getId());
2524  ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2525  // END PATCH ChangeEvent: Record cut event.
2526  }
2527  } // END CUT
2528 
2529  // process LINK command
2530  if ($_SESSION["clipboard"]["cmd"] == "link")
2531  {
2532  foreach ($ref_ids as $ref_id)
2533  {
2534  // get node data
2535  $top_node = $this->tree->getNodeData($ref_id);
2536 
2537  // get subnodes of top nodes
2538  $subnodes[$ref_id] = $this->tree->getSubtree($top_node);
2539  }
2540 
2541  // now move all subtrees to new location
2542  foreach ($subnodes as $key => $subnode)
2543  {
2544  // first paste top_node....
2545  $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($key);
2546  $new_ref_id = $obj_data->createReference();
2547  $obj_data->putInTree($_GET["ref_id"]);
2548  $obj_data->setPermissions($_GET["ref_id"]);
2549 
2550  // BEGIN ChangeEvent: Record link event.
2551  $node_data = $tree->getNodeData($new_ref_id);
2552  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2553  $this->object->getId());
2554  ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2555  // END PATCH ChangeEvent: Record link event.
2556  }
2557 
2558  $log->write("ilObjectGUI::pasteObject(), link finished");
2559 
2560  // inform other objects in hierarchy about link operation
2561  //$this->object->notify("link",$this->object->getRefId(),$_SESSION["clipboard"]["parent_non_rbac_id"],$this->object->getRefId(),$subnodes);
2562  } // END LINK
2563 
2564  // save cmd for correct message output after clearing the clipboard
2565  $last_cmd = $_SESSION["clipboard"]["cmd"];
2566 
2567 
2568  // clear clipboard
2569  $this->clearObject();
2570 
2571  if ($last_cmd == "cut")
2572  {
2573  ilUtil::sendSuccess($this->lng->txt("msg_cut_copied"),true);
2574  }
2575  // BEGIN WebDAV: Support a copy command in repository
2576  else if ($last_cmd == "copy")
2577  {
2578  ilUtil::sendSuccess($this->lng->txt("msg_cloned"),true);
2579  }
2580  else if ($last_cmd == 'link')
2581  // END WebDAV: Support copy command in repository
2582  {
2583  ilUtil::sendSuccess($this->lng->txt("msg_linked"),true);
2584  }
2585 
2586  $this->ctrl->returnToParent($this);
2587 
2588  } // END PASTE
2589 
2590 
2591  // BEGIN WebDAV: Support a copy command in repository
2592 
2600  // stefan.born@phzh.ch (01.07.2013):
2601  // UNCOMMENTED DUE NEW copyObject FUNCTION AND BECAUSE IT SEEMS THIS FUNCTION IS NOT USED ANYWHERE
2602  /*function copyObject()
2603  {
2604  global $ilAccess,$ilObjDefinition;
2605 
2606  if(!$ilAccess->checkAccess('copy','',$_GET['item_ref_id']))
2607  {
2608  $title = ilObject::_lookupTitle(ilObject::_lookupObjId($_GET['item_ref_id']));
2609 
2610  ilUtil::sendFailure($this->lng->txt('msg_no_perm_copy').' '.$title,true);
2611  $this->ctrl->returnToParent($this);
2612  }
2613 
2614  $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
2615  $_SESSION["clipboard"]["cmd"] = 'copy';
2616 
2617  ilUtil::sendInfo($this->lng->txt("msg_copy_clipboard"),true);
2618 
2619  // THIS FUNCTION DOES NOT EXIST!
2620  return $this->initAndDisplayCopyIntoObjectObject();
2621 
2622 
2623 
2624 
2625 
2626 
2627  // FOR ALL OBJECTS THAT SHOULD BE COPIED
2628  foreach ($_POST["id"] as $ref_id)
2629  {
2630  // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
2631  $node_data = $this->tree->getNodeData($ref_id);
2632  $subtree_nodes = $this->tree->getSubTree($node_data);
2633 
2634  $all_node_data[] = $node_data;
2635  $all_subtree_nodes[] = $subtree_nodes;
2636 
2637  // CHECK VIEW, READ AND COPY PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
2638  foreach ($subtree_nodes as $node)
2639  {
2640  if($node['type'] == 'rolf')
2641  {
2642  continue;
2643  }
2644 
2645  if (!$rbacsystem->checkAccess('visible,read,copy',$node["ref_id"]))
2646  {
2647  $no_copy[] = $node["ref_id"];
2648  }
2649  }
2650  }
2651  // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'view,read'
2652  if (count($no_copy))
2653  {
2654  $this->ilias->raiseError($this->lng->txt("msg_no_perm_copy")." ".implode(',',$this->getTitlesByRefId($no_copy)),
2655  $this->ilias->error_obj->MESSAGE);
2656  }
2657  $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
2658  $_SESSION["clipboard"]["cmd"] = ($_GET["cmd"] != "" && $_GET["cmd"] != "post")
2659  ? $_GET["cmd"]
2660  : key($_POST["cmd"]);
2661  $_SESSION["clipboard"]["ref_ids"] = $_POST["id"];
2662 
2663  ilUtil::sendInfo($this->lng->txt("msg_copy_clipboard"),true);
2664 
2665  $this->ctrl->returnToParent($this);
2666 
2667  } // END COPY
2668  */
2669  // BEGIN WebDAV: Support copy command in repository
2670 
2671 
2675  function clipboardObject()
2676  {
2677  global $ilErr, $ilLog, $ilTabs, $tpl, $ilToolbar, $ilCtrl, $lng;
2678 
2679  $ilTabs->activateTab("clipboard");
2680 
2681  // function should not be called if clipboard is empty
2682  if (empty($_SESSION['clipboard']) or !is_array($_SESSION['clipboard']))
2683  {
2684  $message = sprintf('%s::clipboardObject(): Illegal access. Clipboard variable is empty!', get_class($this));
2685  $ilLog->write($message,$ilLog->FATAL);
2686  $ilErr->raiseError($this->lng->txt("permission_denied"),$ilErr->WARNING);
2687  }
2688 
2689  $data = array();
2690  foreach($_SESSION["clipboard"]["ref_ids"] as $ref_id)
2691  {
2692  if(!$tmp_obj = ilObjectFactory::getInstanceByRefId($ref_id,false))
2693  {
2694  continue;
2695  }
2696 
2697  $data[] = array(
2698  "type" => $tmp_obj->getType(),
2699  "type_txt" => $this->lng->txt("obj_".$tmp_obj->getType()),
2700  "title" => $tmp_obj->getTitle(),
2701  "cmd" => ($_SESSION["clipboard"]["cmd"] == "cut") ? $this->lng->txt("move") :$this->lng->txt($_SESSION["clipboard"]["cmd"]),
2702  "ref_id" => $ref_id,
2703  "obj_id" => $tmp_obj->getId()
2704  );
2705 
2706  unset($tmp_obj);
2707  }
2708 
2709  include_once("./Services/Object/classes/class.ilObjClipboardTableGUI.php");
2710  $tab = new ilObjClipboardTableGUI($this, "clipboard");
2711  $tab->setData($data);
2712  $tpl->setContent($tab->getHTML());
2713 
2714  if (count($data) > 0)
2715  {
2716  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2717  $ilToolbar->addFormButton($lng->txt("insert_object_here"),
2718  "paste");
2719  $ilToolbar->addFormButton($lng->txt("clear_clipboard"),
2720  "clear");
2721  }
2722 
2723  return true;
2724  }
2725 
2726 
2731  function showCustomIconsEditing($a_input_colspan = 1, ilPropertyFormGUI $a_form = null, $a_as_section = true)
2732  {
2733  if ($this->ilias->getSetting("custom_icons"))
2734  {
2735  if(!$a_form)
2736  {
2737  /*
2738  $this->tpl->addBlockFile("CONTAINER_ICONS", "container_icon_settings",
2739  "tpl.container_icon_settings.html", "Services/Container");
2740 
2741  if (($big_icon = $this->object->getBigIconPath()) != "")
2742  {
2743  $this->tpl->setCurrentBlock("big_icon");
2744  $this->tpl->setVariable("SRC_BIG_ICON", $big_icon);
2745  $this->tpl->parseCurrentBlock();
2746  }
2747  if ($this->object->getType() != "root")
2748  {
2749  if (($small_icon = $this->object->getSmallIconPath()) != "")
2750  {
2751  $this->tpl->setCurrentBlock("small_icon");
2752  $this->tpl->setVariable("SRC_SMALL_ICON", $small_icon);
2753  $this->tpl->parseCurrentBlock();
2754  }
2755  $this->tpl->setCurrentBlock("small_icon_row");
2756  $this->tpl->setVariable("SMALL_ICON", $this->lng->txt("standard_icon"));
2757  $this->tpl->setVariable("SMALL_SIZE", "(".
2758  $this->ilias->getSetting("custom_icon_small_width")."x".
2759  $this->ilias->getSetting("custom_icon_small_height").")");
2760  $this->tpl->setVariable("TXT_REMOVE_S", $this->lng->txt("remove"));
2761  $this->tpl->parseCurrentBlock();
2762  }
2763  if (($tiny_icon = $this->object->getTinyIconPath()) != "")
2764  {
2765  $this->tpl->setCurrentBlock("tiny_icon");
2766  $this->tpl->setVariable("SRC_TINY_ICON", $tiny_icon);
2767  $this->tpl->parseCurrentBlock();
2768  }
2769  $this->tpl->setCurrentBlock("container_icon_settings");
2770  $this->tpl->setVariable("SPAN_TITLE", $a_input_colspan + 1);
2771  $this->tpl->setVariable("SPAN_INPUT", $a_input_colspan);
2772  $this->tpl->setVariable("ICON_SETTINGS", $this->lng->txt("icon_settings"));
2773  $this->tpl->setVariable("BIG_ICON", $this->lng->txt("big_icon"));
2774  $this->tpl->setVariable("TINY_ICON", $this->lng->txt("tiny_icon"));
2775  $this->tpl->setVariable("BIG_SIZE", "(".
2776  $this->ilias->getSetting("custom_icon_big_width")."x".
2777  $this->ilias->getSetting("custom_icon_big_height").")");
2778  $this->tpl->setVariable("TINY_SIZE", "(".
2779  $this->ilias->getSetting("custom_icon_tiny_width")."x".
2780  $this->ilias->getSetting("custom_icon_tiny_height").")");
2781  $this->tpl->setVariable("TXT_REMOVE", $this->lng->txt("remove"));
2782  $this->tpl->parseCurrentBlock();
2783  */
2784  }
2785  else
2786  {
2787  //$big_icon = $this->object->getBigIconPath();
2788  $custom_icon = $this->object->getCustomIconPath();
2789  //$tiny_icon = $this->object->getTinyIconPath();
2790 
2791  if($a_as_section)
2792  {
2793  $title = new ilFormSectionHeaderGUI();
2794  $title->setTitle($this->lng->txt("icon_settings"));
2795  }
2796  else
2797  {
2798  $title = new ilCustomInputGUI($this->lng->txt("icon_settings"), "");
2799  }
2800  $a_form->addItem($title);
2801 
2802  // big
2803  /*
2804  $caption = $this->lng->txt("big_icon")." (".
2805  $this->ilias->getSetting("custom_icon_big_width")."x".
2806  $this->ilias->getSetting("custom_icon_big_height").")";
2807  $icon = new ilImageFileInputGUI($caption, "cont_big_icon");
2808  $icon->setImage($big_icon);
2809  if($a_as_section)
2810  {
2811  $a_form->addItem($icon);
2812  }
2813  else
2814  {
2815  $title->addSubItem($icon);
2816  }*/
2817 
2818  // small/standard
2819  //if ($this->object->getType() != "root")
2820  //{
2821  /*$caption = $this->lng->txt("standard_icon")." (".
2822  $this->ilias->getSetting("custom_icon_small_width")."x".
2823  $this->ilias->getSetting("custom_icon_small_height").")";*/
2824  $caption = $this->lng->txt("cont_custom_icon");
2825  $icon = new ilImageFileInputGUI($caption, "cont_icon");
2826  $icon->setSuffixes(array("svg"));
2827  $icon->setImage($custom_icon);
2828  if($a_as_section)
2829  {
2830  $a_form->addItem($icon);
2831  }
2832  else
2833  {
2834  $title->addSubItem($icon);
2835  }
2836  //}
2837 
2838  // tiny
2839  /*
2840  $caption = $this->lng->txt("tiny_icon")." (".
2841  $this->ilias->getSetting("custom_icon_tiny_width")."x".
2842  $this->ilias->getSetting("custom_icon_tiny_height").")";
2843  $icon = new ilImageFileInputGUI($caption, "cont_tiny_icon");
2844  $icon->setImage($tiny_icon);
2845  if($a_as_section)
2846  {
2847  $a_form->addItem($icon);
2848  }
2849  else
2850  {
2851  $title->addSubItem($icon);
2852  }
2853  */
2854  }
2855  }
2856  }
2857 
2859  {
2860  global $ilAccess;
2861 
2862  // #10081
2863  if($_SESSION["il_cont_admin_panel"] &&
2864  $this->object->getRefId() &&
2865  !$ilAccess->checkAccess("write", "", $this->object->getRefId()))
2866  {
2867  return false;
2868  }
2869 
2870  return $_SESSION["il_cont_admin_panel"];
2871  }
2872 
2876  function setColumnSettings($column_gui)
2877  {
2878  global $ilAccess;
2879  parent::setColumnSettings($column_gui);
2880 
2881  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
2882  $this->isActiveAdministrationPanel() &&
2883  $this->allowBlocksMoving())
2884  {
2885  $column_gui->setEnableMovement(true);
2886  }
2887 
2888  $column_gui->setRepositoryItems(
2889  $this->object->getSubItems($this->isActiveAdministrationPanel(), true));
2890 
2891  //if ($ilAccess->checkAccess("write", "", $this->object->getRefId())
2892  // && $this->allowBlocksConfigure())
2893  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
2894  {
2895  $column_gui->setBlockProperty("news", "settings", true);
2896  //$column_gui->setBlockProperty("news", "public_notifications_option", true);
2897  $column_gui->setBlockProperty("news", "default_visibility_option", true);
2898  $column_gui->setBlockProperty("news", "hide_news_block_option", true);
2899  }
2900 
2901  if ($this->isActiveAdministrationPanel())
2902  {
2903  $column_gui->setAdminCommands(true);
2904  }
2905  }
2906 
2911  {
2912  true;
2913  }
2914 
2919  {
2920  true;
2921  }
2922 
2930  public function cloneWizardPageTreeObject()
2931  {
2932  $this->cloneWizardPageObject(true);
2933  }
2934 
2942  public function cloneWizardPageListObject()
2943  {
2944  $this->cloneWizardPageObject(false);
2945  }
2946 
2953  public function cloneWizardPageObject($a_tree_view = true)
2954  {
2955  include_once('Services/CopyWizard/classes/class.ilCopyWizardPageFactory.php');
2956 
2957  global $ilObjDataCache,$tree;
2958 
2959  if(!$_REQUEST['clone_source'])
2960  {
2961  ilUtil::sendFailure($this->lng->txt('select_one'));
2962  if(isset($_SESSION['wizard_search_title']))
2963  {
2964  $this->searchCloneSourceObject();
2965  }
2966  else
2967  {
2968  $this->createObject();
2969  }
2970  return false;
2971  }
2972  $source_id = $_REQUEST['clone_source'];
2973  $new_type = $_REQUEST['new_type'];
2974  $this->ctrl->setParameter($this,'clone_source',(int) $_REQUEST['clone_source']);
2975  $this->ctrl->setParameter($this,'new_type',$new_type);
2976 
2977 
2978  // Generell JavaScript
2979  $this->tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
2980  $this->tpl->setVariable('BODY_ATTRIBUTES','onload="ilDisableChilds(\'cmd\');"');
2981 
2982 
2983  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.container_wizard_page.html',
2984  "Services/Container");
2985  $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
2986  $this->tpl->setVariable('TYPE_IMG',ilUtil::getImagePath('icon_'.$new_type.'.svg'));
2987  $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_'.$new_type));
2988  $this->tpl->setVariable('TXT_DUPLICATE',$this->lng->txt($new_type.'_wizard_page'));
2989  $this->tpl->setVariable('INFO_DUPLICATE',$this->lng->txt($new_type.'_copy_threads_info'));
2990  $this->tpl->setVariable('BTN_COPY',$this->lng->txt('obj_'.$new_type.'_duplicate'));
2991  $this->tpl->setVariable('BTN_BACK',$this->lng->txt('btn_back'));
2992  if(isset($_SESSION['wizard_search_title']))
2993  {
2994  $this->tpl->setVariable('CMD_BACK','searchCloneSource');
2995  }
2996  else
2997  {
2998  $this->tpl->setVariable('CMD_BACK','create');
2999  }
3000 
3001  $this->tpl->setVariable('BTN_TREE',$this->lng->txt('treeview'));
3002  $this->tpl->setVariable('BTN_LIST',$this->lng->txt('flatview'));
3003 
3004  // Fill item rows
3005  // tree view
3006  if($a_tree_view)
3007  {
3008  $first = true;
3009  $has_items = false;
3010  foreach($subnodes = $tree->getSubtree($source_node = $tree->getNodeData($source_id),true) as $node)
3011  {
3012  if($first == true)
3013  {
3014  $first = false;
3015  continue;
3016  }
3017 
3018  if($node['type'] == 'rolf')
3019  {
3020  continue;
3021  }
3022 
3023  $has_items = true;
3024 
3025  for($i = $source_node['depth'];$i < $node['depth']; $i++)
3026  {
3027  $this->tpl->touchBlock('padding');
3028  $this->tpl->touchBlock('end_padding');
3029  }
3030  // fill options
3031  $copy_wizard_page = ilCopyWizardPageFactory::_getInstanceByType($source_id,$node['type']);
3032  $copy_wizard_page->fillTreeSelection($node['ref_id'],$node['type'],$node['depth']);
3033 
3034  $this->tpl->setCurrentBlock('tree_row');
3035  $this->tpl->setVariable('TREE_IMG',ilUtil::getImagePath('icon_'.$node['type'].'.svg'));
3036  $this->tpl->setVariable('TREE_ALT_IMG',$this->lng->txt('obj_'.$node['type']));
3037  $this->tpl->setVariable('TREE_TITLE',$node['title']);
3038  $this->tpl->parseCurrentBlock();
3039  }
3040  if(!$has_items)
3041  {
3042  $this->tpl->setCurrentBlock('no_content');
3043  $this->tpl->setVariable('TXT_NO_CONTENT',$this->lng->txt('container_no_items'));
3044  $this->tpl->parseCurrentBlock();
3045  }
3046  else
3047  {
3048  $this->tpl->setCurrentBlock('tree_footer');
3049  $this->tpl->setVariable('TXT_COPY_ALL',$this->lng->txt('copy_all'));
3050  $this->tpl->setVariable('TXT_LINK_ALL',$this->lng->txt('link_all'));
3051  $this->tpl->setVariable('TXT_OMIT_ALL',$this->lng->txt('omit_all'));
3052  $this->tpl->parseCurrentBlock();
3053 
3054  }
3055  }
3056  else
3057  {
3058  foreach($tree->getSubTreeTypes($source_id,array('rolf','crs')) as $type)
3059  {
3060  $copy_wizard_page = ilCopyWizardPageFactory::_getInstanceByType($source_id,$type);
3061  if(strlen($html = $copy_wizard_page->getWizardPageBlockHTML()))
3062  {
3063  $this->tpl->setCurrentBlock('obj_row');
3064  $this->tpl->setVariable('ITEM_BLOCK',$html);
3065  $this->tpl->parseCurrentBlock();
3066  }
3067  }
3068  }
3069  }
3070 
3078  public function cloneAllObject()
3079  {
3080  global $ilLog, $ilCtrl;
3081 
3082  include_once('./Services/Link/classes/class.ilLink.php');
3083  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
3084 
3085  global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser;
3086 
3087  $new_type = $_REQUEST['new_type'];
3088  $ref_id = (int) $_GET['ref_id'];
3089  $clone_source = (int) $_REQUEST['clone_source'];
3090 
3091  if(!$rbacsystem->checkAccess('create', $ref_id,$new_type))
3092  {
3093  $ilErr->raiseError($this->lng->txt('permission_denied'));
3094  }
3095  if(!$clone_source)
3096  {
3097  ilUtil::sendFailure($this->lng->txt('select_one'));
3098  $this->createObject();
3099  return false;
3100  }
3101  if(!$ilAccess->checkAccess('write','', $clone_source,$new_type))
3102  {
3103  $ilErr->raiseError($this->lng->txt('permission_denied'));
3104  }
3105 
3106  $options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
3107  $orig = ilObjectFactory::getInstanceByRefId($clone_source);
3108  $result = $orig->cloneAllObject($_COOKIE['PHPSESSID'], $_COOKIE['ilClientId'], $new_type, $ref_id, $clone_source, $options);
3109 
3110  // Check if copy is in progress
3111  if ($result == $ref_id)
3112  {
3113  ilUtil::sendInfo($this->lng->txt("object_copy_in_progress"),true);
3114  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
3115  $ilCtrl->redirectByClass("ilrepositorygui", "");
3116  }
3117  else
3118  {
3119  ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
3120  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $result);
3121  $ilCtrl->redirectByClass("ilrepositorygui", "");
3122  }
3123  }
3124 
3125 
3133  public function saveSortingObject()
3134  {
3135  include_once('Services/Container/classes/class.ilContainerSorting.php');
3136  $sorting = ilContainerSorting::_getInstance($this->object->getId());
3137 
3138  // Allow comma
3139  $positions = str_replace(',','.',$_POST['position']);
3140 
3141  $sorting->savePost($positions);
3142  ilUtil::sendSuccess($this->lng->txt('cntr_saved_sorting'), true);
3143  $this->ctrl->redirect($this, "editOrder");
3144  }
3145 
3146  // BEGIN WebDAV: Support a copy command in the repository
3157  function cloneNodes($srcRef,$dstRef,&$mapping, $newName=null)
3158  {
3159  global $tree;
3160  global $ilias;
3161 
3162  // clone the source node
3163  $srcObj =& $ilias->obj_factory->getInstanceByRefId($srcRef);
3164  error_log(__METHOD__.' cloning srcRef='.$srcRef.' dstRef='.$dstRef.'...');
3165  $newRef = $srcObj->cloneObject($dstRef)->getRefId();
3166  error_log(__METHOD__.' ...cloning... newRef='.$newRef.'...');
3167 
3168  // We must immediately apply a new name to the object, to
3169  // prevent confusion of WebDAV clients about having two objects with identical
3170  // name in the repository.
3171  if (! is_null($newName))
3172  {
3173  $newObj =& $ilias->obj_factory->getInstanceByRefId($newRef);
3174  $newObj->setTitle($newName);
3175  $newObj->update();
3176  unset($newObj);
3177  }
3178  unset($srcObj);
3179  $mapping[$newRef] = $srcRef;
3180 
3181  // clone all children of the source node
3182  $children = $tree->getChilds($srcRef);
3183  foreach ($tree->getChilds($srcRef) as $child)
3184  {
3185  // Don't clone role folders, because it does not make sense to clone local roles
3186  // FIXME - Maybe it does make sense (?)
3187  if ($child["type"] != 'rolf')
3188  {
3189  $this->cloneNodes($child["ref_id"],$newRef,$mapping);
3190  }
3191  else
3192  {
3193  if (count($rolf = $tree->getChildsByType($newRef,"rolf")))
3194  {
3195  $mapping[$rolf[0]["ref_id"]] = $child["ref_id"];
3196  }
3197  }
3198  }
3199  error_log(__METHOD__.' ...cloned srcRef='.$srcRef.' dstRef='.$dstRef.' newRef='.$newRef);
3200  return $newRef;
3201  }
3202  // END PATCH WebDAV: Support a copy command in the repository
3203 
3207  function modifyItemGUI(&$a_item_list_gui, $a_item_data, $a_show_path)
3208  {
3209  global $lng;
3210 
3211  if($a_show_path)
3212  {
3213  $a_item_list_gui->addCustomProperty($lng->txt('path'),
3214  ilContainer::buildPath($a_item_data['ref_id'], $this->object->getRefId()),
3215  false, true);
3216  }
3217  }
3218 
3222  static function _buildPath($a_ref_id, $a_course_ref_id)
3223  {
3224  global $tree;
3225 
3226  $path_arr = $tree->getPathFull($a_ref_id, $a_course_ref_id);
3227  $counter = 0;
3228  foreach($path_arr as $data)
3229  {
3230  if($counter++)
3231  {
3232  $path .= " > ";
3233  }
3234  $path .= $data['title'];
3235  }
3236 
3237  return $path;
3238  }
3239 
3240  //
3241  // Style editing
3242  //
3243 
3248  {
3249  global $ilTabs, $tpl;
3250 
3251  $this->checkPermission("write");
3252 
3253  $this->initStylePropertiesForm();
3254  $tpl->setContent($this->form->getHTML());
3255 
3256  $ilTabs->activateTab("obj_sty");
3257  }
3258 
3263  {
3264  global $ilCtrl, $lng, $ilTabs, $ilSetting, $tpl;
3265 
3266  $tpl->setTreeFlatIcon("", "");
3267  $ilTabs->clearTargets();
3268  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
3269  "xhtml_page");
3270  if ($xpage_id > 0)
3271  {
3272  $ilTabs->setBackTarget($lng->txt("cntr_back_to_old_editor"),
3273  $ilCtrl->getLinkTarget($this, "switchToOldEditor"), "_top");
3274  }
3275  else
3276  {
3277  $ilTabs->setBackTarget($lng->txt("back"), "./goto.php?target=".$this->object->getType()."_".
3278  $this->object->getRefId(), "_top");
3279  }
3280 
3281  include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
3282  $page_gui = new ilContainerPageGUI($this->object->getId());
3283  $style_id = $this->object->getStyleSheetId();
3284  if (ilObject::_lookupType($style_id) == "sty")
3285  {
3286  $page_gui->setStyleId($style_id);
3287  }
3288  else
3289  {
3290  $style_id = 0;
3291  }
3292  $page_gui->setTabHook($this, "addPageTabs");
3293  $ilCtrl->getHTML($page_gui);
3294  $ilTabs->setTabActive("obj_sty");
3295 
3296  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
3297  $lng->loadLanguageModule("style");
3298 
3299  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3300  $this->form = new ilPropertyFormGUI();
3301 
3302  $fixed_style = $ilSetting->get("fixed_content_style_id");
3303 // $style_id = $this->object->getStyleSheetId();
3304 
3305  if ($fixed_style > 0)
3306  {
3307  $st = new ilNonEditableValueGUI($lng->txt("wiki_current_style"));
3308  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
3309  $this->lng->txt("global_fixed").")");
3310  $this->form->addItem($st);
3311  }
3312  else
3313  {
3314  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
3315  $_GET["ref_id"]);
3316 
3317  $st_styles[0] = $this->lng->txt("default");
3318  ksort($st_styles);
3319 
3320  if ($style_id > 0)
3321  {
3322  // individual style
3323  if (!ilObjStyleSheet::_lookupStandard($style_id))
3324  {
3325  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
3326  $st->setValue(ilObject::_lookupTitle($style_id));
3327  $this->form->addItem($st);
3328 
3329 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
3330 
3331  // delete command
3332  $this->form->addCommandButton("editStyle",
3333  $lng->txt("style_edit_style"));
3334  $this->form->addCommandButton("deleteStyle",
3335  $lng->txt("style_delete_style"));
3336 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
3337  }
3338  }
3339 
3340  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
3341  {
3342  $style_sel = ilUtil::formSelect ($style_id, "style_id",
3343  $st_styles, false, true);
3344  $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
3345  $style_sel->setOptions($st_styles);
3346  $style_sel->setValue($style_id);
3347  $this->form->addItem($style_sel);
3348 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
3349  $this->form->addCommandButton("saveStyleSettings",
3350  $lng->txt("save"));
3351  $this->form->addCommandButton("createStyle",
3352  $lng->txt("sty_create_ind_style"));
3353  }
3354  }
3355  $this->form->setTitle($lng->txt("obj_sty"));
3356  $this->form->setFormAction($ilCtrl->getFormAction($this));
3357  }
3358 
3363  {
3364  global $ilCtrl;
3365 
3366  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
3367  }
3368 
3372  function editStyleObject()
3373  {
3374  global $ilCtrl;
3375 
3376  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
3377  }
3378 
3383  {
3384  global $ilCtrl;
3385 
3386  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
3387  }
3388 
3393  {
3394  global $ilSetting;
3395 
3396  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
3397  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
3398  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
3399  || $this->object->getStyleSheetId() == 0))
3400  {
3401  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
3402  $this->object->update();
3403  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
3404  }
3405  $this->ctrl->redirect($this, "editStyleProperties");
3406  }
3407 
3412  {
3413  global $ilCtrl;
3414 
3415  $ref_id = $_GET["cmdrefid"];
3417  $type = ilObject::_lookupType($obj_id);
3418 
3419  // this should be done via container-object->getSubItem in the future
3420  $data = array("child" => $ref_id, "ref_id" => $ref_id, "obj_id" => $obj_id,
3421  "type" => $type);
3422  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
3423  $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($type);
3424  $item_list_gui->setContainerObject($this);
3425 
3426  $item_list_gui->enableComments(true);
3427  $item_list_gui->enableNotes(true);
3428  $item_list_gui->enableTags(true);
3429 
3430  $this->modifyItemGUI($item_list_gui, $data, false);
3431  $html = $item_list_gui->getListItemHTML($ref_id,
3432  $obj_id, "", "", true, true);
3433 
3434  // include plugin slot for async item list
3435  global $ilPluginAdmin;
3436  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
3437  foreach ($pl_names as $pl)
3438  {
3439  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
3440  $gui_class = $ui_plugin->getUIClassInstance();
3441  $resp = $gui_class->getHTML("Services/Container", "async_item_list", array("html" => $html));
3442  if ($resp["mode"] != ilUIHookPluginGUI::KEEP)
3443  {
3444  $html = $gui_class->modifyHTML($html, $resp);
3445  }
3446  }
3447 
3448  echo $html;
3449  exit;
3450  }
3451 
3456  protected function showPasswordInstructionObject($a_init = true)
3457  {
3458  global $tpl,$ilToolbar;
3459 
3460  if($a_init)
3461  {
3462  ilUtil::sendInfo($this->lng->txt('webdav_pwd_instruction'));
3463  $this->initFormPasswordInstruction();
3464  }
3465 
3466  include_once ('Services/WebDAV/classes/class.ilDAVServer.php');
3467  $davServer = ilDAVServer::getInstance();
3468  $ilToolbar->addButton(
3469  $this->lng->txt('mount_webfolder'),
3470  $davServer->getMountURI($this->object->getRefId()),
3471  '_blank',
3472  '',
3473  $davServer->getFolderURI($this->object->getRefId())
3474  );
3475 
3476  $tpl->setContent($this->form->getHTML());
3477  }
3478 
3483  protected function initFormPasswordInstruction()
3484  {
3485  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3486  $this->form = new ilPropertyFormGUI();
3487  $this->form->setFormAction($this->ctrl->getFormAction($this));
3488 
3489  // new password
3490  $ipass = new ilPasswordInputGUI($this->lng->txt("desired_password"), "new_password");
3491  $ipass->setRequired(true);
3492 
3493  $this->form->addItem($ipass);
3494  $this->form->addCommandButton("savePassword", $this->lng->txt("save"));
3495  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
3496 
3497  $this->form->setTitle($this->lng->txt("chg_ilias_and_webfolder_password"));
3498  $this->form->setFormAction($this->ctrl->getFormAction($this));
3499 
3500  return $this->form;
3501  }
3502 
3507  protected function savePasswordObject()
3508  {
3509  global $ilUser;
3510 
3511  $form = $this->initFormPasswordInstruction();
3512  if($form->checkInput())
3513  {
3514  $ilUser->resetPassword($this->form->getInput('new_password'),$this->form->getInput('new_password'));
3515  ilUtil::sendSuccess($this->lng->txt('webdav_pwd_instruction_success'),true);
3516  $this->showPasswordInstructionObject(false);
3517  return true;
3518  }
3519  $form->setValuesByPost();
3521  }
3522 
3530  {
3531  global $tpl;
3532 
3533  $html = null;
3534 
3535  $item_data = $this->object->getSubItems(false, false, (int) $_GET["child_ref_id"]);
3536  $container_view = $this->getContentGUI();
3537 
3538  // list item is session material (not part of "_all"-items - see below)
3539  include_once './Modules/Session/classes/class.ilEventItems.php';
3540  $event_items = ilEventItems::_getItemsOfContainer($this->object->getRefId());
3541  if(in_array((int)$_GET["child_ref_id"], $event_items))
3542  {
3543  include_once('./Services/Object/classes/class.ilObjectActivation.php');
3544  foreach ($this->object->items["sess"] as $id)
3545  {
3546  $items = ilObjectActivation::getItemsByEvent($id['obj_id']);
3547  foreach($items as $event_item)
3548  {
3549  if ($event_item["child"] == (int)$_GET["child_ref_id"])
3550  {
3551  // sessions
3552  if((int)$_GET["parent_ref_id"])
3553  {
3554  $event_item["parent"] = (int)$_GET["parent_ref_id"];
3555  }
3556  $html = $container_view->renderItem($event_item);
3557  }
3558  }
3559  }
3560  }
3561 
3562  // "normal" list item
3563  if(!$html)
3564  {
3565  foreach ($this->object->items["_all"] as $id)
3566  {
3567  if ($id["child"] == (int) $_GET["child_ref_id"])
3568  {
3569  $html = $container_view->renderItem($id);
3570  }
3571  }
3572  }
3573 
3574  if($html)
3575  {
3576  echo $html;
3577 
3578  // we need to add onload code manually (rating, comments, etc.)
3579  echo $tpl->getOnLoadCodeForAsynch();
3580  }
3581 
3582  exit;
3583  }
3584 
3585  // begin-patch fm
3592  protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
3593  {
3594  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
3595 
3596  // begin-patch fm
3597  include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
3598  if(ilFMSettings::getInstance()->isEnabled())
3599  {
3600  if($lg instanceof ilObjectListGUI)
3601  {
3602  $lg->addCustomCommand($this->ctrl->getLinkTarget($this,'fileManagerLaunch'), 'fm_start','_blank');
3603  }
3604  }
3605  // end-patch fm
3606  return $lg;
3607  }
3608 
3612  protected function fileManagerLaunchObject()
3613  {
3614  global $ilUser;
3615 
3616  $tpl = new ilTemplate('tpl.fm_launch_ws.html',false,false,'Services/WebServices/FileManager');
3617  $tpl->setVariable('JNLP_URL',ILIAS_HTTP_PATH.'/Services/WebServices/FileManager/lib/dist/FileManager.jnlp');
3618  $tpl->setVariable('SESSION_ID', $_COOKIE['PHPSESSID'].'::'.CLIENT_ID);
3619  $tpl->setVariable('UID',$ilUser->getId());
3620  $tpl->setVariable('REF_ID', $this->object->getRefId());
3621  $tpl->setVariable('WSDL_URI', ILIAS_HTTP_PATH.'/webservice/soap/server.php?wsdl');
3622  $tpl->setVariable('LOCAL_FRAME', ilFMSettings::getInstance()->isLocalFSEnabled() ? 1 : 0);
3623  $tpl->setVariable('REST_URI',ILIAS_HTTP_PATH.'/Services/WebServices/Rest/server.php');
3624  $tpl->setVariable('FILE_LOCKS',0);
3625  $tpl->setVariable('UPLOAD_FILESIZE', ilFMSettings::getInstance()->getMaxFileSize());
3626 
3627  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
3628  $header_top_title = ilObjSystemFolder::_getHeaderTitle();
3629  $tpl->setVariable('HEADER_TITLE',$header_top_title ? $header_top_title : '');
3630  echo $tpl->get();
3631  exit;
3632  }
3633  // begin-patch fm
3634 
3641  function showRepTree($a_initial_call = false)
3642  {
3643  global $tpl, $ilUser, $ilSetting, $ilCtrl;
3644 
3645  // set current repository view mode
3646  if (!empty($_GET["set_mode"]))
3647  {
3648  $_SESSION["il_rep_mode"] = $_GET["set_mode"];
3649  if ($ilUser->getId() != ANONYMOUS_USER_ID)
3650  {
3651  $ilUser->writePref("il_rep_mode", $_GET["set_mode"]);
3652  }
3653  }
3654 
3655  // get user setting
3656  if ($_SESSION["il_rep_mode"] == "")
3657  {
3658  if ($ilUser->getId() != ANONYMOUS_USER_ID)
3659  {
3660  $_SESSION["il_rep_mode"] = $ilUser->getPref("il_rep_mode");
3661  }
3662  }
3663 
3664  // if nothing set, get default view
3665  if ($_SESSION["il_rep_mode"] == "")
3666  {
3667  $_SESSION["il_rep_mode"] = $ilSetting->get("default_repository_view");
3668  }
3669 
3670  $mode = ($_SESSION["il_rep_mode"] != "")
3671  ? $_SESSION["il_rep_mode"]
3672  : "flat";
3673 
3674  // check for administration context, see #0016312
3675  if ($mode == "tree" && (strtolower($_GET["baseClass"]) != "iladministrationgui"))
3676  {
3677  include_once("./Services/Repository/classes/class.ilRepositoryExplorerGUI.php");
3678  $exp = new ilRepositoryExplorerGUI($this, "showRepTree");
3679  if (!$exp->handleCommand())
3680  {
3681  $tpl->setLeftNavContent($exp->getHTML());
3682  }
3683  }
3684  }
3685 
3691  protected function initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
3692  {
3693  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
3694  include_once './Services/Container/classes/class.ilContainer.php';
3695 
3696  $settings = new ilContainerSortingSettings($this->object->getId());
3697  $sort = new ilRadioGroupInputGUI($this->lng->txt('sorting_header'), "sorting");
3698 
3699  if(in_array(ilContainer::SORT_INHERIT, $a_sorting_settings))
3700  {
3701  $sort_inherit = new ilRadioOption();
3702  $sort_inherit->setTitle(
3703  $this->lng->txt('sort_inherit_prefix').
3704  ' ('.ilContainerSortingSettings::sortModeToString(
3706  $this->object->getId())).') '
3707  );
3708  $sort_inherit->setValue(ilContainer::SORT_INHERIT);
3709  $sort_inherit->setInfo($this->lng->txt('sorting_info_inherit'));
3710  $sort->addOption($sort_inherit);
3711  }
3712  if(in_array(ilContainer::SORT_TITLE,$a_sorting_settings))
3713  {
3714  $sort_title = new ilRadioOption(
3715  $this->lng->txt('sorting_title_header'),
3717  );
3718  $sort_title->setInfo($this->lng->txt('sorting_info_title'));
3719 
3720  $this->initSortingDirectionForm($settings,$sort_title,'title');
3721  $sort->addOption($sort_title);
3722  }
3723  if(in_array(ilContainer::SORT_CREATION, $a_sorting_settings))
3724  {
3725  $sort_activation = new ilRadioOption($this->lng->txt('sorting_creation_header'),ilContainer::SORT_CREATION);
3726  $sort_activation->setInfo($this->lng->txt('sorting_creation_info'));
3727  $this->initSortingDirectionForm($settings,$sort_activation,'creation');
3728  $sort->addOption($sort_activation);
3729  }
3730  if(in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings))
3731  {
3732  $sort_activation = new ilRadioOption($this->lng->txt('crs_sort_activation'),ilContainer::SORT_ACTIVATION);
3733  $sort_activation->setInfo($this->lng->txt('crs_sort_timing_info'));
3734  $this->initSortingDirectionForm($settings,$sort_activation,'activation');
3735  $sort->addOption($sort_activation);
3736  }
3737  if(in_array(ilContainer::SORT_MANUAL, $a_sorting_settings))
3738  {
3739  $sort_manual = new ilRadioOption(
3740  $this->lng->txt('sorting_manual_header'),
3742  );
3743  $sort_manual->setInfo($this->lng->txt('sorting_info_manual'));
3744  $this->initManualSortingOptionForm($settings, $sort_manual, "manual", $a_sorting_settings);
3745  $sort->addOption($sort_manual);
3746  }
3747 
3748  $sort->setValue($settings->getSortMode());
3749  $form->addItem($sort);
3750 
3751  return $form;
3752  }
3753 
3758  protected function initSortingDirectionForm(ilContainerSortingSettings $sorting_settings, $element, $a_prefix)
3759  {
3760  $direction = new ilRadioGroupInputGUI($this->lng->txt('sorting_direction'),$a_prefix.'_sorting_direction');
3761  $direction->setValue($sorting_settings->getSortDirection());
3762  $direction->setRequired(TRUE);
3763 
3764  // asc
3765  $asc = new ilRadioOption(
3766  $this->lng->txt('sorting_asc'),
3768  );
3769  $direction->addOption($asc);
3770 
3771  // desc
3772  $desc = new ilRadioOption(
3773  $this->lng->txt('sorting_desc'),
3775  );
3776  $direction->addOption($desc);
3777 
3778  $element->addSubItem($direction);
3779 
3780  return $element;
3781  }
3782 
3787  protected function initManualSortingOptionForm(ilContainerSortingSettings $settings, $element, $a_prefix,
3788  $a_sorting_settings)
3789  {
3790  $position = new ilRadioGroupInputGUI($this->lng->txt('sorting_new_items_position'),$a_prefix.'_new_items_position');
3791  $position->setValue($settings->getSortNewItemsPosition());
3792  $position->setRequired(TRUE);
3793 
3794  //new items insert on top
3795  $new_top = new ilRadioOption(
3796  $this->lng->txt('sorting_new_items_at_top'),
3798  );
3799 
3800  $position->addOption($new_top);
3801 
3802  //new items insert at bottom
3803  $new_bottom = new ilRadioOption(
3804  $this->lng->txt('sorting_new_items_at_bottom'),
3806  );
3807 
3808  $position->addOption($new_bottom);
3809 
3810  $element->addSubItem($position);
3811 
3812  $order = new ilRadioGroupInputGUI($this->lng->txt('sorting_new_items_order'),$a_prefix.'_new_items_order');
3813  $order->setValue($settings->getSortNewItemsOrder());
3814  $order->setRequired(TRUE);
3815 
3816  if(in_array(ilContainer::SORT_TITLE, $a_sorting_settings))
3817  {
3818  //new items sort in alphabetical order
3819  $new_title = new ilRadioOption(
3820  $this->lng->txt('sorting_title_header'),
3822  );
3823 
3824  $order->addOption($new_title);
3825  }
3826 
3827  if(in_array(ilContainer::SORT_CREATION, $a_sorting_settings))
3828  {
3829  //new items sort by creation date
3830  $new_creation = new ilRadioOption(
3831  $this->lng->txt('sorting_creation_header'),
3833  );
3834 
3835  $order->addOption($new_creation);
3836  }
3837 
3838 
3839  if(in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings))
3840  {
3841  //new items by activation
3842  $new_activation = new ilRadioOption(
3843  $this->lng->txt('crs_sort_activation'),
3845  );
3846 
3847  $order->addOption($new_activation);
3848  }
3849 
3850  $element->addSubItem($order);
3851 
3852  $this->initSortingDirectionForm($settings,$element,'manual');
3853 
3854  return $element;
3855  }
3856 
3861  protected function saveSortingSettings(ilPropertyFormGUI $form)
3862  {
3863  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
3864  $settings = new ilContainerSortingSettings($this->object->getId());
3865  $settings->setSortMode($form->getInput("sorting"));
3866 
3867  switch($form->getInput('sorting'))
3868  {
3870  $settings->setSortDirection($form->getInput('title_sorting_direction'));
3871  break;
3873  $settings->setSortDirection($form->getInput('activation_sorting_direction'));
3874  break;
3876  $settings->setSortDirection($form->getInput('creation_sorting_direction'));
3877  break;
3879  $settings->setSortNewItemsPosition($form->getInput('manual_new_items_position'));
3880  $settings->setSortNewItemsOrder($form->getInput('manual_new_items_order'));
3881  $settings->setSortDirection($form->getInput('manual_sorting_direction'));
3882  break;
3883  }
3884 
3885  $settings->update();
3886  }
3887 
3893  public function trashObject()
3894  {
3895  global $tpl;
3896 
3897  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3898  $ru = new ilRepUtilGUI($this);
3899  $ru->showTrashTable($_GET["ref_id"]);
3900  }
3901 
3907  public function removeFromSystemObject()
3908  {
3909  global $log, $ilAppEventHandler, $lng;
3910 
3911  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3912  $ru = new ilRepUtilGUI($this);
3913  $ru->removeObjectsFromSystem($_POST["trash_id"]);
3914  $this->ctrl->redirect($this, "trash");
3915  }
3916 
3920  public function undeleteObject()
3921  {
3922  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3923  $ru = new ilRepUtilGUI($this);
3924  $ru->restoreObjects($_GET["ref_id"], $_POST["trash_id"]);
3925  $this->ctrl->redirect($this, "trash");
3926  }
3927 
3932  {
3933  global $lng;
3934  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3935 
3936  if(!isset($_POST["trash_id"]))
3937  {
3938  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3939  $this->ctrl->redirect($this, "trash");
3940  }
3941 
3942  $ru = new ilRepUtilGUI($this);
3943  $ru->confirmRemoveFromSystemObject($_POST["trash_id"]);
3944  }
3945 
3950  protected function getTreeSelectorGUI($cmd)
3951  {
3952  include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
3953  $exp = new ilRepositorySelectorExplorerGUI($this, "showPasteTree");
3954  $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
3955  if ($cmd == "link") {
3956  $exp->setSelectMode("nodes", true);
3957  return $exp;
3958  } else {
3959  $exp->setSelectMode("nodes[]", false);
3960  return $exp;
3961  }
3962  }
3963 }
3964 ?>
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static lookupTemplateId($a_ref_id)
Lookup template id ilDB $ilDB.
static _getRTEClassname()
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _isActionsVisible()
Static getter.
initManualSortingOptionForm(ilContainerSortingSettings $settings, $element, $a_prefix, $a_sorting_settings)
Add manual sorting options.
getContentGUI()
Get content gui object.
getAsynchItemListObject()
Get item list command drop down asynchronously.
static _getInstanceByType($a_source_id, $a_item_type)
Get instance by type.
saveSortingObject()
Save Sorting.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
ILIAS Setting Class.
deleteStyleObject()
Delete Style.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
addMessageRow(&$a_tpl, $a_message, $a_type)
add message row
redrawListItemObject()
Redraw a list item (ajax)
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add file manager link.
enableAdministrationPanelObject()
enable administration panel
removeFromSystemObject()
remove objects from trash bin and all entries therefore every object needs a specific deleteObject() ...
exit
Definition: login.php:54
clearObject()
clear clipboard and go back to last object
addStandardRow(&$a_tpl, $a_html, $a_item_ref_id="", $a_item_obj_id="", $a_image_type="")
adds a standard row to a block template
$_POST['username']
Definition: cron.php:12
showPasswordInstructionObject($a_init=true)
Show webdav password instruction.
const SORT_NEW_ITEMS_POSITION_TOP
static getItemsByEvent($a_event_id)
Get session material / event items.
Shows all items grouped by type.
getTitlesByRefId($a_ref_ids)
get Titles of objects this method is used for error messages in methods cut/copy/paste ...
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
cloneWizardPageTreeObject()
public
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
Explorer for selecting repository items.
fileManagerLaunchObject()
Launch jnlp.
& newBlockTemplate()
determin admin commands
This class represents a selection list property in a property form.
$result
renderObject()
render the object
This class represents a property form user interface.
static _appendNumberOfCopyToFilename($a_file_name, $nth_copy=null, $a_handle_extension=false)
Appends the text " - Copy" to a filename in the language of the current user.
& _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
Container page GUI class.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
static copyFile($obj_id, $title, $tmpdir)
getEditFormValues()
Get values for edit form.
createStyleObject()
Create Style.
& executeCommand()
execute command note: this method is overwritten in all container objects
setTitleAndDescription()
called by prepare output
This class represents a section header in a property form.
cloneAllObject()
Clone all object Overwritten method for copying container objects.
allowBlocksMoving()
Standard is to allow blocks moving.
trashObject()
Show trash content of object.
_getItemsOfContainer($a_ref_id)
$_COOKIE["ilClientId"]
Definition: cron.php:11
$cmd
Definition: sahs_server.php:35
editPageContentObject()
edit page content (for repository root node and categories)
editOrderObject()
Edit order.
_writeContainerSetting($a_id, $a_keyword, $a_value)
static _isActive()
Static getter.
switchToStdEditorObject()
Switch to standard page editor.
prepareOutput($a_show_subobjects=true)
prepare output
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static _lookupTitle($a_id)
lookup object title
confirmRemoveFromSystemObject()
confirmation screen remove from system
addItem($a_item)
Add Item (Property, SectionHeader).
static isActive()
createObject()
create new object form
isActiveOrdering()
Check if ordering is enabled.
_cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
synchronises appearances of media objects in $a_text with media object usage table ...
const IL_CRS_VIEW_TIMING
static addToDesktop()
Add desktop item public.
setInfo($a_info)
Set Info.
setPageEditorTabs()
Add page editor tabs.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
getSyntaxStylePath()
get syntax style path
initSortingDirectionForm(ilContainerSortingSettings $sorting_settings, $element, $a_prefix)
Add sorting direction.
_lookupIconPath($a_id, $a_size="big")
lookup icon path
static _lookupObjectId($a_ref_id)
lookup object id
global $ilCtrl
Definition: ilias.php:18
initFormPasswordInstruction()
Init password form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
addHeaderRow(&$a_tpl, $a_type, $a_show_image=true)
adds a header row to a block template
_existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages) ...
getTabs(&$tabs_gui)
common tabs for all container objects (should be called at the end of child getTabs() method ...
pasteObject()
paste object from clipboard to current place Depending on the chosen command the object(s) are linked...
editStyleObject()
Edit Style.
useNewEditorObject()
Use new editor (-> delete xhtml content page)
editStylePropertiesObject()
Edit style properties.
static showMemberViewSwitch($a_ref_id)
Show member view switch.
const SORT_NEW_ITEMS_POSITION_BOTTOM
This class represents a property in a property form.
GUI class for didactic template settings inside repository objects.
showPermanentLink(&$tpl)
show permanent link
savePasswordObject()
Save password.
undeleteObject()
Get objects back from trash.
if(!is_array($argv)) $options
setColumnSettings($column_gui)
May be overwritten in subclasses.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
static _buildPath($a_ref_id, $a_course_ref_id)
build path
$GLOBALS['ct_recipient']
Container page object.
addSubItem($a_item)
Add Subitem.
modifyItemGUI(&$a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container.
showCustomIconsEditing($a_input_colspan=1, ilPropertyFormGUI $a_form=null, $a_as_section=true)
show edit section of custom icons for container
linkObject()
create an new reference of an object in tree it&#39;s like a hard link of unix
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
clearAdminCommandsDetermination()
cleaer administration commands determination
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.
const SORT_NEW_ITEMS_ORDER_CREATION
allowBlocksConfigure()
Standard is to allow blocks configuration.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
Repository explorer GUI class.
special template class to simplify handling of ITX/PEAR
omitLocator($a_omit=true)
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
Class ilObjectListGUI.
Repository GUI Utilities.
static lookupSortModeFromParentContainer($a_obj_id)
Lookup sort mode from parent container.
showPasteTreeObject()
Show paste tree.
saveStyleSettingsObject()
Save style settings.
addPageTabs()
Add page tabs.
_getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
forwardToStyleSheet()
Forward to style object.
This class represents a password property in a property form.
& forwardToPageObject()
forward command to page object
Class to report exception.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
redirection script todo: (a better solution should control the processing via a xml file) ...
const LINK_OBJECT
cancelMoveLinkObject()
Cancel move|link empty clipboard and return to parent.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getInstance()
Get singelton iunstance.
setOptions($a_options)
Set Options.
showPossibleSubObjects()
show possible sub objects selection list
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
_isInTrash($a_ref_id)
checks wether object is in trash
copyObject()
Copy object(s) out from a container and write the information to clipboard It is not possible to copy...
prepareOutput()
prepare output
static _lookupType($a_id, $a_reference=false)
lookup object type
disableAdministrationPanelObject()
enable administration panel
XHTML Page class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
cloneWizardPageListObject()
public
const SORT_NEW_ITEMS_ORDER_ACTIVATION
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
setContentSubTabs()
Set content sub tabs.
This class represents an image file property in a property form.
static removeFromDesktop()
Remove item from personal desktop public.
This class represents a custom property in a property form.
downloadMultipleObjects($a_ref_ids)
_lookupStandard($a_id)
Lookup standard flag.
static getInstance()
Get singleton instance.
setStyleId($a_styleid)
Set Style Id.
getSortNewItemsPosition()
GET new item position.
static _getFrame($a_class, $a_type='')
Get content frame name.
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
getContentStylePath($a_style_id)
get content style path
Render add new item selector.
Class ilObjStyleSheetGUI.
global $ilSetting
Definition: privfeed.php:40
static _adjustMovedObjectConditions($a_ref_id)
In the moment it is not allowed to create preconditions on objects that are located outside of a cour...
static getInstance()
Get instance.
const SORT_DIRECTION_DESC
Shows all items grouped by type.
$path
Definition: index.php:22
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static getInstance($a_obj_id)
Get instance.
ilContainerGUI($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
global $ilDB
setTabHook($a_object, $a_function)
Set tab hook.
static _lookupAbsolutePath($obj_id, $a_version=null)
return absolute path for version
getCreationMode()
get creation mode
cutObject()
cut object(s) out from a container and write the information to clipboard
Class ilContainerGUI.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
getDidacticTemplateVar($a_type)
Get didactic template setting from creation screen.
initStylePropertiesForm()
Init style properties form.
render()
Add new item selection to current page incl.
static _lookupSortMode($a_obj_id)
lookup sort mode
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static _getInstance($a_obj_id)
get instance by obj_id
showAdministrationPanel(&$tpl)
show administration panel
const SORT_DIRECTION_ASC
isActiveItemOrdering()
Check if item ordering is enabled.
_catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static recurseFolder($refid, $title, $tmpdir)
private functions which iterates through all folders and files and create an according file structure...
editPageFrameObject()
show page editor frameset
getContainerPageHTML()
Get container page HTML.
const SORT_NEW_ITEMS_ORDER_TITLE
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
cloneNodes($srcRef, $dstRef, &$mapping, $newName=null)
Recursively clones all nodes of the RBAC tree.
cloneWizardPageObject($a_tree_view=true)
Show clone wizard page for container objects.
keepObjectsInClipboardObject()
Keep objects in the clipboard.
clipboardObject()
Copy object(s) out from a container and write the information to clipboard It is not possible to copy...
setRequired($a_required)
Set Required.
const IL_COMP_SERVICE
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
GUI class for course objective view.
switchToOldEditorObject()
Switch to old page editor.
addStandardContainerSubTabs($a_include_view=true)
Add standar container subtabs for view, manage, oderdering and text/media editor link.
showRepTree($a_initial_call=false)
Show tree.
Class ilFramesetGUI.