ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilStructureObjectGUI Class Reference

Class ilStructureObjectGUI. More...

+ Inheritance diagram for ilStructureObjectGUI:
+ Collaboration diagram for ilStructureObjectGUI:

Public Member Functions

 ilStructureObjectGUI (&$a_content_obj, &$a_tree)
 Constructor @access public. More...
 
 setStructureObject (&$a_st_object)
 set structure object More...
 
 getType ()
 this function is called by condition handler gui interface More...
 
executeCommand ()
 execute command More...
 
 create ()
 create new page or chapter in chapter More...
 
 edit ()
 
 view ()
 
 showHierarchy ()
 Show subhiearchy of pages and subchapters. More...
 
 cutItems ($a_return="view")
 Copy items to clipboard, then cut them from the current tree. More...
 
 copyItems ($a_return="view")
 Copy items to clipboard. More...
 
 saveAllTitles ()
 Save all titles of chapters/pages. More...
 
 subchap ()
 
 add_cell ($val, $link="")
 output a cell in object list More...
 
 save ()
 save new chapter More...
 
 putInTree ()
 put chapter into tree More...
 
 cutPage ()
 cut page More...
 
 copyPage ()
 copy page More...
 
 pastePage ()
 paste page More...
 
 cutChapter ()
 Cut chapter(s) More...
 
 copyChapter ()
 copy a single chapter (selection) More...
 
 pasteChapter ()
 paste chapter More...
 
 activatePages ()
 activates or deactivates pages More...
 
 initConditionHandlerInterface ()
 
 cancel ()
 cancel creation of new page or chapter More...
 
 setTabs ()
 output tabs More...
 
 insertChapter ($a_as_sub=false)
 Insert (multiple) chapters at node. More...
 
 insertSubchapter ()
 Insert (multiple) subchapters at node. More...
 
 insertChapterClip ($a_as_sub=false, $a_return="view")
 Insert Chapter from clipboard. More...
 
 insertSubchapterClip ()
 Insert Chapter from clipboard. More...
 
 insertPage ()
 Insert (multiple) pages at node. More...
 
 insertPageClip ()
 Insert pages from clipboard. More...
 
 proceedDragDrop ()
 Perform drag and drop action. More...
 
 setPageLayout ()
 Set layout for multipl pages. More...
 
 initSetPageLayoutForm ()
 Init set page layout form. More...
 
 savePageLayout ()
 Save page layout. More...
 
 editMasterLanguage ()
 Edit master language. More...
 
 switchToLanguage ()
 Switch to language. More...
 
- Public Member Functions inherited from ilLMObjectGUI
 ilLMObjectGUI (&$a_content_obj)
 constructor More...
 
 setActions ($a_actions="")
 build action array More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 create ()
 structure / page object creation form More...
 
 putInTree ()
 put this object into content object tree More...
 
 delete ()
 Confirm deletion screen (delete page or structure objects) More...
 
 cancelDelete ()
 cancel deletion of page/structure objects More...
 
 confirmedDelete ()
 page and structure object deletion More...
 
 add_cell ($val, $link="")
 output a cell in object list More...
 
 showActions ($a_actions)
 show possible action (form buttons) More...
 
 checkTree ()
 check the content object tree More...
 

Static Public Member Functions

static _goto ($a_target, $a_target_ref_id="")
 redirect script More...
 

Data Fields

 $obj
 
 $tree
 
- Data Fields inherited from ilLMObjectGUI
 $ilias
 
 $tpl
 
 $lng
 
 $obj
 
 $ctrl
 
 $content_object
 
 $actions
 

Detailed Description

Class ilStructureObjectGUI.

User Interface for Structure Objects Editing

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilStructureObjectGUI: ilConditionHandlerGUI, ilObjectMetaDataGUI

Definition at line 21 of file class.ilStructureObjectGUI.php.

Member Function Documentation

◆ _goto()

static ilStructureObjectGUI::_goto (   $a_target,
  $a_target_ref_id = "" 
)
static

redirect script

Parameters
string$a_target

Definition at line 645 of file class.ilStructureObjectGUI.php.

646 {
647 global $rbacsystem, $ilErr, $lng, $ilAccess;
648
649 // determine learning object
650 $lm_id = ilLMObject::_lookupContObjID($a_target);
651
652 // get all references
653 $ref_ids = ilObject::_getAllReferences($lm_id);
654
655 // always try passed ref id first
656 if (in_array($a_target_ref_id, $ref_ids))
657 {
658 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
659 }
660
661 // check read permissions
662 foreach ($ref_ids as $ref_id)
663 {
664 // Permission check
665 if ($ilAccess->checkAccess("read", "", $ref_id))
666 {
667 // don't redirect anymore, just set parameters
668 // (goto.php includes "ilias.php")
669 $_GET["baseClass"] = "ilLMPresentationGUI";
670 $_GET["obj_id"] = $a_target;
671 $_GET["ref_id"] = $ref_id;
672 include_once("ilias.php");
673 exit;;
674 }
675 }
676
677 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
678 {
679 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
680 ilObject::_lookupTitle($lm_id)), true);
681 include_once("./Services/Object/classes/class.ilObjectGUI.php");
683 }
684
685 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
686 }
$_GET["client_id"]
_lookupContObjID($a_id)
get learning module / digibook id for lm object
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
exit
Definition: login.php:54
$ref_id
Definition: sahs_server.php:39

References $_GET, $ilErr, ilLMObjectGUI\$lng, $ref_id, ilObject\_getAllReferences(), ilObjectGUI\_gotoRepositoryRoot(), ilLMObject\_lookupContObjID(), ilObject\_lookupTitle(), exit, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ activatePages()

ilStructureObjectGUI::activatePages ( )

activates or deactivates pages

Definition at line 509 of file class.ilStructureObjectGUI.php.

510 {
511 global $lng;
512
513 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
514 if (is_array($_POST["id"]))
515 {
516 $act_items = array();
517 // get all "top" ids, i.e. remove ids, that have a selected parent
518 foreach($_POST["id"] as $id)
519 {
520 $path = $this->tree->getPathId($id);
521 $take = true;
522 foreach($path as $path_id)
523 {
524 if ($path_id != $id && in_array($path_id, $_POST["id"]))
525 {
526 $take = false;
527 }
528 }
529 if ($take)
530 {
531 $act_items[] = $id;
532 }
533 }
534
535
536 foreach($act_items as $id)
537 {
538 $childs = $this->tree->getChilds($id);
539 foreach($childs as $child)
540 {
541 if (ilLMObject::_lookupType($child["child"]) == "pg")
542 {
543 $act = ilLMPage::_lookupActive($child["child"],
544 $this->content_object->getType());
545 ilLMPage::_writeActive($child["child"],
546 $this->content_object->getType(), !$act);
547 }
548 }
549 if (ilLMObject::_lookupType($id) == "pg")
550 {
551 $act = ilLMPage::_lookupActive($id,
552 $this->content_object->getType());
554 $this->content_object->getType(), !$act);
555 }
556 }
557 }
558 else
559 {
560 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
561 }
562
563 $this->ctrl->redirect($this, "view");
564 }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
_writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
$_POST['username']
Definition: cron.php:12
$path
Definition: index.php:22

References $_POST, ilLMObjectGUI\$lng, $path, ilPageObject\_lookupActive(), ilLMObject\_lookupType(), ilPageObject\_writeActive(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ add_cell()

ilStructureObjectGUI::add_cell (   $val,
  $link = "" 
)

output a cell in object list

Reimplemented from ilLMObjectGUI.

Definition at line 370 of file class.ilStructureObjectGUI.php.

371 {
372 if(!empty($link))
373 {
374 $this->tpl->setCurrentBlock("begin_link");
375 $this->tpl->setVariable("LINK_TARGET", $link);
376 $this->tpl->parseCurrentBlock();
377 $this->tpl->touchBlock("end_link");
378 }
379
380 $this->tpl->setCurrentBlock("text");
381 $this->tpl->setVariable("TEXT_CONTENT", $val);
382 $this->tpl->parseCurrentBlock();
383 $this->tpl->setCurrentBlock("table_cell");
384 $this->tpl->parseCurrentBlock();
385 }

◆ cancel()

ilStructureObjectGUI::cancel ( )

cancel creation of new page or chapter

Definition at line 587 of file class.ilStructureObjectGUI.php.

588 {
589 if ($_GET["obj_id"] != 0)
590 {
591 if ($_GET["new_type"] == "pg")
592 {
593 $this->ctrl->redirect($this, "view");
594 }
595 else
596 {
597 $this->ctrl->redirect($this, "subchap");
598 }
599 }
600 }

References $_GET.

◆ copyChapter()

ilStructureObjectGUI::copyChapter ( )

copy a single chapter (selection)

Definition at line 491 of file class.ilStructureObjectGUI.php.

492 {
493 $this->copyItems("subchap");
494 }
copyItems($a_return="view")
Copy items to clipboard.

References copyItems().

+ Here is the call graph for this function:

◆ copyItems()

ilStructureObjectGUI::copyItems (   $a_return = "view")

Copy items to clipboard.

Definition at line 228 of file class.ilStructureObjectGUI.php.

229 {
230 global $ilCtrl, $lng;
231
232 $items = ilUtil::stripSlashesArray($_POST["id"]);
233 if (!is_array($items))
234 {
235 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
236 $ilCtrl->redirect($this, "showHierarchy");
237 }
238
239 $todel = array(); // delete IDs < 0 (needed for non-js editing)
240 foreach($items as $k => $item)
241 {
242 if ($item < 0)
243 {
244 $todel[] = $k;
245 }
246 }
247 foreach($todel as $k)
248 {
249 unset($items[$k]);
250 }
251
252 if (!ilLMObject::uniqueTypesCheck($items))
253 {
254 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
255 $ilCtrl->redirect($this, "showHierarchy");
256 }
257
258 ilLMObject::clipboardCopy($this->content_object->getId(), $items);
260
261 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
262 $ilCtrl->redirect($this, $a_return);
263 }
static clipboardCopy($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ilCtrl, ilLMObjectGUI\$lng, ilLMObject\clipboardCopy(), ilUtil\sendFailure(), ilUtil\sendInfo(), ilEditClipboard\setAction(), ilUtil\stripSlashesArray(), and ilLMObject\uniqueTypesCheck().

Referenced by copyChapter(), and copyPage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyPage()

ilStructureObjectGUI::copyPage ( )

copy page

Definition at line 459 of file class.ilStructureObjectGUI.php.

460 {
461 $this->copyItems();
462 }

References copyItems().

+ Here is the call graph for this function:

◆ create()

ilStructureObjectGUI::create ( )

create new page or chapter in chapter

Reimplemented from ilLMObjectGUI.

Definition at line 114 of file class.ilStructureObjectGUI.php.

115 {
116 if ($_GET["obj_id"] != "")
117 {
118 $this->setTabs();
119 }
120 parent::create();
121 }

References $_GET, and setTabs().

+ Here is the call graph for this function:

◆ cutChapter()

ilStructureObjectGUI::cutChapter ( )

Cut chapter(s)

Definition at line 483 of file class.ilStructureObjectGUI.php.

484 {
485 $this->cutItems("subchap");
486 }
cutItems($a_return="view")
Copy items to clipboard, then cut them from the current tree.

References cutItems().

+ Here is the call graph for this function:

◆ cutItems()

ilStructureObjectGUI::cutItems (   $a_return = "view")

Copy items to clipboard, then cut them from the current tree.

Definition at line 187 of file class.ilStructureObjectGUI.php.

188 {
189 global $ilCtrl, $lng;
190
191 $items = ilUtil::stripSlashesArray($_POST["id"]);
192 if (!is_array($items))
193 {
194 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
195 $ilCtrl->redirect($this, "showHierarchy");
196 }
197
198 $todel = array(); // delete IDs < 0 (needed for non-js editing)
199 foreach($items as $k => $item)
200 {
201 if ($item < 0)
202 {
203 $todel[] = $k;
204 }
205 }
206 foreach($todel as $k)
207 {
208 unset($items[$k]);
209 }
210
211 if (!ilLMObject::uniqueTypesCheck($items))
212 {
213 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
214 $ilCtrl->redirect($this, "showHierarchy");
215 }
216
217 ilLMObject::clipboardCut($this->content_object->getId(), $items);
219 //ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"), true);
220 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
221
222 $ilCtrl->redirect($this, $a_return);
223 }
clipboardCut($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.

References $_POST, $ilCtrl, ilLMObjectGUI\$lng, ilLMObject\clipboardCut(), ilUtil\sendFailure(), ilUtil\sendInfo(), ilEditClipboard\setAction(), ilUtil\stripSlashesArray(), and ilLMObject\uniqueTypesCheck().

Referenced by cutChapter(), and cutPage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cutPage()

ilStructureObjectGUI::cutPage ( )

cut page

Definition at line 451 of file class.ilStructureObjectGUI.php.

452 {
453 $this->cutItems();
454 }

References cutItems().

+ Here is the call graph for this function:

◆ edit()

ilStructureObjectGUI::edit ( )

Definition at line 123 of file class.ilStructureObjectGUI.php.

124 {
125 $this->view();
126 }

References view().

+ Here is the call graph for this function:

◆ editMasterLanguage()

ilStructureObjectGUI::editMasterLanguage ( )

Edit master language.

Parameters

return

Definition at line 1004 of file class.ilStructureObjectGUI.php.

1005 {
1006 global $ilCtrl;
1007
1008 $ilCtrl->setParameter($this, "transl", "");
1009 $ilCtrl->redirect($this, "showHierarchy");
1010 }

References $ilCtrl.

◆ executeCommand()

& ilStructureObjectGUI::executeCommand ( )

execute command

Definition at line 60 of file class.ilStructureObjectGUI.php.

61 {
62//echo "<br>:cmd:".$this->ctrl->getCmd().":cmdClass:".$this->ctrl->getCmdClass().":";
63 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd();
65
66 switch($next_class)
67 {
68 case 'ilobjectmetadatagui':
69
70 $this->setTabs();
71
72 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
73 $md_gui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
74 $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'General');
75 $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'Educational'); // #9510
76 $this->ctrl->forwardCommand($md_gui);
77 break;
78
79 case "ilconditionhandlergui":
80 global $ilTabs;
81 include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
82
83 $this->setTabs();
85 $this->ctrl->forwardCommand($this->condHI);
86 $ilTabs->setTabActive('preconditions');
87 break;
88
89 default:
90 if($cmd == 'listConditions')
91 {
92 $this->setTabs();
94 $ret =& $this->condHI->executeCommand();
95 }
96 elseif(($cmd == "create") && ($_POST["new_type"] == "pg"))
97 {
98 $this->setTabs();
99 $pg_gui =& new ilLMPageObjectGUI($this->content_object);
100 $ret =& $pg_gui->executeCommand();
101 }
102 else
103 {
104 $ret =& $this->$cmd();
105 }
106 break;
107 }
108 }
Class ilLMPageObjectGUI.
Class ilObjectMetaDataGUI.
$cmd
Definition: sahs_server.php:35

References $_POST, $cmd, $ret, initConditionHandlerInterface(), and setTabs().

+ Here is the call graph for this function:

◆ getType()

ilStructureObjectGUI::getType ( )

this function is called by condition handler gui interface

Definition at line 52 of file class.ilStructureObjectGUI.php.

53 {
54 return "st";
55 }

◆ ilStructureObjectGUI()

ilStructureObjectGUI::ilStructureObjectGUI ( $a_content_obj,
$a_tree 
)

Constructor @access public.

Definition at line 30 of file class.ilStructureObjectGUI.php.

31 {
32 global $ilias, $tpl, $lng;
33
34 parent::ilLMObjectGUI($a_content_obj);
35 $this->tree =& $a_tree;
36 }

References ilLMObjectGUI\$ilias, ilLMObjectGUI\$lng, and ilLMObjectGUI\$tpl.

◆ initConditionHandlerInterface()

ilStructureObjectGUI::initConditionHandlerInterface ( )

Definition at line 570 of file class.ilStructureObjectGUI.php.

571 {
572 include_once("./Services/AccessControl/classes/class.ilConditionHandlerGUI.php");
573
574 $this->condHI =& new ilConditionHandlerGUI($this);
575 $this->condHI->setBackButtons(array());
576 $this->condHI->setAutomaticValidation(false);
577 $this->condHI->setTargetType("st");
578 $this->condHI->setTargetRefId($this->content_object->getRefId());
579 $this->condHI->setTargetId($this->obj->getId());
580 $this->condHI->setTargetTitle($this->obj->getTitle());
581 }
class ilConditionHandlerGUI

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ initSetPageLayoutForm()

ilStructureObjectGUI::initSetPageLayoutForm ( )

Init set page layout form.

Definition at line 951 of file class.ilStructureObjectGUI.php.

952 {
953 global $lng, $ilCtrl;
954
955 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
956 $this->form = new ilPropertyFormGUI();
957
958 if (is_array($_POST["id"]))
959 {
960 foreach ($_POST["id"] as $id)
961 {
962 $hi = new ilHiddenInputGUI("id[]");
963 $hi->setValue($id);
964 $this->form->addItem($hi);
965 }
966 }
967 $layout = ilObjContentObjectGUI::getLayoutOption($lng->txt("cont_layout"), "layout",
968 $this->content_object->getLayout());
969
970 $this->form->addItem($layout);
971
972 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
973 $this->form->addCommandButton("showHierarchy", $lng->txt("cancel"));
974
975 $this->form->setTitle($lng->txt("cont_set_layout"));
976 $this->form->setFormAction($ilCtrl->getFormAction($this));
977
978 }
This class represents a hidden form property in a property form.
static getLayoutOption($a_txt, $a_var, $a_def_option="")
Save help mapping.
This class represents a property form user interface.

References $_POST, $ilCtrl, ilLMObjectGUI\$lng, and ilObjContentObjectGUI\getLayoutOption().

Referenced by setPageLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertChapter()

ilStructureObjectGUI::insertChapter (   $a_as_sub = false)

Insert (multiple) chapters at node.

Definition at line 691 of file class.ilStructureObjectGUI.php.

692 {
693 global $ilCtrl, $lng;
694
695 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
696
699
700 if ($a_as_sub) // as subchapter
701 {
702 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) // insert under parent
703 {
704 $parent_id = $node_id;
705 $target = "";
706 }
707 else // we shouldnt end up here
708 {
709 $ilCtrl->redirect($this, "showHierarchy");
710 return;
711 }
712 }
713 else // as chapter
714 {
715 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) // insert after node id
716 {
717 $parent_id = $this->tree->getParentId($node_id);
718 $target = $node_id;
719 }
720 else // insert as first child
721 {
722 $parent_id = $node_id;
723 $target = IL_FIRST_NODE;
724 }
725 }
726 for ($i = 1; $i <= $num; $i++)
727 {
728 $chap = new ilStructureObject($this->content_object);
729 $chap->setType("st");
730 $chap->setTitle($lng->txt("cont_new_chap"));
731 $chap->setLMId($this->content_object->getId());
732 $chap->create();
733 ilLMObject::putInTree($chap, $parent_id, $target);
734 }
735
736 $ilCtrl->redirect($this, "view");
737 }
const IL_FIRST_NODE
Definition: class.ilTree.php:5
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.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilStructreObject.

