ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilStructureObjectGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
6require_once("./Modules/LearningModule/classes/class.ilLMObjectGUI.php");
7require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
8
22{
26 protected $user;
27
31 protected $error;
32
36 protected $tabs;
37
41 protected $log;
42
43 public $obj; // structure object
44 public $tree;
45
50 public function __construct(&$a_content_obj, &$a_tree)
51 {
52 global $DIC;
53
54 $this->tree = $DIC->repositoryTree();
55 $this->user = $DIC->user();
56 $this->ctrl = $DIC->ctrl();
57 $this->lng = $DIC->language();
58 $this->error = $DIC["ilErr"];
59 $this->tabs = $DIC->tabs();
60 $this->log = $DIC["ilLog"];
61 $this->tpl = $DIC["tpl"];
62 parent::__construct($a_content_obj);
63 $this->tree = $a_tree;
64 }
65
71 public function setStructureObject(&$a_st_object)
72 {
73 $this->obj = $a_st_object;
74 }
75
76
80 public function getType()
81 {
82 return "st";
83 }
84
88 public function executeCommand()
89 {
90 //echo "<br>:cmd:".$this->ctrl->getCmd().":cmdClass:".$this->ctrl->getCmdClass().":";
91 $next_class = $this->ctrl->getNextClass($this);
92 $cmd = $this->ctrl->getCmd();
93
94 switch ($next_class) {
95 case 'ilobjectmetadatagui':
96
97 $this->setTabs();
98
99 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
100 $md_gui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
101 $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'General');
102 $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'Educational'); // #9510
103 $this->ctrl->forwardCommand($md_gui);
104 break;
105
106 case "ilconditionhandlergui":
107 $ilTabs = $this->tabs;
108 include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
109
110 $this->setTabs();
112 $this->ctrl->forwardCommand($this->condHI);
113 $ilTabs->setTabActive('preconditions');
114 break;
115
116 default:
117 if ($cmd == 'listConditions') {
118 $this->setTabs();
120 $this->condHI->executeCommand();
121 } elseif (($cmd == "create") && ($_POST["new_type"] == "pg")) {
122 $this->setTabs();
123 $pg_gui = new ilLMPageObjectGUI($this->content_object);
124 $pg_gui->executeCommand();
125 } else {
126 $this->$cmd();
127 }
128 break;
129 }
130 }
131
132
136 public function create()
137 {
138 if ($_GET["obj_id"] != "") {
139 $this->setTabs();
140 }
141 parent::create();
142 }
143
144 public function edit()
145 {
146 $this->view();
147 }
148
149 /*
150 * display pages of structure object
151 */
152 public function view()
153 {
158
159 $this->showHierarchy();
160 }
161
162
166 public function showHierarchy()
167 {
170
171 $this->setTabs();
172
173 $ilCtrl->setParameter($this, "backcmd", "showHierarchy");
174
175 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
176 $form_gui = new ilChapterHierarchyFormGUI($this->content_object->getType(), $_GET["transl"]);
177 $form_gui->setFormAction($ilCtrl->getFormAction($this));
178 $form_gui->setTitle($this->obj->getTitle());
179 $form_gui->setIcon(ilUtil::getImagePath("icon_st.svg"));
180 $form_gui->setTree($this->tree);
181 $form_gui->setCurrentTopNodeId($this->obj->getId());
182 $form_gui->addMultiCommand($lng->txt("delete"), "delete");
183 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
184 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
185 $form_gui->addMultiCommand($lng->txt("cont_de_activate"), "activatePages");
186 if ($this->content_object->getLayoutPerPage()) {
187 $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayout");
188 }
189 $form_gui->setDragIcon(ilUtil::getImagePath("icon_pg.svg"));
190 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
191 $form_gui->addHelpItem($lng->txt("cont_chapters_after_pages"));
192 $up_gui = "ilobjlearningmodulegui";
193 $ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
194 $ilCtrl->setParameterByClass($up_gui, "active_node", "");
195
196 $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
197 $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
198 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
199
200 include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
201 $ml_head = ilObjContentObjectGUI::getMultiLangHeader($this->content_object->getId(), $this);
202
203 $this->tpl->setContent($ml_head . $ctpl->get());
204 }
205
209 public function cutItems($a_return = "view")
210 {
213
214 $items = ilUtil::stripSlashesArray($_POST["id"]);
215 if (!is_array($items)) {
216 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
217 $ilCtrl->redirect($this, "showHierarchy");
218 }
219
220 $todel = array(); // delete IDs < 0 (needed for non-js editing)
221 foreach ($items as $k => $item) {
222 if ($item < 0) {
223 $todel[] = $k;
224 }
225 }
226 foreach ($todel as $k) {
227 unset($items[$k]);
228 }
229
230 if (!ilLMObject::uniqueTypesCheck($items)) {
231 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
232 $ilCtrl->redirect($this, "showHierarchy");
233 }
234
235 ilLMObject::clipboardCut($this->content_object->getId(), $items);
237 //ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"), true);
238 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
239
240 $ilCtrl->redirect($this, $a_return);
241 }
242
246 public function copyItems($a_return = "view")
247 {
250
251 $items = ilUtil::stripSlashesArray($_POST["id"]);
252 if (!is_array($items)) {
253 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
254 $ilCtrl->redirect($this, "showHierarchy");
255 }
256
257 $todel = array(); // delete IDs < 0 (needed for non-js editing)
258 foreach ($items as $k => $item) {
259 if ($item < 0) {
260 $todel[] = $k;
261 }
262 }
263 foreach ($todel as $k) {
264 unset($items[$k]);
265 }
266
267 if (!ilLMObject::uniqueTypesCheck($items)) {
268 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
269 $ilCtrl->redirect($this, "showHierarchy");
270 }
271
272 ilLMObject::clipboardCopy($this->content_object->getId(), $items);
274
275 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
276 $ilCtrl->redirect($this, $a_return);
277 }
278
282 public function saveAllTitles()
283 {
285
286 ilLMObject::saveTitles($this->content_object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
287
288 ilUtil::sendSuccess($this->lng->txt("lm_save_titles"), true);
289 $ilCtrl->redirect($this, "showHierarchy");
290 }
291
292 /*
293 * display subchapters of structure object
294 */
295 public function subchap()
296 {
301
302 $this->setTabs();
303
304 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
305 $num = 0;
306
307 $this->tpl->setCurrentBlock("form");
308 $this->ctrl->setParameter($this, "backcmd", "subchap");
309 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
310 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_subchapters"));
311 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
312
313 $cnt = 0;
314 $childs = $this->tree->getChilds($this->obj->getId());
315 foreach ($childs as $child) {
316 if ($child["type"] != "st") {
317 continue;
318 }
319 $this->tpl->setCurrentBlock("table_row");
320 // color changing
321 $css_row = ilUtil::switchColor($cnt++, "tblrow1", "tblrow2");
322
323 // checkbox
324 $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
325 $this->tpl->setVariable("CSS_ROW", $css_row);
326 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.svg"));
327
328 // type
329 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]);
330 $link = $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view");
331 $this->tpl->setVariable("LINK_TARGET", $link);
332
333 // title
334 $this->tpl->setVariable(
335 "TEXT_CONTENT",
337 $child["obj_id"],
339 $this->content_object->isActiveNumbering()
340 )
341 );
342
343 $this->tpl->parseCurrentBlock();
344 }
345 if ($cnt == 0) {
346 $this->tpl->setCurrentBlock("notfound");
347 $this->tpl->setVariable("NUM_COLS", 3);
348 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
349 $this->tpl->parseCurrentBlock();
350 }
351 //else
352 //{
353 // SHOW VALID ACTIONS
354 $this->tpl->setVariable("NUM_COLS", 3);
355 $acts = array("delete" => "delete", "cutChapter" => "cut",
356 "copyChapter" => "copyChapter");
357 if ($ilUser->clipboardHasObjectsOfType("st")) {
358 $acts["pasteChapter"] = "pasteChapter";
359 }
360 $this->showActions($acts);
361 //}
362
363 // SHOW POSSIBLE SUB OBJECTS
364 $this->tpl->setVariable("NUM_COLS", 3);
365 //$this->showPossibleSubObjects("st");
366 $subobj = array("st");
367 $opts = ilUtil::formSelect(12, "new_type", $subobj);
368 //$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
369 $this->tpl->setCurrentBlock("add_object");
370 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
371 //$this->tpl->setVariable("FORMACTION_OBJ_ADD", "adm_object.php?cmd=create&ref_id=".$_GET["ref_id"]);
372 $this->tpl->setVariable("BTN_NAME", "create");
373 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
374 $this->tpl->parseCurrentBlock();
375
376 //$this->tpl->setVariable("NUM_COLS", 2);
377 //$this->showPossibleSubObjects("st");
378
379 $this->tpl->setCurrentBlock("form");
380 $this->tpl->parseCurrentBlock();
381
382 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
383 }
384
388 public function add_cell($val, $link = "")
389 {
390 if (!empty($link)) {
391 $this->tpl->setCurrentBlock("begin_link");
392 $this->tpl->setVariable("LINK_TARGET", $link);
393 $this->tpl->parseCurrentBlock();
394 $this->tpl->touchBlock("end_link");
395 }
396
397 $this->tpl->setCurrentBlock("text");
398 $this->tpl->setVariable("TEXT_CONTENT", $val);
399 $this->tpl->parseCurrentBlock();
400 $this->tpl->setCurrentBlock("table_cell");
401 $this->tpl->parseCurrentBlock();
402 }
403
404
408 public function save()
409 {
410 $this->obj = new ilStructureObject($this->content_object);
411
412 $this->obj->setType("st");
413 $this->obj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
414 $this->obj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
415 $this->obj->setLMId($this->content_object->getId());
416 $this->obj->create();
417
418 $this->putInTree();
419
420 // check the tree
421 $this->checkTree();
422
423 if (!empty($_GET["obj_id"])) {
424 $this->ctrl->redirect($this, "subchap");
425 }
426 }
427
431 public function putInTree()
432 {
433 //echo "st:putInTree";
434 // chapters should be behind pages in the tree
435 // so if target is first node, the target is substituted with
436 // the last child of type pg
437 if ($_GET["target"] == IL_FIRST_NODE) {
438 $tree = new ilTree($this->content_object->getId());
439 $tree->setTableNames('lm_tree', 'lm_data');
440 $tree->setTreeTablePK("lm_id");
441
442 // determine parent node id
443 $parent_id = (!empty($_GET["obj_id"]))
444 ? $_GET["obj_id"]
445 : $tree->getRootId();
446 // determine last child of type pg
447 $childs = $tree->getChildsByType($parent_id, "pg");
448 if (count($childs) != 0) {
449 $_GET["target"] = $childs[count($childs) - 1]["obj_id"];
450 }
451 }
452 if (empty($_GET["target"])) {
453 $_GET["target"] = IL_LAST_NODE;
454 }
455
456 parent::putInTree();
457 }
458
462 public function cutPage()
463 {
464 $this->cutItems();
465 }
466
470 public function copyPage()
471 {
472 $this->copyItems();
473 }
474
478 public function pastePage()
479 {
482
483 if (!$ilUser->clipboardHasObjectsOfType("pg")) {
484 $ilErr->raiseError($this->lng->txt("no_page_in_clipboard"), $ilErr->MESSAGE);
485 }
486
487 return $this->insertPageClip();
488 }
489
490
494 public function cutChapter()
495 {
496 $this->cutItems("subchap");
497 }
498
502 public function copyChapter()
503 {
504 $this->copyItems("subchap");
505 }
506
510 public function pasteChapter()
511 {
513
514 return $this->insertChapterClip(false, "subchap");
515 }
516
520 public function activatePages()
521 {
523
524 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
525 if (is_array($_POST["id"])) {
526 $act_items = array();
527 // get all "top" ids, i.e. remove ids, that have a selected parent
528 foreach ($_POST["id"] as $id) {
529 $path = $this->tree->getPathId($id);
530 $take = true;
531 foreach ($path as $path_id) {
532 if ($path_id != $id && in_array($path_id, $_POST["id"])) {
533 $take = false;
534 }
535 }
536 if ($take) {
537 $act_items[] = $id;
538 }
539 }
540
541
542 foreach ($act_items as $id) {
543 $childs = $this->tree->getChilds($id);
544 foreach ($childs as $child) {
545 if (ilLMObject::_lookupType($child["child"]) == "pg") {
547 $child["child"],
548 $this->content_object->getType()
549 );
551 $child["child"],
552 $this->content_object->getType(),
553 !$act
554 );
555 }
556 }
557 if (ilLMObject::_lookupType($id) == "pg") {
559 $id,
560 $this->content_object->getType()
561 );
563 $id,
564 $this->content_object->getType(),
565 !$act
566 );
567 }
568 }
569 } else {
570 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
571 }
572
573 $this->ctrl->redirect($this, "view");
574 }
575
576 //
577 // Condition handling stuff
578 //
579
581 {
582 include_once("./Services/AccessControl/classes/class.ilConditionHandlerGUI.php");
583
584 $this->condHI = new ilConditionHandlerGUI($this);
585 $this->condHI->setBackButtons(array());
586 $this->condHI->setAutomaticValidation(false);
587 $this->condHI->setTargetType("st");
588 $this->condHI->setTargetRefId($this->content_object->getRefId());
589 $this->condHI->setTargetId($this->obj->getId());
590 $this->condHI->setTargetTitle($this->obj->getTitle());
591 }
592
593
597 public function cancel()
598 {
599 if ($_GET["obj_id"] != 0) {
600 if ($_GET["new_type"] == "pg") {
601 $this->ctrl->redirect($this, "view");
602 } else {
603 $this->ctrl->redirect($this, "subchap");
604 }
605 }
606 }
607
608
612 public function setTabs()
613 {
614 $ilTabs = $this->tabs;
617
618 // subelements
619 $ilTabs->addTarget(
620 "cont_pages_and_subchapters",
621 $this->ctrl->getLinkTarget($this, 'showHierarchy'),
622 array("view", "showHierarchy"),
623 get_class($this)
624 );
625
626 // preconditions
627 $ilTabs->addTarget(
628 "preconditions",
629 $this->ctrl->getLinkTarget($this, 'listConditions'),
630 "listConditions",
631 get_class($this)
632 );
633
634 // metadata
635 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
636 $mdgui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
637 $mdtab = $mdgui->getTab();
638 if ($mdtab) {
639 $ilTabs->addTarget(
640 "meta_data",
641 $mdtab,
642 "",
643 "ilmdeditorgui"
644 );
645 }
646
647 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_st.svg"));
648 $this->tpl->setTitle(
649 $this->lng->txt($this->obj->getType()) . ": " . $this->obj->getTitle()
650 );
651
652 // presentation view
653 $ilTabs->addNonTabbedLink(
654 "pres_mode",
655 $lng->txt("cont_presentation_view"),
656 ILIAS_HTTP_PATH . "/goto.php?target=st_" . $this->obj->getId(),
657 "_top"
658 );
659 }
660
666 public static function _goto($a_target, $a_target_ref_id = "")
667 {
668 global $DIC;
669
670 $rbacsystem = $DIC->rbac()->system();
671 $ilErr = $DIC["ilErr"];
672 $lng = $DIC->language();
673 $ilAccess = $DIC->access();
674
675 // determine learning object
676 $lm_id = ilLMObject::_lookupContObjID($a_target);
677
678 // get all references
679 $ref_ids = ilObject::_getAllReferences($lm_id);
680
681 // always try passed ref id first
682 if (in_array($a_target_ref_id, $ref_ids)) {
683 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
684 }
685
686 // check read permissions
687 foreach ($ref_ids as $ref_id) {
688 // Permission check
689 if ($ilAccess->checkAccess("read", "", $ref_id)) {
690 // don't redirect anymore, just set parameters
691 // (goto.php includes "ilias.php")
692 $_GET["baseClass"] = "ilLMPresentationGUI";
693 $_GET["obj_id"] = $a_target;
694 $_GET["ref_id"] = $ref_id;
695 include_once("ilias.php");
696 exit;
697 ;
698 }
699 }
700
701 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
703 $lng->txt("msg_no_perm_read_item"),
705 ), true);
706 include_once("./Services/Object/classes/class.ilObjectGUI.php");
708 }
709
710 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
711 }
712
716 public function insertChapter($a_as_sub = false)
717 {
720
721 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
722
725
726 if ($a_as_sub) { // as subchapter
727 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert under parent
728 $parent_id = $node_id;
729 $target = "";
730 } else { // we shouldnt end up here
731 $ilCtrl->redirect($this, "showHierarchy");
732 return;
733 }
734 } else { // as chapter
735 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
736 $parent_id = $this->tree->getParentId($node_id);
737 $target = $node_id;
738 } else { // insert as first child
739 $parent_id = $node_id;
741 }
742 }
743 for ($i = 1; $i <= $num; $i++) {
744 $chap = new ilStructureObject($this->content_object);
745 $chap->setType("st");
746 $chap->setTitle($lng->txt("cont_new_chap"));
747 $chap->setLMId($this->content_object->getId());
748 $chap->create();
749 ilLMObject::putInTree($chap, $parent_id, $target);
750 }
751
752 $ilCtrl->redirect($this, "view");
753 }
754
758 public function insertSubchapter()
759 {
761
762 $this->insertChapter(true);
763 }
764
768 public function insertChapterClip($a_as_sub = false, $a_return = "view")
769 {
773
774 $ilLog->write("Insert Chapter From Clipboard");
775
776 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
777
780
781 if ($a_as_sub) { // as subchapter
782 if (!$first_child) { // insert under parent
783 $parent_id = $node_id;
784 $target = "";
785 } else { // we shouldnt end up here
786 $ilCtrl->redirect($this, "showHierarchy");
787 return;
788 }
789 } else { // as chapter
790 if (!$first_child) { // insert after node id
791 $parent_id = $this->tree->getParentId($node_id);
792 $target = $node_id;
793 } else { // insert as first child
794 $parent_id = $node_id;
796
797 // do not move a chapter in front of a page
798 $childs = $this->tree->getChildsByType($parent_id, "pg");
799 if (count($childs) != 0) {
800 $target = $childs[count($childs) - 1]["obj_id"];
801 }
802 }
803 }
804
805 // copy and paste
806 $chapters = $ilUser->getClipboardObjects("st", true);
807 $copied_nodes = array();
808
809 foreach ($chapters as $chap) {
810 $ilLog->write("Call pasteTree, Target LM: " . $this->content_object->getId() . ", Chapter ID: " . $chap["id"]
811 . ", Parent ID: " . $parent_id . ", Target: " . $target);
813 $this->content_object,
814 $chap["id"],
815 $parent_id,
816 $target,
817 $chap["insert_time"],
818 $copied_nodes,
819 (ilEditClipboard::getAction() == "copy")
820 );
821 $target = $cid;
822 }
823 ilLMObject::updateInternalLinks($copied_nodes);
824
825 if (ilEditClipboard::getAction() == "cut") {
826 $ilUser->clipboardDeleteObjectsOfType("pg");
827 $ilUser->clipboardDeleteObjectsOfType("st");
829 }
830
831 $this->content_object->checkTree();
832 $ilCtrl->redirect($this, $a_return);
833 }
834
838 public function insertSubchapterClip()
839 {
840 $this->insertChapterClip(true);
841 }
842
846 public function insertPage()
847 {
850
851 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
852
855
856 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
857 $parent_id = $this->tree->getParentId($node_id);
858 $target = $node_id;
859 } else { // insert as first child
860 $parent_id = $node_id;
862 }
863
864 for ($i = 1; $i <= $num; $i++) {
865 $page = new ilLMPageObject($this->content_object);
866 $page->setType("pg");
867 $page->setTitle($lng->txt("cont_new_page"));
868 $page->setLMId($this->content_object->getId());
869 $page->create();
870 ilLMObject::putInTree($page, $parent_id, $target);
871 }
872
873 $ilCtrl->redirect($this, "showHierarchy");
874 }
875
879 public function insertPageClip()
880 {
883
884 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
885
888
889 if (!$first_child) { // insert after node id
890 $parent_id = $this->tree->getParentId($node_id);
891 $target = $node_id;
892 } else { // insert as first child
893 $parent_id = $node_id;
895 }
896
897 // cut and paste
898 $pages = $ilUser->getClipboardObjects("pg");
899 $copied_nodes = array();
900 foreach ($pages as $pg) {
902 $this->content_object,
903 $pg["id"],
904 $parent_id,
905 $target,
906 $pg["insert_time"],
907 $copied_nodes,
908 (ilEditClipboard::getAction() == "copy")
909 );
910 $target = $cid;
911 }
912 ilLMObject::updateInternalLinks($copied_nodes);
913
914 if (ilEditClipboard::getAction() == "cut") {
915 $ilUser->clipboardDeleteObjectsOfType("pg");
916 $ilUser->clipboardDeleteObjectsOfType("st");
918 }
919
920 $ilCtrl->redirect($this, "view");
921 }
922
923
927 public function proceedDragDrop()
928 {
930
931 //echo "-".$_POST["il_hform_source_id"]."-".$_POST["il_hform_target_id"]."-".$_POST["il_hform_fc"]."-";
932 $this->content_object->executeDragDrop(
933 $_POST["il_hform_source_id"],
934 $_POST["il_hform_target_id"],
935 $_POST["il_hform_fc"],
936 $_POST["il_hform_as_subitem"]
937 );
938 $ilCtrl->redirect($this, "showHierarchy");
939 }
940
944
948 public function setPageLayout()
949 {
953
954 if (!is_array($_POST["id"])) {
955 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
956 $ilCtrl->redirect($this, "showHierarchy");
957 }
958
959 $this->initSetPageLayoutForm();
960
961 $tpl->setContent($this->form->getHTML());
962 }
963
967 public function initSetPageLayoutForm()
968 {
971
972 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
973 $this->form = new ilPropertyFormGUI();
974
975 if (is_array($_POST["id"])) {
976 foreach ($_POST["id"] as $id) {
977 $hi = new ilHiddenInputGUI("id[]");
978 $hi->setValue($id);
979 $this->form->addItem($hi);
980 }
981 }
983 $lng->txt("cont_layout"),
984 "layout",
985 $this->content_object->getLayout()
986 );
987
988 $this->form->addItem($layout);
989
990 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
991 $this->form->addCommandButton("showHierarchy", $lng->txt("cancel"));
992
993 $this->form->setTitle($lng->txt("cont_set_layout"));
994 $this->form->setFormAction($ilCtrl->getFormAction($this));
995 }
996
1000 public function savePageLayout()
1001 {
1002 $lng = $this->lng;
1004
1005 foreach ($_POST["id"] as $id) {
1009 ilUtil::stripSlashes($_POST["layout"]),
1010 $this->content_object
1011 );
1012 }
1013 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1014 $ilCtrl->redirect($this, "showHierarchy");
1015 }
1016
1023 public function editMasterLanguage()
1024 {
1026
1027 $ilCtrl->setParameter($this, "transl", "");
1028 $ilCtrl->redirect($this, "showHierarchy");
1029 }
1030
1037 public function switchToLanguage()
1038 {
1040
1041 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
1042 $ilCtrl->redirect($this, "showHierarchy");
1043 }
1044}
sprintf('%.4f', $callTime)
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
const IL_CHAPTER_TITLE
const IL_LAST_NODE
Definition: class.ilTree.php:4
const IL_FIRST_NODE
Definition: class.ilTree.php:5
This class represents a hierarchical form.
class ilConditionHandlerGUI
static setAction($a_action)
This class represents a hidden form property in a property form.
static getPostNodeId()
Get node ID of _POST input.
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false)
static getPostMulti()
Get multi number of _POST input.
Class ilLMObject.
showActions($a_actions)
show possible action (form buttons)
checkTree()
check the content object tree
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static clipboardCopy($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static clipboardCut($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static saveTitles($a_lm, $a_titles, $a_lang="-")
Save titles for lm objects.
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters)
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
static writeLayout($a_obj_id, $a_layout, $a_lm=null)
Write layout setting.
static pasteTree( $a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
Paste item (tree) from clipboard to current lm.
Class ilLMPageObjectGUI.
Class ilLMPageObject.
static getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode="")
Get multi lang header.
static getLayoutOption($a_txt, $a_var, $a_def_option="")
Save help mapping.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
Class ilObjectMetaDataGUI.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
This class represents a property form user interface.
Class ilStructureObjectGUI.
proceedDragDrop()
Perform drag and drop action.
initSetPageLayoutForm()
Init set page layout form.
add_cell($val, $link="")
output a cell in object list
copyItems($a_return="view")
Copy items to clipboard.
insertSubchapterClip()
Insert Chapter from clipboard.
create()
create new page or chapter in chapter
activatePages()
activates or deactivates pages
__construct(&$a_content_obj, &$a_tree)
Constructor @access public.
editMasterLanguage()
Edit master language.
saveAllTitles()
Save all titles of chapters/pages.
putInTree()
put chapter into tree
insertChapterClip($a_as_sub=false, $a_return="view")
Insert Chapter from clipboard.
cancel()
cancel creation of new page or chapter
insertPage()
Insert (multiple) pages at node.
insertSubchapter()
Insert (multiple) subchapters at node.
copyChapter()
copy a single chapter (selection)
showHierarchy()
Show subhiearchy of pages and subchapters.
static _goto($a_target, $a_target_ref_id="")
redirect script
switchToLanguage()
Switch to language.
insertChapter($a_as_sub=false)
Insert (multiple) chapters at node.
insertPageClip()
Insert pages from clipboard.
cutItems($a_return="view")
Copy items to clipboard, then cut them from the current tree.
setPageLayout()
Set layout for multipl pages.
setStructureObject(&$a_st_object)
set structure object
getType()
this function is called by condition handler gui interface
Class ilStructreObject.
static _getPresentationTitle( $a_st_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
get presentation title
special template class to simplify handling of ITX/PEAR
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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 sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
$i
Definition: disco.tpl.php:19
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
global $ilErr
Definition: raiseError.php:16
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18