ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
4require_once "./Services/Object/classes/class.ilObjectGUI.php";
5require_once "./Services/Container/classes/class.ilContainer.php";
6include_once './Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
7
21{
22 var $bl_cnt = 1; // block counter
24
29 function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
30 {
31 global $rbacsystem, $lng;
32
33 $this->rbacsystem = $rbacsystem;
34
35 $lng->loadLanguageModule("cntr");
36 $lng->loadLanguageModule('cont');
37
38 //parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
39
40 // Activate tree cache when rendering the container to improve performance
41 //$tree->useCache(false);
42
43 // prepare output things should generally be made in executeCommand
44 // method (maybe dependent on current class/command
45 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
46 }
47
52 function executeCommand()
53 {
54 global $tpl;
55
56 $next_class = $this->ctrl->getNextClass();
57 $cmd = $this->ctrl->getCmd("render");
58
59 switch($next_class)
60 {
61 // page editing
62 case "ilcontainerpagegui":
63 if ($_GET["redirectSource"] != "ilinternallinkgui")
64 {
65 $ret = $this->forwardToPageObject();
66 $tpl->setContent($ret);
67 }
68 else
69 {
70 return "";
71 }
72 break;
73
74 case "ilobjstylesheetgui":
75 $this->forwardToStyleSheet();
76 break;
77
78 default:
79 $this->prepareOutput();
80 $cmd .= "Object";
81 $this->$cmd();
82 break;
83 }
84 return true;
85 }
86
92 protected function getEditFormValues()
93 {
94 $values = parent::getEditFormValues();
95
96 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
97 $values['didactic_type'] =
98 'dtpl_'.ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
99
100 return $values;
101 }
102
106 protected function afterUpdate()
107 {
108 // check if template is changed
109 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
111 $this->object->getRefId()
112 );
113 $new_tpl_id = (int) $this->getDidacticTemplateVar('dtpl');
114
115 if($new_tpl_id != $current_tpl_id)
116 {
117 $_REQUEST['tplid'] = $new_tpl_id;
118
119 // redirect to didactic template confirmation
120 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
121 $this->ctrl->setReturn($this,'edit');
122 $this->ctrl->setCmdClass('ildidactictemplategui');
123 $this->ctrl->setCmd('confirmTemplateSwitch');
124 $dtpl_gui = new ilDidacticTemplateGUI($this);
125 return $this->ctrl->forwardCommand($dtpl_gui);
126 }
127 parent::afterUpdate();
128 }
129
130
135 {
136 global $ilCtrl, $ilTabs;
137
138 $ilTabs->clearTargets();
139
140 $cmd = $ilCtrl->getCmd();
141 include_once ("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
142 $this->ctrl->setReturn($this, "editStyleProperties");
143 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
144 $style_gui->omitLocator();
145 if ($cmd == "create" || $_GET["new_type"]=="sty")
146 {
147 $style_gui->setCreationMode(true);
148 }
149
150 if ($cmd == "confirmedDelete")
151 {
152 $this->object->setStyleSheetId(0);
153 $this->object->update();
154 }
155
156 $ret = $this->ctrl->forwardCommand($style_gui);
157
158 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
159 {
160 $style_id = $ret;
161 $this->object->setStyleSheetId($style_id);
162 $this->object->update();
163 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
164 }
165 }
166
167
172 {
173 global $lng, $ilTabs, $ilCtrl;
174
175 $cmd = $ilCtrl->getCmd();
176
177 if (in_array($cmd, array("displayMediaFullscreen", "downloadFile", "displayMedia")))
178 {
179 $this->checkPermission("read");
180 }
181 else
182 {
183 $this->checkPermission("write");
184 }
185
186 $ilTabs->clearTargets();
187
188 if ($_GET["redirectSource"] == "ilinternallinkgui")
189 {
190 exit;
191 }
192
193 $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
194 "xhtml_page");
195 if ($xpage_id > 0)
196 {
197 $ilTabs->setBackTarget($lng->txt("cntr_back_to_old_editor"),
198 $ilCtrl->getLinkTarget($this, "switchToOldEditor"), "_top");
199 }
200 else
201 {
202 $ilTabs->setBackTarget($lng->txt("back"), "./goto.php?target=".$this->object->getType()."_".
203 $this->object->getRefId(), "_top");
204 }
205
206 // page object
207 include_once("./Services/Container/classes/class.ilContainerPage.php");
208 include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
209
210 $lng->loadLanguageModule("content");
211
212 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
213 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
214 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
215 $this->tpl->setCurrentBlock("SyntaxStyle");
216 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
218 $this->tpl->parseCurrentBlock();
219
220 if (!ilContainerPage::_exists("cont",
221 $this->object->getId()))
222 {
223 // doesn't exist -> create new one
224 $new_page_object = new ilContainerPage();
225 $new_page_object->setParentId($this->object->getId());
226 $new_page_object->setId($this->object->getId());
227 $new_page_object->createFromXML();
228 }
229
230 // get page object
231 $this->ctrl->setReturnByClass("ilcontainerpagegui", "edit");
232 $page_gui = new ilContainerPageGUI($this->object->getId());
233 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
235 $this->object->getStyleSheetId(), $this->object->getType()));
236
237 $page_gui->setTemplateTargetVar("ADM_CONTENT");
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");
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/Content/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/Content/classes/class.ilObjStyleSheet.php");
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 public function prepareOutput($a_show_subobjects = true)
351 {
352 if (parent::prepareOutput($a_show_subobjects)) // 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
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
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
577 if(!$folder_set->get("bgtask_download", 0))
578 {
579 $toolbar->addFormButton(
580 $this->lng->txt('download_selected_items'),
581 'download'
582 );
583 }
584 else
585 {
586 $GLOBALS['tpl']->addJavaScript("Services/BackgroundTask/js/BgTask.js");
587 $GLOBALS['tpl']->addOnLoadCode("il.BgTask.initMultiForm('ilFolderDownloadBackgroundTaskHandler');");
588
589 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
590 $button = ilSubmitButton::getInstance();
591 $button->setCaption("download_selected_items");
592 $button->addCSSClass("ilbgtasksubmit");
593 $button->setCommand("download");
594 $toolbar->addButtonInstance($button);
595 }
596 }
597 }
598 if($this->object->getType() == 'crs' or $this->object->getType() == 'grp')
599 {
600 if($this->object->gotItems())
601 {
602 $toolbar->addSeparator();
603 }
604
605 $toolbar->addButton(
606 $this->lng->txt('cntr_adopt_content'),
607 $this->ctrl->getLinkTargetByClass(
608 'ilObjectCopyGUI',
609 'adoptContent')
610 );
611 }
612 }
613 else
614 {
615 //$GLOBALS["tpl"]->addAdminPanelCommand("paste",
616 // $this->lng->txt("paste_clipboard_items"));
617
618 $toolbar->addFormButton(
619 $this->lng->txt('paste_clipboard_items'),
620 'paste'
621 );
622
623 if($_SESSION["clipboard"]["cmd"] == "link")
624 {
625 //$GLOBALS["tpl"]->addAdminPanelCommand("initAndDisplayLinkIntoMultipleObjects",
626 // $this->lng->txt("paste_clipboard_items_into_multiple_objects"));
627 /*$toolbar->addFormButton(
628 $this->lng->txt('paste_clipboard_items_into_multiple_objects'),
629 'initAndDisplayLinkIntoMultipleObjects'
630 );*/
631 }
632
633 $toolbar->addFormButton(
634 $this->lng->txt('clear_clipboard'),
635 'clear'
636 );
637
638 if ($this->isMultiDownloadEnabled())
639 {
640 $toolbar->addSeparator();
641 $toolbar->addFormButton(
642 $this->lng->txt('download_selected_items'),
643 'download'
644 );
645 }
646 }
647
648 $GLOBALS['tpl']->addAdminPanelToolbar(
649 $toolbar,
650 ($this->object->gotItems() && !$_SESSION["clipboard"]) ? true : false,
651 ($this->object->gotItems() && !$_SESSION["clipboard"]) ? true : false
652 );
653
654 // form action needed, see http://www.ilias.de/mantis/view.php?id=9630
655 if ($this->object->gotItems())
656 {
657 $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
658 }
659 }
660 else
661 {
662 if ($this->edit_order)
663 {
664 if($this->object->gotItems() and $ilAccess->checkAccess("write", "", $this->object->getRefId()))
665 {
666 include_once('./Services/Container/classes/class.ilContainer.php');
667
668 if ($this->isActiveOrdering())
669 {
670 // #11843
671 $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
672
673 include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
674 $toolbar = new ilToolbarGUI();
675 $this->ctrl->setParameter($this, "type", "");
676 $this->ctrl->setParameter($this, "item_ref_id", "");
677
678 $toolbar->addFormButton(
679 $this->lng->txt('sorting_save'),
680 'saveSorting'
681 );
682
683 $GLOBALS['tpl']->addAdminPanelToolbar($toolbar, true, false);
684
685 /*
686 $GLOBALS["tpl"]->addAdminPanelCommand("saveSorting",
687 $this->lng->txt('sorting_save'));
688
689 // button should appear at bottom, too
690 $GLOBALS["tpl"]->admin_panel_bottom = true;
691 */
692 }
693 }
694 }
695 else if ($this->isMultiDownloadEnabled())
696 {
697 // bugfix mantis 0021272
698 $children_of_type_file = $this->getAllNestedFiles($_GET['ref_id']);
699 // Check if there are any files and therefore downloadable objects.
700 // In case that there are no downloadable objects the download button mustn't be displayed (see mantis 0021272)
701 if(count($children_of_type_file) != 0)
702 {
703 // #11843
704 $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
705
706 include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
707 $toolbar = new ilToolbarGUI();
708 $this->ctrl->setParameter($this, "type", "");
709 $this->ctrl->setParameter($this, "item_ref_id", "");
710
711 $toolbar->addFormButton(
712 $this->lng->txt('download_selected_items'),
713 'download'
714 );
715
716 $GLOBALS['tpl']->addAdminPanelToolbar(
717 $toolbar,
718 $this->object->gotItems() ? true : false,
719 $this->object->gotItems() ? true : false
720 );
721 }
722 else
723 {
724 ilUtil::sendInfo($this->lng->txt('msg_no_downloadable_objects'), true);
725 }
726 }
727 }
728 }
729
736 private function getAllNestedFiles($ref_id) {
737 $files = array();
738 // get sibling files
739 $sibling_files = $this->tree->getChildsByType($ref_id, "file");
740 // add sibling files to file array
741 foreach ($sibling_files as $sibling_course)
742 {
743 array_push($files, $sibling_course);
744 }
745 // get child files (nested inside directories)
746 $categories = $this->getAllNestedCategories($ref_id);
747 foreach ($categories as $category)
748 {
749 $category_ref_id = $category["ref_id"];
750 $nested_files = $this->tree->getChildsByType($category_ref_id, "file");
751 // add nested files to file array
752 foreach ($nested_files as $nested_course)
753 {
754 array_push($files, $nested_course);
755 }
756 }
757 return $files;
758 }
759
760 /*
761 * Get all categories that are nested in the category whose ref_id is passed to this function or are nested in its subcategories
762 * Required for fixing mantis bug 0021272
763 * @param int $ref_id
764 * @return array
765 */
767 {
768 $categories = $this->tree->getChildsByType($ref_id, "cat");
769 // outsourcing to a variable to enable increasing the value when elements are added during iteration
770 $num_categories = count($categories);
771 // using a for loop instead of a foreach loop to enable adding elements during iteration by increasing the comparison value (num_categories)
772 for ($i = 0; $i < $num_categories; $i ++)
773 {
774 $category_ref_id = $categories[$i]["ref_id"];
775 // determining if there are categories directly nested within the current category
776 $new_categories = $this->tree->getChildsByType($category_ref_id, "cat");
777 if ($new_categories != NULL)
778 {
779 foreach ($new_categories as $new_category)
780 {
781 // adding the newly found categories to the end of the array so that they may be searched for directly nested categories too
782 array_push($categories, $new_category);
783 // recounting the amount of elements in the category array so that the iteration can continue despite elements being added
784 $num_categories = count($categories);
785 }
786 }
787 }
788 return $categories;
789 }
790
792 {
793 global $tree;
794
795 if(!$tree->checkForParentType($this->object->getRefId(),'crs'))
796 {
797 return false;
798 }
799 $tpl->setCurrentBlock("custom_button");
800 $tpl->setVariable("ADMIN_MODE_LINK",$this->ctrl->getLinkTargetByClass('ilcoursecontentgui','editTimings'));
801 $tpl->setVariable("TXT_ADMIN_MODE",$this->lng->txt('timings_edit'));
802 $tpl->parseCurrentBlock();
803 return true;
804 }
809 {
810 $GLOBALS["tpl"]->setPermanentLink($this->object->getType(),
811 $this->object->getRefId(), "", "_top");
812 }
813
818 {
819 global $ilCtrl;
820
821 $_SESSION["il_cntr_editor"] = "std";
822 $ilCtrl->redirect($this, "editPageFrame");
823 }
824
829 {
830 global $ilCtrl;
831
832 $_SESSION["il_cntr_editor"] = "old";
833 $ilCtrl->redirect($this, "editPageFrame");
834 }
835
840 {
841 global $ilCtrl, $ilAccess, $lng, $ilCtrl;
842
843 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
844 {
845 include_once("./Services/XHTMLPage/classes/class.ilXHTMLPage.php");
846
847 /* keep old page content for now...
848 $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
849 "xhtml_page");
850 if ($xpage_id)
851 {
852 $xpage = new ilXHTMLPage($xpage_id);
853 }
854 */
855
856 ilContainer::_writeContainerSetting($this->object->getId(),
857 "xhtml_page", 0);
858
859 ilUtil::sendSuccess($lng->txt("cntr_switched_editor"), true);
860 }
861
862 $ilCtrl->redirect($this, "editPageFrame");
863 }
864
869 {
870 // old tiny stuff
871 $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
872 "xhtml_page");
873 if ($xpage_id > 0 && $_SESSION["il_cntr_editor"] != "std")
874 {
875 $this->ctrl->redirect($this, "editPageContent");
876 }
877 else
878 {
879 $this->ctrl->redirectByClass(array("ilcontainerpagegui"), "edit");
880 }
881 }
882
889 {
890 global $rbacsystem, $tpl, $lng, $ilCtrl;
891
892 if (!$rbacsystem->checkAccess("write", $this->ref_id))
893 {
894 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
895 }
896
897 $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
898 "xhtml_page");
899 if ($xpage_id > 0)
900 {
901 include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
902 $xpage = new ilXHTMLPage($xpage_id);
903 $content = $xpage->getContent();
904 }
905
906 // get template
907 $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.container_edit_page_content.html",
908 "Services/Container");
909 $tpl->setVariable("VAL_CONTENT", ilUtil::prepareFormOutput($content));
910 $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
911 $tpl->setVariable("TXT_EDIT_PAGE_CONTENT",
912 $this->lng->txt("edit_page_content"));
913 $tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
914 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
915 $tpl->setVariable("TXT_MIGRATION_INFO", $lng->txt("cntr_old_editor_warning"));
916 $tpl->setVariable("TXT_MIGRATION_OPEN_STD_EDITOR", $lng->txt("cntr_old_editor_open_standard_editor"));
917 $tpl->setVariable("IMG_WARNING", ilUtil::getImagePath("icon_alert.svg"));
918 $tpl->setVariable("HREF_OPEN_STD_EDITOR", $ilCtrl->getLinkTarget($this, "switchToStdEditor"));
919 $tpl->setVariable("ALT_WARNING", $lng->txt("warning"));
920
921 include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
922 include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
923 //$ta = new ilTextAreaInputGUI();
924 //$tags = $ta->getRteTagSet("extended_table_img");
925
926 // add rte support
927 include_once "./Services/RTE/classes/class.ilRTE.php";
928 $rtestring = ilRTE::_getRTEClassname();
929 include_once "./Services/RTE/classes/class.$rtestring.php";
930 $rte = new $rtestring();
931 //$rte->addPlugin("latex");
932 include_once "./Services/Object/classes/class.ilObject.php";
934 $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
935 $rte->addRTESupport($obj_id, $obj_type);
936 //$rte->setStyleSelect(true);
937 //$rte->addCustomRTESupport($obj_id, $obj_type, $tags);
938 }
939
941 {
942 include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
943 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
944 $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
945 "xhtml_page");
946
947 /*include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
948 include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
949 $ta = new ilTextAreaInputGUI();
950 $ta->setRteTagSet("extended_table_img");
951 $tags = $ta->getRteTagString();*/
952
953 //$text = ilUtil::stripSlashes($_POST["page_content"],
954 // true,
955 // $tags);
956
957 $text = ilUtil::stripSlashes($_POST["page_content"],
958 true,
960 if ($xpage_id > 0)
961 {
962 $xpage = new ilXHTMLPage($xpage_id);
963 $xpage->setContent($text);
964 $xpage->save();
965 }
966 else
967 {
968 $xpage = new ilXHTMLPage();
969 $xpage->setContent($text);
970 $xpage->save();
971 ilContainer::_writeContainerSetting($this->object->getId(),
972 "xhtml_page", $xpage->getId());
973 }
974
975 include_once("Services/RTE/classes/class.ilRTE.php");
976 ilRTE::_cleanupMediaObjectUsage($text, $this->object->getType().":html",
977 $this->object->getId());
978
979 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
980 $this->ctrl->redirect($this, "");
981 }
982
984 {
985 $this->ctrl->redirect($this, "");
986 }
987
989 {
990 global $lng, $tree;
991
992 $tpl = new ilTemplate("tpl.container_link_help.html", true, true,
993 "Services/Container");
994
995 $type_ordering = array(
996 "cat", "fold", "crs", "grp", "chat", "frm", "lres",
997 "glo", "webr", "file", "exc",
998 "tst", "svy", "mep", "qpl", "spl");
999
1000 $childs = $tree->getChilds($_GET["ref_id"]);
1001 foreach($childs as $child)
1002 {
1003 if (in_array($child["type"], array("lm", "sahs", "htlm")))
1004 {
1005 $cnt["lres"]++;
1006 }
1007 else
1008 {
1009 $cnt[$child["type"]]++;
1010 }
1011 }
1012
1013 $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
1014 $tpl->setVariable("TXT_HELP_HEADER", $lng->txt("help"));
1015 foreach($type_ordering as $type)
1016 {
1017 $tpl->setCurrentBlock("row");
1018 $tpl->setVariable("ROWCOL", "tblrow".((($i++)%2)+1));
1019 if ($type != "lres")
1020 {
1021 $tpl->setVariable("TYPE", $lng->txt("objs_".$type).
1022 " (".((int)$cnt[$type]).")");
1023 }
1024 else
1025 {
1026 $tpl->setVariable("TYPE", $lng->txt("learning_resources").
1027 " (".((int)$cnt["lres"]).")");
1028 }
1029 $tpl->setVariable("TXT_LINK", "[list-".$type."]");
1030 $tpl->parseCurrentBlock();
1031 }
1032 $tpl->show();
1033 exit;
1034
1035 }
1036
1041 {
1042 $this->adminCommands = false;
1043 }
1044
1048/* function determineAdminCommands($a_ref_id, $a_admin_com_included_in_list = false)
1049 {
1050 if (!$this->adminCommands)
1051 {
1052 if (!$this->isActiveAdministrationPanel())
1053 {
1054 if ($this->rbacsystem->checkAccess("delete", $a_ref_id))
1055 {
1056 $this->adminCommands = true;
1057 }
1058 }
1059 else
1060 {
1061 $this->adminCommands = $a_admin_com_included_in_list;
1062 }
1063 }
1064 }*/
1065
1073 {
1074 $tpl = new ilTemplate("tpl.container_list_block.html", true, true,
1075 "Services/Container");
1076 $this->cur_row_type = "row_type_1";
1077 return $tpl;
1078 }
1079
1087 function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true)
1088 {
1089 $icon = ilUtil::getImagePath("icon_".$a_type.".svg");
1090 $title = $this->lng->txt("objs_".$a_type);
1091
1092 if ($a_show_image)
1093 {
1094 $a_tpl->setCurrentBlock("container_header_row_image");
1095 $a_tpl->setVariable("HEADER_IMG", $icon);
1096 $a_tpl->setVariable("HEADER_ALT", $title);
1097 }
1098 else
1099 {
1100 $a_tpl->setCurrentBlock("container_header_row");
1101 }
1102
1103 $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
1104 $a_tpl->parseCurrentBlock();
1105 $a_tpl->touchBlock("container_row");
1106 }
1107
1115 function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "",
1116 $a_image_type = "")
1117 {
1118 $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1119 ? "row_type_2"
1120 : "row_type_1";
1121
1122 $a_tpl->touchBlock($this->cur_row_type);
1123
1124 $nbsp = true;
1125 if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows")
1126 {
1127 $icon = ilUtil::getImagePath("icon_".$a_image_type.".svg");
1128 $alt = $this->lng->txt("obj_".$a_image_type);
1129
1130 // custom icon
1131 if ($this->ilias->getSetting("custom_icons") &&
1132 in_array($a_image_type, array("cat","grp","crs")))
1133 {
1134 require_once("./Services/Container/classes/class.ilContainer.php");
1135 if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
1136 {
1137 $icon = $path;
1138 }
1139 }
1140
1141 $a_tpl->setCurrentBlock("block_row_image");
1142 $a_tpl->setVariable("ROW_IMG", $icon);
1143 $a_tpl->setVariable("ROW_ALT", $alt);
1144 $a_tpl->parseCurrentBlock();
1145 $nbsp = false;
1146 }
1147
1148 if ($this->isActiveAdministrationPanel())
1149 {
1150 $a_tpl->setCurrentBlock("block_row_check");
1151 $a_tpl->setVariable("ITEM_ID", $a_item_ref_id);
1152 $a_tpl->parseCurrentBlock();
1153 $nbsp = false;
1154 }
1155 include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
1156 if($this->isActiveAdministrationPanel() &&
1158 {
1159 $a_tpl->setCurrentBlock('block_position');
1160 $a_tpl->setVariable('POS_TYPE',$a_image_type);
1161 $a_tpl->setVariable('POS_ID',$a_item_ref_id);
1162 $a_tpl->setVariable('POSITION',sprintf('%.1f',$this->current_position++));
1163 $a_tpl->parseCurrentBlock();
1164 }
1165 if ($nbsp)
1166 {
1167 $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1168 }
1169 $a_tpl->setCurrentBlock("container_standard_row");
1170 $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
1171 $a_tpl->parseCurrentBlock();
1172 $a_tpl->touchBlock("container_row");
1173 }
1174
1178 function addMessageRow(&$a_tpl, $a_message, $a_type)
1179 {
1180 $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1181 ? "row_type_2"
1182 : "row_type_1";
1183
1184 $a_tpl->touchBlock($this->cur_row_type);
1185
1186 $type = $this->lng->txt("obj_".$a_type);
1187 $a_message = str_replace("[type]", $type, $a_message);
1188
1189 $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1190
1191 $a_tpl->setCurrentBlock("container_standard_row");
1192 $a_tpl->setVariable("BLOCK_ROW_CONTENT",
1193 $a_message);
1194 $a_tpl->parseCurrentBlock();
1195 $a_tpl->touchBlock("container_row");
1196 }
1197
1198 function resetRowType()
1199 {
1200 $this->cur_row_type = "";
1201 }
1202
1203
1208 {
1209 global $lng;
1210
1211 if (!$this->isActiveAdministrationPanel()
1212 || strtolower($this->ctrl->getCmdClass()) != "ilcontainerpagegui")
1213 {
1214 return;
1215 }
1216
1217 $lng->loadLanguageModule("content");
1218 //$tabs_gui = new ilTabsGUI();
1219 //$tabs_gui->setSubTabs();
1220
1221 // back to upper context
1222 $this->tabs_gui->setBackTarget($this->lng->txt("obj_cat"),
1223 $this->ctrl->getLinkTarget($this, "frameset"),
1224 ilFrameTargetInfo::_getFrame("MainContent"));
1225
1226 $this->tabs_gui->addTarget("edit", $this->ctrl->getLinkTargetByClass("ilcontainerpagegui", "view")
1227 , array("", "view"), "ilcontainerpagegui");
1228
1229 //$this->tpl->setTabs($tabs_gui->getHTML());
1230 }
1231
1235 function addStandardContainerSubTabs($a_include_view = true)
1236 {
1237 global $ilTabs, $ilAccess, $lng, $ilCtrl, $ilUser, $ilSetting;
1238
1239 if (!is_object($this->object))
1240 {
1241 return;
1242 }
1243
1244 if ($a_include_view && $ilAccess->checkAccess("read", "", $this->object->getRefId()))
1245 {
1246 if (!$this->isActiveAdministrationPanel())
1247 {
1248 $ilTabs->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTarget($this, "view"));
1249 }
1250 else
1251 {
1252 $ilTabs->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTarget($this, "disableAdministrationPanel"));
1253 }
1254 }
1255
1256 if ( $ilUser->getId() != ANONYMOUS_USER_ID &&
1257 ($this->adminCommands ||
1258 (is_object($this->object) &&
1259 ($ilAccess->checkAccess("write", "", $this->object->getRefId())))
1260 ||
1261 (is_object($this->object) &&
1262 ($this->object->getHiddenFilesFound())) ||
1263 $_SESSION["clipboard"]
1264 )
1265 )
1266 {
1267 if ($this->isActiveAdministrationPanel())
1268 {
1269 $ilTabs->addSubTab("manage", $lng->txt("cntr_manage"), $ilCtrl->getLinkTarget($this, ""));
1270 }
1271 else
1272 {
1273 $ilTabs->addSubTab("manage", $lng->txt("cntr_manage"), $ilCtrl->getLinkTarget($this, "enableAdministrationPanel"));
1274 }
1275 }
1276 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1277 is_object($this->object) &&
1278 $ilAccess->checkAccess("write", "", $this->object->getRefId()) /* &&
1279 $this->object->getOrderType() == ilContainer::SORT_MANUAL */ // always on because of custom block order
1280 )
1281 {
1282 $ilTabs->addSubTab("ordering", $lng->txt("cntr_ordering"), $ilCtrl->getLinkTarget($this, "editOrder"));
1283 }
1284 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1285 is_object($this->object) &&
1286 $ilAccess->checkAccess("write", "", $this->object->getRefId())
1287 )
1288 {
1289 if ($ilSetting->get("enable_cat_page_edit"))
1290 {
1291 $ilTabs->addSubTab("page_editor", $lng->txt("cntr_text_media_editor"), $ilCtrl->getLinkTarget($this, "editPageFrame"),
1292 ilFrameTargetInfo::_getFrame("MainContent"));
1293 }
1294 }
1295 }
1296
1297
1302 function getTabs()
1303 {
1304 global $rbacsystem, $ilCtrl;
1305
1306 // edit permissions
1307 if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
1308 {
1309 $this->tabs_gui->addTarget("perm_settings",
1310 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1311 array("perm","info","owner"), 'ilpermissiongui');
1312 if ($ilCtrl->getNextClass() == "ilpermissiongui")
1313 {
1314 $this->tabs_gui->activateTab("perm_settings");
1315 }
1316 }
1317
1318 // show clipboard
1319 if (strtolower($_GET["baseClass"]) == "ilrepositorygui" && !empty($_SESSION["clipboard"]))
1320 {
1321 $this->tabs_gui->addTarget("clipboard",
1322 $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
1323 }
1324
1325 }
1326
1327 //*****************
1328 // COMMON METHODS (may be overwritten in derived classes
1329 // if special handling is necessary)
1330 //*****************
1331
1336 {
1337 $_SESSION["il_cont_admin_panel"] = true;
1338 $this->ctrl->redirect($this, "render");
1339 }
1340
1345 {
1346 $_SESSION["il_cont_admin_panel"] = false;
1347 $this->ctrl->redirect($this, "render");
1348 }
1349
1354 {
1355 global $ilTabs;
1356
1357 $this->edit_order = true;
1358 $_SESSION["il_cont_admin_panel"] = false;
1359 $this->renderObject();
1360
1361 $ilTabs->activateSubTab("ordering");
1362 }
1363
1368 public function isActiveOrdering()
1369 {
1370 return $this->edit_order ? true : false;
1371 }
1372
1377 public function isActiveItemOrdering()
1378 {
1379 if($this->isActiveOrdering())
1380 {
1381 return (ilContainerSortingSettings::_lookupSortMode($this->object->getId()) == ilContainer::SORT_MANUAL);
1382 }
1383 return false;
1384 }
1385
1389 public function addToDeskObject()
1390 {
1391 global $ilSetting, $lng;
1392
1393 if((int)$ilSetting->get('disable_my_offers'))
1394 {
1395 return $this->renderObject();
1396 }
1397
1398 include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
1400 ilUtil::sendSuccess($lng->txt("added_to_desktop"));
1401 $this->renderObject();
1402 }
1403
1407 public function removeFromDeskObject()
1408 {
1409 global $ilSetting, $lng;
1410
1411 if((int)$ilSetting->get('disable_my_offers'))
1412 {
1413 return $this->renderObject();
1414 }
1415
1416 include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
1418 ilUtil::sendSuccess($lng->txt("removed_from_desktop"));
1419 $this->renderObject();
1420 }
1421
1423 {
1424 $this->multi_download_enabled = true;
1425 $this->renderObject();
1426 }
1427
1429 {
1431 }
1432
1433 // BEGIN WebDAV: Lock/Unlock objects
1434 function lockObject()
1435 {
1436 global $tree, $ilUser, $rbacsystem;
1437
1438 if (!$rbacsystem->checkAccess("write",$_GET['item_ref_id']))
1439 {
1440 $this->ilErr->raiseError($this->lng->txt('err_no_permission'),$this->ilErr->MESSAGE);
1441 }
1442
1443
1444 require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1446 {
1447 require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
1449 {
1450 require_once 'Services/WebDAV/classes/class.ilDAVLocks.php';
1451 $locks = new ilDAVLocks();
1452
1453 $result = $locks->lockRef($_GET['item_ref_id'],
1454 $ilUser->getId(), $ilUser->getLogin(),
1455 'ref_'.$_GET['item_ref_id'].'_usr_'.$ilUser->getId(),
1456 time() + /*30*24*60**/60, 0, 'exclusive'
1457 );
1458
1460 $this->lng->txt(
1461 ($result === true) ? 'object_locked' : $result
1462 ),
1463 true);
1464 }
1465 }
1466 $this->renderObject();
1467 }
1468 // END WebDAV: Lock/Unlock objects
1469
1476 function cutObject()
1477 {
1478 global $rbacsystem, $ilCtrl;
1479
1480 if ($_GET["item_ref_id"] != "")
1481 {
1482 $_POST["id"] = array($_GET["item_ref_id"]);
1483 }
1484
1485 //$this->ilias->raiseError("move operation does not work at the moment and is disabled",$this->ilias->error_obj->MESSAGE);
1486
1487 if (!isset($_POST["id"]))
1488 {
1489 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1490 }
1491
1492 // FOR ALL OBJECTS THAT SHOULD BE COPIED
1493 foreach ($_POST["id"] as $ref_id)
1494 {
1495 // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
1496 $node_data = $this->tree->getNodeData($ref_id);
1497 $subtree_nodes = $this->tree->getSubTree($node_data);
1498
1499 $all_node_data[] = $node_data;
1500 $all_subtree_nodes[] = $subtree_nodes;
1501
1502 // CHECK DELETE PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1503 foreach ($subtree_nodes as $node)
1504 {
1505 if($node['type'] == 'rolf')
1506 {
1507 continue;
1508 }
1509
1510 if (!$rbacsystem->checkAccess('delete',$node["ref_id"]))
1511 {
1512 $no_cut[] = $node["ref_id"];
1513 }
1514 }
1515 }
1516 // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1517 if (count($no_cut))
1518 {
1519 $titles = array();
1520 foreach((array) $no_cut as $cut_id)
1521 {
1522 $titles[] = ilObject::_lookupTitle(ilObject::_lookupObjId($cut_id));
1523 }
1524 $this->ilias->raiseError(
1525 $this->lng->txt("msg_no_perm_cut")." ".implode(',',(array) $titles),
1526 $this->ilias->error_obj->MESSAGE
1527 );
1528 }
1529 $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
1530 $_SESSION["clipboard"]["cmd"] = $ilCtrl->getCmd();
1531 $_SESSION["clipboard"]["ref_ids"] = $_POST["id"];
1532
1533 ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"),true);
1534
1535 return $this->initAndDisplayMoveIntoObjectObject();
1536 } // END CUT
1537
1545 function copyObject()
1546 {
1547 global $rbacsystem, $ilCtrl, $objDefinition;
1548
1549 if ($_GET["item_ref_id"] != "")
1550 {
1551 $_POST["id"] = array($_GET["item_ref_id"]);
1552 }
1553
1554 if (!isset($_POST["id"]))
1555 {
1556 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1557 }
1558
1559 // FOR ALL OBJECTS THAT SHOULD BE COPIED
1560 $containers = 0;
1561 foreach ($_POST["id"] as $ref_id)
1562 {
1563 // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
1564 $node_data = $this->tree->getNodeData($ref_id);
1565
1566 // count containers
1567 if ($objDefinition->isContainer($node_data["type"]))
1568 {
1569 $containers++;
1570 }
1571
1572 $subtree_nodes = $this->tree->getSubTree($node_data);
1573
1574 $all_node_data[] = $node_data;
1575 $all_subtree_nodes[] = $subtree_nodes;
1576
1577 // CHECK COPY PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1578 foreach ($subtree_nodes as $node)
1579 {
1580 if($node['type'] == 'rolf')
1581 {
1582 continue;
1583 }
1584
1585 if (!$rbacsystem->checkAccess('visible,read,copy',$node["ref_id"]))
1586 {
1587 $no_copy[] = $node["ref_id"];
1588 }
1589 }
1590 }
1591
1592 if ($containers > 0 && count($_POST["id"]) > 1)
1593 {
1594 $this->ilias->raiseError($this->lng->txt("cntr_container_only_on_their_own"), $this->ilias->error_obj->MESSAGE);
1595 }
1596
1597 // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1598 if (count($no_copy))
1599 {
1600 $titles = array();
1601 foreach((array) $no_copy as $copy_id)
1602 {
1603 $titles[] = ilObject::_lookupTitle(ilObject::_lookupObjId($copy_id));
1604 }
1605 $this->ilias->raiseError(
1606 $this->lng->txt("msg_no_perm_copy") . " " . implode(',',$titles),
1607 $this->ilias->error_obj->MESSAGE);
1608 }
1609
1610 // if we have a single container, set it as source id and redirect to ilObjectCopyGUI
1611 if (count($_POST["id"]) == 1)
1612 {
1613 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $_POST["id"][0]);
1614 $ilCtrl->redirectByClass("ilobjectcopygui", "initTargetSelection");
1615 }
1616 else
1617 {
1618 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode($_POST["id"],"_"));
1619 $ilCtrl->redirectByClass("ilobjectcopygui", "initTargetSelection");
1620 }
1621
1622 $_SESSION["clipboard"]["parent"] = $_GET["ref_id"];
1623 $_SESSION["clipboard"]["cmd"] = $ilCtrl->getCmd();
1624 $_SESSION["clipboard"]["ref_ids"] = $_POST["id"];
1625
1626 ilUtil::sendInfo($this->lng->txt("msg_copy_clipboard"), true);
1627
1629 } // END COPY
1630
1632 {
1633 global $rbacsystem, $ilCtrl;
1634
1635 if ($_GET["item_ref_id"] != "")
1636 {
1637 $_POST["id"] = array($_GET["item_ref_id"]);
1638 }
1639
1640 if (!isset($_POST["id"]))
1641 {
1642 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1643 }
1644
1645 // FOR ALL OBJECTS THAT SHOULD BE DOWNLOADED
1646 foreach ($_POST["id"] as $ref_id)
1647 {
1648 $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1649 $obj_type = $object->getType();
1650 if (!in_array($obj_type, array("fold", "file")))
1651 {
1652 $no_download[] = $object->getType();
1653 }
1654 else if (!$rbacsystem->checkAccess('read', $ref_id))
1655 {
1656 $no_perm[] = $ref_id;
1657 }
1658 }
1659
1660 // IF THERE IS ANY OBJECT THAT CANNOT BE DOWNLOADED
1661 if (count($no_download))
1662 {
1663 $no_download = array_unique($no_download);
1664 foreach ($no_download as $type)
1665 {
1666 $txt_objs[] = $this->lng->txt("objs_".$type);
1667 }
1668 $this->ilias->raiseError(implode(', ',$txt_objs)." ".$this->lng->txt("msg_obj_no_download"),$this->ilias->error_obj->MESSAGE);
1669 }
1670
1671 // NO ACCESS
1672 if (count($no_perm))
1673 {
1674 $this->ilias->raiseError(
1675 $this->lng->txt("msg_obj_perm_download")." ".implode(',',$no_perm),
1676 $this->ilias->error_obj->MESSAGE);
1677 }
1678
1679 // download the objects
1680 $this->downloadMultipleObjects($_POST["id"]);
1681 }
1682
1683 private function downloadMultipleObjects($a_ref_ids)
1684 {
1685 global $lng, $rbacsystem, $ilAccess;
1686
1687 include_once 'Modules/Folder/classes/class.ilObjFolder.php';
1688 include_once 'Modules/File/classes/class.ilObjFile.php';
1689 include_once 'Modules/File/classes/class.ilFileException.php';
1690
1691 // create temporary file to download
1692 $zip = PATH_TO_ZIP;
1693 $tmpdir = ilUtil::ilTempnam();
1694 ilUtil::makeDir($tmpdir);
1695
1696 try
1697 {
1698 // copy each selected object
1699 foreach ($a_ref_ids as $ref_id)
1700 {
1701 if (!$ilAccess->checkAccess("read", "", $ref_id))
1702 continue;
1703
1705 continue;
1706
1707 // get object
1708 $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1709 $obj_type = $object->getType();
1710 if ($obj_type == "fold")
1711 {
1712 // copy folder to temp directory
1713 self::recurseFolder($ref_id, $object->getTitle(), $tmpdir);
1714 }
1715 else if ($obj_type == "file")
1716 {
1717 // copy file to temp directory
1718 self::copyFile($object->getId(), $object->getTitle(), $tmpdir);
1719 }
1720 }
1721
1722 // compress the folder
1723 $deliverFilename = ilUtil::getAsciiFilename($this->object->getTitle()) . ".zip";
1724 $tmpzipfile = ilUtil::ilTempnam() . ".zip";
1725 ilUtil::zip($tmpdir, $tmpzipfile, true);
1726 ilUtil::delDir($tmpdir);
1727 ilUtil::deliverFile($tmpzipfile, $deliverFilename, '', false, true, true);
1728 }
1729 catch (ilFileException $e)
1730 {
1731 ilUtil::sendInfo($e->getMessage(), true);
1732 }
1733 }
1734
1743 private static function recurseFolder($refid, $title, $tmpdir)
1744 {
1745 global $rbacsystem, $tree, $ilAccess;
1746
1747 $tmpdir = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
1748 ilUtil::makeDir($tmpdir);
1749
1750 $subtree = $tree->getChildsByTypeFilter($refid, array("fold","file"));
1751
1752 foreach ($subtree as $child)
1753 {
1754 if (!$ilAccess->checkAccess("read", "", $child["ref_id"]))
1755 continue;
1756
1757 if (ilObject::_isInTrash($child["ref_id"]))
1758 continue;
1759
1760 if ($child["type"] == "fold")
1761 self::recurseFolder($child["ref_id"], $child["title"], $tmpdir);
1762 else
1763 self::copyFile($child["obj_id"], $child["title"], $tmpdir);
1764 }
1765 }
1766
1767 private static function copyFile($obj_id, $title, $tmpdir)
1768 {
1769 $newFilename = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
1770
1771 // copy to temporary directory
1773 if (!copy($oldFilename, $newFilename))
1774 throw new ilFileException("Could not copy ".$oldFilename." to ".$newFilename);
1775
1776 touch($newFilename, filectime($oldFilename));
1777 }
1778
1785 function linkObject()
1786 {
1787 global $clipboard, $rbacsystem, $rbacadmin, $ilCtrl;
1788
1789 if ($_GET["item_ref_id"] != "")
1790 {
1791 $_POST["id"] = array($_GET["item_ref_id"]);
1792 }
1793
1794 if (!isset($_POST["id"]))
1795 {
1796 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1797 }
1798
1799 // CHECK ACCESS
1800 foreach ($_POST["id"] as $ref_id)
1801 {
1802 if (!$rbacsystem->checkAccess('delete',$ref_id))
1803 {
1804 $no_cut[] = $ref_id;
1805 }
1806
1807 $object =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
1808
1809 if (!$this->objDefinition->allowLink($object->getType()))
1810 {
1811 $no_link[] = $object->getType();
1812 }
1813 }
1814
1815 // NO ACCESS
1816 if (count($no_cut))
1817 {
1818 $this->ilias->raiseError($this->lng->txt("msg_no_perm_link")." ".
1819 implode(',',$no_cut),$this->ilias->error_obj->MESSAGE);
1820 }
1821
1822 if (count($no_link))
1823 {
1824 //#12203
1825 $this->ilias->raiseError($this->lng->txt("msg_obj_no_link"),$this->ilias->error_obj->MESSAGE);
1826
1827 //$this->ilias->raiseError($this->lng->txt("msg_not_possible_link")." ".
1828 // implode(',',$no_link),$this->ilias->error_obj->MESSAGE);
1829 }
1830
1831 // WRITE TO CLIPBOARD
1832 $clipboard["parent"] = $_GET["ref_id"];
1833 $clipboard["cmd"] = $ilCtrl->getCmd();
1834
1835 foreach ($_POST["id"] as $ref_id)
1836 {
1837 $clipboard["ref_ids"][] = $ref_id;
1838 }
1839
1840 $_SESSION["clipboard"] = $clipboard;
1841
1842 $suffix = 'p';
1843 if(count($clipboard["ref_ids"]) == 1)
1844 {
1845 $suffix = 's';
1846 }
1847 ilUtil::sendInfo($this->lng->txt("msg_link_clipboard_" . $suffix),true);
1848
1850
1851 } // END LINK
1852
1853
1859 function clearObject()
1860 {
1861 unset($_SESSION["clipboard"]);
1862 unset($_SESSION["il_rep_clipboard"]);
1863
1864 //var_dump($this->getReturnLocation("clear",$this->ctrl->getLinkTarget($this)),get_class($this));
1865
1866 // only redirect if clipboard was cleared
1867 if (isset($_POST["cmd"]["clear"]))
1868 {
1869 ilUtil::sendSuccess($this->lng->txt("msg_clear_clipboard"),true);
1870 // fixed mantis 0018474: Clear Clipboard redirects to Subtab View, instead of Subtab "Edit Multiple"
1871 $this->ctrl->redirect($this, 'render');
1872 }
1873 }
1874
1876 {
1877 global $rbacsystem, $rbacadmin, $rbacreview, $log, $tree, $ilObjDataCache, $ilUser;
1878
1879 $command = $_SESSION['clipboard']['cmd'];
1880 if(!in_array($command, array('cut', 'link', 'copy')))
1881 {
1882 $message = __METHOD__.": cmd was neither 'cut', 'link' nor 'copy'; may be a hack attempt!";
1883 $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
1884 }
1885
1886 if($command == 'cut')
1887 {
1888 if(isset($_POST['node']) && (int)$_POST['node'])
1889 $_POST['nodes'] = array($_POST['node']);
1890 }
1891
1892 if(!is_array($_POST['nodes']) || !count($_POST['nodes']))
1893 {
1894 ilUtil::sendFailure($this->lng->txt('select_at_least_one_object'));
1895 switch ($command)
1896 {
1897 case 'cut':
1898 $this->showPasteTreeObject();
1899 break;
1900 case 'copy':
1901 $this->showPasteTreeObject();
1902 break;
1903 case 'link':
1904 $this->showPasteTreeObject();
1905 break;
1906 }
1907 return;
1908 }
1909
1910 // this loop does all checks
1911 $folder_objects_cache = array();
1912 foreach($_SESSION['clipboard']['ref_ids'] as $ref_id)
1913 {
1915 $current_parent_id = $tree->getParentId($obj_data->getRefId());
1916
1917 foreach($_POST['nodes'] as $folder_ref_id)
1918 {
1919 if(!array_key_exists($folder_ref_id, $folder_objects_cache))
1920 {
1921 $folder_objects_cache[$folder_ref_id] = ilObjectFactory::getInstanceByRefId($folder_ref_id);
1922 }
1923
1924 // CHECK ACCESS
1925 if(!$rbacsystem->checkAccess('create', $folder_ref_id, $obj_data->getType()))
1926 {
1927 $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().']');
1928 }
1929
1930 // CHECK IF REFERENCE ALREADY EXISTS
1931 if($folder_ref_id == $current_parent_id)
1932 {
1933 $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().']');
1934 }
1935
1936 // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
1937 if ($tree->isGrandChild($ref_id, $folder_ref_id) ||
1938 $ref_id == $folder_ref_id)
1939 {
1940 $is_child[] = sprintf($this->lng->txt('msg_paste_object_not_in_itself'), $obj_data->getTitle().' ['.$obj_data->getRefId().']');
1941 }
1942
1943 // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT
1944 if(!in_array($obj_data->getType(), array_keys($folder_objects_cache[$folder_ref_id]->getPossibleSubObjects())))
1945 {
1946 $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().']',
1947 $GLOBALS['lng']->txt('obj_'.$obj_data->getType()));
1948 }
1949 }
1950 }
1951
1953 // process checking results
1954 if(count($exists) && $command != "copy")
1955 {
1956 $error .= implode('<br />', $exists);
1957 }
1958
1959 if(count($is_child))
1960 {
1961 $error .= $error != '' ? '<br />' : '';
1962 $error .= implode('<br />', $is_child);
1963 }
1964
1965 if(count($not_allowed_subobject))
1966 {
1967 $error .= $error != '' ? '<br />' : '';
1968 $error .= implode('<br />', $not_allowed_subobject);
1969 }
1970
1971 if(count($no_paste))
1972 {
1973 $error .= $error != '' ? '<br />' : '';
1974 $error .= implode('<br />', $no_paste);
1975 }
1976
1977 if($error != '')
1978 {
1980 switch ($command)
1981 {
1982 case 'cut':
1983 $this->showPasteTreeObject();
1984 break;
1985 case 'copy':
1986 $this->showPasteTreeObject();
1987 break;
1988 case 'link':
1989 $this->showPasteTreeObject();
1990 break;
1991 }
1992 return;
1993 }
1994
1995 // log pasteObject call
1996 $log->write(__METHOD__.", cmd: ".$command);
1997
1999 // everything ok: now paste the objects to new location
2000
2001 // to prevent multiple actions via back/reload button
2002 $ref_ids = $_SESSION['clipboard']['ref_ids'];
2003 unset($_SESSION['clipboard']['ref_ids']);
2004
2005 // BEGIN ChangeEvent: Record paste event.
2006 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
2007 // END ChangeEvent: Record paste event.
2008
2009 // process COPY command
2010 if($command == 'copy')
2011 {
2012 foreach($_POST['nodes'] as $folder_ref_id)
2013 {
2014 foreach($ref_ids as $ref_id)
2015 {
2016 $revIdMapping = array();
2017
2018 $oldNode_data = $tree->getNodeData($ref_id);
2019 if ($oldNode_data['parent'] == $folder_ref_id)
2020 {
2021 require_once 'Modules/File/classes/class.ilObjFileAccess.php';
2022 $newTitle = ilObjFileAccess::_appendNumberOfCopyToFilename($oldNode_data['title'],null);
2023 $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, $newTitle);
2024 }
2025 else
2026 {
2027 $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, null);
2028 }
2029
2030 // BEGIN ChangeEvent: Record copy event.
2031 $old_parent_data = $tree->getParentNodeData($ref_id);
2032 $newNode_data = $tree->getNodeData($newRef);
2033 ilChangeEvent::_recordReadEvent($oldNode_data['type'], $ref_id,
2034 $oldNode_data['obj_id'], $ilUser->getId());
2035 ilChangeEvent::_recordWriteEvent($newNode_data['obj_id'], $ilUser->getId(), 'add',
2036 $ilObjDataCache->lookupObjId($folder_ref_id));
2037 ilChangeEvent::_catchupWriteEvents($newNode_data['obj_id'], $ilUser->getId());
2038 // END PATCH ChangeEvent: Record cut event.
2039 }
2040 }
2041
2042 ilUtil::sendSuccess($this->lng->txt('msg_cloned'), true);
2043 } // END COPY
2044
2045 // process CUT command
2046 if($command == 'cut')
2047 {
2048 foreach($_POST['nodes'] as $folder_ref_id)
2049 {
2050 foreach($ref_ids as $ref_id)
2051 {
2052 // Store old parent
2053 $old_parent = $tree->getParentId($ref_id);
2054 $tree->moveTree($ref_id, $folder_ref_id);
2055 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
2056
2057 include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
2059
2060 // BEGIN ChangeEvent: Record cut event.
2061 $node_data = $tree->getNodeData($ref_id);
2062 $old_parent_data = $tree->getNodeData($old_parent);
2063 ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'remove',
2064 $old_parent_data['obj_id']);
2065 ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2066 $ilObjDataCache->lookupObjId($folder_ref_id));
2067 ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2068 // END PATCH ChangeEvent: Record cut event.
2069 }
2070
2071 // prevent multiple iterations for cut cmommand
2072 break;
2073 }
2074
2075 ilUtil::sendSuccess($this->lng->txt('msg_cut_copied'), true);
2076 } // END CUT
2077
2078 // process LINK command
2079 if($command == 'link')
2080 {
2081 $linked_to_folders = array();
2082
2083 include_once "Services/AccessControl/classes/class.ilRbacLog.php";
2084 $rbac_log_active = ilRbacLog::isActive();
2085
2086 foreach($_POST['nodes'] as $folder_ref_id)
2087 {
2088 $linked_to_folders[$folder_ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($folder_ref_id));
2089
2090 foreach($ref_ids as $ref_id)
2091 {
2092 // get node data
2093 $top_node = $tree->getNodeData($ref_id);
2094
2095 // get subnodes of top nodes
2096 $subnodes[$ref_id] = $tree->getSubtree($top_node);
2097 }
2098
2099 // now move all subtrees to new location
2100 foreach($subnodes as $key => $subnode)
2101 {
2102 // first paste top_node....
2103 $obj_data = ilObjectFactory::getInstanceByRefId($key);
2104 $new_ref_id = $obj_data->createReference();
2105 $obj_data->putInTree($folder_ref_id);
2106 $obj_data->setPermissions($folder_ref_id);
2107
2108 // rbac log
2109 if($rbac_log_active)
2110 {
2111 $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id, false);
2112 $rbac_log = ilRbacLog::gatherFaPa($new_ref_id, array_keys($rbac_log_roles), true);
2113 ilRbacLog::add(ilRbacLog::LINK_OBJECT, $new_ref_id, $rbac_log, $key);
2114 }
2115
2116 // BEGIN ChangeEvent: Record link event.
2117 $node_data = $tree->getNodeData($new_ref_id);
2118 ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2119 $ilObjDataCache->lookupObjId($folder_ref_id));
2120 ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2121 // END PATCH ChangeEvent: Record link event.
2122 }
2123
2124 $log->write(__METHOD__.', link finished');
2125 }
2126
2127 $linked_targets = array();
2128 if(count($linked_to_folders))
2129 {
2130 require_once 'Services/Link/classes/class.ilLink.php';
2131 foreach($linked_to_folders as $ref_id => $title)
2132 {
2133 $linked_targets[] = '<a href="' . ilLink::_getLink($ref_id) . '">' . $title . '</a>';
2134 }
2135 }
2136
2137 $suffix = 'p';
2138 if(count($ref_ids) == 1)
2139 {
2140 $suffix = 's';
2141 }
2142 ilUtil::sendSuccess(sprintf($this->lng->txt('mgs_objects_linked_to_the_following_folders_' . $suffix), implode(', ', $linked_targets)), true);
2143 } // END LINK
2144
2145 // clear clipboard
2146 $this->clearObject();
2147
2148 $this->ctrl->returnToParent($this);
2149 }
2150
2152 {
2153 global $tree;
2154
2155 // empty session on init
2156 $_SESSION['paste_linked_repexpand'] = array();
2157
2158 // copy opend nodes from repository explorer
2159 $_SESSION['paste_linked_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
2160
2161 // open current position
2162 $path = $tree->getPathId((int)$_GET['ref_id']);
2163 foreach((array)$path as $node_id)
2164 {
2165 if(!in_array($node_id, $_SESSION['paste_linked_repexpand']))
2166 $_SESSION['paste_linked_repexpand'][] = $node_id;
2167 }
2168
2169 return $this->showPasteTreeObject();
2170 }
2171
2175 public function showPasteTreeObject()
2176 {
2177 global $ilTabs, $ilToolbar;
2178
2179 $ilTabs->setTabActive('view_content');
2180
2181 if(!in_array($_SESSION['clipboard']['cmd'], array('link', 'copy', 'cut')))
2182 {
2183 $message = __METHOD__.": Unknown action.";
2184 $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2185 }
2186 $cmd = $_SESSION['clipboard']['cmd'];
2187
2188 //
2189 $exp = $this->getTreeSelectorGUI($cmd);
2190 if ($exp->handleCommand())
2191 {
2192 return;
2193 }
2194 $output = $exp->getHTML();
2195
2196 $txt_var = ($cmd == "copy")
2197 ? "copy"
2198 : "paste";
2199
2200 // toolbars
2201 $t = new ilToolbarGUI();
2202 $t->setFormAction($this->ctrl->getFormAction($this, "performPasteIntoMultipleObjects"));
2203
2204 include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
2206 $b->setCaption($txt_var);
2207 $b->setCommand("performPasteIntoMultipleObjects");
2208
2209 //$t->addFormButton($this->lng->txt($txt_var), "performPasteIntoMultipleObjects");
2210 $t->addStickyItem($b);
2211
2212 $t->addSeparator();
2213 $this->lng->loadLanguageModule('obj');
2214 $t->addFormButton($this->lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
2215
2216 $t->addFormButton($this->lng->txt("cancel"), "cancelMoveLink");
2217 $t->setCloseFormTag(false);
2218 $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
2219 $output = $t->getHTML().$output;
2220 $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
2221 $t->setCloseFormTag(true);
2222 $t->setOpenFormTag(false);
2223 $output.= "<br />".$t->getHTML();
2224
2225 $this->tpl->setContent($output);
2226 }
2227
2228
2229
2230/* public function showLinkIntoMultipleObjectsTreeObject()
2231 {
2232 global $ilTabs, $ilToolbar;
2233
2234 $ilTabs->setTabActive('view_content');
2235
2236 if(!in_array($_SESSION['clipboard']['cmd'], array('link')))
2237 {
2238 $message = __METHOD__.": cmd was not 'link'; may be a hack attempt!";
2239 $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2240 }
2241
2242 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
2243 "Services/Object");
2244
2245 require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
2246 $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_CHECK,
2247 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_linked_repexpand');
2248 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showLinkIntoMultipleObjectsTree'));
2249 $exp->setTargetGet('ref_id');
2250 $exp->setPostVar('nodes[]');
2251 $exp->highlightNode($_GET['ref_id']);
2252 is_array($_POST['nodes']) ? $exp->setCheckedItems((array)$_POST['nodes']) : $exp->setCheckedItems(array());
2253
2254 if($_GET['paste_linked_repexpand'] == '')
2255 {
2256 $expanded = $this->tree->readRootId();
2257 }
2258 else
2259 {
2260 $expanded = $_GET['paste_linked_repexpand'];
2261 }
2262
2263 $this->tpl->setVariable('FORM_TARGET', '_top');
2264 $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects'));
2265
2266 $exp->setExpand($expanded);
2267 // build html-output
2268 $exp->setOutput(0);
2269 $output = $exp->getOutput();
2270
2271 $this->tpl->setVariable('OBJECT_TREE', $output);
2272
2273 $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
2274 $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('paste'));
2275
2276 $ilToolbar->addButton($this->lng->txt('cancel'), $this->ctrl->getLinkTarget($this,'cancelMoveLink'));
2277 }*/
2278
2283 public function cancelMoveLinkObject()
2284 {
2285 unset($_SESSION['clipboard']);
2286 $GLOBALS['ilCtrl']->returnToParent($this);
2287 }
2288
2293 {
2294 ilUtil::sendSuccess($this->lng->txt("obj_inserted_clipboard"), true);
2295 $GLOBALS['ilCtrl']->returnToParent($this);
2296 }
2297
2298
2300 {
2301 global $tree;
2302
2303 // empty session on init
2304 $_SESSION['paste_copy_repexpand'] = array();
2305
2306 // copy opend nodes from repository explorer
2307 $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
2308
2309 // open current position
2310 $path = $tree->getPathId((int)$_GET['ref_id']);
2311 foreach((array)$path as $node_id)
2312 {
2313 if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
2314 $_SESSION['paste_copy_repexpand'][] = $node_id;
2315 }
2316
2317 return $this->showPasteTreeObject();
2318 }
2319
2320 /*public function showCopyIntoMultipleObjectsTreeObject()
2321 {
2322 global $ilTabs, $ilToolbar;
2323
2324 $ilTabs->setTabActive('view_content');
2325
2326 if(!in_array($_SESSION['clipboard']['cmd'], array('copy')))
2327 {
2328 $message = __METHOD__.": cmd was not 'copy'; may be a hack attempt!";
2329 $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2330 }
2331
2332 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html', "Services/Object");
2333
2334 require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
2335 $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_CHECK,
2336 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_copy_repexpand');
2337 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showCopyIntoMultipleObjectsTree'));
2338 $exp->setTargetGet('ref_id');
2339 $exp->setPostVar('nodes[]');
2340 $exp->highlightNode($_GET['ref_id']);
2341 is_array($_POST['nodes']) ? $exp->setCheckedItems((array)$_POST['nodes']) : $exp->setCheckedItems(array());
2342
2343 if($_GET['paste_copy_repexpand'] == '')
2344 {
2345 $expanded = $this->tree->readRootId();
2346 }
2347 else
2348 {
2349 $expanded = $_GET['paste_copy_repexpand'];
2350 }
2351
2352 $this->tpl->setVariable('FORM_TARGET', '_top');
2353 $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects'));
2354
2355 $exp->setExpand($expanded);
2356 // build html-output
2357 $exp->setOutput(0);
2358 $output = $exp->getOutput();
2359
2360 $this->tpl->setVariable('OBJECT_TREE', $output);
2361
2362 $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
2363 $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('copy'));
2364
2365 $ilToolbar->addButton($this->lng->txt('cancel'), $this->ctrl->getLinkTarget($this,'cancelMoveLink'));
2366 }*/
2367
2369 {
2370 global $tree;
2371
2372 // empty session on init
2373 $_SESSION['paste_cut_repexpand'] = array();
2374
2375 // copy opend nodes from repository explorer
2376 $_SESSION['paste_cut_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
2377
2378 // open current position
2379 $path = $tree->getPathId((int)$_GET['ref_id']);
2380 foreach((array)$path as $node_id)
2381 {
2382 if(!in_array($node_id, $_SESSION['paste_cut_repexpand']))
2383 $_SESSION['paste_cut_repexpand'][] = $node_id;
2384 }
2385
2386 return $this->showPasteTreeObject();
2387 }
2388
2389 /*public function showMoveIntoObjectTreeObject()
2390 {
2391 global $ilTabs, $ilToolbar;
2392
2393 $ilTabs->setTabActive('view_content');
2394
2395 if(!in_array($_SESSION['clipboard']['cmd'], array('cut')))
2396 {
2397 $message = __METHOD__.": cmd was not 'cut'; may be a hack attempt!";
2398 $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
2399 }
2400
2401 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
2402 "Services/Object");
2403
2404 require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
2405 $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_RADIO,
2406 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_cut_repexpand');
2407 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showMoveIntoObjectTree'));
2408 $exp->setTargetGet('ref_id');
2409 $exp->setPostVar('node');
2410 $exp->setCheckedItems(array((int)$_POST['node']));
2411 $exp->highlightNode($_GET['ref_id']);
2412
2413 if($_GET['paste_cut_repexpand'] == '')
2414 {
2415 $expanded = $this->tree->readRootId();
2416 }
2417 else
2418 {
2419 $expanded = $_GET['paste_cut_repexpand'];
2420 }
2421
2422 $this->tpl->setVariable('FORM_TARGET', '_top');
2423 $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects'));
2424
2425 $exp->setExpand($expanded);
2426 // build html-output
2427 $exp->setOutput(0);
2428 $output = $exp->getOutput();
2429
2430 $this->tpl->setVariable('OBJECT_TREE', $output);
2431
2432 $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
2433 $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('paste'));
2434
2435 $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this,'cancelMoveLink'));
2436 }*/
2437
2444 function pasteObject()
2445 {
2446 global $rbacsystem, $rbacadmin, $rbacreview, $log,$tree;
2447 global $ilUser, $lng, $ilCtrl;
2448
2449 // BEGIN ChangeEvent: Record paste event.
2450 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
2451 // END ChangeEvent: Record paste event.
2452
2453//var_dump($_SESSION["clipboard"]);exit;
2454 if (!in_array($_SESSION["clipboard"]["cmd"],array("cut","link","copy")))
2455 {
2456 $message = get_class($this)."::pasteObject(): cmd was neither 'cut','link' or 'copy'; may be a hack attempt!";
2457 $this->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
2458 }
2459
2460 // this loop does all checks
2461 foreach ($_SESSION["clipboard"]["ref_ids"] as $ref_id)
2462 {
2463 $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($ref_id);
2464
2465 // CHECK ACCESS
2466 if (!$rbacsystem->checkAccess('create',$this->object->getRefId(), $obj_data->getType()))
2467 {
2468 $no_paste[] = $ref_id;
2469 $no_paste_titles[] = $obj_data->getTitle();
2470 }
2471
2472 // CHECK IF REFERENCE ALREADY EXISTS
2473 if ($this->object->getRefId() == $this->tree->getParentId($obj_data->getRefId()))
2474 {
2475 $exists[] = $ref_id;
2476 break;
2477 }
2478
2479 // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
2480 if ($this->tree->isGrandChild($ref_id,$this->object->getRefId()))
2481 {
2483 }
2484
2485 if ($ref_id == $this->object->getRefId())
2486 {
2488 }
2489
2490 // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT
2491 $obj_type = $obj_data->getType();
2492
2493 if (!in_array($obj_type, array_keys($this->object->getPossibleSubObjects())))
2494 {
2495 $not_allowed_subobject[] = $obj_data->getType();
2496 }
2497 }
2498
2500 // process checking results
2501 // BEGIN WebDAV: Copying an object into the same container is allowed
2502 if (count($exists) && $_SESSION["clipboard"]["cmd"] != "copy")
2503 // END WebDAV: Copying an object into the same container is allowed
2504 {
2505 $this->ilias->raiseError($this->lng->txt("msg_obj_exists"),$this->ilias->error_obj->MESSAGE);
2506 }
2507
2508 if (count($is_child))
2509 {
2510 $this->ilias->raiseError($this->lng->txt("msg_not_in_itself")." ".implode(',',$is_child),
2511 $this->ilias->error_obj->MESSAGE);
2512 }
2513
2514 if (count($not_allowed_subobject))
2515 {
2516 $this->ilias->raiseError($this->lng->txt("msg_may_not_contain")." ".implode(',',$not_allowed_subobject),
2517 $this->ilias->error_obj->MESSAGE);
2518 }
2519
2520 if (count($no_paste))
2521 {
2522 $this->ilias->raiseError($this->lng->txt("msg_no_perm_paste")." ".
2523 implode(',',$no_paste),$this->ilias->error_obj->MESSAGE);
2524 }
2525
2526 // log pasteObject call
2527 $log->write("ilObjectGUI::pasteObject(), cmd: ".$_SESSION["clipboard"]["cmd"]);
2528
2530 // everything ok: now paste the objects to new location
2531
2532 // to prevent multiple actions via back/reload button
2533 $ref_ids = $_SESSION["clipboard"]["ref_ids"];
2534 unset($_SESSION["clipboard"]["ref_ids"]);
2535
2536 // BEGIN WebDAV: Support a copy command in the repository
2537 // process COPY command
2538 if ($_SESSION["clipboard"]["cmd"] == "copy")
2539 {
2540 unset($_SESSION["clipboard"]["cmd"]);
2541
2542 // new implementation, redirects to ilObjectCopyGUI
2543 if (count($ref_ids) == 1)
2544 {
2545 $ilCtrl->setParameterByClass("ilobjectcopygui", "target", $this->object->getRefId());
2546 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $ref_ids[0]);
2547 $ilCtrl->redirectByClass("ilobjectcopygui", "saveTarget");
2548 }
2549 else
2550 {
2551 $ilCtrl->setParameterByClass("ilobjectcopygui", "target", $this->object->getRefId());
2552 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode($ref_ids, "_"));
2553 $ilCtrl->redirectByClass("ilobjectcopygui", "saveTarget");
2554 }
2555
2556
2557
2558 /* old implementation
2559
2560 foreach($ref_ids as $ref_id)
2561 {
2562 $revIdMapping = array();
2563
2564 $oldNode_data = $tree->getNodeData($ref_id);
2565 if ($oldNode_data['parent'] == $this->object->getRefId())
2566 {
2567 require_once 'Modules/File/classes/class.ilObjFileAccess.php';
2568 $newTitle = ilObjFileAccess::_appendNumberOfCopyToFilename($oldNode_data['title'],null);
2569 $newRef = $this->cloneNodes($ref_id, $this->object->getRefId(), $refIdMapping, $newTitle);
2570 }
2571 else
2572 {
2573 $newRef = $this->cloneNodes($ref_id, $this->object->getRefId(), $refIdMapping, null);
2574 }
2575
2576 // BEGIN ChangeEvent: Record copy event.
2577 $old_parent_data = $tree->getParentNodeData($ref_id);
2578 $newNode_data = $tree->getNodeData($newRef);
2579 ilChangeEvent::_recordReadEvent($oldNode_data['type'], $ref_id,
2580 $oldNode_data['obj_id'], $ilUser->getId());
2581 ilChangeEvent::_recordWriteEvent($newNode_data['obj_id'], $ilUser->getId(), 'add',
2582 $this->object->getId());
2583 ilChangeEvent::_catchupWriteEvents($newNode_data['obj_id'], $ilUser->getId());
2584 // END ChangeEvent: Record copy event.
2585 }*/
2586
2587 $log->write("ilObjectGUI::pasteObject(), copy finished");
2588 }
2589 // END WebDAV: Support a Copy command in the repository
2590
2591 // process CUT command
2592 if ($_SESSION["clipboard"]["cmd"] == "cut")
2593 {
2594
2595 foreach($ref_ids as $ref_id)
2596 {
2597 // Store old parent
2598 $old_parent = $tree->getParentId($ref_id);
2599 $this->tree->moveTree($ref_id,$this->object->getRefId());
2600 $rbacadmin->adjustMovedObjectPermissions($ref_id,$old_parent);
2601
2602 include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
2604
2605 // BEGIN ChangeEvent: Record cut event.
2606 $node_data = $tree->getNodeData($ref_id);
2607 $old_parent_data = $tree->getNodeData($old_parent);
2608 ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'remove',
2609 $old_parent_data['obj_id']);
2610 ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2611 $this->object->getId());
2612 ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2613 // END PATCH ChangeEvent: Record cut event.
2614 }
2615 } // END CUT
2616
2617 // process LINK command
2618 if ($_SESSION["clipboard"]["cmd"] == "link")
2619 {
2620 foreach ($ref_ids as $ref_id)
2621 {
2622 // get node data
2623 $top_node = $this->tree->getNodeData($ref_id);
2624
2625 // get subnodes of top nodes
2626 $subnodes[$ref_id] = $this->tree->getSubtree($top_node);
2627 }
2628
2629 // now move all subtrees to new location
2630 foreach ($subnodes as $key => $subnode)
2631 {
2632 // first paste top_node....
2633 $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($key);
2634 $new_ref_id = $obj_data->createReference();
2635 $obj_data->putInTree($_GET["ref_id"]);
2636 $obj_data->setPermissions($_GET["ref_id"]);
2637
2638 // BEGIN ChangeEvent: Record link event.
2639 $node_data = $tree->getNodeData($new_ref_id);
2640 ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add',
2641 $this->object->getId());
2642 ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId());
2643 // END PATCH ChangeEvent: Record link event.
2644 }
2645
2646 $log->write("ilObjectGUI::pasteObject(), link finished");
2647
2648 } // END LINK
2649
2650 // save cmd for correct message output after clearing the clipboard
2651 $last_cmd = $_SESSION["clipboard"]["cmd"];
2652
2653
2654 // clear clipboard
2655 $this->clearObject();
2656
2657 if ($last_cmd == "cut")
2658 {
2659 ilUtil::sendSuccess($this->lng->txt("msg_cut_copied"),true);
2660 }
2661 // BEGIN WebDAV: Support a copy command in repository
2662 else if ($last_cmd == "copy")
2663 {
2664 ilUtil::sendSuccess($this->lng->txt("msg_cloned"),true);
2665 }
2666 else if ($last_cmd == 'link')
2667 // END WebDAV: Support copy command in repository
2668 {
2669 ilUtil::sendSuccess($this->lng->txt("msg_linked"),true);
2670 }
2671
2672 $this->ctrl->returnToParent($this);
2673
2674 } // END PASTE
2675
2676
2681 {
2682 global $ilErr, $ilLog, $ilTabs, $tpl, $ilToolbar, $ilCtrl, $lng;
2683
2684 $ilTabs->activateTab("clipboard");
2685
2686 // function should not be called if clipboard is empty
2687 if (empty($_SESSION['clipboard']) or !is_array($_SESSION['clipboard']))
2688 {
2689 $message = sprintf('%s::clipboardObject(): Illegal access. Clipboard variable is empty!', get_class($this));
2690 $ilLog->write($message,$ilLog->FATAL);
2691 $ilErr->raiseError($this->lng->txt("permission_denied"),$ilErr->WARNING);
2692 }
2693
2694 $data = array();
2695 foreach($_SESSION["clipboard"]["ref_ids"] as $ref_id)
2696 {
2697 if(!$tmp_obj = ilObjectFactory::getInstanceByRefId($ref_id,false))
2698 {
2699 continue;
2700 }
2701
2702 $data[] = array(
2703 "type" => $tmp_obj->getType(),
2704 "type_txt" => $this->lng->txt("obj_".$tmp_obj->getType()),
2705 "title" => $tmp_obj->getTitle(),
2706 "cmd" => ($_SESSION["clipboard"]["cmd"] == "cut") ? $this->lng->txt("move") :$this->lng->txt($_SESSION["clipboard"]["cmd"]),
2707 "ref_id" => $ref_id,
2708 "obj_id" => $tmp_obj->getId()
2709 );
2710
2711 unset($tmp_obj);
2712 }
2713
2714 include_once("./Services/Object/classes/class.ilObjClipboardTableGUI.php");
2715 $tab = new ilObjClipboardTableGUI($this, "clipboard");
2716 $tab->setData($data);
2717 $tpl->setContent($tab->getHTML());
2718
2719 if (count($data) > 0)
2720 {
2721 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2722 $ilToolbar->addFormButton($lng->txt("insert_object_here"),
2723 "paste");
2724 $ilToolbar->addFormButton($lng->txt("clear_clipboard"),
2725 "clear");
2726 }
2727
2728 return true;
2729 }
2730
2731
2736 function showCustomIconsEditing($a_input_colspan = 1, ilPropertyFormGUI $a_form = null, $a_as_section = true)
2737 {
2738 if ($this->ilias->getSetting("custom_icons"))
2739 {
2740 if(!$a_form)
2741 {
2742 /*
2743 $this->tpl->addBlockFile("CONTAINER_ICONS", "container_icon_settings",
2744 "tpl.container_icon_settings.html", "Services/Container");
2745
2746 if (($big_icon = $this->object->getBigIconPath()) != "")
2747 {
2748 $this->tpl->setCurrentBlock("big_icon");
2749 $this->tpl->setVariable("SRC_BIG_ICON", $big_icon);
2750 $this->tpl->parseCurrentBlock();
2751 }
2752 if ($this->object->getType() != "root")
2753 {
2754 if (($small_icon = $this->object->getSmallIconPath()) != "")
2755 {
2756 $this->tpl->setCurrentBlock("small_icon");
2757 $this->tpl->setVariable("SRC_SMALL_ICON", $small_icon);
2758 $this->tpl->parseCurrentBlock();
2759 }
2760 $this->tpl->setCurrentBlock("small_icon_row");
2761 $this->tpl->setVariable("SMALL_ICON", $this->lng->txt("standard_icon"));
2762 $this->tpl->setVariable("SMALL_SIZE", "(".
2763 $this->ilias->getSetting("custom_icon_small_width")."x".
2764 $this->ilias->getSetting("custom_icon_small_height").")");
2765 $this->tpl->setVariable("TXT_REMOVE_S", $this->lng->txt("remove"));
2766 $this->tpl->parseCurrentBlock();
2767 }
2768 if (($tiny_icon = $this->object->getTinyIconPath()) != "")
2769 {
2770 $this->tpl->setCurrentBlock("tiny_icon");
2771 $this->tpl->setVariable("SRC_TINY_ICON", $tiny_icon);
2772 $this->tpl->parseCurrentBlock();
2773 }
2774 $this->tpl->setCurrentBlock("container_icon_settings");
2775 $this->tpl->setVariable("SPAN_TITLE", $a_input_colspan + 1);
2776 $this->tpl->setVariable("SPAN_INPUT", $a_input_colspan);
2777 $this->tpl->setVariable("ICON_SETTINGS", $this->lng->txt("icon_settings"));
2778 $this->tpl->setVariable("BIG_ICON", $this->lng->txt("big_icon"));
2779 $this->tpl->setVariable("TINY_ICON", $this->lng->txt("tiny_icon"));
2780 $this->tpl->setVariable("BIG_SIZE", "(".
2781 $this->ilias->getSetting("custom_icon_big_width")."x".
2782 $this->ilias->getSetting("custom_icon_big_height").")");
2783 $this->tpl->setVariable("TINY_SIZE", "(".
2784 $this->ilias->getSetting("custom_icon_tiny_width")."x".
2785 $this->ilias->getSetting("custom_icon_tiny_height").")");
2786 $this->tpl->setVariable("TXT_REMOVE", $this->lng->txt("remove"));
2787 $this->tpl->parseCurrentBlock();
2788 */
2789 }
2790 else
2791 {
2792 //$big_icon = $this->object->getBigIconPath();
2793 $custom_icon = $this->object->getCustomIconPath();
2794 //$tiny_icon = $this->object->getTinyIconPath();
2795
2796 if($a_as_section)
2797 {
2799 $title->setTitle($this->lng->txt("icon_settings"));
2800 }
2801 else
2802 {
2803 $title = new ilCustomInputGUI($this->lng->txt("icon_settings"), "");
2804 }
2805 $a_form->addItem($title);
2806
2807 // big
2808 /*
2809 $caption = $this->lng->txt("big_icon")." (".
2810 $this->ilias->getSetting("custom_icon_big_width")."x".
2811 $this->ilias->getSetting("custom_icon_big_height").")";
2812 $icon = new ilImageFileInputGUI($caption, "cont_big_icon");
2813 $icon->setImage($big_icon);
2814 if($a_as_section)
2815 {
2816 $a_form->addItem($icon);
2817 }
2818 else
2819 {
2820 $title->addSubItem($icon);
2821 }*/
2822
2823 // small/standard
2824 //if ($this->object->getType() != "root")
2825 //{
2826 /*$caption = $this->lng->txt("standard_icon")." (".
2827 $this->ilias->getSetting("custom_icon_small_width")."x".
2828 $this->ilias->getSetting("custom_icon_small_height").")";*/
2829 $caption = $this->lng->txt("cont_custom_icon");
2830 $icon = new ilImageFileInputGUI($caption, "cont_icon");
2831 $icon->setSuffixes(array("svg"));
2832 $icon->setImage($custom_icon);
2833 if($a_as_section)
2834 {
2835 $a_form->addItem($icon);
2836 }
2837 else
2838 {
2839 $title->addSubItem($icon);
2840 }
2841 //}
2842
2843 // tiny
2844 /*
2845 $caption = $this->lng->txt("tiny_icon")." (".
2846 $this->ilias->getSetting("custom_icon_tiny_width")."x".
2847 $this->ilias->getSetting("custom_icon_tiny_height").")";
2848 $icon = new ilImageFileInputGUI($caption, "cont_tiny_icon");
2849 $icon->setImage($tiny_icon);
2850 if($a_as_section)
2851 {
2852 $a_form->addItem($icon);
2853 }
2854 else
2855 {
2856 $title->addSubItem($icon);
2857 }
2858 */
2859 }
2860 }
2861 }
2862
2864 {
2865 global $ilAccess;
2866
2867 // #10081
2868 if($_SESSION["il_cont_admin_panel"] &&
2869 $this->object->getRefId() &&
2870 !$ilAccess->checkAccess("write", "", $this->object->getRefId()))
2871 {
2872 return false;
2873 }
2874
2875 return $_SESSION["il_cont_admin_panel"];
2876 }
2877
2881 function setColumnSettings(ilColumnGUI $column_gui)
2882 {
2883 global $ilAccess;
2884 parent::setColumnSettings($column_gui);
2885
2886 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()) &&
2887 $this->isActiveAdministrationPanel() &&
2888 $this->allowBlocksMoving())
2889 {
2890 $column_gui->setEnableMovement(true);
2891 }
2892
2893 $column_gui->setRepositoryItems(
2894 $this->object->getSubItems($this->isActiveAdministrationPanel(), true));
2895
2896 //if ($ilAccess->checkAccess("write", "", $this->object->getRefId())
2897 // && $this->allowBlocksConfigure())
2898 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
2899 {
2900 $column_gui->setBlockProperty("news", "settings", true);
2901 //$column_gui->setBlockProperty("news", "public_notifications_option", true);
2902 $column_gui->setBlockProperty("news", "default_visibility_option", true);
2903 $column_gui->setBlockProperty("news", "hide_news_block_option", true);
2904 }
2905
2906 if ($this->isActiveAdministrationPanel())
2907 {
2908 $column_gui->setAdminCommands(true);
2909 }
2910 }
2911
2916 {
2917 return true;
2918 }
2919
2924 {
2925 return true;
2926 }
2927
2936 {
2937 $this->cloneWizardPageObject(true);
2938 }
2939
2948 {
2949 $this->cloneWizardPageObject(false);
2950 }
2951
2958 public function cloneWizardPageObject($a_tree_view = true)
2959 {
2960 include_once('Services/CopyWizard/classes/class.ilCopyWizardPageFactory.php');
2961
2962 global $ilObjDataCache,$tree;
2963
2964 if(!$_REQUEST['clone_source'])
2965 {
2966 ilUtil::sendFailure($this->lng->txt('select_one'));
2967 if(isset($_SESSION['wizard_search_title']))
2968 {
2969 $this->searchCloneSourceObject();
2970 }
2971 else
2972 {
2973 $this->createObject();
2974 }
2975 return false;
2976 }
2977 $source_id = $_REQUEST['clone_source'];
2978 $new_type = $_REQUEST['new_type'];
2979 $this->ctrl->setParameter($this,'clone_source',(int) $_REQUEST['clone_source']);
2980 $this->ctrl->setParameter($this,'new_type',$new_type);
2981
2982
2983 // Generell JavaScript
2984 $this->tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
2985 $this->tpl->setVariable('BODY_ATTRIBUTES','onload="ilDisableChilds(\'cmd\');"');
2986
2987
2988 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.container_wizard_page.html',
2989 "Services/Container");
2990 $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
2991 $this->tpl->setVariable('TYPE_IMG',ilUtil::getImagePath('icon_'.$new_type.'.svg'));
2992 $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_'.$new_type));
2993 $this->tpl->setVariable('TXT_DUPLICATE',$this->lng->txt($new_type.'_wizard_page'));
2994 $this->tpl->setVariable('INFO_DUPLICATE',$this->lng->txt($new_type.'_copy_threads_info'));
2995 $this->tpl->setVariable('BTN_COPY',$this->lng->txt('obj_'.$new_type.'_duplicate'));
2996 $this->tpl->setVariable('BTN_BACK',$this->lng->txt('btn_back'));
2997 if(isset($_SESSION['wizard_search_title']))
2998 {
2999 $this->tpl->setVariable('CMD_BACK','searchCloneSource');
3000 }
3001 else
3002 {
3003 $this->tpl->setVariable('CMD_BACK','create');
3004 }
3005
3006 $this->tpl->setVariable('BTN_TREE',$this->lng->txt('treeview'));
3007 $this->tpl->setVariable('BTN_LIST',$this->lng->txt('flatview'));
3008
3009 // Fill item rows
3010 // tree view
3011 if($a_tree_view)
3012 {
3013 $first = true;
3014 $has_items = false;
3015 foreach($subnodes = $tree->getSubtree($source_node = $tree->getNodeData($source_id),true) as $node)
3016 {
3017 if($first == true)
3018 {
3019 $first = false;
3020 continue;
3021 }
3022
3023 if($node['type'] == 'rolf')
3024 {
3025 continue;
3026 }
3027
3028 $has_items = true;
3029
3030 for($i = $source_node['depth'];$i < $node['depth']; $i++)
3031 {
3032 $this->tpl->touchBlock('padding');
3033 $this->tpl->touchBlock('end_padding');
3034 }
3035 // fill options
3036 $copy_wizard_page = ilCopyWizardPageFactory::_getInstanceByType($source_id,$node['type']);
3037 $copy_wizard_page->fillTreeSelection($node['ref_id'],$node['type'],$node['depth']);
3038
3039 $this->tpl->setCurrentBlock('tree_row');
3040 $this->tpl->setVariable('TREE_IMG',ilUtil::getImagePath('icon_'.$node['type'].'.svg'));
3041 $this->tpl->setVariable('TREE_ALT_IMG',$this->lng->txt('obj_'.$node['type']));
3042 $this->tpl->setVariable('TREE_TITLE',$node['title']);
3043 $this->tpl->parseCurrentBlock();
3044 }
3045 if(!$has_items)
3046 {
3047 $this->tpl->setCurrentBlock('no_content');
3048 $this->tpl->setVariable('TXT_NO_CONTENT',$this->lng->txt('container_no_items'));
3049 $this->tpl->parseCurrentBlock();
3050 }
3051 else
3052 {
3053 $this->tpl->setCurrentBlock('tree_footer');
3054 $this->tpl->setVariable('TXT_COPY_ALL',$this->lng->txt('copy_all'));
3055 $this->tpl->setVariable('TXT_LINK_ALL',$this->lng->txt('link_all'));
3056 $this->tpl->setVariable('TXT_OMIT_ALL',$this->lng->txt('omit_all'));
3057 $this->tpl->parseCurrentBlock();
3058
3059 }
3060 }
3061 else
3062 {
3063 foreach($tree->getSubTreeTypes($source_id,array('rolf','crs')) as $type)
3064 {
3065 $copy_wizard_page = ilCopyWizardPageFactory::_getInstanceByType($source_id,$type);
3066 if(strlen($html = $copy_wizard_page->getWizardPageBlockHTML()))
3067 {
3068 $this->tpl->setCurrentBlock('obj_row');
3069 $this->tpl->setVariable('ITEM_BLOCK',$html);
3070 $this->tpl->parseCurrentBlock();
3071 }
3072 }
3073 }
3074 }
3075
3083 public function cloneAllObject()
3084 {
3085 global $ilLog, $ilCtrl;
3086
3087 include_once('./Services/Link/classes/class.ilLink.php');
3088 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
3089
3090 global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser;
3091
3092 $new_type = $_REQUEST['new_type'];
3093 $ref_id = (int) $_GET['ref_id'];
3094 $clone_source = (int) $_REQUEST['clone_source'];
3095
3096 if(!$rbacsystem->checkAccess('create', $ref_id,$new_type))
3097 {
3098 $ilErr->raiseError($this->lng->txt('permission_denied'));
3099 }
3100 if(!$clone_source)
3101 {
3102 ilUtil::sendFailure($this->lng->txt('select_one'));
3103 $this->createObject();
3104 return false;
3105 }
3106 if(!$ilAccess->checkAccess('write','', $clone_source,$new_type))
3107 {
3108 $ilErr->raiseError($this->lng->txt('permission_denied'));
3109 }
3110
3111 $options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
3113 $result = $orig->cloneAllObject($_COOKIE['PHPSESSID'], $_COOKIE['ilClientId'], $new_type, $ref_id, $clone_source, $options);
3114
3115 include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
3117 {
3118 ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
3119 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $result['ref_id']);
3120 $ilCtrl->redirectByClass("ilrepositorygui", "");
3121 }
3122 else
3123 {
3124 ilUtil::sendInfo($this->lng->txt("object_copy_in_progress"),true);
3125 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
3126 $ilCtrl->redirectByClass("ilrepositorygui", "");
3127 }
3128 }
3129
3130
3138 public function saveSortingObject()
3139 {
3140 include_once('Services/Container/classes/class.ilContainerSorting.php');
3141 $sorting = ilContainerSorting::_getInstance($this->object->getId());
3142
3143 // Allow comma
3144 $positions = str_replace(',','.',$_POST['position']);
3145
3146 $sorting->savePost($positions);
3147 ilUtil::sendSuccess($this->lng->txt('cntr_saved_sorting'), true);
3148 $this->ctrl->redirect($this, "editOrder");
3149 }
3150
3151 // BEGIN WebDAV: Support a copy command in the repository
3162 function cloneNodes($srcRef,$dstRef,&$mapping, $newName=null)
3163 {
3164 global $tree;
3165 global $ilias;
3166
3167 // clone the source node
3168 $srcObj =& $ilias->obj_factory->getInstanceByRefId($srcRef);
3169 error_log(__METHOD__.' cloning srcRef='.$srcRef.' dstRef='.$dstRef.'...');
3170 $newRef = $srcObj->cloneObject($dstRef)->getRefId();
3171 error_log(__METHOD__.' ...cloning... newRef='.$newRef.'...');
3172
3173 // We must immediately apply a new name to the object, to
3174 // prevent confusion of WebDAV clients about having two objects with identical
3175 // name in the repository.
3176 if (! is_null($newName))
3177 {
3178 $newObj =& $ilias->obj_factory->getInstanceByRefId($newRef);
3179 $newObj->setTitle($newName);
3180 $newObj->update();
3181 unset($newObj);
3182 }
3183 unset($srcObj);
3184 $mapping[$newRef] = $srcRef;
3185
3186 // clone all children of the source node
3187 $children = $tree->getChilds($srcRef);
3188 foreach ($tree->getChilds($srcRef) as $child)
3189 {
3190 // Don't clone role folders, because it does not make sense to clone local roles
3191 // FIXME - Maybe it does make sense (?)
3192 if ($child["type"] != 'rolf')
3193 {
3194 $this->cloneNodes($child["ref_id"],$newRef,$mapping);
3195 }
3196 else
3197 {
3198 if (count($rolf = $tree->getChildsByType($newRef,"rolf")))
3199 {
3200 $mapping[$rolf[0]["ref_id"]] = $child["ref_id"];
3201 }
3202 }
3203 }
3204 error_log(__METHOD__.' ...cloned srcRef='.$srcRef.' dstRef='.$dstRef.' newRef='.$newRef);
3205 return $newRef;
3206 }
3207 // END PATCH WebDAV: Support a copy command in the repository
3208
3216 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
3217 {
3218 global $lng;
3219
3220 if($a_show_path)
3221 {
3222 $a_item_list_gui->addCustomProperty($lng->txt('path'),
3223 ilContainer::buildPath($a_item_data['ref_id'], $this->object->getRefId()),
3224 false, true);
3225 }
3226 }
3227
3231 static function _buildPath($a_ref_id, $a_course_ref_id)
3232 {
3233 global $tree;
3234
3235 $path_arr = $tree->getPathFull($a_ref_id, $a_course_ref_id);
3236 $counter = 0;
3237 foreach($path_arr as $data)
3238 {
3239 if($counter++)
3240 {
3241 $path .= " > ";
3242 }
3243 $path .= $data['title'];
3244 }
3245
3246 return $path;
3247 }
3248
3249 //
3250 // Style editing
3251 //
3252
3257 {
3258 global $ilTabs, $tpl;
3259
3260 $this->checkPermission("write");
3261
3262 $this->initStylePropertiesForm();
3263 $tpl->setContent($this->form->getHTML());
3264
3265 $ilTabs->activateTab("obj_sty");
3266 }
3267
3272 {
3273 global $ilCtrl, $lng, $ilTabs, $ilSetting, $tpl;
3274
3275 $tpl->setTreeFlatIcon("", "");
3276 $ilTabs->clearTargets();
3277 $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(),
3278 "xhtml_page");
3279 if ($xpage_id > 0)
3280 {
3281 $ilTabs->setBackTarget($lng->txt("cntr_back_to_old_editor"),
3282 $ilCtrl->getLinkTarget($this, "switchToOldEditor"), "_top");
3283 }
3284 else
3285 {
3286 $ilTabs->setBackTarget($lng->txt("back"), "./goto.php?target=".$this->object->getType()."_".
3287 $this->object->getRefId(), "_top");
3288 }
3289
3290 include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
3291 $page_gui = new ilContainerPageGUI($this->object->getId());
3292 $style_id = $this->object->getStyleSheetId();
3293 if (ilObject::_lookupType($style_id) == "sty")
3294 {
3295 $page_gui->setStyleId($style_id);
3296 }
3297 else
3298 {
3299 $style_id = 0;
3300 }
3301 $page_gui->setTabHook($this, "addPageTabs");
3302 $ilCtrl->getHTML($page_gui);
3303 $ilTabs->setTabActive("obj_sty");
3304
3305 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
3306 $lng->loadLanguageModule("style");
3307
3308 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3309 $this->form = new ilPropertyFormGUI();
3310
3311 $fixed_style = $ilSetting->get("fixed_content_style_id");
3312// $style_id = $this->object->getStyleSheetId();
3313
3314 if ($fixed_style > 0)
3315 {
3316 $st = new ilNonEditableValueGUI($lng->txt("wiki_current_style"));
3317 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
3318 $this->lng->txt("global_fixed").")");
3319 $this->form->addItem($st);
3320 }
3321 else
3322 {
3323 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
3324 $_GET["ref_id"]);
3325
3326 $st_styles[0] = $this->lng->txt("default");
3327 ksort($st_styles);
3328
3329 if ($style_id > 0)
3330 {
3331 // individual style
3332 if (!ilObjStyleSheet::_lookupStandard($style_id))
3333 {
3334 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
3335 $st->setValue(ilObject::_lookupTitle($style_id));
3336 $this->form->addItem($st);
3337
3338//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
3339
3340 // delete command
3341 $this->form->addCommandButton("editStyle",
3342 $lng->txt("style_edit_style"));
3343 $this->form->addCommandButton("deleteStyle",
3344 $lng->txt("style_delete_style"));
3345//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
3346 }
3347 }
3348
3349 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
3350 {
3351 $style_sel = ilUtil::formSelect ($style_id, "style_id",
3352 $st_styles, false, true);
3353 $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
3354 $style_sel->setOptions($st_styles);
3355 $style_sel->setValue($style_id);
3356 $this->form->addItem($style_sel);
3357//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
3358 $this->form->addCommandButton("saveStyleSettings",
3359 $lng->txt("save"));
3360 $this->form->addCommandButton("createStyle",
3361 $lng->txt("sty_create_ind_style"));
3362 }
3363 }
3364 $this->form->setTitle($lng->txt("obj_sty"));
3365 $this->form->setFormAction($ilCtrl->getFormAction($this));
3366 }
3367
3372 {
3373 global $ilCtrl;
3374
3375 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
3376 }
3377
3382 {
3383 global $ilCtrl;
3384
3385 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
3386 }
3387
3392 {
3393 global $ilCtrl;
3394
3395 $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
3396 }
3397
3402 {
3403 global $ilSetting;
3404
3405 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
3406 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
3407 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
3408 || $this->object->getStyleSheetId() == 0))
3409 {
3410 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
3411 $this->object->update();
3412 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
3413 }
3414 $this->ctrl->redirect($this, "editStyleProperties");
3415 }
3416
3421 {
3422 global $ilCtrl;
3423
3424 $ref_id = $_GET["cmdrefid"];
3427
3428 // this should be done via container-object->getSubItem in the future
3429 $data = array("child" => $ref_id, "ref_id" => $ref_id, "obj_id" => $obj_id,
3430 "type" => $type);
3431 include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
3432 $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($type);
3433 $item_list_gui->setContainerObject($this);
3434
3435 $item_list_gui->enableComments(true);
3436 $item_list_gui->enableNotes(true);
3437 $item_list_gui->enableTags(true);
3438
3439 $this->modifyItemGUI($item_list_gui, $data, false);
3440 $html = $item_list_gui->getListItemHTML($ref_id,
3441 $obj_id, "", "", true, true);
3442
3443 // include plugin slot for async item list
3444 global $ilPluginAdmin;
3445 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
3446 foreach ($pl_names as $pl)
3447 {
3448 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
3449 $gui_class = $ui_plugin->getUIClassInstance();
3450 $resp = $gui_class->getHTML("Services/Container", "async_item_list", array("html" => $html));
3451 if ($resp["mode"] != ilUIHookPluginGUI::KEEP)
3452 {
3453 $html = $gui_class->modifyHTML($html, $resp);
3454 }
3455 }
3456
3457 echo $html;
3458 exit;
3459 }
3460
3465 protected function showPasswordInstructionObject($a_init = true)
3466 {
3467 global $tpl,$ilToolbar;
3468
3469 if($a_init)
3470 {
3471 ilUtil::sendInfo($this->lng->txt('webdav_pwd_instruction'));
3473 }
3474
3475 include_once ('Services/WebDAV/classes/class.ilDAVServer.php');
3476 $davServer = ilDAVServer::getInstance();
3477 $ilToolbar->addButton(
3478 $this->lng->txt('mount_webfolder'),
3479 $davServer->getMountURI($this->object->getRefId()),
3480 '_blank',
3481 '',
3482 $davServer->getFolderURI($this->object->getRefId())
3483 );
3484
3485 $tpl->setContent($this->form->getHTML());
3486 }
3487
3492 protected function initFormPasswordInstruction()
3493 {
3494 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3495 $this->form = new ilPropertyFormGUI();
3496 $this->form->setFormAction($this->ctrl->getFormAction($this));
3497
3498 // new password
3499 $ipass = new ilPasswordInputGUI($this->lng->txt("desired_password"), "new_password");
3500 $ipass->setRequired(true);
3501
3502 $this->form->addItem($ipass);
3503 $this->form->addCommandButton("savePassword", $this->lng->txt("save"));
3504 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
3505
3506 $this->form->setTitle($this->lng->txt("chg_ilias_and_webfolder_password"));
3507 $this->form->setFormAction($this->ctrl->getFormAction($this));
3508
3509 return $this->form;
3510 }
3511
3516 protected function savePasswordObject()
3517 {
3518 global $ilUser;
3519
3520 $form = $this->initFormPasswordInstruction();
3521 if($form->checkInput())
3522 {
3523 $ilUser->resetPassword($this->form->getInput('new_password'),$this->form->getInput('new_password'));
3524 ilUtil::sendSuccess($this->lng->txt('webdav_pwd_instruction_success'),true);
3525 $this->showPasswordInstructionObject(false);
3526 return true;
3527 }
3528 $form->setValuesByPost();
3530 }
3531
3539 {
3540 global $tpl;
3541
3542 $html = null;
3543
3544 $item_data = $this->object->getSubItems(false, false, (int) $_GET["child_ref_id"]);
3545 $container_view = $this->getContentGUI();
3546
3547 // list item is session material (not part of "_all"-items - see below)
3548 include_once './Modules/Session/classes/class.ilEventItems.php';
3549 $event_items = ilEventItems::_getItemsOfContainer($this->object->getRefId());
3550 if(in_array((int)$_GET["child_ref_id"], $event_items))
3551 {
3552 include_once('./Services/Object/classes/class.ilObjectActivation.php');
3553 foreach ($this->object->items["sess"] as $id)
3554 {
3555 $items = ilObjectActivation::getItemsByEvent($id['obj_id']);
3556 foreach($items as $event_item)
3557 {
3558 if ($event_item["child"] == (int)$_GET["child_ref_id"])
3559 {
3560 // sessions
3561 if((int)$_GET["parent_ref_id"])
3562 {
3563 $event_item["parent"] = (int)$_GET["parent_ref_id"];
3564 }
3565 $html = $container_view->renderItem($event_item);
3566 }
3567 }
3568 }
3569 }
3570
3571 // "normal" list item
3572 if(!$html)
3573 {
3574 foreach ($this->object->items["_all"] as $id)
3575 {
3576 if ($id["child"] == (int) $_GET["child_ref_id"])
3577 {
3578 $html = $container_view->renderItem($id);
3579 }
3580 }
3581 }
3582
3583 if($html)
3584 {
3585 echo $html;
3586
3587 // we need to add onload code manually (rating, comments, etc.)
3588 echo $tpl->getOnLoadCodeForAsynch();
3589 }
3590
3591 exit;
3592 }
3593
3594 // begin-patch fm
3601 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
3602 {
3603 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
3604
3605 // begin-patch fm
3606 include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
3607 if(ilFMSettings::getInstance()->isEnabled())
3608 {
3609 if($lg instanceof ilObjectListGUI)
3610 {
3611 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,'fileManagerLaunch'), 'fm_start','_blank');
3612 }
3613 }
3614 // end-patch fm
3615 return $lg;
3616 }
3617
3621 protected function fileManagerLaunchObject()
3622 {
3623 global $ilUser;
3624
3625 $tpl = new ilTemplate('tpl.fm_launch_ws.html',false,false,'Services/WebServices/FileManager');
3626 $tpl->setVariable('JNLP_URL',ILIAS_HTTP_PATH.'/Services/WebServices/FileManager/lib/dist/FileManager.jnlp');
3627 $tpl->setVariable('SESSION_ID', $_COOKIE['PHPSESSID'].'::'.CLIENT_ID);
3628 $tpl->setVariable('UID',$ilUser->getId());
3629 $tpl->setVariable('REF_ID', $this->object->getRefId());
3630 $tpl->setVariable('WSDL_URI', ILIAS_HTTP_PATH.'/webservice/soap/server.php?wsdl');
3631 $tpl->setVariable('LOCAL_FRAME', ilFMSettings::getInstance()->isLocalFSEnabled() ? 1 : 0);
3632 $tpl->setVariable('REST_URI',ILIAS_HTTP_PATH.'/Services/WebServices/Rest/server.php');
3633 $tpl->setVariable('FILE_LOCKS',0);
3634 $tpl->setVariable('UPLOAD_FILESIZE', ilFMSettings::getInstance()->getMaxFileSize());
3635
3636 include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
3637 $header_top_title = ilObjSystemFolder::_getHeaderTitle();
3638 $tpl->setVariable('HEADER_TITLE',$header_top_title ? $header_top_title : '');
3639 echo $tpl->get();
3640 exit;
3641 }
3642 // begin-patch fm
3643
3647 function showRepTree()
3648 {
3649 global $tpl, $ilUser, $ilSetting, $ilCtrl;
3650
3651 // set current repository view mode
3652 if (!empty($_GET["set_mode"]))
3653 {
3654 $_SESSION["il_rep_mode"] = $_GET["set_mode"];
3655 if ($ilUser->getId() != ANONYMOUS_USER_ID)
3656 {
3657 $ilUser->writePref("il_rep_mode", $_GET["set_mode"]);
3658 }
3659 }
3660
3661 // get user setting
3662 if ($_SESSION["il_rep_mode"] == "")
3663 {
3664 if ($ilUser->getId() != ANONYMOUS_USER_ID)
3665 {
3666 $_SESSION["il_rep_mode"] = $ilUser->getPref("il_rep_mode");
3667 }
3668 }
3669
3670 // if nothing set, get default view
3671 if ($_SESSION["il_rep_mode"] == "")
3672 {
3673 $_SESSION["il_rep_mode"] = $ilSetting->get("default_repository_view");
3674 }
3675
3676 $mode = ($_SESSION["il_rep_mode"] != "")
3677 ? $_SESSION["il_rep_mode"]
3678 : "flat";
3679
3680 // check for administration context, see #0016312
3681 if ($mode == "tree" && (strtolower($_GET["baseClass"]) != "iladministrationgui"))
3682 {
3683 include_once("./Services/Repository/classes/class.ilRepositoryExplorerGUI.php");
3684 $exp = new ilRepositoryExplorerGUI($this, "showRepTree");
3685 if (!$exp->handleCommand())
3686 {
3687 $tpl->setLeftNavContent($exp->getHTML());
3688 }
3689 }
3690 }
3691
3697 protected function initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
3698 {
3699 include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
3700 include_once './Services/Container/classes/class.ilContainer.php';
3701
3702 $settings = new ilContainerSortingSettings($this->object->getId());
3703 $sort = new ilRadioGroupInputGUI($this->lng->txt('sorting_header'), "sorting");
3704
3705 if(in_array(ilContainer::SORT_INHERIT, $a_sorting_settings))
3706 {
3707 $sort_inherit = new ilRadioOption();
3708 $sort_inherit->setTitle(
3709 $this->lng->txt('sort_inherit_prefix').
3710 ' ('.ilContainerSortingSettings::sortModeToString(
3712 $this->object->getId())).') '
3713 );
3714 $sort_inherit->setValue(ilContainer::SORT_INHERIT);
3715 $sort_inherit->setInfo($this->lng->txt('sorting_info_inherit'));
3716 $sort->addOption($sort_inherit);
3717 }
3718 if(in_array(ilContainer::SORT_TITLE,$a_sorting_settings))
3719 {
3720 $sort_title = new ilRadioOption(
3721 $this->lng->txt('sorting_title_header'),
3723 );
3724 $sort_title->setInfo($this->lng->txt('sorting_info_title'));
3725
3726 $this->initSortingDirectionForm($settings,$sort_title,'title');
3727 $sort->addOption($sort_title);
3728 }
3729 if(in_array(ilContainer::SORT_CREATION, $a_sorting_settings))
3730 {
3731 $sort_activation = new ilRadioOption($this->lng->txt('sorting_creation_header'),ilContainer::SORT_CREATION);
3732 $sort_activation->setInfo($this->lng->txt('sorting_creation_info'));
3733 $this->initSortingDirectionForm($settings,$sort_activation,'creation');
3734 $sort->addOption($sort_activation);
3735 }
3736 if(in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings))
3737 {
3738 $sort_activation = new ilRadioOption($this->lng->txt('crs_sort_activation'),ilContainer::SORT_ACTIVATION);
3739 $sort_activation->setInfo($this->lng->txt('crs_sort_timing_info'));
3740 $this->initSortingDirectionForm($settings,$sort_activation,'activation');
3741 $sort->addOption($sort_activation);
3742 }
3743 if(in_array(ilContainer::SORT_MANUAL, $a_sorting_settings))
3744 {
3745 $sort_manual = new ilRadioOption(
3746 $this->lng->txt('sorting_manual_header'),
3748 );
3749 $sort_manual->setInfo($this->lng->txt('sorting_info_manual'));
3750 $this->initManualSortingOptionForm($settings, $sort_manual, "manual", $a_sorting_settings);
3751 $sort->addOption($sort_manual);
3752 }
3753
3754 // Handle moved containers and there possibly invalid values
3755 if(in_array($settings->getSortMode(), $a_sorting_settings))
3756 {
3757 $sort->setValue($settings->getSortMode());
3758 }
3759 else
3760 {
3761 $sort->setValue(ilContainer::SORT_TITLE);
3762 }
3763 $form->addItem($sort);
3764
3765 return $form;
3766 }
3767
3772 protected function initSortingDirectionForm(ilContainerSortingSettings $sorting_settings, $element, $a_prefix)
3773 {
3774 if($a_prefix == 'manual')
3775 {
3776 $txt = $this->lng->txt('sorting_new_items_direction');
3777 }
3778 else
3779 {
3780 $txt = $this->lng->txt('sorting_direction');
3781 }
3782
3783 $direction = new ilRadioGroupInputGUI($txt,$a_prefix.'_sorting_direction');
3784 $direction->setValue($sorting_settings->getSortDirection());
3785 $direction->setRequired(TRUE);
3786
3787 // asc
3788 $asc = new ilRadioOption(
3789 $this->lng->txt('sorting_asc'),
3791 );
3792 $direction->addOption($asc);
3793
3794 // desc
3795 $desc = new ilRadioOption(
3796 $this->lng->txt('sorting_desc'),
3798 );
3799 $direction->addOption($desc);
3800
3801 $element->addSubItem($direction);
3802
3803 return $element;
3804 }
3805
3810 protected function initManualSortingOptionForm(ilContainerSortingSettings $settings, $element, $a_prefix,
3811 $a_sorting_settings)
3812 {
3813 $position = new ilRadioGroupInputGUI($this->lng->txt('sorting_new_items_position'),$a_prefix.'_new_items_position');
3814 $position->setValue($settings->getSortNewItemsPosition());
3815 $position->setRequired(TRUE);
3816
3817 //new items insert on top
3818 $new_top = new ilRadioOption(
3819 $this->lng->txt('sorting_new_items_at_top'),
3821 );
3822
3823 $position->addOption($new_top);
3824
3825 //new items insert at bottom
3826 $new_bottom = new ilRadioOption(
3827 $this->lng->txt('sorting_new_items_at_bottom'),
3829 );
3830
3831 $position->addOption($new_bottom);
3832
3833 $element->addSubItem($position);
3834
3835 $order = new ilRadioGroupInputGUI($this->lng->txt('sorting_new_items_order'),$a_prefix.'_new_items_order');
3836 $order->setValue($settings->getSortNewItemsOrder());
3837 $order->setRequired(TRUE);
3838
3839 if(in_array(ilContainer::SORT_TITLE, $a_sorting_settings))
3840 {
3841 //new items sort in alphabetical order
3842 $new_title = new ilRadioOption(
3843 $this->lng->txt('sorting_title_header'),
3845 );
3846
3847 $order->addOption($new_title);
3848 }
3849
3850 if(in_array(ilContainer::SORT_CREATION, $a_sorting_settings))
3851 {
3852 //new items sort by creation date
3853 $new_creation = new ilRadioOption(
3854 $this->lng->txt('sorting_creation_header'),
3856 );
3857
3858 $order->addOption($new_creation);
3859 }
3860
3861
3862 if(in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings))
3863 {
3864 //new items by activation
3865 $new_activation = new ilRadioOption(
3866 $this->lng->txt('crs_sort_activation'),
3868 );
3869
3870 $order->addOption($new_activation);
3871 }
3872
3873 $element->addSubItem($order);
3874
3875 $this->initSortingDirectionForm($settings,$element,'manual');
3876
3877 return $element;
3878 }
3879
3884 protected function saveSortingSettings(ilPropertyFormGUI $form)
3885 {
3886 include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
3887 $settings = new ilContainerSortingSettings($this->object->getId());
3888 $settings->setSortMode($form->getInput("sorting"));
3889
3890 switch($form->getInput('sorting'))
3891 {
3893 $settings->setSortDirection($form->getInput('title_sorting_direction'));
3894 break;
3896 $settings->setSortDirection($form->getInput('activation_sorting_direction'));
3897 break;
3899 $settings->setSortDirection($form->getInput('creation_sorting_direction'));
3900 break;
3902 $settings->setSortNewItemsPosition($form->getInput('manual_new_items_position'));
3903 $settings->setSortNewItemsOrder($form->getInput('manual_new_items_order'));
3904 $settings->setSortDirection($form->getInput('manual_sorting_direction'));
3905 break;
3906 }
3907
3908 $settings->update();
3909 }
3910
3916 public function trashObject()
3917 {
3918 global $tpl;
3919
3920 include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3921 $ru = new ilRepUtilGUI($this);
3922 $ru->showTrashTable($_GET["ref_id"]);
3923 }
3924
3930 public function removeFromSystemObject()
3931 {
3932 global $log, $ilAppEventHandler, $lng;
3933
3934 include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3935 $ru = new ilRepUtilGUI($this);
3936 $ru->removeObjectsFromSystem($_POST["trash_id"]);
3937 $this->ctrl->redirect($this, "trash");
3938 }
3939
3943 public function undeleteObject()
3944 {
3945 include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3946 $ru = new ilRepUtilGUI($this);
3947 $ru->restoreObjects($_GET["ref_id"], $_POST["trash_id"]);
3948 $this->ctrl->redirect($this, "trash");
3949 }
3950
3955 {
3956 global $lng;
3957 include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
3958
3959 if(!isset($_POST["trash_id"]))
3960 {
3961 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3962 $this->ctrl->redirect($this, "trash");
3963 }
3964
3965 $ru = new ilRepUtilGUI($this);
3966 $ru->confirmRemoveFromSystemObject($_POST["trash_id"]);
3967 }
3968
3973 protected function getTreeSelectorGUI($cmd)
3974 {
3975 include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
3976 $exp = new ilRepositorySelectorExplorerGUI($this, "showPasteTree");
3977 // TODO: The study programme 'prg' is not included here, as the
3978 // ilRepositorySelectorExplorerGUI only handles static rules for
3979 // parent-child-relations and not the dynamic relationsships
3980 // required for the SP (see #16909).
3981 $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
3982 if ($cmd == "link") {
3983 $exp->setSelectMode("nodes", true);
3984 return $exp;
3985 } else {
3986 $exp->setSelectMode("nodes[]", false);
3987 return $exp;
3988 }
3989 }
3990
3995 {
3996 $this->ctrl->setReturn($this, "");
3997 }
3998
3999}
4000?>
sprintf('%.4f', $callTime)
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
$result
$error
Definition: Error.php:17
$files
Definition: add-vimline.php:18
$path
Definition: aliased.php:25
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
const IL_CRS_VIEW_TIMING
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static _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 _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
Column user interface class.
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
setEnableMovement($a_enablemovement)
Set Enable Movement.
setRepositoryItems($a_repositoryitems)
Set Repository Items.
setAdminCommands($a_admincommands)
Set Administration Commmands.
static _adjustMovedObjectConditions($a_ref_id)
In the moment it is not allowed to create preconditions on objects that are located outside of a cour...
Class ilContainerGUI.
downloadMultipleObjects($a_ref_ids)
clearObject()
clear clipboard and go back to last object
saveSortingObject()
Save Sorting.
afterUpdate()
Post (successful) object update hook.
editPageFrameObject()
show page editor frameset
showAdministrationPanel(&$tpl)
show administration panel
clipboardObject()
show clipboard
getAsynchItemListObject()
Get item list command drop down asynchronously.
savePasswordObject()
Save password.
cloneWizardPageTreeObject()
@access public
setContentSubTabs()
Set content sub tabs.
setSideColumnReturn()
Set return point for side column actions.
initFormPasswordInstruction()
Init password form.
addStandardRow(&$a_tpl, $a_html, $a_item_ref_id="", $a_item_obj_id="", $a_image_type="")
adds a standard row to a block template
& forwardToPageObject()
forward command to page object
getEditFormValues()
Get values for edit form.
disableAdministrationPanelObject()
enable administration panel
trashObject()
Show trash content of object.
static _buildPath($a_ref_id, $a_course_ref_id)
build path
initStylePropertiesForm()
Init style properties form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
cutObject()
cut object(s) out from a container and write the information to clipboard
confirmRemoveFromSystemObject()
confirmation screen remove from system
showPasteTreeObject()
Show paste tree.
getContentGUI()
Get content gui object.
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
addHeaderRow(&$a_tpl, $a_type, $a_show_image=true)
adds a header row to a block template
cancelMoveLinkObject()
Cancel move|link empty clipboard and return to parent.
allowBlocksConfigure()
Standard is to allow blocks configuration.
isActiveOrdering()
Check if ordering is enabled.
cloneNodes($srcRef, $dstRef, &$mapping, $newName=null)
Recursively clones all nodes of the RBAC tree.
getContainerPageHTML()
Get container page HTML.
initManualSortingOptionForm(ilContainerSortingSettings $settings, $element, $a_prefix, $a_sorting_settings)
Add manual sorting options.
clearAdminCommandsDetermination()
cleaer administration commands determination
switchToOldEditorObject()
Switch to old page editor.
addStandardContainerSubTabs($a_include_view=true)
Add standar container subtabs for view, manage, oderdering and text/media editor link.
static copyFile($obj_id, $title, $tmpdir)
& newBlockTemplate()
determin admin commands
redrawListItemObject()
Redraw a list item (ajax)
undeleteObject()
Get objects back from trash.
prepareOutput($a_show_subobjects=true)
prepare output
showPasswordInstructionObject($a_init=true)
Show webdav password instruction.
fileManagerLaunchObject()
Launch jnlp.
pasteObject()
paste object from clipboard to current place Depending on the chosen command the object(s) are linked...
editStylePropertiesObject()
Edit style properties.
editStyleObject()
Edit Style.
saveStyleSettingsObject()
Save style settings.
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify list gui for presentation in container @global type $lng.
setPageEditorTabs()
Add page editor tabs.
useNewEditorObject()
Use new editor (-> delete xhtml content page)
initSortingDirectionForm(ilContainerSortingSettings $sorting_settings, $element, $a_prefix)
Add sorting direction.
renderObject()
render the object
addPageTabs()
Add page tabs.
showPermanentLink(&$tpl)
show permanent link
cloneWizardPageObject($a_tree_view=true)
Show clone wizard page for container objects.
addMessageRow(&$a_tpl, $a_message, $a_type)
add message row
editOrderObject()
Edit order.
setTitleAndDescription()
called by prepare output
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add file manager link.
forwardToStyleSheet()
Forward to style object.
showCustomIconsEditing($a_input_colspan=1, ilPropertyFormGUI $a_form=null, $a_as_section=true)
show edit section of custom icons for container
isActiveItemOrdering()
Check if item ordering is enabled.
allowBlocksMoving()
Standard is to allow blocks moving.
enableAdministrationPanelObject()
enable administration panel
copyObject()
Copy object(s) out from a container and write the information to clipboard It is not possible to copy...
setColumnSettings(ilColumnGUI $column_gui)
May be overwritten in subclasses.
showPossibleSubObjects()
show possible sub objects selection list
linkObject()
create an new reference of an object in tree it's like a hard link of unix
deleteStyleObject()
Delete Style.
cloneWizardPageListObject()
@access public
switchToStdEditorObject()
Switch to standard page editor.
createStyleObject()
Create Style.
editPageContentObject()
edit page content (for repository root node and categories)
keepObjectsInClipboardObject()
Keep objects in the clipboard.
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
removeFromSystemObject()
remove objects from trash bin and all entries therefore every object needs a specific deleteObject() ...
executeCommand()
execute command note: this method is overwritten in all container objects
cloneAllObject()
Clone all object Overwritten method for copying container objects.
getAllNestedFiles($ref_id)
Get all files that are nested in the category whose ref_id is passed to this function or are nested i...
static recurseFolder($refid, $title, $tmpdir)
private functions which iterates through all folders and files and create an according file structure...
getTabs()
common tabs for all container objects (should be called at the end of child getTabs() method
GUI class for course objective view.
Container page GUI class.
Container page object.
static lookupSortModeFromParentContainer($a_obj_id)
Lookup sort mode from parent container.
static _lookupSortMode($a_obj_id)
lookup sort mode
static _getInstance($a_obj_id)
get instance by obj_id
const SORT_DIRECTION_DESC
const SORT_NEW_ITEMS_ORDER_ACTIVATION
const SORT_NEW_ITEMS_ORDER_TITLE
const SORT_NEW_ITEMS_ORDER_CREATION
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
static _lookupIconPath($a_id, $a_size="big")
lookup icon path
static _writeContainerSetting($a_id, $a_keyword, $a_value)
const SORT_NEW_ITEMS_POSITION_BOTTOM
const SORT_NEW_ITEMS_POSITION_TOP
const SORT_DIRECTION_ASC
static _isFinished($a_copy_id)
check if copy is finished
static _getInstanceByType($a_source_id, $a_item_type)
Get instance by type.
This class represents a custom property in a property form.
static _isActionsVisible()
Static getter.
static getInstance()
Get singelton instance.
static addToDesktop()
Add desktop item @access public.
static removeFromDesktop()
Remove item from personal desktop @access public.
GUI class for didactic template settings inside repository objects.
static lookupTemplateId($a_ref_id)
Lookup template id @global ilDB $ilDB.
static _getItemsOfContainer($a_ref_id)
static getInstance()
Get singleton instance.
Class to report exception.
This class represents a section header in a property form.
static _getFrame($a_class, $a_type='')
Get content frame name.
This class represents an image file property in a property form.
static showMemberViewSwitch($a_ref_id)
Show member view switch.
static getInstance()
Get instance.
This class represents a non editable value in a property form.
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
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.
static _lookupAbsolutePath($obj_id, $a_version=null)
return absolute path for version
Class ilObjStyleSheetGUI.
static _lookupStandard($a_id)
Lookup standard flag.
static getSyntaxStylePath()
get syntax style path
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getContentStylePath($a_style_id)
get content style path
static _getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static getItemsByEvent($a_event_id)
Get session material / event items.
Render add new item selector.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
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.
getCreationMode()
get creation mode
createObject()
create new object form
static _getListGUIByType($a_type, $a_context=ilObjectListGUI::CONTEXT_REPOSITORY)
Class ilObjectListGUI.
static getInstance($a_obj_id)
Get instance.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _isInTrash($a_ref_id)
checks wether object is in trash
static _lookupType($a_id, $a_reference=false)
lookup object type
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages)
This class represents a password property in a property form.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static _getRTEClassname()
static _cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
This class represents a property in a property form.
This class represents an option in a radio group.
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
const LINK_OBJECT
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static isActive()
Repository GUI Utilities.
Repository explorer GUI class.
Explorer for selecting repository items.
This class represents a selection list property in a property form.
ILIAS Setting Class.
static getInstance()
Factory.
special template class to simplify handling of ITX/PEAR
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static zip($a_dir, $a_file, $compress_content=false)
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
XHTML Page class.
$counter
$txt
Definition: error.php:12
$html
Definition: example_001.php:87
$lg
Definition: example_018.php:62
$text
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
global $ilErr
Definition: raiseError.php:16
$cmd
Definition: sahs_server.php:35
global $ilDB
if(!is_array($argv)) $options
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:93