ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 
21 {
22  var $bl_cnt = 1; // block counter
24 
29  function ilContainerGUI($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
30  {
31  global $rbacsystem, $lng, $tree;
32 
33  $this->rbacsystem =& $rbacsystem;
34 
35  $lng->loadLanguageModule("cntr");
36 
37  //$this->ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
38 
39  // Activate tree cache when rendering the container to improve performance
40  //$tree->useCache(false);
41 
42  // prepare output things should generally be made in executeCommand
43  // method (maybe dependent on current class/command
44  $this->ilObjectGUI($a_data, $a_id, $a_call_by_reference, false);
45  }
46 
51  function &executeCommand()
52  {
53  global $tpl;
54 
55  $next_class = $this->ctrl->getNextClass();
56  $cmd = $this->ctrl->getCmd("render");
57 
58  switch($next_class)
59  {
60  // page editing
61  case "ilcontainerpagegui":
62  if ($_GET["redirectSource"] != "ilinternallinkgui")
63  {
64  $ret = $this->forwardToPageObject();
65  $tpl->setContent($ret);
66  }
67  else
68  {
69  return "";
70  }
71  break;
72 
73  case "ilobjstylesheetgui":
74  $this->forwardToStyleSheet();
75  break;
76 
77  default:
78  $this->prepareOutput();
79  $cmd .= "Object";
80  $this->$cmd();
81  break;
82  }
83  return true;
84  }
85 
91  protected function getEditFormValues()
92  {
93  $values = parent::getEditFormValues();
94 
95  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
96  $values['didactic_type'] =
97  'dtpl_'.ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
98 
99  return $values;
100  }
101 
105  protected function afterUpdate()
106  {
107  // check if template is changed
108  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
109  $current_tpl_id = (int) ilDidacticTemplateObjSettings::lookupTemplateId(
110  $this->object->getRefId()
111  );
112  $new_tpl_id = (int) $this->getDidacticTemplateVar('dtpl');
113 
114  if($new_tpl_id != $current_tpl_id)
115  {
116  $_REQUEST['tplid'] = $new_tpl_id;
117 
118  // redirect to didactic template confirmation
119  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
120  $this->ctrl->setReturn($this,'edit');
121  $this->ctrl->setCmdClass('ildidactictemplategui');
122  $this->ctrl->setCmd('confirmTemplateSwitch');
123  $dtpl_gui = new ilDidacticTemplateGUI($this);
124  return $this->ctrl->forwardCommand($dtpl_gui);
125  }
126  parent::afterUpdate();
127  }
128 
129 
134  {
135  global $ilCtrl, $ilTabs;
136 
137  $ilTabs->clearTargets();
138 
139  $cmd = $ilCtrl->getCmd();
140  include_once ("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
141  $this->ctrl->setReturn($this, "editStyleProperties");
142  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
143  $style_gui->omitLocator();
144  if ($cmd == "create" || $_GET["new_type"]=="sty")
145  {
146  $style_gui->setCreationMode(true);
147  }
148 
149  if ($cmd == "confirmedDelete")
150  {
151  $this->object->setStyleSheetId(0);
152  $this->object->update();
153  }
154 
155  $ret = $this->ctrl->forwardCommand($style_gui);
156 
157  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
158  {
159  $style_id = $ret;
160  $this->object->setStyleSheetId($style_id);
161  $this->object->update();
162  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
163  }
164  }
165 
166 
171  {
172  global $lng, $ilTabs, $ilCtrl;
173 
174  $cmd = $ilCtrl->getCmd();
175 
176  if (in_array($cmd, array("displayMediaFullscreen", "downloadFile", "displayMedia")))
177  {
178  $this->checkPermission("read");
179  }
180  else
181  {
182  $this->checkPermission("write");
183  }
184 
185  $ilTabs->clearTargets();
186 
187  if ($_GET["redirectSource"] == "ilinternallinkgui")
188  {
189  exit;
190  }
191 
192  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
193  "xhtml_page");
194  if ($xpage_id > 0)
195  {
196  $ilTabs->setBackTarget($lng->txt("cntr_back_to_old_editor"),
197  $ilCtrl->getLinkTarget($this, "switchToOldEditor"), "_top");
198  }
199  else
200  {
201  $ilTabs->setBackTarget($lng->txt("back"), "./goto.php?target=".$this->object->getType()."_".
202  $this->object->getRefId(), "_top");
203  }
204 
205  // page object
206  include_once("./Services/Container/classes/class.ilContainerPage.php");
207  include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
208 
209  $lng->loadLanguageModule("content");
210 
211  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
212  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
213  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
214  $this->tpl->setCurrentBlock("SyntaxStyle");
215  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
217  $this->tpl->parseCurrentBlock();
218 
219  if (!ilContainerPage::_exists("cont",
220  $this->object->getId()))
221  {
222  // doesn't exist -> create new one
223  $new_page_object = new ilContainerPage();
224  $new_page_object->setParentId($this->object->getId());
225  $new_page_object->setId($this->object->getId());
226  $new_page_object->createFromXML();
227  }
228 
229  // get page object
230  $this->ctrl->setReturnByClass("ilcontainerpagegui", "edit");
231  $page_gui = new ilContainerPageGUI($this->object->getId());
232  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
233  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
234  $this->object->getStyleSheetId(), $this->object->getType()));
235 
236  $page_gui->setTemplateTargetVar("ADM_CONTENT");
237  $page_gui->setLinkXML($link_xml);
238  $page_gui->setFileDownloadLink("");
239  $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "showMediaFullscreen"));
240  //$page_gui->setLinkParams($this->ctrl->getUrlParameterString()); // todo
241  $page_gui->setPresentationTitle("");
242  $page_gui->setTemplateOutput(false);
243 
244  // old editor information text
245  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
246  "xhtml_page");
247  if ($xpage_id > 0)
248  {
249  $wtpl = new ilTemplate("tpl.cntr_old_editor_message.html", true,
250  true, "Services/Container");
251  $wtpl->setVariable("ALT_WARNING", $lng->txt("warning"));
252  $wtpl->setVariable("IMG_WARNING",
253  ilUtil::getImagePath("icon_alert.svg"));
254  $wtpl->setVariable("TXT_MIGRATION_INFO", $lng->txt("cntr_switch_to_new_editor_message"));
255  $wtpl->setVariable("TXT_MIGRATION_INFO", $lng->txt("cntr_switch_to_new_editor_message"));
256  $wtpl->setVariable("HREF_SWITCH_TO_NEW_EDITOR",
257  $ilCtrl->getLinkTarget($this, "useNewEditor"));
258  $wtpl->setVariable("TXT_MIGRATION_SWITCH",
259  $lng->txt("cntr_switch_to_new_editor_cmd"));
260  $page_gui->setPrependingHtml($wtpl->get());
261  }
262 
263  // style tab
264  $page_gui->setTabHook($this, "addPageTabs");
265 
266  $ret = $this->ctrl->forwardCommand($page_gui);
267 
268  //$ret =& $page_gui->executeCommand();
269  return $ret;
270  }
271 
275  function addPageTabs()
276  {
277  global $ilTabs, $ilCtrl;
278 
279  $ilTabs->addTarget("obj_sty",
280  $ilCtrl->getLinkTarget($this, 'editStyleProperties'), "editStyleProperties");
281  }
282 
287  {
288  global $ilSetting, $ilUser;
289 
290  if (!$ilSetting->get("enable_cat_page_edit"))
291  {
292  return;
293  }
294 
295  // old page editor content
296  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
297  "xhtml_page");
298  if ($xpage_id > 0)
299  {
300  include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
301  $xpage = new ilXHTMLPage($xpage_id);
302  return $xpage->getContent();
303  }
304 
305 
306  // page object
307 
308 
309  // if page does not exist, return nothing
310  include_once("./Services/COPage/classes/class.ilPageUtil.php");
311  if (!ilPageUtil::_existsAndNotEmpty("cont",
312  $this->object->getId()))
313  {
314  return "";
315  }
316  include_once("./Services/Container/classes/class.ilContainerPage.php");
317  include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
318 
319  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
320  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
321  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
322  $this->tpl->setCurrentBlock("SyntaxStyle");
323  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
325  $this->tpl->parseCurrentBlock();
326 
327  // get page object
328  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
329  $ot = ilObjectTranslation::getInstance($this->object->getId());
330  $lang = $ot->getEffectiveContentLang($ilUser->getCurrentLanguage(), "cont");
331  $page_gui = new ilContainerPageGUI($this->object->getId(), 0, $lang);
332  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
333  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
334  $this->object->getStyleSheetId(), $this->object->getType()));
335 
336  $page_gui->setPresentationTitle("");
337  $page_gui->setTemplateOutput(false);
338  $page_gui->setHeader("");
339  $ret = $page_gui->showPage();
340 
341  //$ret = "<div style='background-color: white; padding:5px; margin-bottom: 30px;'>".$ret."</div>";
342 
343  //$ret =& $page_gui->executeCommand();
344  return $ret;
345  }
346 
350  function prepareOutput($a_show_subobjects = true)
351  {
352  if (parent::prepareOutput()) // return false in admin mode
353  {
354  if ($this->getCreationMode() != true && $a_show_subobjects)
355  {
356  // This method is called directly from ilContainerGUI::renderObject
357  #$this->showPossibleSubObjects();
358  $this->showTreeFlatIcon();
359 
360  // Member view
361  include_once './Services/Container/classes/class.ilMemberViewGUI.php';
362  ilMemberViewGUI::showMemberViewSwitch($this->object->getRefId());
363  }
364  }
365  }
366 
367  function showTreeFlatIcon()
368  {
369  global $tpl;
370 
371  // dont show icon, if role (permission gui->rolegui) is edited
372  if ($_GET["obj_id"] != "")
373  {
374  return;
375  }
376  // hide for member view
377  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
378  if(ilMemberViewSettings::getInstance()->isActive())
379  {
380  return;
381  }
382 
383  $mode = ($_SESSION["il_rep_mode"] == "flat")
384  ? "tree"
385  : "flat";
386  $link = "ilias.php?baseClass=ilRepositoryGUI&amp;cmd=frameset&amp;set_mode=".$mode."&amp;ref_id=".$this->object->getRefId();
387  $tpl->setTreeFlatIcon($link, $mode);
388  }
389 
394  {
395  global $ilias;
396 
397  if (!ilContainer::_lookupContainerSetting($this->object->getId(), "hide_header_icon_and_title"))
398  {
399  $this->tpl->setTitle($this->object->getTitle());
400  $this->tpl->setDescription($this->object->getLongDescription());
401 
402  // set tile icon
403  $icon = ilObject::_getIcon($this->object->getId(), "big", $this->object->getType());
404  if ($ilias->getSetting("custom_icons") &&
405  in_array($this->object->getType(), array("cat","grp","crs", "root")))
406  {
407  require_once("./Services/Container/classes/class.ilContainer.php");
408  if (($path = ilContainer::_lookupIconPath($this->object->getId(), "big")) != "")
409  {
410  $icon = $path;
411  }
412  }
413  $this->tpl->setTitleIcon($icon, $this->lng->txt("obj_".$this->object->getType()));
414 
415  include_once './Services/Object/classes/class.ilObjectListGUIFactory.php';
416  $lgui = ilObjectListGUIFactory::_getListGUIByType($this->object->getType());
417  $lgui->initItem($this->object->getRefId(), $this->object->getId());
418  $this->tpl->setAlertProperties($lgui->getAlertProperties());
419  }
420  }
421 
426  {
427  include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
428  $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
429  $gui->render();
430  }
431 
438  function getContentGUI()
439  {
440  switch ($this->object->getViewMode())
441  {
442  // all items in one block
444  include_once("./Services/Container/classes/class.ilContainerSimpleContentGUI.php");
445  $container_view = new ilContainerSimpleContentGUI($this);
446  break;
447 
449  include_once('./Services/Container/classes/class.ilContainerObjectiveGUI.php');
450  $container_view = new ilContainerObjectiveGUI($this);
451  break;
452 
453  // all items in one block
455  case IL_CRS_VIEW_TIMING: // not nice this workaround
456  include_once("./Services/Container/classes/class.ilContainerSessionsContentGUI.php");
457  $container_view = new ilContainerSessionsContentGUI($this);
458  break;
459 
460  // all items in one block
462  default:
463  include_once("./Services/Container/classes/class.ilContainerByTypeContentGUI.php");
464  $container_view = new ilContainerByTypeContentGUI($this);
465  break;
466  }
467 
468  return $container_view;
469  }
470 
471 
472 
476  function renderObject()
477  {
478  global $ilDB, $tpl, $ilTabs, $ilCtrl, $ilSetting;
479 
480  $container_view = $this->getContentGUI();
481 
482  $this->setContentSubTabs();
483  if ($this->isActiveAdministrationPanel())
484  {
485  $ilTabs->activateSubTab("manage");
486  }
487  else
488  {
489  $ilTabs->activateSubTab("view_content");
490  }
491 
492  $container_view->setOutput();
493 
494  $this->adminCommands = $container_view->adminCommands;
495 
496  // it is important not to show the subobjects/admin panel here, since
497  // we will create nested forms in case, e.g. a news/calendar item is added
498  if ($ilCtrl->getNextClass() != "ilcolumngui")
499  {
500  $this->showAdministrationPanel($tpl);
501  $this->showPossibleSubObjects();
502  }
503 
504  $this->showPermanentLink($tpl);
505 
506  // add tree updater javascript
507  if ((int) $_GET["ref_id"] > 1 && $ilSetting->get("rep_tree_synchronize"))
508  {
509  $ilCtrl->setParameter($this, "active_node", (int) $_GET["ref_id"]);
510  /*$tpl->addOnloadCode("
511  if (parent && parent.tree && parent.tree.updater)
512  {
513  parent.tree.updater('tree_div', '".
514  $ilCtrl->getLinkTarget($this, "showTree", "", true, false)
515  ."');
516  }");*/
517  }
518  }
519 
523  function setContentSubTabs()
524  {
526  }
527 
532  {
533  global $ilAccess, $lng;
534 
535  $lng->loadLanguageModule('cntr');
536 
537  if ($this->isActiveAdministrationPanel())
538  {
539  // #11545
540  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
541 
542  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
543  $toolbar = new ilToolbarGUI();
544  $this->ctrl->setParameter($this, "type", "");
545  $this->ctrl->setParameter($this, "item_ref_id", "");
546 
547  if (!$_SESSION["clipboard"])
548  {
549  if ($this->object->gotItems())
550  {
551  $toolbar->setLeadingImage(
552  ilUtil::getImagePath("arrow_upright.svg"),
553  $lng->txt("actions")
554  );
555  $toolbar->addFormButton(
556  $this->lng->txt('delete_selected_items'),
557  'delete'
558  );
559  $toolbar->addFormButton(
560  $this->lng->txt('move_selected_items'),
561  'cut'
562  );
563  $toolbar->addFormButton(
564  $this->lng->txt('copy_selected_items'),
565  'copy'
566  );
567  $toolbar->addFormButton(
568  $this->lng->txt('link_selected_items'),
569  'link'
570  );
571  // add download button if multi download enabled
572  $folder_set = new ilSetting("fold");
573  if ($folder_set->get("enable_multi_download") == true)
574  {
575  $toolbar->addSeparator();
576  $toolbar->addFormButton(
577  $this->lng->txt('download_selected_items'),
578  'download'
579  );
580  }
581  }
582  if($this->object->getType() == 'crs' or $this->object->getType() == 'grp')
583  {
584  if($this->object->gotItems())
585  {
586  $toolbar->addSeparator();
587  }
588 
589  $toolbar->addButton(
590  $this->lng->txt('cntr_adopt_content'),
591  $this->ctrl->getLinkTargetByClass(
592  'ilObjectCopyGUI',
593  'adoptContent')
594  );
595  }
596  }
597  else
598  {
599  //$GLOBALS["tpl"]->addAdminPanelCommand("paste",
600  // $this->lng->txt("paste_clipboard_items"));
601 
602  $toolbar->addFormButton(
603  $this->lng->txt('paste_clipboard_items'),
604  'paste'
605  );
606 
607  if($_SESSION["clipboard"]["cmd"] == "link")
608  {
609  //$GLOBALS["tpl"]->addAdminPanelCommand("initAndDisplayLinkIntoMultipleObjects",
610  // $this->lng->txt("paste_clipboard_items_into_multiple_objects"));
611  /*$toolbar->addFormButton(
612  $this->lng->txt('paste_clipboard_items_into_multiple_objects'),
613  'initAndDisplayLinkIntoMultipleObjects'
614  );*/
615  }
616 
617  $toolbar->addFormButton(
618  $this->lng->txt('clear_clipboard'),
619  'clear'
620  );
621 
622  if ($this->isMultiDownloadEnabled())
623  {
624  $toolbar->addSeparator();
625  $toolbar->addFormButton(
626  $this->lng->txt('download_selected_items'),
627  'download'
628  );
629  }
630  }
631 
632  $GLOBALS['tpl']->addAdminPanelToolbar(
633  $toolbar,
634  ($this->object->gotItems() && !$_SESSION["clipboard"]) ? true : false,
635  ($this->object->gotItems() && !$_SESSION["clipboard"]) ? true : false
636  );
637 
638  // form action needed, see http://www.ilias.de/mantis/view.php?id=9630
639  if ($this->object->gotItems())
640  {
641  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
642  }
643  }
644  else
645  {
646  if ($this->edit_order)
647  {
648  if($this->object->gotItems() and $ilAccess->checkAccess("write", "", $this->object->getRefId()))
649  {
650  include_once('./Services/Container/classes/class.ilContainer.php');
651 
652  if ($this->isActiveOrdering())
653  {
654  // #11843
655  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
656 
657  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
658  $toolbar = new ilToolbarGUI();
659  $this->ctrl->setParameter($this, "type", "");
660  $this->ctrl->setParameter($this, "item_ref_id", "");
661 
662  $toolbar->addFormButton(
663  $this->lng->txt('sorting_save'),
664  'saveSorting'
665  );
666 
667  $GLOBALS['tpl']->addAdminPanelToolbar($toolbar, true, false);
668 
669  /*
670  $GLOBALS["tpl"]->addAdminPanelCommand("saveSorting",
671  $this->lng->txt('sorting_save'));
672 
673  // button should appear at bottom, too
674  $GLOBALS["tpl"]->admin_panel_bottom = true;
675  */
676  }
677  }
678  }
679  else if ($this->isMultiDownloadEnabled())
680  {
681  // #11843
682  $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
683 
684  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
685  $toolbar = new ilToolbarGUI();
686  $this->ctrl->setParameter($this, "type", "");
687  $this->ctrl->setParameter($this, "item_ref_id", "");
688 
689  $toolbar->addFormButton(
690  $this->lng->txt('download_selected_items'),
691  'download'
692  );
693 
694  $GLOBALS['tpl']->addAdminPanelToolbar(
695  $toolbar,
696  $this->object->gotItems() ? true : false,
697  $this->object->gotItems() ? true : false
698  );
699  }
700  }
701  }
702 
704  {
705  global $tree;
706 
707  if(!$tree->checkForParentType($this->object->getRefId(),'crs'))
708  {
709  return false;
710  }
711  $tpl->setCurrentBlock("custom_button");
712  $tpl->setVariable("ADMIN_MODE_LINK",$this->ctrl->getLinkTargetByClass('ilcoursecontentgui','editTimings'));
713  $tpl->setVariable("TXT_ADMIN_MODE",$this->lng->txt('timings_edit'));
714  $tpl->parseCurrentBlock();
715  return true;
716  }
721  {
722  $GLOBALS["tpl"]->setPermanentLink($this->object->getType(),
723  $this->object->getRefId(), "", "_top");
724  }
725 
730  {
731  global $ilCtrl;
732 
733  $_SESSION["il_cntr_editor"] = "std";
734  $ilCtrl->redirect($this, "editPageFrame");
735  }
736 
741  {
742  global $ilCtrl;
743 
744  $_SESSION["il_cntr_editor"] = "old";
745  $ilCtrl->redirect($this, "editPageFrame");
746  }
747 
752  {
753  global $ilCtrl, $ilAccess, $lng, $ilCtrl;
754 
755  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
756  {
757  include_once("./Services/XHTMLPage/classes/class.ilXHTMLPage.php");
758 
759  /* keep old page content for now...
760  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
761  "xhtml_page");
762  if ($xpage_id)
763  {
764  $xpage = new ilXHTMLPage($xpage_id);
765  }
766  */
767 
768  ilContainer::_writeContainerSetting($this->object->getId(),
769  "xhtml_page", 0);
770 
771  ilUtil::sendSuccess($lng->txt("cntr_switched_editor"), true);
772  }
773 
774  $ilCtrl->redirect($this, "editPageFrame");
775  }
776 
781  {
782  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
783  $fs_gui = new ilFramesetGUI();
784 
785  $fs_gui->setFramesetTitle($this->object->getTitle());
786  $fs_gui->setMainFrameName("content");
787  $fs_gui->setSideFrameName("tree");
788 
789  // old tiny stuff
790  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
791  "xhtml_page");
792  if ($xpage_id > 0 && $_SESSION["il_cntr_editor"] != "std")
793  {
794  $fs_gui->setMainFrameSource(
795  $this->ctrl->getLinkTarget(
796  $this, "editPageContent"));
797  $fs_gui->setSideFrameSource(
798  $this->ctrl->getLinkTarget($this, "showLinkList"));
799  }
800  else
801  {
802  $this->ctrl->redirectByClass(array("ilcontainerpagegui"), "edit");
803  exit;
804  }
805 
806  $fs_gui->show();
807  exit;
808  }
809 
816  {
817  global $rbacsystem, $tpl, $lng, $ilCtrl;
818 
819  if (!$rbacsystem->checkAccess("write", $this->ref_id))
820  {
821  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
822  }
823 
824  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
825  "xhtml_page");
826  if ($xpage_id > 0)
827  {
828  include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
829  $xpage = new ilXHTMLPage($xpage_id);
830  $content = $xpage->getContent();
831  }
832 
833  // get template
834  $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.container_edit_page_content.html",
835  "Services/Container");
836  $tpl->setVariable("VAL_CONTENT", ilUtil::prepareFormOutput($content));
837  $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
838  $tpl->setVariable("TXT_EDIT_PAGE_CONTENT",
839  $this->lng->txt("edit_page_content"));
840  $tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
841  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
842  $tpl->setVariable("TXT_MIGRATION_INFO", $lng->txt("cntr_old_editor_warning"));
843  $tpl->setVariable("TXT_MIGRATION_OPEN_STD_EDITOR", $lng->txt("cntr_old_editor_open_standard_editor"));
844  $tpl->setVariable("IMG_WARNING", ilUtil::getImagePath("icon_alert.svg"));
845  $tpl->setVariable("HREF_OPEN_STD_EDITOR", $ilCtrl->getLinkTarget($this, "switchToStdEditor"));
846  $tpl->setVariable("ALT_WARNING", $lng->txt("warning"));
847 
848  include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
849  include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
850  //$ta = new ilTextAreaInputGUI();
851  //$tags = $ta->getRteTagSet("extended_table_img");
852 
853  // add rte support
854  include_once "./Services/RTE/classes/class.ilRTE.php";
855  $rtestring = ilRTE::_getRTEClassname();
856  include_once "./Services/RTE/classes/class.$rtestring.php";
857  $rte = new $rtestring();
858  //$rte->addPlugin("latex");
859  include_once "./Services/Object/classes/class.ilObject.php";
861  $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
862  $rte->addRTESupport($obj_id, $obj_type);
863  //$rte->setStyleSelect(true);
864  //$rte->addCustomRTESupport($obj_id, $obj_type, $tags);
865  }
866 
868  {
869  include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
870  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
871  $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
872  "xhtml_page");
873 
874  /*include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
875  include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
876  $ta = new ilTextAreaInputGUI();
877  $ta->setRteTagSet("extended_table_img");
878  $tags = $ta->getRteTagString();*/
879 
880  //$text = ilUtil::stripSlashes($_POST["page_content"],
881  // true,
882  // $tags);
883 
884  $text = ilUtil::stripSlashes($_POST["page_content"],
885  true,
887  if ($xpage_id > 0)
888  {
889  $xpage = new ilXHTMLPage($xpage_id);
890  $xpage->setContent($text);
891  $xpage->save();
892  }
893  else
894  {
895  $xpage = new ilXHTMLPage();
896  $xpage->setContent($text);
897  $xpage->save();
898  ilContainer::_writeContainerSetting($this->object->getId(),
899  "xhtml_page", $xpage->getId());
900  }
901 
902  include_once("Services/RTE/classes/class.ilRTE.php");
903  ilRTE::_cleanupMediaObjectUsage($text, $this->object->getType().":html",
904  $this->object->getId());
905 
906  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
907  $this->ctrl->redirect($this, "");
908  }
909 
911  {
912  $this->ctrl->redirect($this, "");
913  }
914 
916  {
917  global $lng, $tree;
918 
919  $tpl = new ilTemplate("tpl.container_link_help.html", true, true,
920  "Services/Container");
921 
922  $type_ordering = array(
923  "cat", "fold", "crs", "grp", "chat", "frm", "lres",
924  "glo", "webr", "file", "exc",
925  "tst", "svy", "mep", "qpl", "spl");
926 
927  $childs = $tree->getChilds($_GET["ref_id"]);
928  foreach($childs as $child)
929  {
930  if (in_array($child["type"], array("lm", "dbk", "sahs", "htlm")))
931  {
932  $cnt["lres"]++;
933  }
934  else
935  {
936  $cnt[$child["type"]]++;
937  }
938  }
939 
940  $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
941  $tpl->setVariable("TXT_HELP_HEADER", $lng->txt("help"));
942  foreach($type_ordering as $type)
943  {
944  $tpl->setCurrentBlock("row");
945  $tpl->setVariable("ROWCOL", "tblrow".((($i++)%2)+1));
946  if ($type != "lres")
947  {
948  $tpl->setVariable("TYPE", $lng->txt("objs_".$type).
949  " (".((int)$cnt[$type]).")");
950  }
951  else
952  {
953  $tpl->setVariable("TYPE", $lng->txt("learning_resources").
954  " (".((int)$cnt["lres"]).")");
955  }
956  $tpl->setVariable("TXT_LINK", "[list-".$type."]");
957  $tpl->parseCurrentBlock();
958  }
959  $tpl->show();
960  exit;
961 
962  }
963 
968  {
969  $this->adminCommands = false;
970  }
971 
975 /* function determineAdminCommands($a_ref_id, $a_admin_com_included_in_list = false)
976  {
977  if (!$this->adminCommands)
978  {
979  if (!$this->isActiveAdministrationPanel())
980  {
981  if ($this->rbacsystem->checkAccess("delete", $a_ref_id))
982  {
983  $this->adminCommands = true;
984  }
985  }
986  else
987  {
988  $this->adminCommands = $a_admin_com_included_in_list;
989  }
990  }
991  }*/
992 
999  function &newBlockTemplate()
1000  {
1001  $tpl = new ilTemplate("tpl.container_list_block.html", true, true,
1002  "Services/Container");
1003  $this->cur_row_type = "row_type_1";
1004  return $tpl;
1005  }
1006 
1014  function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true)
1015  {
1016  $icon = ilUtil::getImagePath("icon_".$a_type.".svg");
1017  $title = $this->lng->txt("objs_".$a_type);
1018 
1019  if ($a_show_image)
1020  {
1021  $a_tpl->setCurrentBlock("container_header_row_image");
1022  $a_tpl->setVariable("HEADER_IMG", $icon);
1023  $a_tpl->setVariable("HEADER_ALT", $title);
1024  }
1025  else
1026  {
1027  $a_tpl->setCurrentBlock("container_header_row");
1028  }
1029 
1030  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
1031  $a_tpl->parseCurrentBlock();
1032  $a_tpl->touchBlock("container_row");
1033  }
1034 
1042  function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "",
1043  $a_image_type = "")
1044  {
1045  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1046  ? "row_type_2"
1047  : "row_type_1";
1048 
1049  $a_tpl->touchBlock($this->cur_row_type);
1050 
1051  $nbsp = true;
1052  if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows")
1053  {
1054  $icon = ilUtil::getImagePath("icon_".$a_image_type.".svg");
1055  $alt = $this->lng->txt("obj_".$a_image_type);
1056 
1057  // custom icon
1058  if ($this->ilias->getSetting("custom_icons") &&
1059  in_array($a_image_type, array("cat","grp","crs")))
1060  {
1061  require_once("./Services/Container/classes/class.ilContainer.php");
1062  if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
1063  {
1064  $icon = $path;
1065  }
1066  }
1067 
1068  $a_tpl->setCurrentBlock("block_row_image");
1069  $a_tpl->setVariable("ROW_IMG", $icon);
1070  $a_tpl->setVariable("ROW_ALT", $alt);
1071  $a_tpl->parseCurrentBlock();
1072  $nbsp = false;
1073  }
1074 
1075  if ($this->isActiveAdministrationPanel())
1076  {
1077  $a_tpl->setCurrentBlock("block_row_check");
1078  $a_tpl->setVariable("ITEM_ID", $a_item_ref_id);
1079  $a_tpl->parseCurrentBlock();
1080  $nbsp = false;
1081  }
1082  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
1083  if($this->isActiveAdministrationPanel() &&
1085  {
1086  $a_tpl->setCurrentBlock('block_position');
1087  $a_tpl->setVariable('POS_TYPE',$a_image_type);
1088  $a_tpl->setVariable('POS_ID',$a_item_ref_id);
1089  $a_tpl->setVariable('POSITION',sprintf('%.1f',$this->current_position++));
1090  $a_tpl->parseCurrentBlock();
1091  }
1092  if ($nbsp)
1093  {
1094  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1095  }
1096  $a_tpl->setCurrentBlock("container_standard_row");
1097  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
1098  $a_tpl->parseCurrentBlock();
1099  $a_tpl->touchBlock("container_row");
1100  }
1101 
1105  function addMessageRow(&$a_tpl, $a_message, $a_type)
1106  {
1107  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1108  ? "row_type_2"
1109  : "row_type_1";
1110 
1111  $a_tpl->touchBlock($this->cur_row_type);
1112 
1113  $type = $this->lng->txt("obj_".$a_type);
1114  $a_message = str_replace("[type]", $type, $a_message);
1115 
1116  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1117 
1118  $a_tpl->setCurrentBlock("container_standard_row");
1119  $a_tpl->setVariable("BLOCK_ROW_CONTENT",
1120  $a_message);
1121  $a_tpl->parseCurrentBlock();
1122  $a_tpl->touchBlock("container_row");
1123  }
1124 
1125  function resetRowType()
1126  {
1127  $this->cur_row_type = "";
1128  }
1129 
1130 
1135  {
1136  global $lng;
1137 
1138  if (!$this->isActiveAdministrationPanel()
1139  || strtolower($this->ctrl->getCmdClass()) != "ilcontainerpagegui")
1140  {
1141  return;
1142  }
1143 
1144  $lng->loadLanguageModule("content");
1145  //$tabs_gui = new ilTabsGUI();
1146  //$tabs_gui->setSubTabs();
1147 
1148  // back to upper context
1149  $this->tabs_gui->setBackTarget($this->lng->txt("obj_cat"),
1150  $this->ctrl->getLinkTarget($this, "frameset"),
1151  ilFrameTargetInfo::_getFrame("MainContent"));
1152 
1153  $this->tabs_gui->addTarget("edit", $this->ctrl->getLinkTargetByClass("ilcontainerpagegui", "view")
1154  , array("", "view"), "ilcontainerpagegui");
1155 
1156  //$this->tpl->setTabs($tabs_gui->getHTML());
1157  }
1158 
1162  function addStandardContainerSubTabs($a_include_view = true)
1163  {
1164  global $ilTabs, $ilAccess, $lng, $ilCtrl, $ilUser, $ilSetting;
1165 
1166  if (!is_object($this->object))
1167  {
1168  return;
1169  }
1170 
1171  if ($a_include_view && $ilAccess->checkAccess("read", "", $this->object->getRefId()))
1172  {
1173  if (!$this->isActiveAdministrationPanel())
1174  {
1175  $ilTabs->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTarget($this, ""));
1176  }
1177  else
1178  {
1179  $ilTabs->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTarget($this, "disableAdministrationPanel"));
1180  }
1181  }
1182 
1183  if ( $ilUser->getId() != ANONYMOUS_USER_ID &&
1184  ($this->adminCommands ||
1185  (is_object($this->object) &&
1186  ($ilAccess->checkAccess("write", "", $this->object->getRefId())))
1187  ||
1188  (is_object($this->object) &&
1189  ($this->object->getHiddenFilesFound())) ||
1190  $_SESSION["clipboard"]
1191  )
1192  )
1193  {
1194  if ($this->isActiveAdministrationPanel())
1195  {
1196  $ilTabs->addSubTab("manage", $lng->txt("cntr_manage"), $ilCtrl->getLinkTarget($this, ""));
1197  }
1198  else
1199  {
1200  $ilTabs->addSubTab("manage", $lng->txt("cntr_manage"), $ilCtrl->getLinkTarget($this, "enableAdministrationPanel"));
1201  }
1202  }
1203  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1204  is_object($this->object) &&
1205  $ilAccess->checkAccess("write", "", $this->object->getRefId()) /* &&
1206  $this->object->getOrderType() == ilContainer::SORT_MANUAL */ // always on because of custom block order
1207  )
1208  {
1209  $ilTabs->addSubTab("ordering", $lng->txt("cntr_ordering"), $ilCtrl->getLinkTarget($this, "editOrder"));
1210  }
1211  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1212  is_object($this->object) &&
1213  $ilAccess->checkAccess("write", "", $this->object->getRefId())
1214  )
1215  {
1216  if ($ilSetting->get("enable_cat_page_edit"))
1217  {
1218  $ilTabs->addSubTab("page_editor", $lng->txt("cntr_text_media_editor"), $ilCtrl->getLinkTarget($this, "editPageFrame"),
1219  ilFrameTargetInfo::_getFrame("MainContent"));
1220  }
1221  }
1222  }
1223 
1224 
1229  function getTabs(&$tabs_gui)
1230  {
1231  global $rbacsystem, $ilCtrl;
1232 
1233  // edit permissions
1234  if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
1235  {
1236  $tabs_gui->addTarget("perm_settings",
1237  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1238  array("perm","info","owner"), 'ilpermissiongui');
1239  if ($ilCtrl->getNextClass() == "ilpermissiongui")
1240  {
1241  $tabs_gui->activateTab("perm_settings");
1242  }
1243  }
1244 
1245  // show clipboard
1246  if (strtolower($_GET["baseClass"]) == "ilrepositorygui" && !empty($_SESSION["clipboard"]))
1247  {
1248  $tabs_gui->addTarget("clipboard",
1249  $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
1250  }
1251 
1252  }
1253 
1254  //*****************
1255  // COMMON METHODS (may be overwritten in derived classes
1256  // if special handling is necessary)
1257  //*****************
1258 
1263  {
1264  $_SESSION["il_cont_admin_panel"] = true;
1265  $this->ctrl->redirect($this, "render");
1266  }
1267 
1272  {
1273  $_SESSION["il_cont_admin_panel"] = false;
1274  $this->ctrl->redirect($this, "render");
1275  }
1276 
1280  function editOrderObject()
1281  {
1282  global $ilTabs;
1283 
1284  $this->edit_order = true;
1285  $_SESSION["il_cont_admin_panel"] = false;
1286  $this->renderObject();
1287 
1288  $ilTabs->activateSubTab("ordering");
1289  }
1290 
1295  public function isActiveOrdering()
1296  {
1297  return $this->edit_order ? true : false;
1298  }
1299 
1304  public function isActiveItemOrdering()
1305  {
1306  if($this->isActiveOrdering())
1307  {
1308  return (ilContainerSortingSettings::_lookupSortMode($this->object->getId()) == ilContainer::SORT_MANUAL);
1309  }
1310  return false;
1311  }
1312 
1316  public function addToDeskObject()
1317  {
1318  global $ilSetting, $lng;
1319 
1320  if((int)$ilSetting->get('disable_my_offers'))
1321  {
1322  return $this->renderObject();
1323  }
1324 
1325  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
1327  ilUtil::sendSuccess($lng->txt("added_to_desktop"));
1328  $this->renderObject();
1329  }
1330 
1334  public function removeFromDeskObject()
1335  {
1336  global $ilSetting, $lng;
1337 
1338  if((int)$ilSetting->get('disable_my_offers'))
1339  {
1340  return $this->renderObject();
1341  }
1342 
1343  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
1345  ilUtil::sendSuccess($lng->txt("removed_from_desktop"));
1346  $this->renderObject();
1347  }
1348 
1350  {
1351  $this->multi_download_enabled = true;
1352  $this->renderObject();
1353  }
1354 
1356  {
1358  }
1359 
1360  // BEGIN WebDAV: Lock/Unlock objects
1361  function lockObject()
1362  {
1363  global $tree, $ilUser, $rbacsystem;
1364 
1365  if (!$rbacsystem->checkAccess("write",$_GET['item_ref_id']))
1366  {
1367  $this->ilErr->raiseError($this->lng->txt('err_no_permission'),$this->ilErr->MESSAGE);
1368  }
1369 
1370 
1371  require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
1373  {
1374  require_once 'Services/WebDAV/classes/class.ilDAVLocks.php';
1375  $locks = new ilDAVLocks();
1376 
1377  $result = $locks->lockRef($_GET['item_ref_id'],
1378  $ilUser->getId(), $ilUser->getLogin(),
1379  'ref_'.$_GET['item_ref_id'].'_usr_'.$ilUser->getId(),
1380  time() + /*30*24*60**/60, 0, 'exclusive'
1381  );
1382 
1384  $this->lng->txt(
1385  ($result === true) ? 'object_locked' : $result
1386  ),
1387  true);
1388  }
1389  $this->renderObject();
1390  }
1391  // END WebDAV: Lock/Unlock objects
1392 
1399  function cutObject()
1400  {
1401  global $rbacsystem, $ilCtrl;
1402 
1403  if ($_GET["item_ref_id"] != "")
1404  {
1405  $_POST["id"] = array($_GET["item_ref_id"]);
1406  }
1407 
1408  //$this->ilias->raiseError("move operation does not work at the moment and is disabled",$this->ilias->error_obj->MESSAGE);
1409 
1410  if (!isset($_POST["id"]))
1411  {
1412  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1413  }
1414 
1415  // FOR ALL OBJECTS THAT SHOULD BE COPIED
1416  foreach ($_POST["id"] as $ref_id)
1417  {
1418  // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
1419  $node_data = $this->tree->getNodeData($ref_id);
1420  $subtree_nodes = $this->tree->getSubTree($node_data);
1421 
1422  $all_node_data[] = $node_data;
1423  $all_subtree_nodes[] = $subtree_nodes;
1424 
1425  // CHECK DELETE PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1426  foreach ($subtree_nodes as $node)
1427  {
1428  if($node['type'] == 'rolf')
1429  {
1430  continue;
1431  }
1432 
1433  if (!$rbacsystem->checkAccess('delete',$node["ref_id"]))
1434  {
1435  $no_cut[] = $node["ref_id"];
1436  }
1437  }
1438  }
1439  // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1440  if (count($no_cut))
1441  {
1442  $this->ilias->raiseError($this->lng->txt("msg_no_perm_cut")." ".implode(',',$this->getTitlesByRefId($no_cut)),
1443  $this->ilias->error_obj->MESSAGE);
1444  }
1445  $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
1446  $_SESSION["clipboard"]["cmd"] = $ilCtrl->getCmd();
1447  $_SESSION["clipboard"]["ref_ids"] = $_POST["id"];
1448 
1449  ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"),true);
1450 
1451  return $this->initAndDisplayMoveIntoObjectObject();
1452  } // END CUT
1453 
1461  function copyObject()
1462  {
1463  global $rbacsystem, $ilCtrl, $objDefinition;
1464 
1465  if ($_GET["item_ref_id"] != "")
1466  {
1467  $_POST["id"] = array($_GET["item_ref_id"]);
1468  }
1469 
1470  if (!isset($_POST["id"]))
1471  {
1472  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1473  }
1474 
1475  // FOR ALL OBJECTS THAT SHOULD BE COPIED
1476  $containers = 0;
1477  foreach ($_POST["id"] as $ref_id)
1478  {
1479  // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
1480  $node_data = $this->tree->getNodeData($ref_id);
1481 
1482  // count containers
1483  if ($objDefinition->isContainer($node_data["type"]))
1484  {
1485  $containers++;
1486  }
1487 
1488  $subtree_nodes = $this->tree->getSubTree($node_data);
1489 
1490  $all_node_data[] = $node_data;
1491  $all_subtree_nodes[] = $subtree_nodes;
1492 
1493  // CHECK COPY PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1494  foreach ($subtree_nodes as $node)
1495  {
1496  if($node['type'] == 'rolf')
1497  {
1498  continue;
1499  }
1500 
1501  if (!$rbacsystem->checkAccess('visible,read,copy',$node["ref_id"]))
1502  {
1503  $no_copy[] = $node["ref_id"];
1504  }
1505  }
1506  }
1507 
1508  if ($containers > 0 && count($_POST["id"]) > 1)
1509  {
1510  $this->ilias->raiseError($this->lng->txt("cntr_container_only_on_their_own"), $this->ilias->error_obj->MESSAGE);
1511  }
1512 
1513  // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1514  if (count($no_copy))
1515  {
1516  $this->ilias->raiseError(
1517  $this->lng->txt("msg_no_perm_copy") . " " . implode(',',$this->getTitlesByRefId($no_copy)),
1518  $this->ilias->error_obj->MESSAGE);
1519  }
1520 
1521  // if we have a single container, set it as source id and redirect to ilObjectCopyGUI
1522  if (count($_POST["id"]) == 1)
1523  {
1524  $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $_POST["id"][0]);
1525  $ilCtrl->redirectByClass("ilobjectcopygui", "initTargetSelection");
1526  }
1527  else
1528  {
1529  $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode($_POST["id"],"_"));
1530  $ilCtrl->redirectByClass("ilobjectcopygui", "initTargetSelection");
1531  }
1532 
1533  $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
1534  $_SESSION["clipboard"]["cmd"] = $ilCtrl->getCmd();
1535  $_SESSION["clipboard"]["ref_ids"] = $_POST["id"];
1536 
1537  ilUtil::sendInfo($this->lng->txt("msg_copy_clipboard"), true);
1538 
1540  } // END COPY
1541 
1542  function downloadObject()
1543  {
1544  global $rbacsystem, $ilCtrl;
1545 
1546  if ($_GET["item_ref_id"] != "")
1547  {
1548  $_POST["id"] = array($_GET["item_ref_id"]);
1549  }
1550 
1551  if (!isset($_POST["id"]))
1552  {
1553  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1554  }
1555 
1556  // FOR ALL OBJECTS THAT SHOULD BE DOWNLOADED
1557  foreach ($_POST["id"] as $ref_id)
1558  {
1559  $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1560  $obj_type = $object->getType();
1561  if (!in_array($obj_type, array("fold", "file")))
1562  {
1563  $no_download[] = $object->getType();
1564  }
1565  else if (!$rbacsystem->checkAccess('read', $ref_id))
1566  {
1567  $no_perm[] = $ref_id;
1568  }
1569  }
1570 
1571  // IF THERE IS ANY OBJECT THAT CANNOT BE DOWNLOADED
1572  if (count($no_download))
1573  {
1574  $no_download = array_unique($no_download);
1575  foreach ($no_download as $type)
1576  {
1577  $txt_objs[] = $this->lng->txt("objs_".$type);
1578  }
1579  $this->ilias->raiseError(implode(', ',$txt_objs)." ".$this->lng->txt("msg_obj_no_download"),$this->ilias->error_obj->MESSAGE);
1580  }
1581 
1582  // NO ACCESS
1583  if (count($no_perm))
1584  {
1585  $this->ilias->raiseError(
1586  $this->lng->txt("msg_obj_perm_download")." ".implode(',',$no_perm),
1587  $this->ilias->error_obj->MESSAGE);
1588  }
1589 
1590  // download the objects
1591  $this->downloadMultipleObjects($_POST["id"]);
1592  }
1593 
1594  private function downloadMultipleObjects($a_ref_ids)
1595  {
1596  global $lng, $rbacsystem, $ilAccess;
1597 
1598  include_once "./Services/Utilities/classes/class.ilUtil.php";
1599  include_once 'Modules/Folder/classes/class.ilObjFolder.php';
1600  include_once 'Modules/File/classes/class.ilObjFile.php';
1601  include_once 'Modules/File/classes/class.ilFileException.php';
1602 
1603  // create temporary file to download
1604  $zip = PATH_TO_ZIP;
1605  $tmpdir = ilUtil::ilTempnam();
1606  ilUtil::makeDir($tmpdir);
1607 
1608  try
1609  {
1610  // copy each selected object
1611  foreach ($a_ref_ids as $ref_id)
1612  {
1613  if (!$ilAccess->checkAccess("read", "", $ref_id))
1614  continue;
1615 
1616  if (ilObject::_isInTrash($ref_id))
1617  continue;
1618 
1619  // get object
1620  $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1621  $obj_type = $object->getType();
1622  if ($obj_type == "fold")
1623  {
1624  // copy folder to temp directory
1625  self::recurseFolder($ref_id, $object->getTitle(), $tmpdir);
1626  }
1627  else if ($obj_type == "file")
1628  {
1629  // copy file to temp directory
1630  self::copyFile($object->getId(), $object->getTitle(), $tmpdir);
1631  }
1632  }
1633 
1634  // compress the folder
1635  $deliverFilename = ilUtil::getAsciiFilename($this->object->getTitle()) . ".zip";
1636  $tmpzipfile = ilUtil::ilTempnam() . ".zip";
1637  ilUtil::zip($tmpdir, $tmpzipfile, true);
1638  ilUtil::delDir($tmpdir);
1639  ilUtil::deliverFile($tmpzipfile, $deliverFilename, '', false, true, true);
1640  }
1641  catch (ilFileException $e)
1642  {
1643  ilUtil::sendInfo($e->getMessage(), true);
1644  }
1645  }
1646 
1655  private static function recurseFolder($refid, $title, $tmpdir)
1656  {
1657  global $rbacsystem, $tree, $ilAccess;
1658 
1659  $tmpdir = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
1660  ilUtil::makeDir($tmpdir);
1661 
1662  $subtree = $tree->getChildsByTypeFilter($refid, array("fold","file"));
1663 
1664  foreach ($subtree as $child)
1665  {
1666  if (!$ilAccess->checkAccess("read", "", $child["ref_id"]))
1667  continue;
1668 
1669  if (ilObject::_isInTrash($child["ref_id"]))
1670  continue;
1671 
1672  if ($child["type"] == "fold")
1673  self::recurseFolder($child["ref_id"], $child["title"], $tmpdir);
1674  else
1675  self::copyFile($child["obj_id"], $child["title"], $tmpdir);
1676  }
1677  }
1678 
1679  private static function copyFile($obj_id, $title, $tmpdir)
1680  {
1681  $newFilename = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
1682 
1683  // copy to temporary directory
1684  $oldFilename = ilObjFile::_lookupAbsolutePath($obj_id);
1685  if (!copy($oldFilename, $newFilename))
1686  throw new ilFileException("Could not copy ".$oldFilename." to ".$newFilename);
1687 
1688  touch($newFilename, filectime($oldFilename));
1689  }
1690 
1697  function linkObject()
1698  {
1699  global $clipboard, $rbacsystem, $rbacadmin, $ilCtrl;
1700 
1701  if ($_GET["item_ref_id"] != "")
1702  {
1703  $_POST["id"] = array($_GET["item_ref_id"]);
1704  }
1705 
1706  if (!isset($_POST["id"]))
1707  {
1708  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1709  }
1710 
1711  // CHECK ACCESS
1712  foreach ($_POST["id"] as $ref_id)
1713  {
1714  if (!$rbacsystem->checkAccess('delete',$ref_id))
1715  {
1716  $no_cut[] = $ref_id;
1717  }
1718 
1719  $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1720 
1721  if (!$this->objDefinition->allowLink($object->getType()))
1722  {
1723  $no_link[] = $object->getType();
1724  }
1725  }
1726 
1727  // NO ACCESS
1728  if (count($no_cut))
1729  {
1730  $this->ilias->raiseError($this->lng->txt("msg_no_perm_link")." ".
1731  implode(',',$no_cut),$this->ilias->error_obj->MESSAGE);
1732  }
1733 
1734  if (count($no_link))
1735  {
1736  //#12203
1737  $this->ilias->raiseError($this->lng->txt("msg_obj_no_link"),$this->ilias->error_obj->MESSAGE);
1738 
1739  //$this->ilias->raiseError($this->lng->txt("msg_not_possible_link")." ".
1740  // implode(',',$no_link),$this->ilias->error_obj->MESSAGE);
1741  }
1742 
1743  // WRITE TO CLIPBOARD
1744  $clipboard["parent"] = $_GET["ref_id"];
1745  $clipboard["cmd"] = $ilCtrl->getCmd();
1746 
1747  foreach ($_POST["id"] as $ref_id)
1748  {
1749  $clipboard["ref_ids"][] = $ref_id;
1750  }
1751 
1752  $_SESSION["clipboard"] = $clipboard;
1753 
1754  $suffix = 'p';
1755  if(count($clipboard["ref_ids"]) == 1)
1756  {
1757  $suffix = 's';
1758  }
1759  ilUtil::sendInfo($this->lng->txt("msg_link_clipboard_" . $suffix),true);
1760 
1762 
1763  } // END LINK
1764 
1765 
1771  function clearObject()
1772  {
1773  unset($_SESSION["clipboard"]);
1774  unset($_SESSION["il_rep_clipboard"]);
1775 
1776  //var_dump($this->getReturnLocation("clear",$this->ctrl->getLinkTarget($this)),get_class($this));
1777 
1778  // only redirect if clipboard was cleared
1779  if (isset($_POST["cmd"]["clear"]))
1780  {
1781  ilUtil::sendSuccess($this->lng->txt("msg_clear_clipboard"),true);
1782  // fixed mantis 0018474: Clear Clipboard redirects to Subtab View, instead of Subtab "Edit Multiple"
1783  $this->ctrl->redirect($this, 'render');
1784  }
1785  }
1786 
1788  {
1789  global $rbacsystem, $rbacadmin, $rbacreview, $log, $tree, $ilObjDataCache, $ilUser;
1790 
1791  $command = $_SESSION['clipboard']['cmd'];
1792  if(!in_array($command, array('cut', 'link', 'copy')))
1793  {
1794  $message = __METHOD__.": cmd was neither 'cut', 'link' nor 'copy'; may be a hack attempt!";
1795  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
1796  }
1797 
1798  if($command == 'cut')
1799  {
1800  if(isset($_POST['node']) && (int)$_POST['node'])
1801  $_POST['nodes'] = array($_POST['node']);
1802  }
1803 
1804  if(!is_array($_POST['nodes']) || !count($_POST['nodes']))
1805  {
1806  ilUtil::sendFailure($this->lng->txt('select_at_least_one_object'));
1807  switch ($command)
1808  {
1809  case 'cut':
1810  $this->showPasteTreeObject();
1811  break;
1812  case 'copy':
1813  $this->showPasteTreeObject();
1814  break;
1815  case 'link':
1816  $this->showPasteTreeObject();
1817  break;
1818  }
1819  return;
1820  }
1821 
1822  // this loop does all checks
1823  $folder_objects_cache = array();
1824  foreach($_SESSION['clipboard']['ref_ids'] as $ref_id)
1825  {
1826  $obj_data = ilObjectFactory::getInstanceByRefId($ref_id);
1827  $current_parent_id = $tree->getParentId($obj_data->getRefId());
1828 
1829  foreach($_POST['nodes'] as $folder_ref_id)
1830  {
1831  if(!array_key_exists($folder_ref_id, $folder_objects_cache))
1832  {
1833  $folder_objects_cache[$folder_ref_id] = ilObjectFactory::getInstanceByRefId($folder_ref_id);
1834  }
1835 
1836  // CHECK ACCESS
1837  if(!$rbacsystem->checkAccess('create', $folder_ref_id, $obj_data->getType()))
1838  {
1839  $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().']');
1840  }
1841 
1842  // CHECK IF REFERENCE ALREADY EXISTS
1843  if($folder_ref_id == $current_parent_id)
1844  {
1845  $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().']');
1846  }
1847 
1848  // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
1849  if ($tree->isGrandChild($ref_id, $folder_ref_id) ||
1850  $ref_id == $folder_ref_id)
1851  {
1852  $is_child[] = sprintf($this->lng->txt('msg_paste_object_not_in_itself'), $obj_data->getTitle().' ['.$obj_data->getRefId().']');
1853  }
1854 
1855  // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT
1856  if(!in_array($obj_data->getType(), array_keys($folder_objects_cache[$folder_ref_id]->getPossibleSubObjects())))
1857  {
1858  $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().']',
1859  $GLOBALS['lng']->txt('obj_'.$obj_data->getType()));
1860  }
1861  }
1862  }
1863 
1865  // process checking results
1866  if(count($exists) && $command != "copy")
1867  {
1868  $error .= implode('<br />', $exists);
1869  }
1870 
1871  if(count($is_child))
1872  {
1873  $error .= $error != '' ? '<br />' : '';
1874  $error .= implode('<br />', $is_child);
1875  }
1876 
1877  if(count($not_allowed_subobject))
1878  {
1879  $error .= $error != '' ? '<br />' : '';
1880  $error .= implode('<br />', $not_allowed_subobject);
1881  }
1882 
1883  if(count($no_paste))
1884  {
1885  $error .= $error != '' ? '<br />' : '';
1886  $error .= implode('<br />', $no_paste);
1887  }
1888 
1889  if($error != '')
1890  {
1891  ilUtil::sendFailure($error);
1892  switch ($command)
1893  {
1894  case 'cut':
1895  $this->showPasteTreeObject();
1896  break;
1897  case 'copy':
1898  $this->showPasteTreeObject();
1899  break;
1900  case 'link':
1901  $this->showPasteTreeObject();
1902  break;
1903  }
1904  return;
1905  }
1906 
1907  // log pasteObject call
1908  $log->write(__METHOD__.", cmd: ".$command);
1909 
1911  // everything ok: now paste the objects to new location
1912 
1913  // to prevent multiple actions via back/reload button
1914  $ref_ids = $_SESSION['clipboard']['ref_ids'];
1915  unset($_SESSION['clipboard']['ref_ids']);
1916 
1917  // BEGIN ChangeEvent: Record paste event.
1918  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1919  // END ChangeEvent: Record paste event.
1920 
1921  // process COPY command
1922  if($command == 'copy')
1923  {
1924  foreach($_POST['nodes'] as $folder_ref_id)
1925  {
1926  foreach($ref_ids as $ref_id)
1927  {
1928  $revIdMapping = array();
1929 
1930  $oldNode_data = $tree->getNodeData($ref_id);
1931  if ($oldNode_data['parent'] == $folder_ref_id)
1932  {
1933  require_once 'Modules/File/classes/class.ilObjFileAccess.php';
1934  $newTitle = ilObjFileAccess::_appendNumberOfCopyToFilename($oldNode_data['title'],null);
1935  $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, $newTitle);
1936  }
1937  else
1938  {
1939  $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, null);
1940  }
1941 
1942  // BEGIN ChangeEvent: Record copy event.
1943  $old_parent_data = $tree->getParentNodeData($ref_id);
1944  $newNode_data = $tree->getNodeData($newRef);
1945  ilChangeEvent::_recordReadEvent($oldNode_data['type'], $ref_id,
1946  $oldNode_data['obj_id'], $ilUser->getId());
1947  ilChangeEvent::_recordWriteEvent($newNode_data['obj_id'], $ilUser->getId(), 'add',
1948  $ilObjDataCache->lookupObjId($folder_ref_id));
1949  ilChangeEvent::_catchupWriteEvents($newNode_data['obj_id'], $ilUser->getId());
1950  // END PATCH ChangeEvent: Record cut event.
1951  }
1952  }
1953 
1954  ilUtil::sendSuccess($this->lng->txt('msg_cloned'), true);
1955  } // END COPY
1956 
1957  // process CUT command
1958  if($command == 'cut')
1959  {
1960  foreach($_POST['nodes'] as $folder_ref_id)
1961  {
1962  foreach($ref_ids as $ref_id)
1963  {
1964  // Store old parent
1965  $old_parent = $tree->getParentId($ref_id);
1966  $tree->moveTree($ref_id, $folder_ref_id);
1967  $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1968 
1969  include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
1971 
1972  // BEGIN ChangeEvent: Record cut event.
1973  $node_data = $tree->getNodeData($ref_id);
1974  $old_parent_data = $tree->getNodeData($old_parent);
1975  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'remove',
1976  $old_parent_data['obj_id']);
1977  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
1978  $ilObjDataCache->lookupObjId($folder_ref_id));
1979  ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
1980  // END PATCH ChangeEvent: Record cut event.
1981  }
1982 
1983  // prevent multiple iterations for cut cmommand
1984  break;
1985  }
1986 
1987  ilUtil::sendSuccess($this->lng->txt('msg_cut_copied'), true);
1988  } // END CUT
1989 
1990  // process LINK command
1991  if($command == 'link')
1992  {
1993  $linked_to_folders = array();
1994 
1995  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
1996  $rbac_log_active = ilRbacLog::isActive();
1997 
1998  foreach($_POST['nodes'] as $folder_ref_id)
1999  {
2000  $linked_to_folders[$folder_ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($folder_ref_id));
2001 
2002  foreach($ref_ids as $ref_id)
2003  {
2004  // get node data
2005  $top_node = $tree->getNodeData($ref_id);
2006 
2007  // get subnodes of top nodes
2008  $subnodes[$ref_id] = $tree->getSubtree($top_node);
2009  }
2010 
2011  // now move all subtrees to new location
2012  foreach($subnodes as $key => $subnode)
2013  {
2014  // first paste top_node....
2015  $obj_data = ilObjectFactory::getInstanceByRefId($key);
2016  $new_ref_id = $obj_data->createReference();
2017  $obj_data->putInTree($folder_ref_id);
2018  $obj_data->setPermissions($folder_ref_id);
2019 
2020  // rbac log
2021  if($rbac_log_active)
2022  {
2023  $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id, false);
2024  $rbac_log = ilRbacLog::gatherFaPa($new_ref_id, array_keys($rbac_log_roles), true);
2025  ilRbacLog::add(ilRbacLog::LINK_OBJECT, $new_ref_id, $rbac_log, $key);
2026  }
2027 
2028  // BEGIN ChangeEvent: Record link event.
2029  $node_data = $tree->getNodeData($new_ref_id);
2030  ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2031  $ilObjDataCache->lookupObjId($folder_ref_id));
2032  ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2033  // END PATCH ChangeEvent: Record link event.
2034  }
2035 
2036  $log->write(__METHOD__.', link finished');
2037  }
2038 
2039  $linked_targets = array();
2040  if(count($linked_to_folders))
2041  {
2042  require_once 'Services/Link/classes/class.ilLink.php';
2043  foreach($linked_to_folders as $ref_id => $title)
2044  {
2045  $linked_targets[] = '<a href="' . ilLink::_getLink($ref_id) . '">' . $title . '</a>';
2046  }
2047  }
2048 
2049  $suffix = 'p';
2050  if(count($ref_ids) == 1)
2051  {
2052  $suffix = 's';
2053  }
2054  ilUtil::sendSuccess(sprintf($this->lng->txt('mgs_objects_linked_to_the_following_folders_' . $suffix), implode(', ', $linked_targets)), true);
2055  } // END LINK
2056 
2057  // clear clipboard
2058  $this->clearObject();
2059 
2060  $this->ctrl->returnToParent($this);
2061  }
2062 
2064  {
2065  global $tree;
2066 
2067  // empty session on init
2068  $_SESSION['paste_linked_repexpand'] = array();
2069 
2070  // copy opend nodes from repository explorer
2071  $_SESSION['paste_linked_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
2072 
2073  // open current position
2074  $path = $tree->getPathId((int)$_GET['ref_id']);
2075  foreach((array)$path as $node_id)
2076  {
2077  if(!in_array($node_id, $_SESSION['paste_linked_repexpand']))
2078  $_SESSION['paste_linked_repexpand'][] = $node_id;
2079  }
2080 
2081  return $this->showPasteTreeObject();
2082  }
2083 
2087  public function showPasteTreeObject()
2088  {
2089  global $ilTabs, $ilToolbar;
2090 
2091  $ilTabs->setTabActive('view_content');
2092 
2093  if(!in_array($_SESSION['clipboard']['cmd'], array('link', 'copy', 'cut')))
2094  {
2095  $message = __METHOD__.": Unknown action.";
2096  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2097  }
2098  $cmd = $_SESSION['clipboard']['cmd'];
2099 
2100  //
2101  $exp = $this->getTreeSelectorGUI($cmd);
2102  if ($exp->handleCommand())
2103  {
2104  return;
2105  }
2106  $output = $exp->getHTML();
2107 
2108  $txt_var = ($cmd == "copy")
2109  ? "copy"
2110  : "paste";
2111 
2112  // toolbars
2113  $t = new ilToolbarGUI();
2114  $t->setFormAction($this->ctrl->getFormAction($this, "performPasteIntoMultipleObjects"));
2115 
2116  include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
2118  $b->setCaption($txt_var);
2119  $b->setCommand("performPasteIntoMultipleObjects");
2120 
2121  //$t->addFormButton($this->lng->txt($txt_var), "performPasteIntoMultipleObjects");
2122  $t->addStickyItem($b);
2123 
2124  $t->addSeparator();
2125  $this->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->object->getPossibleSubObjects())))
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  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
3112  {
3113  ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
3114  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $result['ref_id']);
3115  $ilCtrl->redirectByClass("ilrepositorygui", "");
3116  }
3117  else
3118  {
3119  ilUtil::sendInfo($this->lng->txt("object_copy_in_progress"),true);
3120  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
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 
3638  function showRepTree()
3639  {
3640  global $tpl, $ilUser, $ilSetting, $ilCtrl;
3641 
3642  // set current repository view mode
3643  if (!empty($_GET["set_mode"]))
3644  {
3645  $_SESSION["il_rep_mode"] = $_GET["set_mode"];
3646  if ($ilUser->getId() != ANONYMOUS_USER_ID)
3647  {
3648  $ilUser->writePref("il_rep_mode", $_GET["set_mode"]);
3649  }
3650  }
3651 
3652  // get user setting
3653  if ($_SESSION["il_rep_mode"] == "")
3654  {
3655  if ($ilUser->getId() != ANONYMOUS_USER_ID)
3656  {
3657  $_SESSION["il_rep_mode"] = $ilUser->getPref("il_rep_mode");
3658  }
3659  }
3660 
3661  // if nothing set, get default view
3662  if ($_SESSION["il_rep_mode"] == "")
3663  {
3664  $_SESSION["il_rep_mode"] = $ilSetting->get("default_repository_view");
3665  }
3666 
3667  $mode = ($_SESSION["il_rep_mode"] != "")
3668  ? $_SESSION["il_rep_mode"]
3669  : "flat";
3670 
3671  // check for administration context, see #0016312
3672  if ($mode == "tree" && (strtolower($_GET["baseClass"]) != "iladministrationgui"))
3673  {
3674  include_once("./Services/Repository/classes/class.ilRepositoryExplorerGUI.php");
3675  $exp = new ilRepositoryExplorerGUI($this, "showRepTree");
3676  if (!$exp->handleCommand())
3677  {
3678  $tpl->setLeftNavContent($exp->getHTML());
3679  }
3680  }
3681  }
3682 
3688  protected function initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
3689  {
3690  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
3691  include_once './Services/Container/classes/class.ilContainer.php';
3692 
3693  $settings = new ilContainerSortingSettings($this->object->getId());
3694  $sort = new ilRadioGroupInputGUI($this->lng->txt('sorting_header'), "sorting");
3695 
3696  if(in_array(ilContainer::SORT_INHERIT, $a_sorting_settings))
3697  {
3698  $sort_inherit = new ilRadioOption();
3699  $sort_inherit->setTitle(
3700  $this->lng->txt('sort_inherit_prefix').
3701  ' ('.ilContainerSortingSettings::sortModeToString(
3703  $this->object->getId())).') '
3704  );
3705  $sort_inherit->setValue(ilContainer::SORT_INHERIT);
3706  $sort_inherit->setInfo($this->lng->txt('sorting_info_inherit'));
3707  $sort->addOption($sort_inherit);
3708  }
3709  if(in_array(ilContainer::SORT_TITLE,$a_sorting_settings))
3710  {
3711  $sort_title = new ilRadioOption(
3712  $this->lng->txt('sorting_title_header'),
3714  );
3715  $sort_title->setInfo($this->lng->txt('sorting_info_title'));
3716 
3717  $this->initSortingDirectionForm($settings,$sort_title,'title');
3718  $sort->addOption($sort_title);
3719  }
3720  if(in_array(ilContainer::SORT_CREATION, $a_sorting_settings))
3721  {
3722  $sort_activation = new ilRadioOption($this->lng->txt('sorting_creation_header'),ilContainer::SORT_CREATION);
3723  $sort_activation->setInfo($this->lng->txt('sorting_creation_info'));
3724  $this->initSortingDirectionForm($settings,$sort_activation,'creation');
3725  $sort->addOption($sort_activation);
3726  }
3727  if(in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings))
3728  {
3729  $sort_activation = new ilRadioOption($this->lng->txt('crs_sort_activation'),ilContainer::SORT_ACTIVATION);
3730  $sort_activation->setInfo($this->lng->txt('crs_sort_timing_info'));
3731  $this->initSortingDirectionForm($settings,$sort_activation,'activation');
3732  $sort->addOption($sort_activation);
3733  }
3734  if(in_array(ilContainer::SORT_MANUAL, $a_sorting_settings))
3735  {
3736  $sort_manual = new ilRadioOption(
3737  $this->lng->txt('sorting_manual_header'),
3739  );
3740  $sort_manual->setInfo($this->lng->txt('sorting_info_manual'));
3741  $this->initManualSortingOptionForm($settings, $sort_manual, "manual", $a_sorting_settings);
3742  $sort->addOption($sort_manual);
3743  }
3744 
3745  // Handle moved containers and there possibly invalid values
3746  if(in_array($settings->getSortMode(), $a_sorting_settings))
3747  {
3748  $sort->setValue($settings->getSortMode());
3749  }
3750  else
3751  {
3752  $sort->setValue(ilContainer::SORT_TITLE);
3753  }
3754  $form->addItem($sort);
3755 
3756  return $form;
3757  }
3758 
3763  protected function initSortingDirectionForm(ilContainerSortingSettings $sorting_settings, $element, $a_prefix)
3764  {
3765  if($a_prefix == 'manual')
3766  {
3767  $txt = $this->lng->txt('sorting_new_items_direction');
3768  }
3769  else
3770  {
3771  $txt = $this->lng->txt('sorting_direction');
3772  }
3773 
3774  $direction = new ilRadioGroupInputGUI($txt,$a_prefix.'_sorting_direction');
3775  $direction->setValue($sorting_settings->getSortDirection());
3776  $direction->setRequired(TRUE);
3777 
3778  // asc
3779  $asc = new ilRadioOption(
3780  $this->lng->txt('sorting_asc'),
3782  );
3783  $direction->addOption($asc);
3784 
3785  // desc
3786  $desc = new ilRadioOption(
3787  $this->lng->txt('sorting_desc'),
3789  );
3790  $direction->addOption($desc);
3791 
3792  $element->addSubItem($direction);
3793 
3794  return $element;
3795  }
3796 
3801  protected function initManualSortingOptionForm(ilContainerSortingSettings $settings, $element, $a_prefix,
3802  $a_sorting_settings)
3803  {
3804  $position = new ilRadioGroupInputGUI($this->lng->txt('sorting_new_items_position'),$a_prefix.'_new_items_position');
3805  $position->setValue($settings->getSortNewItemsPosition());
3806  $position->setRequired(TRUE);
3807 
3808  //new items insert on top
3809  $new_top = new ilRadioOption(
3810  $this->lng->txt('sorting_new_items_at_top'),
3812  );
3813 
3814  $position->addOption($new_top);
3815 
3816  //new items insert at bottom
3817  $new_bottom = new ilRadioOption(
3818  $this->lng->txt('sorting_new_items_at_bottom'),
3820  );
3821 
3822  $position->addOption($new_bottom);
3823 
3824  $element->addSubItem($position);
3825 
3826  $order = new ilRadioGroupInputGUI($this->lng->txt('sorting_new_items_order'),$a_prefix.'_new_items_order');
3827  $order->setValue($settings->getSortNewItemsOrder());
3828  $order->setRequired(TRUE);
3829 
3830  if(in_array(ilContainer::SORT_TITLE, $a_sorting_settings))
3831  {
3832  //new items sort in alphabetical order
3833  $new_title = new ilRadioOption(
3834  $this->lng->txt('sorting_title_header'),
3836  );
3837 
3838  $order->addOption($new_title);
3839  }
3840 
3841  if(in_array(ilContainer::SORT_CREATION, $a_sorting_settings))
3842  {
3843  //new items sort by creation date
3844  $new_creation = new ilRadioOption(
3845  $this->lng->txt('sorting_creation_header'),
3847  );
3848 
3849  $order->addOption($new_creation);
3850  }
3851 
3852 
3853  if(in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings))
3854  {
3855  //new items by activation
3856  $new_activation = new ilRadioOption(
3857  $this->lng->txt('crs_sort_activation'),
3859  );
3860 
3861  $order->addOption($new_activation);
3862  }
3863 
3864  $element->addSubItem($order);
3865 
3866  $this->initSortingDirectionForm($settings,$element,'manual');
3867 
3868  return $element;
3869  }
3870 
3875  protected function saveSortingSettings(ilPropertyFormGUI $form)
3876  {
3877  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
3878  $settings = new ilContainerSortingSettings($this->object->getId());
3879  $settings->setSortMode($form->getInput("sorting"));
3880 
3881  switch($form->getInput('sorting'))
3882  {
3884  $settings->setSortDirection($form->getInput('title_sorting_direction'));
3885  break;
3887  $settings->setSortDirection($form->getInput('activation_sorting_direction'));
3888  break;
3890  $settings->setSortDirection($form->getInput('creation_sorting_direction'));
3891  break;
3893  $settings->setSortNewItemsPosition($form->getInput('manual_new_items_position'));
3894  $settings->setSortNewItemsOrder($form->getInput('manual_new_items_order'));
3895  $settings->setSortDirection($form->getInput('manual_sorting_direction'));
3896  break;
3897  }
3898 
3899  $settings->update();
3900  }
3901 
3907  public function trashObject()
3908  {
3909  global $tpl;
3910 
3911  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3912  $ru = new ilRepUtilGUI($this);
3913  $ru->showTrashTable($_GET["ref_id"]);
3914  }
3915 
3921  public function removeFromSystemObject()
3922  {
3923  global $log, $ilAppEventHandler, $lng;
3924 
3925  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3926  $ru = new ilRepUtilGUI($this);
3927  $ru->removeObjectsFromSystem($_POST["trash_id"]);
3928  $this->ctrl->redirect($this, "trash");
3929  }
3930 
3934  public function undeleteObject()
3935  {
3936  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3937  $ru = new ilRepUtilGUI($this);
3938  $ru->restoreObjects($_GET["ref_id"], $_POST["trash_id"]);
3939  $this->ctrl->redirect($this, "trash");
3940  }
3941 
3946  {
3947  global $lng;
3948  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3949 
3950  if(!isset($_POST["trash_id"]))
3951  {
3952  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3953  $this->ctrl->redirect($this, "trash");
3954  }
3955 
3956  $ru = new ilRepUtilGUI($this);
3957  $ru->confirmRemoveFromSystemObject($_POST["trash_id"]);
3958  }
3959 
3964  protected function getTreeSelectorGUI($cmd)
3965  {
3966  include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
3967  $exp = new ilRepositorySelectorExplorerGUI($this, "showPasteTree");
3968  // TODO: The study programme 'prg' is not included here, as the
3969  // ilRepositorySelectorExplorerGUI only handles static rules for
3970  // parent-child-relations and not the dynamic relationsships
3971  // required for the SP (see #16909).
3972  $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
3973  if ($cmd == "link") {
3974  $exp->setSelectMode("nodes", true);
3975  return $exp;
3976  } else {
3977  $exp->setSelectMode("nodes[]", false);
3978  return $exp;
3979  }
3980  }
3981 }
3982 ?>
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.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
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.
$lg
Definition: example_018.php:62
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.
$_SESSION["AccountId"]
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.
static _isFinished($a_copy_id)
check if copy is finished
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 _buildPath($a_ref_id, $a_course_ref_id)
build path
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
$txt
Definition: error.php:12
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.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
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.
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
$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
$text
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
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
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.
$html
Definition: example_001.php:87
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.
Class ilFramesetGUI.