ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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, ilMDEditorGUI

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 640 of file class.ilStructureObjectGUI.php.

641 {
642 global $rbacsystem, $ilErr, $lng, $ilAccess;
643
644 // determine learning object
645 $lm_id = ilLMObject::_lookupContObjID($a_target);
646
647 // get all references
648 $ref_ids = ilObject::_getAllReferences($lm_id);
649
650 // always try passed ref id first
651 if (in_array($a_target_ref_id, $ref_ids))
652 {
653 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
654 }
655
656 // check read permissions
657 foreach ($ref_ids as $ref_id)
658 {
659 // Permission check
660 if ($ilAccess->checkAccess("read", "", $ref_id))
661 {
662 // don't redirect anymore, just set parameters
663 // (goto.php includes "ilias.php")
664 $_GET["baseClass"] = "ilLMPresentationGUI";
665 $_GET["obj_id"] = $a_target;
666 $_GET["ref_id"] = $ref_id;
667 include_once("ilias.php");
668 exit;;
669 }
670 }
671
672 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
673 {
674 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
675 ilObject::_lookupTitle($lm_id)), true);
676 include_once("./Services/Object/classes/class.ilObjectGUI.php");
678 }
679
680 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
681 }
$_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 510 of file class.ilStructureObjectGUI.php.

511 {
512 global $lng;
513
514 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
515 if (is_array($_POST["id"]))
516 {
517 $act_items = array();
518 // get all "top" ids, i.e. remove ids, that have a selected parent
519 foreach($_POST["id"] as $id)
520 {
521 $path = $this->tree->getPathId($id);
522 $take = true;
523 foreach($path as $path_id)
524 {
525 if ($path_id != $id && in_array($path_id, $_POST["id"]))
526 {
527 $take = false;
528 }
529 }
530 if ($take)
531 {
532 $act_items[] = $id;
533 }
534 }
535
536
537 foreach($act_items as $id)
538 {
539 $childs = $this->tree->getChilds($id);
540 foreach($childs as $child)
541 {
542 if (ilLMObject::_lookupType($child["child"]) == "pg")
543 {
544 $act = ilLMPage::_lookupActive($child["child"],
545 $this->content_object->getType());
546 ilLMPage::_writeActive($child["child"],
547 $this->content_object->getType(), !$act);
548 }
549 }
550 if (ilLMObject::_lookupType($id) == "pg")
551 {
552 $act = ilLMPage::_lookupActive($id,
553 $this->content_object->getType());
555 $this->content_object->getType(), !$act);
556 }
557 }
558 }
559 else
560 {
561 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
562 }
563
564 $this->ctrl->redirect($this, "view");
565 }
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 371 of file class.ilStructureObjectGUI.php.

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

◆ cancel()

ilStructureObjectGUI::cancel ( )

cancel creation of new page or chapter

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

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

References $_GET.

◆ copyChapter()

ilStructureObjectGUI::copyChapter ( )

copy a single chapter (selection)

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

493 {
494 $this->copyItems("subchap");
495 }
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 229 of file class.ilStructureObjectGUI.php.

230 {
231 global $ilCtrl, $lng;
232
233 $items = ilUtil::stripSlashesArray($_POST["id"]);
234 if (!is_array($items))
235 {
236 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
237 $ilCtrl->redirect($this, "showHierarchy");
238 }
239
240 $todel = array(); // delete IDs < 0 (needed for non-js editing)
241 foreach($items as $k => $item)
242 {
243 if ($item < 0)
244 {
245 $todel[] = $k;
246 }
247 }
248 foreach($todel as $k)
249 {
250 unset($items[$k]);
251 }
252
253 if (!ilLMObject::uniqueTypesCheck($items))
254 {
255 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
256 $ilCtrl->redirect($this, "showHierarchy");
257 }
258
259 ilLMObject::clipboardCopy($this->content_object->getId(), $items);
261
262 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
263 $ilCtrl->redirect($this, $a_return);
264 }
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 460 of file class.ilStructureObjectGUI.php.

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

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 115 of file class.ilStructureObjectGUI.php.

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

