ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilStructureObjectGUI Class Reference

Class ilStructureObjectGUI. More...

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

Public Member Functions

 __construct (&$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
 __construct (&$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.

Constructor & Destructor Documentation

◆ __construct()

ilStructureObjectGUI::__construct ( $a_content_obj,
$a_tree 
)

Constructor @access public.

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

31 {
32 parent::__construct($a_content_obj);
33 $this->tree = $a_tree;
34 }

Member Function Documentation

◆ _goto()

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

redirect script

Parameters
string$a_target

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

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

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

+ Here is the call graph for this function:

◆ activatePages()

ilStructureObjectGUI::activatePages ( )

activates or deactivates pages

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

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

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

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

◆ cancel()

ilStructureObjectGUI::cancel ( )

cancel creation of new page or chapter

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

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

References $_GET.

◆ copyChapter()

ilStructureObjectGUI::copyChapter ( )

copy a single chapter (selection)

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

488 {
489 $this->copyItems("subchap");
490 }
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 224 of file class.ilStructureObjectGUI.php.

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

456 {
457 $this->copyItems();
458 }

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

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

References $_GET, and setTabs().

+ Here is the call graph for this function:

◆ cutChapter()

ilStructureObjectGUI::cutChapter ( )

Cut chapter(s)

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

480 {
481 $this->cutItems("subchap");
482 }
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 183 of file class.ilStructureObjectGUI.php.

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

448 {
449 $this->cutItems();
450 }

References cutItems().

+ Here is the call graph for this function:

◆ edit()

ilStructureObjectGUI::edit ( )

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

122 {
123 $this->view();
124 }

References view().

+ Here is the call graph for this function:

◆ editMasterLanguage()

ilStructureObjectGUI::editMasterLanguage ( )

Edit master language.

Parameters

return

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

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

References $ilCtrl.

◆ executeCommand()

ilStructureObjectGUI::executeCommand ( )

execute command

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

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

References $_POST, $cmd, 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 50 of file class.ilStructureObjectGUI.php.

51 {
52 return "st";
53 }

◆ initConditionHandlerInterface()

ilStructureObjectGUI::initConditionHandlerInterface ( )

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

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ initSetPageLayoutForm()

ilStructureObjectGUI::initSetPageLayoutForm ( )

Init set page layout form.

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

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

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

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

References $ilCtrl, $ilLog, $ilUser, $target, 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 830 of file class.ilStructureObjectGUI.php.

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

References $ilCtrl, ilLMObjectGUI\$lng, $target, 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 866 of file class.ilStructureObjectGUI.php.

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

References $ilCtrl, $ilUser, $target, 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 738 of file class.ilStructureObjectGUI.php.

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

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

496 {
497 global $ilUser;
498
499 return $this->insertChapterClip(false, "subchap");
500 }

References $ilUser, and insertChapterClip().

+ Here is the call graph for this function:

◆ pastePage()

ilStructureObjectGUI::pastePage ( )

paste page

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

464 {
465 global $ilUser;
466
467 if (!$ilUser->clipboardHasObjectsOfType("pg"))
468 {
469 $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
470 }
471
472 return $this->insertPageClip();
473 }
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 912 of file class.ilStructureObjectGUI.php.

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

References $_POST, and $ilCtrl.

◆ putInTree()

ilStructureObjectGUI::putInTree ( )

put chapter into tree

Reimplemented from ilLMObjectGUI.

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

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

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

265 {
266 global $ilCtrl;
267
268 ilLMObject::saveTitles($this->content_object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
269
270 $ilCtrl->redirect($this, "showHierarchy");
271 }
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 979 of file class.ilStructureObjectGUI.php.

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

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

42 {
43 $this->obj = $a_st_object;
44 }

◆ setTabs()

ilStructureObjectGUI::setTabs ( )

output tabs

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

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

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

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

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

References $_GET, and $ilCtrl.

◆ view()

ilStructureObjectGUI::view ( )

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

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