ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 $tpl
 
 $lng
 
 $obj
 
 $ctrl
 
 $content_object
 
 $actions
 

Protected Attributes

 $user
 
 $error
 
 $tabs
 
 $log
 

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

51 {
52 global $DIC;
53
54 $this->tree = $DIC->repositoryTree();
55 $this->user = $DIC->user();
56 $this->ctrl = $DIC->ctrl();
57 $this->lng = $DIC->language();
58 $this->error = $DIC["ilErr"];
59 $this->tabs = $DIC->tabs();
60 $this->log = $DIC["ilLog"];
61 $this->tpl = $DIC["tpl"];
62 parent::__construct($a_content_obj);
63 $this->tree = $a_tree;
64 }
user()
Definition: user.php:4
error($a_errmsg)
set error message @access public
global $DIC
Definition: saml.php:7

References $DIC, error(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

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

redirect script

Parameters
string$a_target

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

667 {
668 global $DIC;
669
670 $rbacsystem = $DIC->rbac()->system();
671 $ilErr = $DIC["ilErr"];
672 $lng = $DIC->language();
673 $ilAccess = $DIC->access();
674
675 // determine learning object
676 $lm_id = ilLMObject::_lookupContObjID($a_target);
677
678 // get all references
679 $ref_ids = ilObject::_getAllReferences($lm_id);
680
681 // always try passed ref id first
682 if (in_array($a_target_ref_id, $ref_ids)) {
683 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
684 }
685
686 // check read permissions
687 foreach ($ref_ids as $ref_id) {
688 // Permission check
689 if ($ilAccess->checkAccess("read", "", $ref_id)) {
690 // don't redirect anymore, just set parameters
691 // (goto.php includes "ilias.php")
692 $_GET["baseClass"] = "ilLMPresentationGUI";
693 $_GET["obj_id"] = $a_target;
694 $_GET["ref_id"] = $ref_id;
695 include_once("ilias.php");
696 exit;
697 ;
698 }
699 }
700
701 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
703 $lng->txt("msg_no_perm_read_item"),
705 ), true);
706 include_once("./Services/Object/classes/class.ilObjectGUI.php");
708 }
709
710 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
711 }
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

References $_GET, $DIC, $ilErr, ilLMObjectGUI\$lng, 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 520 of file class.ilStructureObjectGUI.php.

521 {
523
524 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
525 if (is_array($_POST["id"])) {
526 $act_items = array();
527 // get all "top" ids, i.e. remove ids, that have a selected parent
528 foreach ($_POST["id"] as $id) {
529 $path = $this->tree->getPathId($id);
530 $take = true;
531 foreach ($path as $path_id) {
532 if ($path_id != $id && in_array($path_id, $_POST["id"])) {
533 $take = false;
534 }
535 }
536 if ($take) {
537 $act_items[] = $id;
538 }
539 }
540
541
542 foreach ($act_items as $id) {
543 $childs = $this->tree->getChilds($id);
544 foreach ($childs as $child) {
545 if (ilLMObject::_lookupType($child["child"]) == "pg") {
547 $child["child"],
548 $this->content_object->getType()
549 );
551 $child["child"],
552 $this->content_object->getType(),
553 !$act
554 );
555 }
556 }
557 if (ilLMObject::_lookupType($id) == "pg") {
559 $id,
560 $this->content_object->getType()
561 );
563 $id,
564 $this->content_object->getType(),
565 !$act
566 );
567 }
568 }
569 } else {
570 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
571 }
572
573 $this->ctrl->redirect($this, "view");
574 }
$_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
if(!array_key_exists('StateId', $_REQUEST)) $id

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

389 {
390 if (!empty($link)) {
391 $this->tpl->setCurrentBlock("begin_link");
392 $this->tpl->setVariable("LINK_TARGET", $link);
393 $this->tpl->parseCurrentBlock();
394 $this->tpl->touchBlock("end_link");
395 }
396
397 $this->tpl->setCurrentBlock("text");
398 $this->tpl->setVariable("TEXT_CONTENT", $val);
399 $this->tpl->parseCurrentBlock();
400 $this->tpl->setCurrentBlock("table_cell");
401 $this->tpl->parseCurrentBlock();
402 }

◆ cancel()

ilStructureObjectGUI::cancel ( )

cancel creation of new page or chapter

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

598 {
599 if ($_GET["obj_id"] != 0) {
600 if ($_GET["new_type"] == "pg") {
601 $this->ctrl->redirect($this, "view");
602 } else {
603 $this->ctrl->redirect($this, "subchap");
604 }
605 }
606 }

References $_GET.

◆ copyChapter()

ilStructureObjectGUI::copyChapter ( )

copy a single chapter (selection)

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

503 {
504 $this->copyItems("subchap");
505 }
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 246 of file class.ilStructureObjectGUI.php.

247 {
250
251 $items = ilUtil::stripSlashesArray($_POST["id"]);
252 if (!is_array($items)) {
253 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
254 $ilCtrl->redirect($this, "showHierarchy");
255 }
256
257 $todel = array(); // delete IDs < 0 (needed for non-js editing)
258 foreach ($items as $k => $item) {
259 if ($item < 0) {
260 $todel[] = $k;
261 }
262 }
263 foreach ($todel as $k) {
264 unset($items[$k]);
265 }
266
267 if (!ilLMObject::uniqueTypesCheck($items)) {
268 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
269 $ilCtrl->redirect($this, "showHierarchy");
270 }
271
272 ilLMObject::clipboardCopy($this->content_object->getId(), $items);
274
275 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
276 $ilCtrl->redirect($this, $a_return);
277 }
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, ilLMObjectGUI\$ctrl, $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 470 of file class.ilStructureObjectGUI.php.

471 {
472 $this->copyItems();
473 }

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

137 {
138 if ($_GET["obj_id"] != "") {
139 $this->setTabs();
140 }
141 parent::create();
142 }

References $_GET, and setTabs().

+ Here is the call graph for this function:

◆ cutChapter()

ilStructureObjectGUI::cutChapter ( )

Cut chapter(s)

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

495 {
496 $this->cutItems("subchap");
497 }
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 209 of file class.ilStructureObjectGUI.php.

210 {
213
214 $items = ilUtil::stripSlashesArray($_POST["id"]);
215 if (!is_array($items)) {
216 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
217 $ilCtrl->redirect($this, "showHierarchy");
218 }
219
220 $todel = array(); // delete IDs < 0 (needed for non-js editing)
221 foreach ($items as $k => $item) {
222 if ($item < 0) {
223 $todel[] = $k;
224 }
225 }
226 foreach ($todel as $k) {
227 unset($items[$k]);
228 }
229
230 if (!ilLMObject::uniqueTypesCheck($items)) {
231 ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
232 $ilCtrl->redirect($this, "showHierarchy");
233 }
234
235 ilLMObject::clipboardCut($this->content_object->getId(), $items);
237 //ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"), true);
238 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
239
240 $ilCtrl->redirect($this, $a_return);
241 }
static clipboardCut($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.

References $_POST, ilLMObjectGUI\$ctrl, $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 462 of file class.ilStructureObjectGUI.php.

463 {
464 $this->cutItems();
465 }

References cutItems().

+ Here is the call graph for this function:

◆ edit()

ilStructureObjectGUI::edit ( )

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

145 {
146 $this->view();
147 }

References view().

+ Here is the call graph for this function:

◆ editMasterLanguage()

ilStructureObjectGUI::editMasterLanguage ( )

Edit master language.

Parameters

return

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

1024 {
1026
1027 $ilCtrl->setParameter($this, "transl", "");
1028 $ilCtrl->redirect($this, "showHierarchy");
1029 }

References ilLMObjectGUI\$ctrl, and $ilCtrl.

◆ executeCommand()

ilStructureObjectGUI::executeCommand ( )

execute command

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

89 {
90 //echo "<br>:cmd:".$this->ctrl->getCmd().":cmdClass:".$this->ctrl->getCmdClass().":";
91 $next_class = $this->ctrl->getNextClass($this);
92 $cmd = $this->ctrl->getCmd();
93
94 switch ($next_class) {
95 case 'ilobjectmetadatagui':
96
97 $this->setTabs();
98
99 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
100 $md_gui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
101 $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'General');
102 $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'Educational'); // #9510
103 $this->ctrl->forwardCommand($md_gui);
104 break;
105
106 case "ilconditionhandlergui":
107 $ilTabs = $this->tabs;
108 include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
109
110 $this->setTabs();
112 $this->ctrl->forwardCommand($this->condHI);
113 $ilTabs->setTabActive('preconditions');
114 break;
115
116 default:
117 if ($cmd == 'listConditions') {
118 $this->setTabs();
120 $this->condHI->executeCommand();
121 } elseif (($cmd == "create") && ($_POST["new_type"] == "pg")) {
122 $this->setTabs();
123 $pg_gui = new ilLMPageObjectGUI($this->content_object);
124 $pg_gui->executeCommand();
125 } else {
126 $this->$cmd();
127 }
128 break;
129 }
130 }
Class ilLMPageObjectGUI.
Class ilObjectMetaDataGUI.

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

81 {
82 return "st";
83 }

◆ initConditionHandlerInterface()

ilStructureObjectGUI::initConditionHandlerInterface ( )

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

581 {
582 include_once("./Services/AccessControl/classes/class.ilConditionHandlerGUI.php");
583
584 $this->condHI = new ilConditionHandlerGUI($this);
585 $this->condHI->setBackButtons(array());
586 $this->condHI->setAutomaticValidation(false);
587 $this->condHI->setTargetType("st");
588 $this->condHI->setTargetRefId($this->content_object->getRefId());
589 $this->condHI->setTargetId($this->obj->getId());
590 $this->condHI->setTargetTitle($this->obj->getTitle());
591 }
class ilConditionHandlerGUI

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ initSetPageLayoutForm()

ilStructureObjectGUI::initSetPageLayoutForm ( )

Init set page layout form.

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

968 {
971
972 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
973 $this->form = new ilPropertyFormGUI();
974
975 if (is_array($_POST["id"])) {
976 foreach ($_POST["id"] as $id) {
977 $hi = new ilHiddenInputGUI("id[]");
978 $hi->setValue($id);
979 $this->form->addItem($hi);
980 }
981 }
983 $lng->txt("cont_layout"),
984 "layout",
985 $this->content_object->getLayout()
986 );
987
988 $this->form->addItem($layout);
989
990 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
991 $this->form->addCommandButton("showHierarchy", $lng->txt("cancel"));
992
993 $this->form->setTitle($lng->txt("cont_set_layout"));
994 $this->form->setFormAction($ilCtrl->getFormAction($this));
995 }
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, ilLMObjectGUI\$ctrl, $id, $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 716 of file class.ilStructureObjectGUI.php.

717 {
720
721 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
722
725
726 if ($a_as_sub) { // as subchapter
727 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert under parent
728 $parent_id = $node_id;
729 $target = "";
730 } else { // we shouldnt end up here
731 $ilCtrl->redirect($this, "showHierarchy");
732 return;
733 }
734 } else { // as chapter
735 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
736 $parent_id = $this->tree->getParentId($node_id);
737 $target = $node_id;
738 } else { // insert as first child
739 $parent_id = $node_id;
741 }
742 }
743 for ($i = 1; $i <= $num; $i++) {
744 $chap = new ilStructureObject($this->content_object);
745 $chap->setType("st");
746 $chap->setTitle($lng->txt("cont_new_chap"));
747 $chap->setLMId($this->content_object->getId());
748 $chap->create();
749 ilLMObject::putInTree($chap, $parent_id, $target);
750 }
751
752 $ilCtrl->redirect($this, "view");
753 }
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.
$i
Definition: disco.tpl.php:19

References ilLMObjectGUI\$ctrl, $i, $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 768 of file class.ilStructureObjectGUI.php.

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

References ilLMObjectGUI\$ctrl, $ilCtrl, $ilLog, $ilUser, $log, $target, $user, 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 846 of file class.ilStructureObjectGUI.php.

847 {
850
851 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
852
855
856 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
857 $parent_id = $this->tree->getParentId($node_id);
858 $target = $node_id;
859 } else { // insert as first child
860 $parent_id = $node_id;
862 }
863
864 for ($i = 1; $i <= $num; $i++) {
865 $page = new ilLMPageObject($this->content_object);
866 $page->setType("pg");
867 $page->setTitle($lng->txt("cont_new_page"));
868 $page->setLMId($this->content_object->getId());
869 $page->create();
870 ilLMObject::putInTree($page, $parent_id, $target);
871 }
872
873 $ilCtrl->redirect($this, "showHierarchy");
874 }
Class ilLMPageObject.

References ilLMObjectGUI\$ctrl, $i, $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 879 of file class.ilStructureObjectGUI.php.

880 {
883
884 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
885
888
889 if (!$first_child) { // insert after node id
890 $parent_id = $this->tree->getParentId($node_id);
891 $target = $node_id;
892 } else { // insert as first child
893 $parent_id = $node_id;
895 }
896
897 // cut and paste
898 $pages = $ilUser->getClipboardObjects("pg");
899 $copied_nodes = array();
900 foreach ($pages as $pg) {
902 $this->content_object,
903 $pg["id"],
904 $parent_id,
905 $target,
906 $pg["insert_time"],
907 $copied_nodes,
908 (ilEditClipboard::getAction() == "copy")
909 );
910 $target = $cid;
911 }
912 ilLMObject::updateInternalLinks($copied_nodes);
913
914 if (ilEditClipboard::getAction() == "cut") {
915 $ilUser->clipboardDeleteObjectsOfType("pg");
916 $ilUser->clipboardDeleteObjectsOfType("st");
918 }
919
920 $ilCtrl->redirect($this, "view");
921 }

References ilLMObjectGUI\$ctrl, $ilCtrl, $ilUser, $target, $user, 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 758 of file class.ilStructureObjectGUI.php.

759 {
761
762 $this->insertChapter(true);
763 }
insertChapter($a_as_sub=false)
Insert (multiple) chapters at node.

References ilLMObjectGUI\$ctrl, $ilCtrl, and insertChapter().

+ Here is the call graph for this function:

◆ insertSubchapterClip()

ilStructureObjectGUI::insertSubchapterClip ( )

Insert Chapter from clipboard.

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

839 {
840 $this->insertChapterClip(true);
841 }
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 510 of file class.ilStructureObjectGUI.php.

511 {
513
514 return $this->insertChapterClip(false, "subchap");
515 }

References $ilUser, $user, and insertChapterClip().

+ Here is the call graph for this function:

◆ pastePage()

ilStructureObjectGUI::pastePage ( )

paste page

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

479 {
482
483 if (!$ilUser->clipboardHasObjectsOfType("pg")) {
484 $ilErr->raiseError($this->lng->txt("no_page_in_clipboard"), $ilErr->MESSAGE);
485 }
486
487 return $this->insertPageClip();
488 }
insertPageClip()
Insert pages from clipboard.

References $error, $ilErr, $ilUser, $user, and insertPageClip().

+ Here is the call graph for this function:

◆ proceedDragDrop()

ilStructureObjectGUI::proceedDragDrop ( )

Perform drag and drop action.

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

928 {
930
931 //echo "-".$_POST["il_hform_source_id"]."-".$_POST["il_hform_target_id"]."-".$_POST["il_hform_fc"]."-";
932 $this->content_object->executeDragDrop(
933 $_POST["il_hform_source_id"],
934 $_POST["il_hform_target_id"],
935 $_POST["il_hform_fc"],
936 $_POST["il_hform_as_subitem"]
937 );
938 $ilCtrl->redirect($this, "showHierarchy");
939 }

References $_POST, ilLMObjectGUI\$ctrl, and $ilCtrl.

◆ putInTree()

ilStructureObjectGUI::putInTree ( )

put chapter into tree

Reimplemented from ilLMObjectGUI.

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

432 {
433 //echo "st:putInTree";
434 // chapters should be behind pages in the tree
435 // so if target is first node, the target is substituted with
436 // the last child of type pg
437 if ($_GET["target"] == IL_FIRST_NODE) {
438 $tree = new ilTree($this->content_object->getId());
439 $tree->setTableNames('lm_tree', 'lm_data');
440 $tree->setTreeTablePK("lm_id");
441
442 // determine parent node id
443 $parent_id = (!empty($_GET["obj_id"]))
444 ? $_GET["obj_id"]
445 : $tree->getRootId();
446 // determine last child of type pg
447 $childs = $tree->getChildsByType($parent_id, "pg");
448 if (count($childs) != 0) {
449 $_GET["target"] = $childs[count($childs) - 1]["obj_id"];
450 }
451 }
452 if (empty($_GET["target"])) {
453 $_GET["target"] = IL_LAST_NODE;
454 }
455
456 parent::putInTree();
457 }
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 408 of file class.ilStructureObjectGUI.php.

409 {
410 $this->obj = new ilStructureObject($this->content_object);
411
412 $this->obj->setType("st");
413 $this->obj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
414 $this->obj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
415 $this->obj->setLMId($this->content_object->getId());
416 $this->obj->create();
417
418 $this->putInTree();
419
420 // check the tree
421 $this->checkTree();
422
423 if (!empty($_GET["obj_id"])) {
424 $this->ctrl->redirect($this, "subchap");
425 }
426 }
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 282 of file class.ilStructureObjectGUI.php.

283 {
285
286 ilLMObject::saveTitles($this->content_object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
287
288 ilUtil::sendSuccess($this->lng->txt("lm_save_titles"), true);
289 $ilCtrl->redirect($this, "showHierarchy");
290 }
static saveTitles($a_lm, $a_titles, $a_lang="-")
Save titles for lm objects.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ savePageLayout()

ilStructureObjectGUI::savePageLayout ( )

Save page layout.

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

1001 {
1002 $lng = $this->lng;
1004
1005 foreach ($_POST["id"] as $id) {
1009 ilUtil::stripSlashes($_POST["layout"]),
1010 $this->content_object
1011 );
1012 }
1013 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1014 $ilCtrl->redirect($this, "showHierarchy");
1015 }
static writeLayout($a_obj_id, $a_layout, $a_lm=null)
Write layout setting.

References $_POST, ilLMObjectGUI\$ctrl, $id, $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 948 of file class.ilStructureObjectGUI.php.

949 {
953
954 if (!is_array($_POST["id"])) {
955 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
956 $ilCtrl->redirect($this, "showHierarchy");
957 }
958
959 $this->initSetPageLayoutForm();
960
961 $tpl->setContent($this->form->getHTML());
962 }
initSetPageLayoutForm()
Init set page layout form.

References $_POST, ilLMObjectGUI\$ctrl, $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 71 of file class.ilStructureObjectGUI.php.

72 {
73 $this->obj = $a_st_object;
74 }

◆ setTabs()

ilStructureObjectGUI::setTabs ( )

output tabs

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

613 {
614 $ilTabs = $this->tabs;
617
618 // subelements
619 $ilTabs->addTarget(
620 "cont_pages_and_subchapters",
621 $this->ctrl->getLinkTarget($this, 'showHierarchy'),
622 array("view", "showHierarchy"),
623 get_class($this)
624 );
625
626 // preconditions
627 $ilTabs->addTarget(
628 "preconditions",
629 $this->ctrl->getLinkTarget($this, 'listConditions'),
630 "listConditions",
631 get_class($this)
632 );
633
634 // metadata
635 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
636 $mdgui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
637 $mdtab = $mdgui->getTab();
638 if ($mdtab) {
639 $ilTabs->addTarget(
640 "meta_data",
641 $mdtab,
642 "",
643 "ilmdeditorgui"
644 );
645 }
646
647 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_st.svg"));
648 $this->tpl->setTitle(
649 $this->lng->txt($this->obj->getType()) . ": " . $this->obj->getTitle()
650 );
651
652 // presentation view
653 $ilTabs->addNonTabbedLink(
654 "pres_mode",
655 $lng->txt("cont_presentation_view"),
656 ILIAS_HTTP_PATH . "/goto.php?target=st_" . $this->obj->getId(),
657 "_top"
658 );
659 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $ilUser, ilLMObjectGUI\$lng, $tabs, $user, 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 166 of file class.ilStructureObjectGUI.php.

167 {
170
171 $this->setTabs();
172
173 $ilCtrl->setParameter($this, "backcmd", "showHierarchy");
174
175 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
176 $form_gui = new ilChapterHierarchyFormGUI($this->content_object->getType(), $_GET["transl"]);
177 $form_gui->setFormAction($ilCtrl->getFormAction($this));
178 $form_gui->setTitle($this->obj->getTitle());
179 $form_gui->setIcon(ilUtil::getImagePath("icon_st.svg"));
180 $form_gui->setTree($this->tree);
181 $form_gui->setCurrentTopNodeId($this->obj->getId());
182 $form_gui->addMultiCommand($lng->txt("delete"), "delete");
183 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
184 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
185 $form_gui->addMultiCommand($lng->txt("cont_de_activate"), "activatePages");
186 if ($this->content_object->getLayoutPerPage()) {
187 $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayout");
188 }
189 $form_gui->setDragIcon(ilUtil::getImagePath("icon_pg.svg"));
190 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
191 $form_gui->addHelpItem($lng->txt("cont_chapters_after_pages"));
192 $up_gui = "ilobjlearningmodulegui";
193 $ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
194 $ilCtrl->setParameterByClass($up_gui, "active_node", "");
195
196 $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
197 $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
198 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
199
200 include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
201 $ml_head = ilObjContentObjectGUI::getMultiLangHeader($this->content_object->getId(), $this);
202
203 $this->tpl->setContent($ml_head . $ctpl->get());
204 }
This class represents a hierarchical form.
static getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode="")
Get multi lang header.
special template class to simplify handling of ITX/PEAR

References $_GET, ilLMObjectGUI\$ctrl, $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 295 of file class.ilStructureObjectGUI.php.

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

1038 {
1040
1041 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
1042 $ilCtrl->redirect($this, "showHierarchy");
1043 }

References $_GET, ilLMObjectGUI\$ctrl, and $ilCtrl.

◆ view()

ilStructureObjectGUI::view ( )

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

153 {
158
159 $this->showHierarchy();
160 }
showHierarchy()
Show subhiearchy of pages and subchapters.

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

Referenced by edit().

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

Field Documentation

◆ $error

ilStructureObjectGUI::$error
protected

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

Referenced by pastePage().

◆ $log

ilStructureObjectGUI::$log
protected

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

Referenced by insertChapterClip().

◆ $obj

ilStructureObjectGUI::$obj

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

◆ $tabs

ilStructureObjectGUI::$tabs
protected

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

Referenced by executeCommand(), and setTabs().

◆ $tree

ilStructureObjectGUI::$tree

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

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

◆ $user

ilStructureObjectGUI::$user
protected

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