References $_GET, and setTabs().

+ Here is the call graph for this function:

◆ cutChapter()

ilStructureObjectGUI::cutChapter ( )

Cut chapter(s)

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

485 {
486 $this->cutItems("subchap");
487 }
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 188 of file class.ilStructureObjectGUI.php.

189 {
190 global $ilCtrl, $lng;
191
192 $items = ilUtil::stripSlashesArray($_POST["id"]);
193 if (!is_array($items))
194 {
195 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
196 $ilCtrl->redirect($this, "showHierarchy");
197 }
198
199 $todel = array(); // delete IDs < 0 (needed for non-js editing)
200 foreach($items as $k => $item)
201 {
202 if ($item < 0)
203 {
204 $todel[] = $k;
205 }
206 }
207 foreach($todel as $k)
208 {
209 unset($items[$k]);
210 }
211
212 if (!ilLMObject::uniqueTypesCheck($items))
213 {
214 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
215 $ilCtrl->redirect($this, "showHierarchy");
216 }
217
218 ilLMObject::clipboardCut($this->content_object->getId(), $items);
220 //ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"), true);
221 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
222
223 $ilCtrl->redirect($this, $a_return);
224 }
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 452 of file class.ilStructureObjectGUI.php.

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

References cutItems().

+ Here is the call graph for this function:

◆ edit()

ilStructureObjectGUI::edit ( )

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

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

References view().

+ Here is the call graph for this function:

◆ editMasterLanguage()

ilStructureObjectGUI::editMasterLanguage ( )

Edit master language.

Parameters

return

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

1000 {
1001 global $ilCtrl;
1002
1003 $ilCtrl->setParameter($this, "transl", "");
1004 $ilCtrl->redirect($this, "showHierarchy");
1005 }

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 'ilmdeditorgui':
69
70 $this->setTabs();
71 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
72
73 $md_gui =& new ilMDEditorGUI($this->content_object->getID(),
74 $this->obj->getId(), $this->obj->getType());
75 $md_gui->addObserver($this->obj,'MDUpdateListener','General');
76
77 $this->ctrl->forwardCommand($md_gui);
78 break;
79
80 case "ilconditionhandlergui":
81 global $ilTabs;
82 include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
83
84 $this->setTabs();
86 $this->ctrl->forwardCommand($this->condHI);
87 $ilTabs->setTabActive('preconditions');
88 break;
89
90 default:
91 if($cmd == 'listConditions')
92 {
93 $this->setTabs();
95 $ret =& $this->condHI->executeCommand();
96 }
97 elseif(($cmd == "create") && ($_POST["new_type"] == "pg"))
98 {
99 $this->setTabs();
100 $pg_gui =& new ilLMPageObjectGUI($this->content_object);
101 $ret =& $pg_gui->executeCommand();
102 }
103 else
104 {
105 $ret =& $this->$cmd();
106 }
107 break;
108 }
109 }
Class ilLMPageObjectGUI.
$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 571 of file class.ilStructureObjectGUI.php.

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ initSetPageLayoutForm()

ilStructureObjectGUI::initSetPageLayoutForm ( )

Init set page layout form.

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

947 {
948 global $lng, $ilCtrl;
949
950 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
951 $this->form = new ilPropertyFormGUI();
952
953 if (is_array($_POST["id"]))
954 {
955 foreach ($_POST["id"] as $id)
956 {
957 $hi = new ilHiddenInputGUI("id[]");
958 $hi->setValue($id);
959 $this->form->addItem($hi);
960 }
961 }
962 $layout = ilObjContentObjectGUI::getLayoutOption($lng->txt("cont_layout"), "layout",
963 $this->content_object->getLayout());
964
965 $this->form->addItem($layout);
966
967 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
968 $this->form->addCommandButton("showHierarchy", $lng->txt("cancel"));
969
970 $this->form->setTitle($lng->txt("cont_set_layout"));
971 $this->form->setFormAction($ilCtrl->getFormAction($this));
972
973 }
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 686 of file class.ilStructureObjectGUI.php.

687 {
688 global $ilCtrl, $lng;
689
690 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
691
694
695 if ($a_as_sub) // as subchapter
696 {
697 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) // insert under parent
698 {
699 $parent_id = $node_id;
700 $target = "";
701 }
702 else // we shouldnt end up here
703 {
704 $ilCtrl->redirect($this, "showHierarchy");
705 return;
706 }
707 }
708 else // as chapter
709 {
710 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) // insert after node id
711 {
712 $parent_id = $this->tree->getParentId($node_id);
713 $target = $node_id;
714 }
715 else // insert as first child
716 {
717 $parent_id = $node_id;
718 $target = IL_FIRST_NODE;
719 }
720 }
721 for ($i = 1; $i <= $num; $i++)
722 {
723 $chap = new ilStructureObject($this->content_object);
724 $chap->setType("st");
725 $chap->setTitle($lng->txt("cont_new_chap"));
726 $chap->setLMId($this->content_object->getId());
727 $chap->create();
728 ilLMObject::putInTree($chap, $parent_id, $target);
729 }
730
731 $ilCtrl->redirect($this, "view");
732 }
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 747 of file class.ilStructureObjectGUI.php.

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

830 {
831 global $ilCtrl, $lng;
832
833 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
834
837
838 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) // insert after node id
839 {
840 $parent_id = $this->tree->getParentId($node_id);
841 $target = $node_id;
842 }
843 else // insert as first child
844 {
845 $parent_id = $node_id;
846 $target = IL_FIRST_NODE;
847 }
848
849 for ($i = 1; $i <= $num; $i++)
850 {
851 $page = new ilLMPageObject($this->content_object);
852 $page->setType("pg");
853 $page->setTitle($lng->txt("cont_new_page"));
854 $page->setLMId($this->content_object->getId());
855 $page->create();
856 ilLMObject::putInTree($page, $parent_id, $target);
857 }
858
859 $ilCtrl->redirect($this, "showHierarchy");
860 }
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 865 of file class.ilStructureObjectGUI.php.

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

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 737 of file class.ilStructureObjectGUI.php.

738 {
739 global $ilCtrl;
740
741 $this->insertChapter(true);
742 }
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 821 of file class.ilStructureObjectGUI.php.

822 {
823 $this->insertChapterClip(true);
824 }
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 500 of file class.ilStructureObjectGUI.php.

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

References $ilUser, and insertChapterClip().

+ Here is the call graph for this function:

◆ pastePage()

ilStructureObjectGUI::pastePage ( )

paste page

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

469 {
470 global $ilUser;
471
472 if (!$ilUser->clipboardHasObjectsOfType("pg"))
473 {
474 $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
475 }
476
477 return $this->insertPageClip();
478 }
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 911 of file class.ilStructureObjectGUI.php.

912 {
913 global $ilCtrl;
914
915//echo "-".$_POST["il_hform_source_id"]."-".$_POST["il_hform_target_id"]."-".$_POST["il_hform_fc"]."-";
916 $this->content_object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
917 $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
918 $ilCtrl->redirect($this, "showHierarchy");
919 }

References $_POST, and $ilCtrl.

◆ putInTree()

ilStructureObjectGUI::putInTree ( )

put chapter into tree

Reimplemented from ilLMObjectGUI.

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

419 {
420//echo "st:putInTree";
421 // chapters should be behind pages in the tree
422 // so if target is first node, the target is substituted with
423 // the last child of type pg
424 if ($_GET["target"] == IL_FIRST_NODE)
425 {
426 $tree = new ilTree($this->content_object->getId());
427 $tree->setTableNames('lm_tree','lm_data');
428 $tree->setTreeTablePK("lm_id");
429
430 // determine parent node id
431 $parent_id = (!empty($_GET["obj_id"]))
432 ? $_GET["obj_id"]
433 : $tree->getRootId();
434 // determine last child of type pg
435 $childs =& $tree->getChildsByType($parent_id, "pg");
436 if (count($childs) != 0)
437 {
438 $_GET["target"] = $childs[count($childs) - 1]["obj_id"];
439 }
440 }
441 if (empty($_GET["target"]))
442 {
443 $_GET["target"] = IL_LAST_NODE;
444 }
445
446 parent::putInTree();
447 }
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 392 of file class.ilStructureObjectGUI.php.

393 {
394
395 $this->obj =& new ilStructureObject($this->content_object);
396
397 $this->obj->setType("st");
398 $this->obj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
399 $this->obj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
400 $this->obj->setLMId($this->content_object->getId());
401 $this->obj->create();
402
403 $this->putInTree();
404
405 // check the tree
406 $this->checkTree();
407
408 if (!empty($_GET["obj_id"]))
409 {
410 $this->ctrl->redirect($this, "subchap");
411 }
412
413 }
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 269 of file class.ilStructureObjectGUI.php.

270 {
271 global $ilCtrl;
272
273 ilLMObject::saveTitles($this->content_object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
274
275 $ilCtrl->redirect($this, "showHierarchy");
276 }
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 978 of file class.ilStructureObjectGUI.php.

979 {
980 global $lng, $ilCtrl;
981
982 foreach ($_POST["id"] as $id)
983 {
984 $id = ilUtil::stripSlashes($id);
986 ilUtil::stripSlashes($_POST["layout"]),
987 $this->content_object);
988 }
989 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
990 $ilCtrl->redirect($this, "showHierarchy");
991 }
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 928 of file class.ilStructureObjectGUI.php.

929 {
930 global $tpl, $ilCtrl, $lng;
931
932 if (!is_array($_POST["id"]))
933 {
934 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
935 $ilCtrl->redirect($this, "showHierarchy");
936 }
937
938 $this->initSetPageLayoutForm();
939
940 $tpl->setContent($this->form->getHTML());
941 }
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 607 of file class.ilStructureObjectGUI.php.

608 {
609 global $ilTabs, $ilUser, $lng;
610
611 // subelements
612 $ilTabs->addTarget("cont_pages_and_subchapters",
613 $this->ctrl->getLinkTarget($this,'showHierarchy'),
614 array("view", "showHierarchy"), get_class($this));
615
616 // preconditions
617 $ilTabs->addTarget("preconditions",
618 $this->ctrl->getLinkTarget($this, 'listConditions'),
619 "listConditions", get_class($this));
620
621 // metadata
622 $ilTabs->addTarget("meta_data",
623 $this->ctrl->getLinkTargetByClass("ilmdeditorgui",''),
624 "", "ilmdeditorgui");
625
626 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_st.svg"));
627 $this->tpl->setTitle(
628 $this->lng->txt($this->obj->getType()).": ".$this->obj->getTitle());
629
630 // presentation view
631 $ilTabs->addNonTabbedLink("pres_mode", $lng->txt("cont_presentation_view"),
632 ILIAS_HTTP_PATH."/goto.php?target=st_".$this->obj->getId(), "_top");
633 }
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 143 of file class.ilStructureObjectGUI.php.

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

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

1014 {
1015 global $ilCtrl;
1016
1017 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
1018 $ilCtrl->redirect($this, "showHierarchy");
1019 }

References $_GET, and $ilCtrl.

◆ view()

ilStructureObjectGUI::view ( )

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

133 {
134 global $tree, $ilUser, $ilCtrl, $lng;
135
136 $this->showHierarchy();
137 }
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: