ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\LearningModule\Editing\EditSubObjectsGUI Class Reference
+ Collaboration diagram for ILIAS\LearningModule\Editing\EditSubObjectsGUI:

Public Member Functions

 __construct (protected InternalDomainService $domain, protected InternalGUIService $gui, protected string $sub_type, protected \ilObjLearningModule $lm, protected string $table_title)
 
 executeCommand ()
 
 tableCommand ()
 
 switchToLanguage ()
 
 editMasterLanguage ()
 
 insertChapterClipBefore ()
 
 insertChapterClipAfter ()
 
 insertChapterClip ( $target=\ilTree::POS_LAST_NODE)
 
 insertPageClipBefore ()
 
 insertPageClipAfter ()
 
 insertPageClip (int $target=0)
 
 insertFirstPage ()
 
 insertPageAfter ()
 
 insertPageBefore ()
 
 insertFirstChapter ()
 
 insertChapterAfter ()
 
 insertChapterBefore ()
 
 editTitle (int $id)
 
 saveTitle ()
 
 saveOrder ()
 
 delete (array $ids)
 confirm deletion screen for page object and structure object deletion More...
 
 cancelDelete ()
 
 confirmedDelete (int $a_parent_subobj_id=0)
 delete page object or structure objects More...
 
 cutItems (array $ids)
 Copy items to clipboard, then cut them from the current tree. More...
 
 copyItems ($ids)
 Copy items to clipboard. More...
 
 activatePages (array $ids)
 
 insertLayoutBefore ()
 
 insertLayoutAfter ()
 
 insertLayout (bool $before=false)
 
 initInsertTemplateForm ()
 
 insertPageFromLayout ()
 

Protected Member Functions

 editPages ()
 
 getTable ()
 
 list ()
 
 insertPage (int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
 
 insertChapter (int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
 
 getEditTitleForm (int $id)
 

Protected Attributes

string $lang
 
array $page_layouts
 
EditingGUIRequest $request
 
int $lm_id
 
ilLMTree $lm_tree
 
int $sub_obj_id
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::__construct ( protected InternalDomainService  $domain,
protected InternalGUIService  $gui,
protected string  $sub_type,
protected \ilObjLearningModule  $lm,
protected string  $table_title 
)

Definition at line 39 of file class.EditSubObjectsGUI.php.

References ilPageLayout\activeLayouts(), ilObject\getId(), and ilPageLayout\MODULE_LM.

45  {
46  $this->sub_obj_id = $this->gui->editing()->request()->getObjId();
47  $this->gui->ctrl()->saveParameterByClass(self::class, "sub_type");
48  $this->lm_id = $lm->getId();
49  $this->lm_tree = $this->domain->lmTree($this->lm_id);
50  $this->request = $this->gui->editing()->request();
51  $this->page_layouts = \ilPageLayout::activeLayouts(
53  );
54  $this->lang = $this->request->getTranslation();
55  }
static activeLayouts(int $a_module=0)
Get active layouts.
+ Here is the call graph for this function:

Member Function Documentation

◆ activatePages()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::activatePages ( array  $ids)

Definition at line 651 of file class.EditSubObjectsGUI.php.

References $id, $lng, $path, ilPageObject\_lookupActive(), ilLMObject\_lookupType(), and ilPageObject\_writeActive().

651  : void
652  {
653  $ctrl = $this->gui->ctrl();
654  $mt = $this->gui->mainTemplate();
655  $lng = $this->domain->lng();
656  $lm_tree = $this->domain->lmTree($this->lm_id);
657 
658  $ids = $ids;
659  if (count($ids) > 0) {
660  $act_items = array();
661  // get all "top" ids, i.e. remove ids, that have a selected parent
662  foreach ($ids as $id) {
663  $path = $lm_tree->getPathId($id);
664  $take = true;
665  foreach ($path as $path_id) {
666  if ($path_id != $id && in_array($path_id, $ids)) {
667  $take = false;
668  }
669  }
670  if ($take) {
671  $act_items[] = $id;
672  }
673  }
674 
675 
676  foreach ($act_items as $id) {
677  $childs = $lm_tree->getChilds($id);
678  foreach ($childs as $child) {
679  if (ilLMObject::_lookupType($child["child"]) == "pg") {
681  $child["child"],
682  $this->lm->getType()
683  );
685  $child["child"],
686  $this->lm->getType(),
687  !$act
688  );
689  }
690  }
691  if (ilLMObject::_lookupType($id) == "pg") {
693  $id,
694  $this->lm->getType()
695  );
697  $id,
698  $this->lm->getType(),
699  !$act
700  );
701  }
702  }
703  } else {
704  $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
705  }
706 
707  $ctrl->redirect($this, "list");
708  }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
$path
Definition: ltiservices.php:29
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
static _lookupType(int $a_obj_id, int $a_lm_id=0)
+ Here is the call graph for this function:

◆ cancelDelete()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::cancelDelete ( )

Definition at line 537 of file class.EditSubObjectsGUI.php.

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\delete().

537  : void
538  {
539  $this->gui->ctrl()->redirect($this, "list");
540  }
+ Here is the caller graph for this function:

◆ confirmedDelete()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::confirmedDelete ( int  $a_parent_subobj_id = 0)

delete page object or structure objects

Parameters
int$a_parent_subobj_idid of parent object (structure object) of the objects, that should be deleted (or no parent object id for top level)

Definition at line 549 of file class.EditSubObjectsGUI.php.

References $id, $lng, ilLMObjectFactory\getInstance(), and ilTree\POS_FIRST_NODE.

549  : void
550  {
551  $tree = $this->domain->lmTree($this->lm_id);
552  $ids = $this->request->getIds();
553  $mt = $this->gui->mainTemplate();
554  $ctrl = $this->gui->ctrl();
555  $lng = $this->domain->lng();
556 
557  // check number of objects
558  if (count($ids) == 0) {
559  $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"));
560  $ctrl->redirect($this, "list");
561  }
562 
563  // delete all selected objects
564  foreach ($ids as $id) {
565  if ($id != \ilTree::POS_FIRST_NODE) {
566  $obj = \ilLMObjectFactory::getInstance($this->lm, $id, false);
567  $node_data = $tree->getNodeData($id);
568  if (is_object($obj)) {
569  $obj->setLMId($this->lm->getId());
570  $obj->delete();
571  }
572  if ($tree->isInTree($id)) {
573  $tree->deleteTree($node_data);
574  }
575  }
576  }
577 
578  // check the tree
579  $this->lm->checkTree();
580 
581  // feedback
582  $mt->setOnScreenMessage('success', $lng->txt("info_deleted"), true);
583  $ctrl->redirect($this, "list");
584  }
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
const POS_FIRST_NODE
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ copyItems()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::copyItems (   $ids)

Copy items to clipboard.

Definition at line 621 of file class.EditSubObjectsGUI.php.

References $lng, ilLMObject\clipboardCopy(), and ilEditClipboard\setAction().

621  : void
622  {
623 
624  $ctrl = $this->gui->ctrl();
625  $lng = $this->domain->lng();
626  $mt = $this->gui->mainTemplate();
627 
628  $items = $ids;
629  if (count($items) == 0) {
630  $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
631  $ctrl->redirect($this, "list");
632  }
633 
634  $todel = array(); // delete IDs < 0 (needed for non-js editing)
635  foreach ($items as $k => $item) {
636  if ($item < 0) {
637  $todel[] = $k;
638  }
639  }
640  foreach ($todel as $k) {
641  unset($items[$k]);
642  }
643 
644  \ilLMObject::clipboardCopy($this->lm_id, $items);
646 
647  $mt->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_copied"), true);
648  $ctrl->redirect($this, "list");
649  }
static setAction(string $a_action)
global $lng
Definition: privfeed.php:31
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:

◆ cutItems()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::cutItems ( array  $ids)

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

Definition at line 589 of file class.EditSubObjectsGUI.php.

References $lng, ilLMObject\clipboardCut(), and ilEditClipboard\setAction().

589  : void
590  {
591  $ctrl = $this->gui->ctrl();
592  $mt = $this->gui->mainTemplate();
593  $lng = $this->domain->lng();
594 
595  $items = $ids;
596  if (count($items) == 0) {
597  $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
598  $ctrl->redirect($this, "list");
599  }
600 
601  $todel = array(); // delete IDs < 0 (needed for non-js editing)
602  foreach ($items as $k => $item) {
603  if ($item < 0) {
604  $todel[] = $k;
605  }
606  }
607  foreach ($todel as $k) {
608  unset($items[$k]);
609  }
610 
611  \ilLMObject::clipboardCut($this->lm_id, $items);
613  $mt->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_cut"), true);
614 
615  $ctrl->redirect($this, "list");
616  }
static setAction(string $a_action)
static clipboardCut(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ delete()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::delete ( array  $ids)

confirm deletion screen for page object and structure object deletion

Parameters
int$a_parent_subobj_idid of parent object (structure object) of the objects, that should be deleted (or no parent object id for top level)

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

References $id, $lng, ILIAS\LearningModule\Editing\EditSubObjectsGUI\$sub_obj_id, ILIAS\LearningModule\Editing\EditSubObjectsGUI\cancelDelete(), and ilTree\POS_FIRST_NODE.

499  : void
500  {
501  $a_parent_subobj_id = $this->sub_obj_id;
502  $mt = $this->gui->mainTemplate();
503  $lng = $this->domain->lng();
504  $ctrl = $this->gui->ctrl();
505 
506  if (count($ids) == 0) {
507  $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
508  $this->cancelDelete();
509  }
510 
511  if (count($ids) == 1 && $ids[0] == \ilTree::POS_FIRST_NODE) {
512  $mt->setOnScreenMessage('failure', $lng->txt("cont_select_item"), true);
513  $this->cancelDelete();
514  }
515 
516  $form_action = $ctrl->getFormActionByClass(self::class);
517 
518  // display confirmation message
519  $cgui = new \ilConfirmationGUI();
520  $cgui->setFormAction($form_action);
521  $cgui->setHeaderText($lng->txt("info_delete_sure"));
522  $cgui->setCancel($lng->txt("cancel"), "cancelDelete");
523  $cgui->setConfirm($lng->txt("confirm"), "confirmedDelete");
524 
525  foreach ($ids as $id) {
526  if ($id != \ilTree::POS_FIRST_NODE) {
527  $obj = new \ilLMObject($this->lm, $id);
528  $caption = $obj->getTitle();
529 
530  $cgui->addItem("id[]", (string) $id, $caption);
531  }
532  }
533 
534  $mt->setContent($cgui->getHTML());
535  }
const POS_FIRST_NODE
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ editMasterLanguage()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::editMasterLanguage ( )

Definition at line 110 of file class.EditSubObjectsGUI.php.

110  : void
111  {
112  $ctrl = $this->gui->ctrl();
113  $ctrl->setParameter($this, "transl", "-");
114  $ctrl->redirect($this, "list");
115  }

◆ editPages()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::editPages ( )
protected

Definition at line 82 of file class.EditSubObjectsGUI.php.

82  : void
83  {
84  $this->gui->ctrl()->setParameterByClass(self::class, "sub_type", "pg");
85  $this->gui->ctrl()->redirectByClass(static::class, "list");
86  }

◆ editTitle()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::editTitle ( int  $id)

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

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\getEditTitleForm().

431  : void
432  {
433  $modal = $this->gui->modal()->form($this->getEditTitleForm($id));
434  $modal->send();
435  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::executeCommand ( )

Definition at line 57 of file class.EditSubObjectsGUI.php.

57  : void
58  {
59  $ctrl = $this->gui->ctrl();
60  $next_class = $ctrl->getNextClass($this);
61  $cmd = $ctrl->getCmd("list");
62 
63  switch ($next_class) {
64  default:
65  if (in_array($cmd, [
66  "list", "tableCommand", "editPages",
67  "insertChapterAfter", "insertChapterBefore", "insertFirstChapter",
68  "insertPageAfter", "insertPageBefore", "insertFirstPage",
69  "editTitle", "saveTitle", "saveOrder",
70  "confirmedDelete", "delete", "cancelDelete",
71  "insertPageClip", "insertPageClipBefore", "insertPageClipAfter",
72  "insertChapterClip", "insertChapterClipBefore", "insertChapterClipAfter",
73  "activatePages",
74  "insertLayoutBefore", "insertLayoutAfter", "insertPageFromLayout",
75  "switchToLanguage", "editMasterLanguage"
76  ])) {
77  $this->$cmd();
78  }
79  }
80  }

◆ getEditTitleForm()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::getEditTitleForm ( int  $id)
protected

Definition at line 398 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\$lang, $lng, ilLMObject\_lookupTitle(), and ilObjectTranslation\getInstance().

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\editTitle(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\saveTitle().

398  : FormAdapterGUI
399  {
400  $lng = $this->domain->lng();
401  $this->gui->ctrl()->setParameterByClass(self::class, "edit_id", $id);
402  $ot = \ilObjectTranslation::getInstance($this->lm->getId());
403  $ml = "";
404  if ($ot->getContentActivated()) {
405  $ml = " (" . $lng->txt("meta_l_" . $ot->getMasterLanguage()) . ")";
406  }
407 
408  $form = $this
409  ->gui
410  ->form(self::class, "saveTitle")
411  ->text("title", $lng->txt('title') . $ml, "", ilLMObject::_lookupTitle($id));
412  if ($ot->getContentActivated()) {
413  foreach ($ot->getLanguages() as $lang) {
414  $code = $lang->getLanguageCode();
415  if ($code === $ot->getMasterLanguage()) {
416  continue;
417  }
418  $lmobjtrans = new \ilLMObjTranslation($id, $code);
419  $title = $lmobjtrans->getTitle();
420  $form = $form->text(
421  "title_" . $code,
422  $lng->txt('title') . " (" . $lng->txt("meta_l_" . $code) . ")",
423  "",
424  $title
425  );
426  }
427  }
428  return $form;
429  }
static _lookupTitle(int $a_obj_id)
static getInstance(int $obj_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTable()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::getTable ( )
protected

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

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\list(), ILIAS\LearningModule\Editing\EditSubObjectsGUI\saveOrder(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\tableCommand().

88  : TableAdapterGUI
89  {
90  return $this->gui->editing()->subObjectTableGUI(
91  $this->table_title,
92  $this->lm_id,
93  $this->sub_type,
94  $this
95  );
96  }
+ Here is the caller graph for this function:

◆ initInsertTemplateForm()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::initInsertTemplateForm ( )

Definition at line 733 of file class.EditSubObjectsGUI.php.

References Vendor\Package\$f, $lng, and ilPageLayout\MODULE_LM.

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertLayout(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPageFromLayout().

733  : Standard
734  {
735  $ui = $this->gui->ui();
736  $f = $ui->factory();
737  $ctrl = $this->gui->ctrl();
738  $lng = $this->domain->lng();
739 
740  $fields["title"] = $f->input()->field()->text($lng->txt("title"), "");
741  $ts = \ilPageLayoutGUI::getTemplateSelection((string) \ilPageLayout::MODULE_LM);
742  if (!is_null($ts)) {
743  $fields["layout_id"] = $ts;
744  }
745 
746  // section
747  $section1 = $f->input()->field()->section($fields, $lng->txt("cont_insert_pagelayout"));
748 
749  $form_action = $ctrl->getLinkTarget($this, "insertPageFromLayout");
750  return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
751  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ insertChapter()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertChapter ( int  $parent_id = 0,
int  $target = \ilTree::POS_LAST_NODE 
)
protected

Definition at line 375 of file class.EditSubObjectsGUI.php.

References $lng, and ilLMObject\putInTree().

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapterAfter(), ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapterBefore(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertFirstChapter().

378  : void {
379  $lng = $this->domain->lng();
380  $ctrl = $this->gui->ctrl();
381  $chap = new \ilStructureObject($this->lm);
382  $chap->setType("st");
383  $chap->setTitle($lng->txt("cont_new_chap"));
384  $chap->setLMId($this->lm_id);
385  $chap->create();
386  \ilLMObject::putInTree($chap, $parent_id, $target);
387 
388  /*
389  if ($parent_id === $this->lm_tree->readRootId()) {
390  $ctrl->setParameterByClass(static::class, "obj_id", 0);
391  } else {
392  $ctrl->setParameterByClass(static::class, "obj_id", $parent_id);
393  }*/
394 
395  $ctrl->redirect($this, "list");
396  }
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertChapterAfter()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertChapterAfter ( )

Definition at line 345 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapter().

345  : void
346  {
347  $target_id = $this->request->getTargetId();
348  $this->insertChapter(
349  $this->sub_obj_id,
350  $target_id
351  );
352  }
insertChapter(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
+ Here is the call graph for this function:

◆ insertChapterBefore()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertChapterBefore ( )

Definition at line 354 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\$sub_obj_id, ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapter(), ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

354  : void
355  {
356  $parent = $this->sub_obj_id;
357  if ($parent === 0) {
358  $parent = $this->lm_tree->getRootId();
359  }
360  $target_id = $this->request->getTargetId();
361  $before_target = \ilTree::POS_FIRST_NODE;
362  foreach ($this->lm_tree->getChilds($parent) as $node) {
363  if ((int) $node["obj_id"] !== $target_id) {
364  $before_target = (int) $node["obj_id"];
365  } else {
366  break;
367  }
368  }
369  $this->insertChapter(
370  $parent,
371  $before_target
372  );
373  }
insertChapter(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
const POS_FIRST_NODE
+ Here is the call graph for this function:

◆ insertChapterClip()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertChapterClip (   $target = \ilTree::POS_LAST_NODE)

Definition at line 189 of file class.EditSubObjectsGUI.php.

References ilEditClipboard\clear(), ilEditClipboard\getAction(), and ilLMObject\updateInternalLinks().

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapterClipAfter(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapterClipBefore().

191  : void {
192  $user = $this->domain->user();
193  $ctrl = $this->gui->ctrl();
194  $parent_id = $this->request->getObjId();
195 
196  // copy and paste
197  $chapters = $user->getClipboardObjects("st", true);
198  $copied_nodes = array();
199 
200  foreach ($chapters as $chap) {
201  $cid = ilLMObject::pasteTree(
202  $this->lm,
203  $chap["id"],
204  $parent_id,
205  (int) $target,
206  (string) ($chap["insert_time"] ?? ""),
207  $copied_nodes,
208  (\ilEditClipboard::getAction() == "copy")
209  );
210  $target = $cid;
211  }
212  ilLMObject::updateInternalLinks($copied_nodes);
213 
214  if (\ilEditClipboard::getAction() == "cut") {
215  $user->clipboardDeleteObjectsOfType("pg");
216  $user->clipboardDeleteObjectsOfType("st");
218  }
219 
220  $this->lm->checkTree();
221  $ctrl->redirect($this, "list");
222  }
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertChapterClipAfter()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertChapterClipAfter ( )

Definition at line 182 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapterClip().

182  : void
183  {
184  $this->insertChapterClip(
185  $this->request->getTargetId()
186  );
187  }
+ Here is the call graph for this function:

◆ insertChapterClipBefore()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertChapterClipBefore ( )

Definition at line 165 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\$sub_obj_id, ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapterClip(), ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

165  : void
166  {
167  $parent = $this->sub_obj_id;
168  $target_id = $this->request->getTargetId();
169  $before_target = \ilTree::POS_FIRST_NODE;
170  foreach ($this->lm_tree->getChilds($parent) as $node) {
171  if ((int) $node["obj_id"] !== $target_id) {
172  $before_target = (int) $node["obj_id"];
173  } else {
174  break;
175  }
176  }
177  $this->insertChapterClip(
178  $before_target
179  );
180  }
const POS_FIRST_NODE
+ Here is the call graph for this function:

◆ insertFirstChapter()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertFirstChapter ( )

Definition at line 339 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertChapter().

339  : void
340  {
341  $this->insertChapter(
342  $this->sub_obj_id
343  );
344  }
insertChapter(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
+ Here is the call graph for this function:

◆ insertFirstPage()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertFirstPage ( )

Definition at line 282 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPage().

282  : void
283  {
284  $this->insertPage(
285  $this->sub_obj_id
286  );
287  }
insertPage(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
+ Here is the call graph for this function:

◆ insertLayout()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertLayout ( bool  $before = false)

Definition at line 720 of file class.EditSubObjectsGUI.php.

References ilLMPageObjectGUI\getLayoutCssFix(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\initInsertTemplateForm().

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertLayoutAfter(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertLayoutBefore().

720  : void
721  {
722  $ctrl = $this->gui->ctrl();
723  $ui = $this->gui->ui();
724  $mt = $this->gui->mainTemplate();
725  if ($before) {
726  $ctrl->setParameterByClass(self::class, "before", "1");
727  }
728  $ctrl->saveParameterByClass(self::class, ["obj_id", "target_id"]);
729  $form = $this->initInsertTemplateForm();
730  $mt->setContent($ui->renderer()->render($form) . \ilLMPageObjectGUI::getLayoutCssFix());
731  }
static getLayoutCssFix()
Get layout css fix (workaround for broken radio options)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertLayoutAfter()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertLayoutAfter ( )

Definition at line 715 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertLayout().

715  : void
716  {
717  $this->insertLayout();
718  }
+ Here is the call graph for this function:

◆ insertLayoutBefore()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertLayoutBefore ( )

Definition at line 710 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertLayout().

710  : void
711  {
712  $this->insertLayout(true);
713  }
+ Here is the call graph for this function:

◆ insertPage()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertPage ( int  $parent_id = 0,
int  $target = \ilTree::POS_LAST_NODE 
)
protected

Definition at line 315 of file class.EditSubObjectsGUI.php.

References $lng, and ilLMObject\putInTree().

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertFirstPage(), ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPageAfter(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPageBefore().

318  : void {
319  $lng = $this->domain->lng();
320  $ctrl = $this->gui->ctrl();
321 
322  $chap = new \ilLMPageObject($this->lm);
323  $chap->setType("pg");
324  $chap->setTitle($lng->txt("cont_new_page"));
325  $chap->setLMId($this->lm_id);
326  $chap->create();
327  \ilLMObject::putInTree($chap, $parent_id, $target);
328 
329  /*
330  if ($parent_id === $this->lm_tree->readRootId()) {
331  $ctrl->setParameterByClass(static::class, "obj_id", 0);
332  } else {
333  $ctrl->setParameterByClass(static::class, "obj_id", $parent_id);
334  }*/
335 
336  $ctrl->redirect($this, "list");
337  }
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPageAfter()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertPageAfter ( )

Definition at line 288 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPage().

288  : void
289  {
290  $target_id = $this->request->getTargetId();
291  $this->insertPage(
292  $this->sub_obj_id,
293  $target_id
294  );
295  }
insertPage(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
+ Here is the call graph for this function:

◆ insertPageBefore()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertPageBefore ( )

Definition at line 297 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\$sub_obj_id, ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPage(), ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

297  : void
298  {
299  $parent = $this->sub_obj_id;
300  $target_id = $this->request->getTargetId();
301  $before_target = \ilTree::POS_FIRST_NODE;
302  foreach ($this->lm_tree->getChildsByType($parent, "pg") as $node) {
303  if ((int) $node["obj_id"] !== $target_id) {
304  $before_target = (int) $node["obj_id"];
305  } else {
306  break;
307  }
308  }
309  $this->insertPage(
310  $parent,
311  $before_target
312  );
313  }
insertPage(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
const POS_FIRST_NODE
+ Here is the call graph for this function:

◆ insertPageClip()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertPageClip ( int  $target = 0)

Definition at line 248 of file class.EditSubObjectsGUI.php.

References ilEditClipboard\clear(), ilEditClipboard\getAction(), and ilLMObject\updateInternalLinks().

Referenced by ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPageClipAfter(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPageClipBefore().

250  : void {
251  $user = $this->domain->user();
252  $ctrl = $this->gui->ctrl();
253 
254  $parent_id = $this->request->getObjId();
255 
256  // cut and paste
257  $pages = $user->getClipboardObjects("pg");
258  $copied_nodes = array();
259  foreach ($pages as $pg) {
260  $cid = ilLMObject::pasteTree(
261  $this->lm,
262  $pg["id"],
263  $parent_id,
264  $target,
265  (string) ($pg["insert_time"] ?? ""),
266  $copied_nodes,
267  (\ilEditClipboard::getAction() == "copy")
268  );
269  $target = $cid;
270  }
271  \ilLMObject::updateInternalLinks($copied_nodes);
272 
273  if (\ilEditClipboard::getAction() == "cut") {
274  $user->clipboardDeleteObjectsOfType("pg");
275  $user->clipboardDeleteObjectsOfType("st");
277  }
278 
279  $ctrl->redirect($this, "list");
280  }
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPageClipAfter()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertPageClipAfter ( )

Definition at line 241 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPageClip().

241  : void
242  {
243  $this->insertPageClip(
244  $this->request->getTargetId()
245  );
246  }
+ Here is the call graph for this function:

◆ insertPageClipBefore()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertPageClipBefore ( )

Definition at line 224 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\$sub_obj_id, ILIAS\LearningModule\Editing\EditSubObjectsGUI\insertPageClip(), ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

224  : void
225  {
226  $parent = $this->sub_obj_id;
227  $target_id = $this->request->getTargetId();
228  $before_target = \ilTree::POS_FIRST_NODE;
229  foreach ($this->lm_tree->getChildsByType($parent, "pg") as $node) {
230  if ((int) $node["obj_id"] !== $target_id) {
231  $before_target = (int) $node["obj_id"];
232  } else {
233  break;
234  }
235  }
236  $this->insertPageClip(
237  $before_target
238  );
239  }
const POS_FIRST_NODE
+ Here is the call graph for this function:

◆ insertPageFromLayout()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::insertPageFromLayout ( )

Definition at line 753 of file class.EditSubObjectsGUI.php.

References $data, $DIC, $lng, ILIAS\LearningModule\Editing\EditSubObjectsGUI\$sub_obj_id, ILIAS\LearningModule\Editing\EditSubObjectsGUI\initInsertTemplateForm(), ilLMPageObject\insertPagesFromTemplate(), ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

753  : void
754  {
755  global $DIC;
756 
757  $ctrl = $this->gui->ctrl();
758  $mt = $this->gui->mainTemplate();
759  $lng = $this->domain->lng();
760 
761 
762  $parent = $this->sub_obj_id;
763  $target_id = $this->request->getTargetId();
764 
765  $first_child = false;
766  if ($this->request->getBefore()) {
767  $before_target = \ilTree::POS_FIRST_NODE;
768  $first_child = true;
769  foreach ($this->lm_tree->getChildsByType($parent, "pg") as $node) {
770  if ((int) $node["obj_id"] !== $target_id) {
771  $before_target = (int) $node["obj_id"];
772  $first_child = false;
773  } else {
774  break;
775  }
776  }
777  $target_id = $before_target;
778  }
779 
780  $form = $this->initInsertTemplateForm();
781  $form = $form->withRequest($DIC->http()->request());
782  $data = $form->getData();
783  $layout_id = $data["sec"]["layout_id"];
785  $this->lm->getId(),
786  1,
787  $target_id,
788  $first_child,
789  (int) $layout_id,
790  $data["sec"]["title"]
791  );
792 
793  $mt->setOnScreenMessage("success", $lng->txt("lm_page_added"), true);
794 
795  $ctrl->redirect($this, "list");
796  }
const POS_FIRST_NODE
static insertPagesFromTemplate(int $lm_id, int $num, int $node_id, bool $first_child, int $layout_id, string $title="")
Insert (multiple) pages templates at node.
global $DIC
Definition: shib_login.php:22
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ list()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::list ( )
protected

Definition at line 118 of file class.EditSubObjectsGUI.php.

References $lng, ilObjContentObjectGUI\getMultiLangHeader(), and ILIAS\LearningModule\Editing\EditSubObjectsGUI\getTable().

118  : void
119  {
120  $lng = $this->domain->lng();
121  $ctrl = $this->gui->ctrl();
122  $main_tpl = $this->gui->mainTemplate();
123  $user = $this->domain->user();
124 
125  $retrieval = $this->domain->subObjectRetrieval(
126  $this->lm_id,
127  $this->sub_type,
128  $this->sub_obj_id,
129  $this->lang
130  );
131 
132  $ml_head = \ilObjLearningModuleGUI::getMultiLangHeader($this->lm_id, $this);
133 
134  if ($retrieval->count() === 0) {
135  if ($this->sub_type === "st") {
136  $this->gui->button(
137  $lng->txt("lm_insert_chapter"),
138  $ctrl->getLinkTargetByClass(self::class, "insertFirstChapter")
139  )->toToolbar();
140  if ($user->clipboardHasObjectsOfType("st")) {
141  $this->gui->button(
142  $lng->txt("lm_insert_chapter_clip"),
143  $ctrl->getLinkTargetByClass(self::class, "insertChapterClip")
144  )->toToolbar();
145  }
146  } else {
147  $this->gui->button(
148  $lng->txt("lm_insert_page"),
149  $ctrl->getLinkTargetByClass(self::class, "insertFirstPage")
150  )->toToolbar();
151  if ($user->clipboardHasObjectsOfType("pg")) {
152  $this->gui->button(
153  $lng->txt("lm_insert_page_clip"),
154  $ctrl->getLinkTargetByClass(self::class, "insertPageClip")
155  )->toToolbar();
156  }
157  }
158  }
159  $table = $this->getTable();
160 
161  $main_tpl->setContent($ml_head . $table->render());
162  $main_tpl->addOnloadCode("window.setTimeout(() => { il.repository.core.trigger('il-lm-editor-tree'); }, 500);");
163  }
static getMultiLangHeader(int $a_lm_id, object $a_gui_class, string $a_mode="")
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ saveOrder()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::saveOrder ( )

Definition at line 460 of file class.EditSubObjectsGUI.php.

References $data, $id, $lng, and ILIAS\LearningModule\Editing\EditSubObjectsGUI\getTable().

460  : void
461  {
462  $mt = $this->gui->mainTemplate();
463  $lng = $this->domain->lng();
464  $tree = $this->domain->lmTree($this->lm_id);
465  $table = $this->getTable();
466  $data = $table->getData();
467  $parent = ($this->sub_obj_id > 0)
468  ? $this->sub_obj_id
469  : $tree->readRootId();
470  if (!is_array($data)) {
471  return;
472  }
473 
474  // note: moveTree has a bug and does not use the last parameter
475  // target will always be "last node"
476  // since all chapters must follow all pages
477  // we can simple call moveTree in the correct order for the chapters
478  // but if we order the pages, we must append all chapters to the data first
479  if ($this->sub_type === "pg") {
480  foreach ($tree->getChilds($parent) as $child) {
481  if ($child["type"] == "st") {
482  $data[] = $child["child"];
483  }
484  }
485  }
486  foreach ($data as $id) {
487  $tree->moveTree((int) $id, $parent);
488  }
489  $mt->setContent("success", $lng->txt("msg_obj_modified"), true);
490  $this->gui->ctrl()->redirect($this, "list");
491  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ saveTitle()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::saveTitle ( )

Definition at line 437 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\$lang, $lng, ILIAS\LearningModule\Editing\EditSubObjectsGUI\getEditTitleForm(), ilObjectTranslation\getInstance(), and ilLMObject\saveTitle().

437  : void
438  {
439  $mt = $this->gui->mainTemplate();
440  $lng = $this->domain->lng();
441  $form = $this->getEditTitleForm($this->request->getEditId());
442  if ($form->isValid()) {
443  \ilLMObject::saveTitle($this->request->getEditId(), $form->getData("title"));
444 
445  $ot = \ilObjectTranslation::getInstance($this->lm->getId());
446  if ($ot->getContentActivated()) {
447  foreach ($ot->getLanguages() as $lang) {
448  $code = $lang->getLanguageCode();
449  if ($code === $ot->getMasterLanguage()) {
450  continue;
451  }
452  \ilLMObject::saveTitle($this->request->getEditId(), $form->getData("title_" . $code), $code);
453  }
454  }
455  }
456  $mt->setContent("success", $lng->txt("msg_obj_modified"), true);
457  $this->gui->ctrl()->redirect($this, "list");
458  }
static getInstance(int $obj_id)
static saveTitle(int $id, string $title, string $lang="-")
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ switchToLanguage()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::switchToLanguage ( )

Definition at line 103 of file class.EditSubObjectsGUI.php.

103  : void
104  {
105  $ctrl = $this->gui->ctrl();
106  $ctrl->setParameter($this, "transl", $this->request->getToTranslation());
107  $ctrl->redirect($this, "list");
108  }

◆ tableCommand()

ILIAS\LearningModule\Editing\EditSubObjectsGUI::tableCommand ( )

Definition at line 98 of file class.EditSubObjectsGUI.php.

References ILIAS\LearningModule\Editing\EditSubObjectsGUI\getTable().

98  : void
99  {
100  $this->getTable()->handleCommand();
101  }
+ Here is the call graph for this function:

Field Documentation

◆ $lang

string ILIAS\LearningModule\Editing\EditSubObjectsGUI::$lang
protected

◆ $lm_id

int ILIAS\LearningModule\Editing\EditSubObjectsGUI::$lm_id
protected

Definition at line 35 of file class.EditSubObjectsGUI.php.

◆ $lm_tree

ilLMTree ILIAS\LearningModule\Editing\EditSubObjectsGUI::$lm_tree
protected

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

◆ $page_layouts

array ILIAS\LearningModule\Editing\EditSubObjectsGUI::$page_layouts
protected

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

◆ $request

EditingGUIRequest ILIAS\LearningModule\Editing\EditSubObjectsGUI::$request
protected

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

◆ $sub_obj_id


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