References $ilCtrl, ilLMObjectGUI\$lng, ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostMulti(), ilHierarchyFormGUI\getPostNodeId(), IL_FIRST_NODE, and ilLMObject\putInTree().

Referenced by insertSubchapter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertChapterClip()

ilStructureObjectGUI::insertChapterClip (   $a_as_sub = false,
  $a_return = "view" 
)

Insert Chapter from clipboard.

Definition at line 752 of file class.ilStructureObjectGUI.php.

753 {
754 global $ilUser, $ilCtrl, $ilLog;
755
756 $ilLog->write("Insert Chapter From Clipboard");
757
758 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
759
762
763 if ($a_as_sub) // as subchapter
764 {
765 if (!$first_child) // insert under parent
766 {
767 $parent_id = $node_id;
768 $target = "";
769 }
770 else // we shouldnt end up here
771 {
772 $ilCtrl->redirect($this, "showHierarchy");
773 return;
774 }
775 }
776 else // as chapter
777 {
778 if (!$first_child) // insert after node id
779 {
780 $parent_id = $this->tree->getParentId($node_id);
781 $target = $node_id;
782 }
783 else // insert as first child
784 {
785 $parent_id = $node_id;
786 $target = IL_FIRST_NODE;
787
788 // do not move a chapter in front of a page
789 $childs = $this->tree->getChildsByType($parent_id, "pg");
790 if (count($childs) != 0)
791 {
792 $target = $childs[count($childs) - 1]["obj_id"];
793 }
794 }
795 }
796
797 // copy and paste
798 $chapters = $ilUser->getClipboardObjects("st", true);
799 $copied_nodes = array();
800
801 foreach ($chapters as $chap)
802 {
803 $ilLog->write("Call pasteTree, Target LM: ".$this->content_object->getId().", Chapter ID: ".$chap["id"]
804 .", Parent ID: ".$parent_id.", Target: ".$target);
805 $cid = ilLMObject::pasteTree($this->content_object, $chap["id"], $parent_id,
806 $target, $chap["insert_time"], $copied_nodes,
807 (ilEditClipboard::getAction() == "copy"));
808 $target = $cid;
809 }
810 ilLMObject::updateInternalLinks($copied_nodes);
811
812 if (ilEditClipboard::getAction() == "cut")
813 {
814 $ilUser->clipboardDeleteObjectsOfType("pg");
815 $ilUser->clipboardDeleteObjectsOfType("st");
817 }
818
819 $this->content_object->checkTree();
820 $ilCtrl->redirect($this, $a_return);
821 }
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.
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
global $ilUser
Definition: imgupload.php:15

References $ilCtrl, $ilLog, $ilUser, ilEditClipboard\clear(), ilEditClipboard\getAction(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostNodeId(), IL_FIRST_NODE, ilLMObject\pasteTree(), and ilLMObject\updateInternalLinks().

Referenced by insertSubchapterClip(), and pasteChapter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPage()

ilStructureObjectGUI::insertPage ( )

Insert (multiple) pages at node.

Definition at line 834 of file class.ilStructureObjectGUI.php.

835 {
836 global $ilCtrl, $lng;
837
838 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
839
842
843 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) // insert after node id
844 {
845 $parent_id = $this->tree->getParentId($node_id);
846 $target = $node_id;
847 }
848 else // insert as first child
849 {
850 $parent_id = $node_id;
851 $target = IL_FIRST_NODE;
852 }
853
854 for ($i = 1; $i <= $num; $i++)
855 {
856 $page = new ilLMPageObject($this->content_object);
857 $page->setType("pg");
858 $page->setTitle($lng->txt("cont_new_page"));
859 $page->setLMId($this->content_object->getId());
860 $page->create();
861 ilLMObject::putInTree($page, $parent_id, $target);
862 }
863
864 $ilCtrl->redirect($this, "showHierarchy");
865 }
Class ilLMPageObject.

References $ilCtrl, ilLMObjectGUI\$lng, ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostMulti(), ilHierarchyFormGUI\getPostNodeId(), IL_FIRST_NODE, and ilLMObject\putInTree().

+ Here is the call graph for this function:

◆ insertPageClip()

ilStructureObjectGUI::insertPageClip ( )

Insert pages from clipboard.

Definition at line 870 of file class.ilStructureObjectGUI.php.

871 {
872 global $ilCtrl, $ilUser;
873
874 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
875
878
879 if (!$first_child) // insert after node id
880 {
881 $parent_id = $this->tree->getParentId($node_id);
882 $target = $node_id;
883 }
884 else // insert as first child
885 {
886 $parent_id = $node_id;
887 $target = IL_FIRST_NODE;
888 }
889
890 // cut and paste
891 $pages = $ilUser->getClipboardObjects("pg");
892 $copied_nodes = array();
893 foreach ($pages as $pg)
894 {
895 $cid = ilLMObject::pasteTree($this->content_object, $pg["id"], $parent_id, $target,
896 $pg["insert_time"], $copied_nodes,
897 (ilEditClipboard::getAction() == "copy"));
898 $target = $cid;
899 }
900 ilLMObject::updateInternalLinks($copied_nodes);
901
902 if (ilEditClipboard::getAction() == "cut")
903 {
904 $ilUser->clipboardDeleteObjectsOfType("pg");
905 $ilUser->clipboardDeleteObjectsOfType("st");
907 }
908
909 $ilCtrl->redirect($this, "view");
910 }

References $ilCtrl, $ilUser, ilEditClipboard\clear(), ilEditClipboard\getAction(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostNodeId(), IL_FIRST_NODE, ilLMObject\pasteTree(), and ilLMObject\updateInternalLinks().

Referenced by pastePage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertSubchapter()

ilStructureObjectGUI::insertSubchapter ( )

Insert (multiple) subchapters at node.

Definition at line 742 of file class.ilStructureObjectGUI.php.

743 {
744 global $ilCtrl;
745
746 $this->insertChapter(true);
747 }
insertChapter($a_as_sub=false)
Insert (multiple) chapters at node.

References $ilCtrl, and insertChapter().

+ Here is the call graph for this function:

◆ insertSubchapterClip()

ilStructureObjectGUI::insertSubchapterClip ( )

Insert Chapter from clipboard.

Definition at line 826 of file class.ilStructureObjectGUI.php.

827 {
828 $this->insertChapterClip(true);
829 }
insertChapterClip($a_as_sub=false, $a_return="view")
Insert Chapter from clipboard.

References insertChapterClip().

+ Here is the call graph for this function:

◆ pasteChapter()

ilStructureObjectGUI::pasteChapter ( )

paste chapter

Definition at line 499 of file class.ilStructureObjectGUI.php.

500 {
501 global $ilUser;
502
503 return $this->insertChapterClip(false, "subchap");
504 }

References $ilUser, and insertChapterClip().

+ Here is the call graph for this function:

◆ pastePage()

ilStructureObjectGUI::pastePage ( )

paste page

Definition at line 467 of file class.ilStructureObjectGUI.php.

468 {
469 global $ilUser;
470
471 if (!$ilUser->clipboardHasObjectsOfType("pg"))
472 {
473 $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
474 }
475
476 return $this->insertPageClip();
477 }
insertPageClip()
Insert pages from clipboard.
redirection script todo: (a better solution should control the processing via a xml file)

References $ilUser, and insertPageClip().

+ Here is the call graph for this function:

◆ proceedDragDrop()

ilStructureObjectGUI::proceedDragDrop ( )

Perform drag and drop action.

Definition at line 916 of file class.ilStructureObjectGUI.php.

917 {
918 global $ilCtrl;
919
920//echo "-".$_POST["il_hform_source_id"]."-".$_POST["il_hform_target_id"]."-".$_POST["il_hform_fc"]."-";
921 $this->content_object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
922 $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
923 $ilCtrl->redirect($this, "showHierarchy");
924 }

References $_POST, and $ilCtrl.

◆ putInTree()

ilStructureObjectGUI::putInTree ( )

put chapter into tree

Reimplemented from ilLMObjectGUI.

Definition at line 417 of file class.ilStructureObjectGUI.php.

418 {
419//echo "st:putInTree";
420 // chapters should be behind pages in the tree
421 // so if target is first node, the target is substituted with
422 // the last child of type pg
423 if ($_GET["target"] == IL_FIRST_NODE)
424 {
425 $tree = new ilTree($this->content_object->getId());
426 $tree->setTableNames('lm_tree','lm_data');
427 $tree->setTreeTablePK("lm_id");
428
429 // determine parent node id
430 $parent_id = (!empty($_GET["obj_id"]))
431 ? $_GET["obj_id"]
432 : $tree->getRootId();
433 // determine last child of type pg
434 $childs =& $tree->getChildsByType($parent_id, "pg");
435 if (count($childs) != 0)
436 {
437 $_GET["target"] = $childs[count($childs) - 1]["obj_id"];
438 }
439 }
440 if (empty($_GET["target"]))
441 {
442 $_GET["target"] = IL_LAST_NODE;
443 }
444
445 parent::putInTree();
446 }
const IL_LAST_NODE
Definition: class.ilTree.php:4
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

References $_GET, $tree, IL_FIRST_NODE, and IL_LAST_NODE.

Referenced by save().

+ Here is the caller graph for this function:

◆ save()

ilStructureObjectGUI::save ( )

save new chapter

Definition at line 391 of file class.ilStructureObjectGUI.php.

392 {
393
394 $this->obj =& new ilStructureObject($this->content_object);
395
396 $this->obj->setType("st");
397 $this->obj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
398 $this->obj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
399 $this->obj->setLMId($this->content_object->getId());
400 $this->obj->create();
401
402 $this->putInTree();
403
404 // check the tree
405 $this->checkTree();
406
407 if (!empty($_GET["obj_id"]))
408 {
409 $this->ctrl->redirect($this, "subchap");
410 }
411
412 }
checkTree()
check the content object tree
putInTree()
put chapter into tree
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_GET, $_POST, ilLMObjectGUI\checkTree(), putInTree(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ saveAllTitles()

ilStructureObjectGUI::saveAllTitles ( )

Save all titles of chapters/pages.

Definition at line 268 of file class.ilStructureObjectGUI.php.

269 {
270 global $ilCtrl;
271
272 ilLMObject::saveTitles($this->content_object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
273
274 $ilCtrl->redirect($this, "showHierarchy");
275 }
static saveTitles($a_lm, $a_titles, $a_lang="-")
Save titles for lm objects.

References $_GET, $_POST, $ilCtrl, ilLMObject\saveTitles(), and ilUtil\stripSlashesArray().

+ Here is the call graph for this function:

◆ savePageLayout()

ilStructureObjectGUI::savePageLayout ( )

Save page layout.

Definition at line 983 of file class.ilStructureObjectGUI.php.

984 {
985 global $lng, $ilCtrl;
986
987 foreach ($_POST["id"] as $id)
988 {
989 $id = ilUtil::stripSlashes($id);
991 ilUtil::stripSlashes($_POST["layout"]),
992 $this->content_object);
993 }
994 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
995 $ilCtrl->redirect($this, "showHierarchy");
996 }
static writeLayout($a_obj_id, $a_layout, $a_lm=null)
Write layout setting.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, $ilCtrl, ilLMObjectGUI\$lng, ilUtil\sendSuccess(), ilUtil\stripSlashes(), and ilLMObject\writeLayout().

+ Here is the call graph for this function:

◆ setPageLayout()

ilStructureObjectGUI::setPageLayout ( )

Set layout for multipl pages.

Definition at line 933 of file class.ilStructureObjectGUI.php.

934 {
935 global $tpl, $ilCtrl, $lng;
936
937 if (!is_array($_POST["id"]))
938 {
939 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
940 $ilCtrl->redirect($this, "showHierarchy");
941 }
942
943 $this->initSetPageLayoutForm();
944
945 $tpl->setContent($this->form->getHTML());
946 }
initSetPageLayoutForm()
Init set page layout form.

References $_POST, $ilCtrl, ilLMObjectGUI\$lng, ilLMObjectGUI\$tpl, initSetPageLayoutForm(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ setStructureObject()

ilStructureObjectGUI::setStructureObject ( $a_st_object)

set structure object

Parameters
object$a_st_objectstructure object

Definition at line 43 of file class.ilStructureObjectGUI.php.

44 {
45 $this->obj =& $a_st_object;
46 }

◆ setTabs()

ilStructureObjectGUI::setTabs ( )

output tabs

Definition at line 606 of file class.ilStructureObjectGUI.php.

607 {
608 global $ilTabs, $ilUser, $lng;
609
610 // subelements
611 $ilTabs->addTarget("cont_pages_and_subchapters",
612 $this->ctrl->getLinkTarget($this,'showHierarchy'),
613 array("view", "showHierarchy"), get_class($this));
614
615 // preconditions
616 $ilTabs->addTarget("preconditions",
617 $this->ctrl->getLinkTarget($this, 'listConditions'),
618 "listConditions", get_class($this));
619
620 // metadata
621 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
622 $mdgui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
623 $mdtab = $mdgui->getTab();
624 if($mdtab)
625 {
626 $ilTabs->addTarget("meta_data",
627 $mdtab,
628 "", "ilmdeditorgui");
629 }
630
631 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_st.svg"));
632 $this->tpl->setTitle(
633 $this->lng->txt($this->obj->getType()).": ".$this->obj->getTitle());
634
635 // presentation view
636 $ilTabs->addNonTabbedLink("pres_mode", $lng->txt("cont_presentation_view"),
637 ILIAS_HTTP_PATH."/goto.php?target=st_".$this->obj->getId(), "_top");
638 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $ilUser, ilLMObjectGUI\$lng, and ilUtil\getImagePath().

Referenced by create(), executeCommand(), showHierarchy(), and subchap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showHierarchy()

ilStructureObjectGUI::showHierarchy ( )

Show subhiearchy of pages and subchapters.

Definition at line 142 of file class.ilStructureObjectGUI.php.

143 {
144 global $lng, $ilCtrl;
145
146 $this->setTabs();
147
148 $ilCtrl->setParameter($this, "backcmd", "showHierarchy");
149
150 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
151 $form_gui = new ilChapterHierarchyFormGUI($this->content_object->getType(), $_GET["transl"]);
152 $form_gui->setFormAction($ilCtrl->getFormAction($this));
153 $form_gui->setTitle($this->obj->getTitle());
154 $form_gui->setIcon(ilUtil::getImagePath("icon_st.svg"));
155 $form_gui->setTree($this->tree);
156 $form_gui->setCurrentTopNodeId($this->obj->getId());
157 $form_gui->addMultiCommand($lng->txt("delete"), "delete");
158 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
159 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
160 $form_gui->addMultiCommand($lng->txt("cont_de_activate"), "activatePages");
161 if ($this->content_object->getLayoutPerPage())
162 {
163 $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayout");
164 }
165 $form_gui->setDragIcon(ilUtil::getImagePath("icon_pg.svg"));
166 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
167 $form_gui->addHelpItem($lng->txt("cont_chapters_after_pages"));
168 $up_gui = ($this->content_object->getType() == "dbk")
169 ? "ilobjdlbookgui"
170 : "ilobjlearningmodulegui";
171 $ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
172 $ilCtrl->setParameterByClass($up_gui, "active_node", "");
173
174 $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
175 $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
176 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
177
178 include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
179 $ml_head = ilObjContentObjectGUI::getMultiLangHeader($this->content_object->getId(), $this);
180
181 $this->tpl->setContent($ml_head.$ctpl->get());
182 }
This class represents a hierarchical form.
static getMultiLangHeader($a_lm_id, $a_gui_class)
Get multi lang header.
special template class to simplify handling of ITX/PEAR

References $_GET, $ilCtrl, ilLMObjectGUI\$lng, ilUtil\getImagePath(), ilObjContentObjectGUI\getMultiLangHeader(), and setTabs().

Referenced by view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ subchap()

ilStructureObjectGUI::subchap ( )

Definition at line 280 of file class.ilStructureObjectGUI.php.

281 {
282 global $tree, $ilCtrl, $lng, $ilUser;
283
284 $this->setTabs();
285
286 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
287 $num = 0;
288
289 $this->tpl->setCurrentBlock("form");
290 $this->ctrl->setParameter($this, "backcmd", "subchap");
291 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
292 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_subchapters"));
293 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
294
295 $cnt = 0;
296 $childs = $this->tree->getChilds($this->obj->getId());
297 foreach ($childs as $child)
298 {
299 if($child["type"] != "st")
300 {
301 continue;
302 }
303 $this->tpl->setCurrentBlock("table_row");
304 // color changing
305 $css_row = ilUtil::switchColor($cnt++,"tblrow1","tblrow2");
306
307 // checkbox
308 $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
309 $this->tpl->setVariable("CSS_ROW", $css_row);
310 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.svg"));
311
312 // type
313 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]);
314 $link = $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view");
315 $this->tpl->setVariable("LINK_TARGET", $link);
316
317 // title
318 $this->tpl->setVariable("TEXT_CONTENT",
320 $this->content_object->isActiveNumbering()));
321
322 $this->tpl->parseCurrentBlock();
323 }
324 if($cnt == 0)
325 {
326 $this->tpl->setCurrentBlock("notfound");
327 $this->tpl->setVariable("NUM_COLS", 3);
328 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
329 $this->tpl->parseCurrentBlock();
330 }
331 //else
332 //{
333 // SHOW VALID ACTIONS
334 $this->tpl->setVariable("NUM_COLS", 3);
335 $acts = array("delete" => "delete", "cutChapter" => "cut",
336 "copyChapter" => "copyChapter");
337 if ($ilUser->clipboardHasObjectsOfType("st"))
338 {
339 $acts["pasteChapter"] = "pasteChapter";
340 }
341 $this->showActions($acts);
342 //}
343
344 // SHOW POSSIBLE SUB OBJECTS
345 $this->tpl->setVariable("NUM_COLS", 3);
346 //$this->showPossibleSubObjects("st");
347 $subobj = array("st");
348 $opts = ilUtil::formSelect(12,"new_type",$subobj);
349 //$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
350 $this->tpl->setCurrentBlock("add_object");
351 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
352 //$this->tpl->setVariable("FORMACTION_OBJ_ADD", "adm_object.php?cmd=create&ref_id=".$_GET["ref_id"]);
353 $this->tpl->setVariable("BTN_NAME", "create");
354 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
355 $this->tpl->parseCurrentBlock();
356
357 //$this->tpl->setVariable("NUM_COLS", 2);
358 //$this->showPossibleSubObjects("st");
359
360 $this->tpl->setCurrentBlock("form");
361 $this->tpl->parseCurrentBlock();
362
363 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
364
365 }
showActions($a_actions)
show possible action (form buttons)
static _getPresentationTitle($a_st_id, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_lm_id=0, $a_lang="-")
get presentation title
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 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.

References $_GET, $ilCtrl, $ilUser, ilLMObjectGUI\$lng, $tree, ilStructureObject\_getPresentationTitle(), ilUtil\formSelect(), ilUtil\getImagePath(), IL_FIRST_NODE, setTabs(), ilLMObjectGUI\showActions(), and ilUtil\switchColor().

+ Here is the call graph for this function:

◆ switchToLanguage()

ilStructureObjectGUI::switchToLanguage ( )

Switch to language.

Parameters

return

Definition at line 1018 of file class.ilStructureObjectGUI.php.

1019 {
1020 global $ilCtrl;
1021
1022 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
1023 $ilCtrl->redirect($this, "showHierarchy");
1024 }

References $_GET, and $ilCtrl.

◆ view()

ilStructureObjectGUI::view ( )

Definition at line 131 of file class.ilStructureObjectGUI.php.

132 {
133 global $tree, $ilUser, $ilCtrl, $lng;
134
135 $this->showHierarchy();
136 }
showHierarchy()
Show subhiearchy of pages and subchapters.

References $ilCtrl, $ilUser, ilLMObjectGUI\$lng, $tree, and showHierarchy().

Referenced by edit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $obj

ilStructureObjectGUI::$obj

Definition at line 23 of file class.ilStructureObjectGUI.php.

◆ $tree

ilStructureObjectGUI::$tree

Definition at line 24 of file class.ilStructureObjectGUI.php.

Referenced by putInTree(), subchap(), and view().


The documentation for this class was generated from the following file: