ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStructureObjectGUI Class Reference

User Interface for Structure Objects Editing. More...

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

Public Member Functions

 __construct (ilObjLearningModule $a_content_obj, ilLMTree $a_tree)
 
 setStructureObject (ilStructureObject $a_st_object)
 
 getType ()
 
 executeCommand ()
 
 create ()
 
 edit ()
 
 view ()
 
 showHierarchy ()
 
 cutItems (string $a_return="view")
 Copy items to clipboard, then cut them from the current tree. More...
 
 copyItems (string $a_return="view")
 Copy items to clipboard. More...
 
 saveAllTitles ()
 Save all titles of chapters/pages. More...
 
 subchap ()
 display subchapters of structure object More...
 
 save ()
 
 putInTree (?int $target=null)
 put chapter into tree More...
 
 cutPage ()
 
 copyPage ()
 
 pastePage ()
 
 cutChapter ()
 
 copyChapter ()
 copy a single chapter (selection) More...
 
 pasteChapter ()
 
 activatePages ()
 
 initConditionHandlerInterface ()
 
 cancel ()
 cancel creation of new page or chapter More...
 
 setTabs ()
 
 insertChapter (bool $a_as_sub=false)
 Insert (multiple) chapters at node. More...
 
 insertSubchapter ()
 Insert (multiple) subchapters at node. More...
 
 insertChapterClip (bool $a_as_sub=false, string $a_return="view")
 Insert Chapter from clipboard. More...
 
 insertSubchapterClip ()
 
 insertPage ()
 
 insertPageClip ()
 
 proceedDragDrop ()
 
 setPageLayout ()
 Set layout for multipl pages. More...
 
 initSetPageLayoutForm ()
 Init set page layout form. More...
 
 savePageLayout ()
 Save page layout. More...
 
 editMasterLanguage ()
 
 switchToLanguage ()
 
 insertTemplate ()
 Displays GUI to select template for page. More...
 
 initInsertTemplateForm ()
 
 insertPageFromTemplate ()
 Insert (multiple) pages templates at node. More...
 
- Public Member Functions inherited from ilLMObjectGUI
 __construct (ilObjLearningModule $a_content_obj)
 constructor More...
 
 setActions (?array $a_actions=null)
 
 getTargetFrame (string $a_cmd, string $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 create ()
 structure / page object creation form More...
 
 getCreateForm ()
 
 putInTree (?int $target=0)
 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...
 
 showActions (array $a_actions)
 show possible action (form buttons) More...
 
 checkTree ()
 check the content object tree More...
 

Static Public Member Functions

static _goto (string $a_target, int $a_target_ref_id=0)
 

Data Fields

ilLMTree $tree
 
- Data Fields inherited from ilLMObjectGUI
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilLMObject $obj
 
ilCtrl $ctrl
 
ilObjLearningModule $content_object
 
array $actions
 

Protected Attributes

ilPropertyFormGUI $form
 
ilConditionHandlerGUI $condHI
 
ilObjUser $user
 
ilTabsGUI $tabs
 
ilLogger $log
 
- Protected Attributes inherited from ilLMObjectGUI
int $requested_ref_id
 
ILIAS DI UIServices $ui
 
int $requested_obj_id
 
string $requested_totransl = ""
 
string $requested_transl = ""
 
string $requested_target
 
string $requested_new_type
 
array $target_frame
 
EditingGUIRequest $request
 

Detailed Description

User Interface for Structure Objects Editing.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilStructureObjectGUI: ilConditionHandlerGUI, ilObjectMetaDataGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilStructureObjectGUI::__construct ( ilObjLearningModule  $a_content_obj,
ilLMTree  $a_tree 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

39  {
40  global $DIC;
41 
42  $this->user = $DIC->user();
43  $this->ctrl = $DIC->ctrl();
44  $this->lng = $DIC->language();
45  $this->tabs = $DIC->tabs();
46  $this->log = $DIC["ilLog"];
47  $this->tpl = $DIC->ui()->mainTemplate();
48  parent::__construct($a_content_obj);
49  $this->tree = $a_tree;
50  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilStructureObjectGUI::_goto ( string  $a_target,
int  $a_target_ref_id = 0 
)
static
Exceptions
ilPermissionException

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

References ilLMObjectGUI\$ctrl, $DIC, ilLMObjectGUI\$lng, $ref_id, ilObject\_getAllReferences(), ilObjectGUI\_gotoRepositoryRoot(), ilLMObject\_lookupContObjID(), ilObject\_lookupTitle(), ilCtrl\redirectByClass(), ROOT_FOLDER_ID, ilCtrl\setParameterByClass(), and ilLanguage\txt().

563  : void {
564  global $DIC;
565  $main_tpl = $DIC->ui()->mainTemplate();
566 
567  $lng = $DIC->language();
568  $ilAccess = $DIC->access();
569  $ctrl = $DIC->ctrl();
570 
571  // determine learning object
572  $lm_id = ilLMObject::_lookupContObjID($a_target);
573 
574  // get all references
575  $ref_ids = ilObject::_getAllReferences($lm_id);
576 
577  // always try passed ref id first
578  if (in_array($a_target_ref_id, $ref_ids)) {
579  $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
580  }
581 
582  // check read permissions
583  foreach ($ref_ids as $ref_id) {
584  // Permission check
585  if ($ilAccess->checkAccess("read", "", $ref_id)) {
586  $ctrl->setParameterByClass("ilLMPresentationGUI", "obj_id", $a_target);
587  $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $ref_id);
588  $ctrl->redirectByClass("ilLMPresentationGUI", "");
589  }
590  }
591 
592  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
593  $main_tpl->setOnScreenMessage('failure', sprintf(
594  $lng->txt("msg_no_perm_read_item"),
595  ilObject::_lookupTitle($lm_id)
596  ), true);
598  }
599 
600  throw new ilPermissionException($lng->txt("msg_no_perm_read_lm"));
601  }
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const ROOT_FOLDER_ID
Definition: constants.php:32
static _getAllReferences(int $id)
get all reference ids for object ID
setParameterByClass(string $a_class, string $a_parameter, $a_value)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67
static _lookupTitle(int $obj_id)
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
+ Here is the call graph for this function:

◆ activatePages()

ilStructureObjectGUI::activatePages ( )

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

References $id, ilLMObjectGUI\$lng, $path, ilPageObject\_lookupActive(), ilLMObject\_lookupType(), ilPageObject\_writeActive(), ILIAS\Repository\ctrl(), and ilLanguage\txt().

428  : void
429  {
430  $lng = $this->lng;
431 
432  $ids = $this->request->getIds();
433  if (count($ids) > 0) {
434  $act_items = array();
435  // get all "top" ids, i.e. remove ids, that have a selected parent
436  foreach ($ids as $id) {
437  $path = $this->tree->getPathId($id);
438  $take = true;
439  foreach ($path as $path_id) {
440  if ($path_id != $id && in_array($path_id, $ids)) {
441  $take = false;
442  }
443  }
444  if ($take) {
445  $act_items[] = $id;
446  }
447  }
448 
449 
450  foreach ($act_items as $id) {
451  $childs = $this->tree->getChilds($id);
452  foreach ($childs as $child) {
453  if (ilLMObject::_lookupType($child["child"]) == "pg") {
455  $child["child"],
456  $this->content_object->getType()
457  );
459  $child["child"],
460  $this->content_object->getType(),
461  !$act
462  );
463  }
464  }
465  if (ilLMObject::_lookupType($id) == "pg") {
467  $id,
468  $this->content_object->getType()
469  );
471  $id,
472  $this->content_object->getType(),
473  !$act
474  );
475  }
476  }
477  } else {
478  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
479  }
480 
481  $this->ctrl->redirect($this, "view");
482  }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$path
Definition: ltiservices.php:32
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status
static _lookupType(int $a_obj_id, int $a_lm_id=0)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ cancel()

ilStructureObjectGUI::cancel ( )

cancel creation of new page or chapter

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

References ILIAS\Repository\ctrl().

499  : void
500  {
501  if ($this->requested_obj_id != 0) {
502  if ($this->requested_new_type == "pg") {
503  $this->ctrl->redirect($this, "view");
504  } else {
505  $this->ctrl->redirect($this, "subchap");
506  }
507  }
508  }
+ Here is the call graph for this function:

◆ copyChapter()

ilStructureObjectGUI::copyChapter ( )

copy a single chapter (selection)

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

References copyItems().

418  : void
419  {
420  $this->copyItems("subchap");
421  }
copyItems(string $a_return="view")
Copy items to clipboard.
+ Here is the call graph for this function:

◆ copyItems()

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

Copy items to clipboard.

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

References ilLMObjectGUI\$ctrl, ilLMObjectGUI\$lng, ilLMObject\clipboardCopy(), ilEditClipboard\setAction(), ilLanguage\txt(), and ilLMObject\uniqueTypesCheck().

Referenced by copyChapter(), and copyPage().

203  : void {
204  $ilCtrl = $this->ctrl;
205  $lng = $this->lng;
206 
207  $items = $this->request->getIds();
208  if (count($items) == 0) {
209  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
210  $ilCtrl->redirect($this, "showHierarchy");
211  }
212 
213  $todel = array(); // delete IDs < 0 (needed for non-js editing)
214  foreach ($items as $k => $item) {
215  if ($item < 0) {
216  $todel[] = $k;
217  }
218  }
219  foreach ($todel as $k) {
220  unset($items[$k]);
221  }
222 
223  if (!ilLMObject::uniqueTypesCheck($items)) {
224  $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_choose_pages_or_chapters_only"), true);
225  $ilCtrl->redirect($this, "showHierarchy");
226  }
227 
228  ilLMObject::clipboardCopy($this->content_object->getId(), $items);
230 
231  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_copied"), true);
232  $ilCtrl->redirect($this, $a_return);
233  }
static setAction(string $a_action)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static uniqueTypesCheck(array $a_items)
Check for unique types (all pages or all chapters)
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyPage()

ilStructureObjectGUI::copyPage ( )

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

References copyItems().

394  : void
395  {
396  $this->copyItems();
397  }
copyItems(string $a_return="view")
Copy items to clipboard.
+ Here is the call graph for this function:

◆ create()

ilStructureObjectGUI::create ( )

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

References setTabs().

104  : void
105  {
106  if ($this->requested_obj_id != 0) {
107  $this->setTabs();
108  }
109  parent::create();
110  }
+ Here is the call graph for this function:

◆ cutChapter()

ilStructureObjectGUI::cutChapter ( )

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

References cutItems().

410  : void
411  {
412  $this->cutItems("subchap");
413  }
cutItems(string $a_return="view")
Copy items to clipboard, then cut them from the current tree.
+ Here is the call graph for this function:

◆ cutItems()

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

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

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

References ilLMObjectGUI\$ctrl, ilLMObjectGUI\$lng, ilLMObject\clipboardCut(), ilEditClipboard\setAction(), ilLanguage\txt(), and ilLMObject\uniqueTypesCheck().

Referenced by cutChapter(), and cutPage().

166  : void {
167  $ilCtrl = $this->ctrl;
168  $lng = $this->lng;
169 
170  $items = $this->request->getIds();
171  if (count($items) == 0) {
172  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
173  $ilCtrl->redirect($this, "showHierarchy");
174  }
175 
176  $todel = array(); // delete IDs < 0 (needed for non-js editing)
177  foreach ($items as $k => $item) {
178  if ($item < 0) {
179  $todel[] = $k;
180  }
181  }
182  foreach ($todel as $k) {
183  unset($items[$k]);
184  }
185 
186  if (!ilLMObject::uniqueTypesCheck($items)) {
187  $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_choose_pages_or_chapters_only"), true);
188  $ilCtrl->redirect($this, "showHierarchy");
189  }
190 
191  ilLMObject::clipboardCut($this->content_object->getId(), $items);
193  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_cut"), true);
194 
195  $ilCtrl->redirect($this, $a_return);
196  }
static setAction(string $a_action)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static uniqueTypesCheck(array $a_items)
Check for unique types (all pages or all chapters)
static clipboardCut(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cutPage()

ilStructureObjectGUI::cutPage ( )

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

References cutItems().

389  : void
390  {
391  $this->cutItems();
392  }
cutItems(string $a_return="view")
Copy items to clipboard, then cut them from the current tree.
+ Here is the call graph for this function:

◆ edit()

ilStructureObjectGUI::edit ( )

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

References view().

112  : void
113  {
114  $this->view();
115  }
+ Here is the call graph for this function:

◆ editMasterLanguage()

ilStructureObjectGUI::editMasterLanguage ( )

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

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

894  : void
895  {
896  $ilCtrl = $this->ctrl;
897 
898  $ilCtrl->setParameter($this, "transl", "-");
899  $ilCtrl->redirect($this, "showHierarchy");
900  }
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
+ Here is the call graph for this function:

◆ executeCommand()

ilStructureObjectGUI::executeCommand ( )

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

References $tabs, ilObjectMetaDataGUI\addMDObserver(), ILIAS\Repository\ctrl(), initConditionHandlerInterface(), and setTabs().

63  : void
64  {
65  $next_class = $this->ctrl->getNextClass($this);
66  $cmd = $this->ctrl->getCmd();
67 
68  switch ($next_class) {
69  case 'ilobjectmetadatagui':
70 
71  $this->setTabs();
72 
73  $md_gui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
74  $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'General');
75  $md_gui->addMDObserver($this->obj, 'MDUpdateListener', 'Educational'); // #9510
76  $this->ctrl->forwardCommand($md_gui);
77  break;
78 
79  case "ilconditionhandlergui":
80  $ilTabs = $this->tabs;
81 
82  $this->setTabs();
84  $this->ctrl->forwardCommand($this->condHI);
85  $ilTabs->setTabActive('preconditions');
86  break;
87 
88  default:
89  if ($cmd == 'listConditions') {
90  $this->setTabs();
92  $this->condHI->executeCommand();
93  } elseif (($cmd == "create") && ($this->requested_new_type == "pg")) {
94  $this->setTabs();
95  $pg_gui = new ilLMPageObjectGUI($this->content_object);
96  $pg_gui->executeCommand();
97  } else {
98  $this->$cmd();
99  }
100  break;
101  }
102  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMDObserver(object $class, string $method, string $section)
User Interface for Learning Module Page Objects Editing.
+ Here is the call graph for this function:

◆ getType()

ilStructureObjectGUI::getType ( )

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

58  : string
59  {
60  return "st";
61  }

◆ initConditionHandlerInterface()

ilStructureObjectGUI::initConditionHandlerInterface ( )

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

Referenced by executeCommand().

484  : void
485  {
486  $this->condHI = new ilConditionHandlerGUI();
487  $this->condHI->setBackButtons(array());
488  $this->condHI->setAutomaticValidation(false);
489  $this->condHI->setTargetType("st");
490  $this->condHI->setTargetRefId($this->content_object->getRefId());
491  $this->condHI->setTargetId($this->obj->getId());
492  $this->condHI->setTargetTitle($this->obj->getTitle());
493  }
class ilConditionHandlerGUI
+ Here is the caller graph for this function:

◆ initInsertTemplateForm()

ilStructureObjectGUI::initInsertTemplateForm ( )

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

References ilLMObjectGUI\$ctrl, Vendor\Package\$f, ilLMObjectGUI\$lng, ilLMObjectGUI\$ui, ilCtrl\getLinkTarget(), ilPageLayout\MODULE_LM, and ilLanguage\txt().

Referenced by insertPageFromTemplate(), and insertTemplate().

932  : Form\Standard
933  {
934  $ui = $this->ui;
935  $f = $ui->factory();
936  $ctrl = $this->ctrl;
937  $lng = $this->lng;
938 
939  $fields["title"] = $f->input()->field()->text($lng->txt("title"), "");
940  $ts = ilPageLayoutGUI::getTemplateSelection(ilPageLayout::MODULE_LM);
941  if (!is_null($ts)) {
942  $fields["layout_id"] = $ts;
943  }
944 
945  // section
946  $section1 = $f->input()->field()->section($fields, $lng->txt("cont_insert_pagelayout"));
947 
948  $form_action = $ctrl->getLinkTarget($this, "insertPageFromTemplate");
949  return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
950  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
ILIAS DI UIServices $ui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSetPageLayoutForm()

ilStructureObjectGUI::initSetPageLayoutForm ( )

Init set page layout form.

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

References ilLMObjectGUI\$ctrl, $id, ilLMObjectGUI\$lng, ILIAS\Repository\form(), ilObjContentObjectGUI\getLayoutOption(), and ilLanguage\txt().

Referenced by setPageLayout().

845  : void
846  {
847  $lng = $this->lng;
848  $ilCtrl = $this->ctrl;
849 
850  $this->form = new ilPropertyFormGUI();
851 
852  $ids = $this->request->getIds();
853  foreach ($ids as $id) {
854  $hi = new ilHiddenInputGUI("id[]");
855  $hi->setValue($id);
856  $this->form->addItem($hi);
857  }
859  $lng->txt("cont_layout"),
860  "layout",
861  $this->content_object->getLayout()
862  );
863 
864  $this->form->addItem($layout);
865 
866  $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
867  $this->form->addCommandButton("showHierarchy", $lng->txt("cancel"));
868 
869  $this->form->setTitle($lng->txt("cont_set_layout"));
870  $this->form->setFormAction($ilCtrl->getFormAction($this));
871  }
static getLayoutOption(string $a_txt, string $a_var, string $a_def_option="")
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertChapter()

ilStructureObjectGUI::insertChapter ( bool  $a_as_sub = false)

Insert (multiple) chapters at node.

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

References ilLMObjectGUI\$ctrl, $i, ilLMObjectGUI\$lng, ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostMulti(), ilHierarchyFormGUI\getPostNodeId(), ilTree\POS_FIRST_NODE, ilLMObject\putInTree(), and ilLanguage\txt().

Referenced by insertSubchapter().

608  : void {
609  $ilCtrl = $this->ctrl;
610  $lng = $this->lng;
611 
614 
615  if ($a_as_sub) { // as subchapter
616  if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert under parent
617  $parent_id = $node_id;
618  $target = "";
619  } else { // we shouldnt end up here
620  $ilCtrl->redirect($this, "showHierarchy");
621  return;
622  }
623  } else { // as chapter
624  if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
625  $parent_id = $this->tree->getParentId($node_id);
626  $target = $node_id;
627  } else { // insert as first child
628  $parent_id = $node_id;
629  $target = ilTree::POS_FIRST_NODE;
630  }
631  }
632  for ($i = 1; $i <= $num; $i++) {
633  $chap = new ilStructureObject($this->content_object);
634  $chap->setType("st");
635  $chap->setTitle($lng->txt("cont_new_chap"));
636  $chap->setLMId($this->content_object->getId());
637  $chap->create();
638  ilLMObject::putInTree($chap, (int) $parent_id, (int) $target);
639  }
640 
641  $ilCtrl->redirect($this, "view");
642  }
static getPostMulti()
Get multi number of _POST input.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getPostNodeId()
Get node ID of _POST input.
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false) ...
const POS_FIRST_NODE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertChapterClip()

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

Insert Chapter from clipboard.

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

References ilLMObjectGUI\$ctrl, $ilUser, $log, $user, ilEditClipboard\clear(), ilEditClipboard\getAction(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostNodeId(), ilTree\POS_FIRST_NODE, ilLMObject\updateInternalLinks(), and ilLogger\write().

Referenced by insertSubchapterClip(), and pasteChapter().

658  : void {
660  $ilCtrl = $this->ctrl;
661  $ilLog = $this->log;
662 
663  $ilLog->write("Insert Chapter From Clipboard");
664 
665 
668 
669  if ($a_as_sub) { // as subchapter
670  if (!$first_child) { // insert under parent
671  $parent_id = $node_id;
672  $target = "";
673  } else { // we shouldnt end up here
674  $ilCtrl->redirect($this, "showHierarchy");
675  return;
676  }
677  } else { // as chapter
678  if (!$first_child) { // insert after node id
679  $parent_id = $this->tree->getParentId($node_id);
680  $target = $node_id;
681  } else { // insert as first child
682  $parent_id = $node_id;
683  $target = ilTree::POS_FIRST_NODE;
684 
685  // do not move a chapter in front of a page
686  $childs = $this->tree->getChildsByType($parent_id, "pg");
687  if (count($childs) != 0) {
688  $target = $childs[count($childs) - 1]["obj_id"];
689  }
690  }
691  }
692 
693  // copy and paste
694  $chapters = $ilUser->getClipboardObjects("st", true);
695  $copied_nodes = array();
696 
697  foreach ($chapters as $chap) {
698  $ilLog->write("Call pasteTree, Target LM: " . $this->content_object->getId() . ", Chapter ID: " . $chap["id"]
699  . ", Parent ID: " . $parent_id . ", Target: " . $target);
700  $cid = ilLMObject::pasteTree(
701  $this->content_object,
702  $chap["id"],
703  $parent_id,
704  (int) $target,
705  (string) ($chap["insert_time"] ?? ""),
706  $copied_nodes,
707  (ilEditClipboard::getAction() == "copy")
708  );
709  $target = $cid;
710  }
711  ilLMObject::updateInternalLinks($copied_nodes);
712 
713  if (ilEditClipboard::getAction() == "cut") {
714  $ilUser->clipboardDeleteObjectsOfType("pg");
715  $ilUser->clipboardDeleteObjectsOfType("st");
717  }
718 
719  $this->content_object->checkTree();
720  $ilCtrl->redirect($this, $a_return);
721  }
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static getPostNodeId()
Get node ID of _POST input.
write(string $a_message, $a_level=ilLogLevel::INFO)
write log message
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false) ...
const POS_FIRST_NODE
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPage()

ilStructureObjectGUI::insertPage ( )

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

References ilLMObjectGUI\$ctrl, $i, ilLMObjectGUI\$lng, ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostMulti(), ilHierarchyFormGUI\getPostNodeId(), ILIAS\Repository\lng(), ilTree\POS_FIRST_NODE, ilLMObject\putInTree(), and ilLanguage\txt().

728  : void
729  {
730  $ilCtrl = $this->ctrl;
731  $lng = $this->lng;
732 
735 
736  if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
737  $parent_id = $this->tree->getParentId($node_id);
738  $target = $node_id;
739  } else { // insert as first child
740  $parent_id = $node_id;
741  $target = ilTree::POS_FIRST_NODE;
742  }
743 
744  for ($i = 1; $i <= $num; $i++) {
745  $page = new ilLMPageObject($this->content_object);
746  $page->setType("pg");
747  $page->setTitle($lng->txt("cont_new_page"));
748  $page->setLMId($this->content_object->getId());
749  $page->create();
750  ilLMObject::putInTree($page, $parent_id, $target);
751  }
752 
753  if ($num == 1) {
754  $this->tpl->setOnScreenMessage("success", $this->lng->txt("lm_page_added"), true);
755  } else {
756  $this->tpl->setOnScreenMessage("success", $this->lng->txt("lm_pages_added"), true);
757  }
758 
759  $ilCtrl->redirect($this, "showHierarchy");
760  }
static getPostMulti()
Get multi number of _POST input.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getPostNodeId()
Get node ID of _POST input.
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false) ...
const POS_FIRST_NODE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ insertPageClip()

ilStructureObjectGUI::insertPageClip ( )

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

References ilLMObjectGUI\$ctrl, $ilUser, $user, ilEditClipboard\clear(), ilEditClipboard\getAction(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostNodeId(), ilTree\POS_FIRST_NODE, and ilLMObject\updateInternalLinks().

Referenced by pastePage().

762  : void
763  {
764  $ilCtrl = $this->ctrl;
766 
769 
770  if (!$first_child) { // insert after node id
771  $parent_id = $this->tree->getParentId($node_id);
772  $target = $node_id;
773  } else { // insert as first child
774  $parent_id = $node_id;
775  $target = ilTree::POS_FIRST_NODE;
776  }
777 
778  // cut and paste
779  $pages = $ilUser->getClipboardObjects("pg");
780  $copied_nodes = array();
781  foreach ($pages as $pg) {
782  $cid = ilLMObject::pasteTree(
783  $this->content_object,
784  $pg["id"],
785  $parent_id,
786  $target,
787  (string) ($pg["insert_time"] ?? ""),
788  $copied_nodes,
789  (ilEditClipboard::getAction() == "copy")
790  );
791  $target = $cid;
792  }
793  ilLMObject::updateInternalLinks($copied_nodes);
794 
795  if (ilEditClipboard::getAction() == "cut") {
796  $ilUser->clipboardDeleteObjectsOfType("pg");
797  $ilUser->clipboardDeleteObjectsOfType("st");
799  }
800 
801  $ilCtrl->redirect($this, "view");
802  }
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
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) ...
const POS_FIRST_NODE
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPageFromTemplate()

ilStructureObjectGUI::insertPageFromTemplate ( )

Insert (multiple) pages templates at node.

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

References ilLMObjectGUI\$ctrl, $data, $DIC, initInsertTemplateForm(), ilLMPageObject\insertPagesFromTemplate(), and ILIAS\Repository\lng().

955  : void
956  {
957  global $DIC;
958 
959  $ilCtrl = $this->ctrl;
960 
961  $form = $this->initInsertTemplateForm();
962  $form = $form->withRequest($DIC->http()->request());
963  $data = $form->getData();
964  $layout_id = $data["sec"]["layout_id"];
965  $node_id = $this->request->getNodeId();
967  $this->content_object->getId(),
968  $this->request->getMulti(),
969  $node_id,
970  $this->request->getFirstChild(),
971  $layout_id,
972  $data["sec"]["title"]
973  );
974 
975  if ($this->request->getMulti() <= 1) {
976  $this->tpl->setOnScreenMessage("success", $this->lng->txt("lm_page_added"), true);
977  } else {
978  $this->tpl->setOnScreenMessage("success", $this->lng->txt("lm_pages_added"), true);
979  }
980 
981  //$ilCtrl->setParameter($this, "highlight", $page_ids);
982  $ilCtrl->redirect($this, "showHierarchy", "node_" . $node_id);
983  }
global $DIC
Definition: feed.php:28
static insertPagesFromTemplate(int $lm_id, int $num, int $node_id, bool $first_child, int $layout_id, string $title="")
Insert (multiple) pages templates at node.
+ Here is the call graph for this function:

◆ insertSubchapter()

ilStructureObjectGUI::insertSubchapter ( )

Insert (multiple) subchapters at node.

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

References insertChapter().

647  : void
648  {
649  $this->insertChapter(true);
650  }
insertChapter(bool $a_as_sub=false)
Insert (multiple) chapters at node.
+ Here is the call graph for this function:

◆ insertSubchapterClip()

ilStructureObjectGUI::insertSubchapterClip ( )

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

References insertChapterClip().

723  : void
724  {
725  $this->insertChapterClip(true);
726  }
insertChapterClip(bool $a_as_sub=false, string $a_return="view")
Insert Chapter from clipboard.
+ Here is the call graph for this function:

◆ insertTemplate()

ilStructureObjectGUI::insertTemplate ( )

Displays GUI to select template for page.

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

References ilLMObjectGUI\$ctrl, ilLMObjectGUI\$lng, $tabs, ilLMObjectGUI\$ui, ilTabsGUI\clearTargets(), ilLMPageObjectGUI\getLayoutCssFix(), ilCtrl\getLinkTarget(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostMulti(), ilHierarchyFormGUI\getPostNodeId(), initInsertTemplateForm(), ilCtrl\saveParameter(), ilTabsGUI\setBackTarget(), ilCtrl\setParameter(), setTabs(), and ilLanguage\txt().

913  : void
914  {
915  $ctrl = $this->ctrl;
916  $ui = $this->ui;
917  $lng = $this->lng;
918 
919  $this->setTabs();
920  $tabs = $this->tabs;
921  $tabs->clearTargets();
922  $tabs->setBackTarget($lng->txt("back"), $ctrl->getLinkTarget($this, "showHierarchy"));
923 
926  $ctrl->setParameter($this, "first_child", (int) ilChapterHierarchyFormGUI::getPostFirstChild());
927  $ctrl->saveParameter($this, "obj_id");
928  $form = $this->initInsertTemplateForm();
929  $this->tpl->setContent($ui->renderer()->render($form) . ilLMPageObjectGUI::getLayoutCssFix());
930  }
static getPostMulti()
Get multi number of _POST input.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getPostNodeId()
Get node ID of _POST input.
static getLayoutCssFix()
Get layout css fix (workaround for broken radio options)
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false) ...
setBackTarget(string $a_title, string $a_target, string $a_frame="")
clearTargets()
clear all targets
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
saveParameter(object $a_gui_obj, $a_parameter)
ILIAS DI UIServices $ui
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
+ Here is the call graph for this function:

◆ pasteChapter()

ilStructureObjectGUI::pasteChapter ( )

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

References insertChapterClip().

423  : void
424  {
425  $this->insertChapterClip(false, "subchap");
426  }
insertChapterClip(bool $a_as_sub=false, string $a_return="view")
Insert Chapter from clipboard.
+ Here is the call graph for this function:

◆ pastePage()

ilStructureObjectGUI::pastePage ( )

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

References $ilUser, $user, insertPageClip(), and ILIAS\Repository\lng().

399  : void
400  {
402 
403  if (!$ilUser->clipboardHasObjectsOfType("pg")) {
404  throw new ilLMException($this->lng->txt("no_page_in_clipboard"));
405  }
406 
407  $this->insertPageClip();
408  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ proceedDragDrop()

ilStructureObjectGUI::proceedDragDrop ( )

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

References ilLMObjectGUI\$ctrl, XapiProxy\$req, and ilLMObjectGUI\$request.

804  : void
805  {
806  $ilCtrl = $this->ctrl;
807 
809  $this->content_object->executeDragDrop(
810  $req->getHFormPar("source_id"),
811  $req->getHFormPar("target_id"),
812  $req->getHFormPar("fc"),
813  $req->getHFormPar("as_subitem")
814  );
815  $ilCtrl->redirect($this, "showHierarchy");
816  }
EditingGUIRequest $request
catch(\Exception $e) $req
Definition: xapiproxy.php:93

◆ putInTree()

ilStructureObjectGUI::putInTree ( ?int  $target = null)

put chapter into tree

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

References ilLMObjectGUI\$requested_target, ilTree\getChildsByType(), ilTree\getRootId(), ilTree\POS_FIRST_NODE, ilTree\POS_LAST_NODE, ilTree\setTableNames(), and ilTree\setTreeTablePK().

Referenced by save().

361  : void {
362  $target = $this->requested_target;
363  //echo "st:putInTree";
364  // chapters should be behind pages in the tree
365  // so if target is first node, the target is substituted with
366  // the last child of type pg
367  if ($target == ilTree::POS_FIRST_NODE) {
368  $tree = new ilTree($this->content_object->getId());
369  $tree->setTableNames('lm_tree', 'lm_data');
370  $tree->setTreeTablePK("lm_id");
371 
372  // determine parent node id
373  $parent_id = ($this->requested_obj_id > 0)
374  ? $this->requested_obj_id
375  : $tree->getRootId();
376  // determine last child of type pg
377  $childs = $tree->getChildsByType($parent_id, "pg");
378  if (count($childs) != 0) {
379  $target = $childs[count($childs) - 1]["obj_id"];
380  }
381  }
382  if ($target == "") {
383  $target = ilTree::POS_LAST_NODE;
384  }
385 
386  parent::putInTree($target);
387  }
setTreeTablePK(string $a_column_name)
set column containing primary key in tree table
const POS_FIRST_NODE
getChildsByType(int $a_node_id, string $a_type)
get child nodes of given node by object type
setTableNames(string $a_table_tree, string $a_table_obj_data, string $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be &#39;obj_id&#39; You may use...
const POS_LAST_NODE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilStructureObjectGUI::save ( )

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

References ilPropertyFormGUI\checkInput(), ilLMObjectGUI\checkTree(), ILIAS\Repository\ctrl(), ilLMObjectGUI\getCreateForm(), ilPropertyFormGUI\getInput(), and putInTree().

333  : void
334  {
335  $form = $this->getCreateForm();
336 
337  if ($form->checkInput()) {
338  $this->obj = new ilStructureObject($this->content_object);
339  $this->obj->setType("st");
340  $this->obj->setTitle($form->getInput("title"));
341  $this->obj->setDescription($form->getInput("desc"));
342  $this->obj->setLMId($this->content_object->getId());
343  $this->obj->create();
344 
345  $this->putInTree();
346 
347  // check the tree
348  $this->checkTree();
349  }
350 
351  if ($this->requested_obj_id > 0) {
352  $this->ctrl->redirect($this, "subchap");
353  }
354  }
checkTree()
check the content object tree
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
putInTree(?int $target=null)
put chapter into tree
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ saveAllTitles()

ilStructureObjectGUI::saveAllTitles ( )

Save all titles of chapters/pages.

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

References ilLMObjectGUI\$ctrl, ILIAS\Repository\lng(), and ilLMObject\saveTitles().

238  : void
239  {
240  $ilCtrl = $this->ctrl;
241 
242  $titles = $this->request->getTitles();
243  ilLMObject::saveTitles($this->content_object, $titles, $this->requested_transl);
244 
245  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lm_save_titles"), true);
246  $ilCtrl->redirect($this, "showHierarchy");
247  }
static saveTitles(ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
Save titles for lm objects.
+ Here is the call graph for this function:

◆ savePageLayout()

ilStructureObjectGUI::savePageLayout ( )

Save page layout.

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

References ilLMObjectGUI\$ctrl, $id, ilLMObjectGUI\$lng, ilLanguage\txt(), and ilLMObject\writeLayout().

876  : void
877  {
878  $lng = $this->lng;
879  $ilCtrl = $this->ctrl;
880 
881  $ids = $this->request->getIds();
882  $layout = $this->request->getLayout();
883  foreach ($ids as $id) {
885  $id,
886  $layout,
887  $this->content_object
888  );
889  }
890  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
891  $ilCtrl->redirect($this, "showHierarchy");
892  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static writeLayout(int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
Write layout setting.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ setPageLayout()

ilStructureObjectGUI::setPageLayout ( )

Set layout for multipl pages.

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

References ilLMObjectGUI\$ctrl, ilLMObjectGUI\$lng, ilLMObjectGUI\$tpl, ILIAS\Repository\form(), initSetPageLayoutForm(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

825  : void
826  {
827  $tpl = $this->tpl;
828  $ilCtrl = $this->ctrl;
829  $lng = $this->lng;
830 
831  $ids = $this->request->getIds();
832  if (count($ids) == 0) {
833  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
834  $ilCtrl->redirect($this, "showHierarchy");
835  }
836 
837  $this->initSetPageLayoutForm();
838 
839  $tpl->setContent($this->form->getHTML());
840  }
initSetPageLayoutForm()
Init set page layout form.
ilGlobalTemplateInterface $tpl
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setContent(string $a_html)
Sets content for standard template.
form( $class_path, string $cmd)
+ Here is the call graph for this function:

◆ setStructureObject()

ilStructureObjectGUI::setStructureObject ( ilStructureObject  $a_st_object)

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

54  : void {
55  $this->obj = $a_st_object;
56  }

◆ setTabs()

ilStructureObjectGUI::setTabs ( )

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

References ilLMObjectGUI\$lng, $tabs, ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ilObjectMetaDataGUI\getTab(), ILIAS\Repository\lng(), and ilLanguage\txt().

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

510  : void
511  {
512  $ilTabs = $this->tabs;
513  $lng = $this->lng;
514 
515  // subelements
516  $ilTabs->addTarget(
517  "cont_pages_and_subchapters",
518  $this->ctrl->getLinkTarget($this, 'showHierarchy'),
519  array("view", "showHierarchy"),
520  get_class($this)
521  );
522 
523  // preconditions
524  $ilTabs->addTarget(
525  "preconditions",
526  $this->ctrl->getLinkTarget($this, 'listConditions'),
527  "listConditions",
528  get_class($this)
529  );
530 
531  // metadata
532  $mdgui = new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
533  $mdtab = $mdgui->getTab();
534  if ($mdtab) {
535  $ilTabs->addTarget(
536  "meta_data",
537  $mdtab,
538  "",
539  "ilmdeditorgui"
540  );
541  }
542 
543  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_st.svg"));
544  $this->tpl->setTitle(
545  $this->lng->txt($this->obj->getType()) . ": " . $this->obj->getTitle()
546  );
547 
548  // presentation view
549  $ilTabs->addNonTabbedLink(
550  "pres_mode",
551  $lng->txt("cont_presentation_view"),
552  ILIAS_HTTP_PATH . "/goto.php?target=st_" . $this->obj->getId(),
553  "_top"
554  );
555  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getTab(string $base_class=null)
Get tab link if available.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showHierarchy()

ilStructureObjectGUI::showHierarchy ( )

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

References ilLMObjectGUI\$ctrl, ilLMObjectGUI\$lng, ilLMObjectGUI\$requested_transl, ilUtil\getImagePath(), ilObjContentObjectGUI\getMultiLangHeader(), ilFormGUI\setFormAction(), setTabs(), and ilLanguage\txt().

Referenced by view().

122  : void
123  {
124  $lng = $this->lng;
125  $ilCtrl = $this->ctrl;
126 
127  $this->setTabs();
128 
129  $ilCtrl->setParameter($this, "backcmd", "showHierarchy");
130 
131  $form_gui = new ilChapterHierarchyFormGUI($this->content_object->getType(), $this->requested_transl);
132  $form_gui->setFormAction($ilCtrl->getFormAction($this));
133  $form_gui->setTitle($this->obj->getTitle());
134  $form_gui->setIcon(ilUtil::getImagePath("icon_st.svg"));
135  $form_gui->setTree($this->tree);
136  $form_gui->setCurrentTopNodeId($this->obj->getId());
137  $form_gui->addMultiCommand($lng->txt("delete"), "delete");
138  $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
139  $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
140  $form_gui->addMultiCommand($lng->txt("cont_de_activate"), "activatePages");
141  if ($this->content_object->getLayoutPerPage()) {
142  $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayout");
143  }
144  $form_gui->setDragIcon(ilUtil::getImagePath("icon_pg.svg"));
145  $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
146  $form_gui->addHelpItem($lng->txt("cont_chapters_after_pages"));
147  $up_gui = "ilobjlearningmodulegui";
148  $ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
149  $ilCtrl->setParameterByClass($up_gui, "active_node", null);
150 
151  $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
152  $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
153  $ilCtrl->setParameter($this, "obj_id", $this->requested_obj_id);
154 
155  $ml_head = ilObjContentObjectGUI::getMultiLangHeader($this->content_object->getId(), $this);
156 
157  $this->tpl->setContent($ml_head . $ctpl->get());
158  $this->tpl->addOnloadCode("window.setTimeout(() => { $('body').trigger('il-lm-editor-tree'); }, 500);");
159  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setFormAction(string $a_formaction)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getMultiLangHeader(int $a_lm_id, object $a_gui_class, string $a_mode="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ subchap()

ilStructureObjectGUI::subchap ( )

display subchapters of structure object

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

References ilLMObjectGUI\$ctrl, $ilUser, $user, ilStructureObject\_getPresentationTitle(), ilLMObject\CHAPTER_TITLE, ILIAS\Repository\ctrl(), ilLegacyFormElementsUtil\formSelect(), ilUtil\getImagePath(), ILIAS\Repository\lng(), ilTree\POS_FIRST_NODE, setTabs(), and ilLMObjectGUI\showActions().

252  : void
253  {
254  $ilCtrl = $this->ctrl;
256 
257  $this->setTabs();
258 
259  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
260  $num = 0;
261 
262  $this->tpl->setCurrentBlock("form");
263  $this->ctrl->setParameter($this, "backcmd", "subchap");
264  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
265  $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_subchapters"));
266  $this->tpl->setVariable("CHECKBOX_TOP", ilTree::POS_FIRST_NODE);
267 
268  $cnt = 0;
269  $childs = $this->tree->getChilds($this->obj->getId());
270  foreach ($childs as $child) {
271  if ($child["type"] != "st") {
272  continue;
273  }
274  $this->tpl->setCurrentBlock("table_row");
275 
276  // checkbox
277  $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
278  $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.svg"));
279 
280  // type
281  $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]);
282  $link = $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view");
283  $this->tpl->setVariable("LINK_TARGET", $link);
284 
285  // title
286  $this->tpl->setVariable(
287  "TEXT_CONTENT",
289  $child["obj_id"],
291  $this->content_object->isActiveNumbering()
292  )
293  );
294 
295  $this->tpl->parseCurrentBlock();
296  $cnt++;
297  }
298 
299  if ($cnt == 0) {
300  $this->tpl->setCurrentBlock("notfound");
301  $this->tpl->setVariable("NUM_COLS", 3);
302  $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
303  $this->tpl->parseCurrentBlock();
304  }
305  //else
306  //{
307  // SHOW VALID ACTIONS
308  $this->tpl->setVariable("NUM_COLS", 3);
309  $acts = array("delete" => "delete", "cutChapter" => "cut",
310  "copyChapter" => "copyChapter");
311  if ($ilUser->clipboardHasObjectsOfType("st")) {
312  $acts["pasteChapter"] = "pasteChapter";
313  }
314  $this->showActions($acts);
315  //}
316 
317  // SHOW POSSIBLE SUB OBJECTS
318  $this->tpl->setVariable("NUM_COLS", 3);
319  $subobj = array("st");
320  $opts = ilLegacyFormElementsUtil::formSelect(12, "new_type", $subobj);
321  $this->tpl->setCurrentBlock("add_object");
322  $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
323  $this->tpl->setVariable("BTN_NAME", "create");
324  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
325  $this->tpl->parseCurrentBlock();
326 
327  $this->tpl->setCurrentBlock("form");
328  $this->tpl->parseCurrentBlock();
329 
330  $ilCtrl->setParameter($this, "obj_id", $this->requested_obj_id);
331  }
static _getPresentationTitle(int $a_st_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
const POS_FIRST_NODE
$ilUser
Definition: imgupload.php:34
showActions(array $a_actions)
show possible action (form buttons)
+ Here is the call graph for this function:

◆ switchToLanguage()

ilStructureObjectGUI::switchToLanguage ( )

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

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

902  : void
903  {
904  $ilCtrl = $this->ctrl;
905 
906  $ilCtrl->setParameter($this, "transl", $this->requested_totransl);
907  $ilCtrl->redirect($this, "showHierarchy");
908  }
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
+ Here is the call graph for this function:

◆ view()

ilStructureObjectGUI::view ( )

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

References showHierarchy().

Referenced by edit().

117  : void
118  {
119  $this->showHierarchy();
120  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $condHI

ilConditionHandlerGUI ilStructureObjectGUI::$condHI
protected

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

◆ $form

ilPropertyFormGUI ilStructureObjectGUI::$form
protected

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

◆ $log

ilLogger ilStructureObjectGUI::$log
protected

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

Referenced by insertChapterClip().

◆ $tabs

ilTabsGUI ilStructureObjectGUI::$tabs
protected

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

Referenced by executeCommand(), insertTemplate(), and setTabs().

◆ $tree

ilLMTree ilStructureObjectGUI::$tree

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

◆ $user

ilObjUser ilStructureObjectGUI::$user
protected

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