ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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  $this->gui->initFetch();
56  }
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 649 of file class.EditSubObjectsGUI.php.

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

649  : void
650  {
651  $ctrl = $this->gui->ctrl();
652  $mt = $this->gui->mainTemplate();
653  $lng = $this->domain->lng();
654  $lm_tree = $this->domain->lmTree($this->lm_id);
655 
656  $ids = $ids;
657  if (count($ids) > 0) {
658  $act_items = array();
659  // get all "top" ids, i.e. remove ids, that have a selected parent
660  foreach ($ids as $id) {
661  $path = $lm_tree->getPathId($id);
662  $take = true;
663  foreach ($path as $path_id) {
664  if ($path_id != $id && in_array($path_id, $ids)) {
665  $take = false;
666  }
667  }
668  if ($take) {
669  $act_items[] = $id;
670  }
671  }
672 
673 
674  foreach ($act_items as $id) {
675  $childs = $lm_tree->getChilds($id);
676  foreach ($childs as $child) {
677  if (ilLMObject::_lookupType($child["child"]) == "pg") {
679  $child["child"],
680  $this->lm->getType()
681  );
683  $child["child"],
684  $this->lm->getType(),
685  !$act
686  );
687  }
688  }
689  if (ilLMObject::_lookupType($id) == "pg") {
691  $id,
692  $this->lm->getType()
693  );
695  $id,
696  $this->lm->getType(),
697  !$act
698  );
699  }
700  }
701  } else {
702  $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
703  }
704 
705  $ctrl->redirect($this, "list");
706  }
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:30
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:24
global $lng
Definition: privfeed.php:32
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 535 of file class.EditSubObjectsGUI.php.

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

535  : void
536  {
537  $this->gui->ctrl()->redirect($this, "list");
538  }
+ 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 547 of file class.EditSubObjectsGUI.php.

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

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

◆ copyItems()

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

Copy items to clipboard.

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

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

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

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

587  : void
588  {
589  $ctrl = $this->gui->ctrl();
590  $mt = $this->gui->mainTemplate();
591  $lng = $this->domain->lng();
592 
593  $items = $ids;
594  if (count($items) == 0) {
595  $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
596  $ctrl->redirect($this, "list");
597  }
598 
599  $todel = array(); // delete IDs < 0 (needed for non-js editing)
600  foreach ($items as $k => $item) {
601  if ($item < 0) {
602  $todel[] = $k;
603  }
604  }
605  foreach ($todel as $k) {
606  unset($items[$k]);
607  }
608 
609  \ilLMObject::clipboardCut($this->lm_id, $items);
611  $mt->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_cut"), true);
612 
613  $ctrl->redirect($this, "list");
614  }
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:32
+ 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 497 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.

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

◆ editMasterLanguage()

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

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

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

◆ editPages()

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

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

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

◆ editTitle()

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

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

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

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

◆ executeCommand()

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

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

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

◆ getEditTitleForm()

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

Definition at line 399 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().

399  : FormAdapterGUI
400  {
401  $lng = $this->domain->lng();
402  $this->gui->ctrl()->setParameterByClass(self::class, "edit_id", $id);
403  $ot = \ilObjectTranslation::getInstance($this->lm->getId());
404  $ml = "";
405  if ($ot->getContentActivated()) {
406  $ml = " (".$lng->txt("meta_l_" .$ot->getMasterLanguage()) . ")";
407  }
408 
409  $form = $this
410  ->gui
411  ->form(self::class, "saveTitle")
412  ->text("title", $lng->txt('title') . $ml, "", ilLMObject::_lookupTitle($id));
413  if ($ot->getContentActivated()) {
414  foreach ($ot->getLanguages() as $lang) {
415  $code = $lang->getLanguageCode();
416  if ($code === $ot->getMasterLanguage()) {
417  continue;
418  }
419  $lmobjtrans = new \ilLMObjTranslation($id, $code);
420  $title = $lmobjtrans->getTitle();
421  $form = $form->text("title_" . $code, $lng->txt('title') . " (" . $lng->txt("meta_l_" . $code) . ")",
422  "", $title);
423  }
424  }
425  return $form;
426  }
static _lookupTitle(int $a_obj_id)
static getInstance(int $obj_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
global $lng
Definition: privfeed.php:32
+ 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 89 of file class.EditSubObjectsGUI.php.

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

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

◆ initInsertTemplateForm()

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

Definition at line 731 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().

731  : Standard
732  {
733  $ui = $this->gui->ui();
734  $f = $ui->factory();
735  $ctrl = $this->gui->ctrl();
736  $lng = $this->domain->lng();
737 
738  $fields["title"] = $f->input()->field()->text($lng->txt("title"), "");
739  $ts = \ilPageLayoutGUI::getTemplateSelection((string) \ilPageLayout::MODULE_LM);
740  if (!is_null($ts)) {
741  $fields["layout_id"] = $ts;
742  }
743 
744  // section
745  $section1 = $f->input()->field()->section($fields, $lng->txt("cont_insert_pagelayout"));
746 
747  $form_action = $ctrl->getLinkTarget($this, "insertPageFromLayout");
748  return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
749  }
global $lng
Definition: privfeed.php:32
+ 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 376 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().

379  : void {
380  $lng = $this->domain->lng();
381  $ctrl = $this->gui->ctrl();
382  $chap = new \ilStructureObject($this->lm);
383  $chap->setType("st");
384  $chap->setTitle($lng->txt("cont_new_chap"));
385  $chap->setLMId($this->lm_id);
386  $chap->create();
387  \ilLMObject::putInTree($chap, $parent_id, $target);
388 
389  /*
390  if ($parent_id === $this->lm_tree->readRootId()) {
391  $ctrl->setParameterByClass(static::class, "obj_id", 0);
392  } else {
393  $ctrl->setParameterByClass(static::class, "obj_id", $parent_id);
394  }*/
395 
396  $ctrl->redirect($this, "list");
397  }
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:32
+ 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 346 of file class.EditSubObjectsGUI.php.

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

346  : void
347  {
348  $target_id = $this->request->getTargetId();
349  $this->insertChapter(
350  $this->sub_obj_id,
351  $target_id
352  );
353  }
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 355 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.

355  : void
356  {
357  $parent = $this->sub_obj_id;
358  if ($parent === 0) {
359  $parent = $this->lm_tree->getRootId();
360  }
361  $target_id = $this->request->getTargetId();
362  $before_target = \ilTree::POS_FIRST_NODE;
363  foreach ($this->lm_tree->getChilds($parent) as $node) {
364  if ((int) $node["obj_id"] !== $target_id) {
365  $before_target = (int) $node["obj_id"];
366  } else {
367  break;
368  }
369  }
370  $this->insertChapter(
371  $parent,
372  $before_target
373  );
374  }
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 190 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().

192  : void {
193  $user = $this->domain->user();
194  $ctrl = $this->gui->ctrl();
195  $parent_id = $this->request->getObjId();
196 
197  // copy and paste
198  $chapters = $user->getClipboardObjects("st", true);
199  $copied_nodes = array();
200 
201  foreach ($chapters as $chap) {
202  $cid = ilLMObject::pasteTree(
203  $this->lm,
204  $chap["id"],
205  $parent_id,
206  (int) $target,
207  (string) ($chap["insert_time"] ?? ""),
208  $copied_nodes,
209  (\ilEditClipboard::getAction() == "copy")
210  );
211  $target = $cid;
212  }
213  ilLMObject::updateInternalLinks($copied_nodes);
214 
215  if (\ilEditClipboard::getAction() == "cut") {
216  $user->clipboardDeleteObjectsOfType("pg");
217  $user->clipboardDeleteObjectsOfType("st");
219  }
220 
221  $this->lm->checkTree();
222  $ctrl->redirect($this, "list");
223  }
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 183 of file class.EditSubObjectsGUI.php.

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

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

◆ insertChapterClipBefore()

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

Definition at line 166 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.

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

◆ insertFirstChapter()

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

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

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

340  : void
341  {
342  $this->insertChapter(
343  $this->sub_obj_id
344  );
345  }
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 283 of file class.EditSubObjectsGUI.php.

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

283  : void
284  {
285  $this->insertPage(
286  $this->sub_obj_id
287  );
288  }
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 718 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().

718  : void
719  {
720  $ctrl = $this->gui->ctrl();
721  $ui = $this->gui->ui();
722  $mt = $this->gui->mainTemplate();
723  if ($before) {
724  $ctrl->setParameterByClass(self::class, "before", "1");
725  }
726  $ctrl->saveParameterByClass(self::class, ["obj_id", "target_id"]);
727  $form = $this->initInsertTemplateForm();
728  $mt->setContent($ui->renderer()->render($form) . \ilLMPageObjectGUI::getLayoutCssFix());
729  }
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 713 of file class.EditSubObjectsGUI.php.

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

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

◆ insertLayoutBefore()

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

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

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

708  : void
709  {
710  $this->insertLayout(true);
711  }
+ 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 316 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().

319  : void {
320  $lng = $this->domain->lng();
321  $ctrl = $this->gui->ctrl();
322 
323  $chap = new \ilLMPageObject($this->lm);
324  $chap->setType("pg");
325  $chap->setTitle($lng->txt("cont_new_page"));
326  $chap->setLMId($this->lm_id);
327  $chap->create();
328  \ilLMObject::putInTree($chap, $parent_id, $target);
329 
330  /*
331  if ($parent_id === $this->lm_tree->readRootId()) {
332  $ctrl->setParameterByClass(static::class, "obj_id", 0);
333  } else {
334  $ctrl->setParameterByClass(static::class, "obj_id", $parent_id);
335  }*/
336 
337  $ctrl->redirect($this, "list");
338  }
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:32
+ 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 289 of file class.EditSubObjectsGUI.php.

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

289  : void
290  {
291  $target_id = $this->request->getTargetId();
292  $this->insertPage(
293  $this->sub_obj_id,
294  $target_id
295  );
296  }
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 298 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.

298  : void
299  {
300  $parent = $this->sub_obj_id;
301  $target_id = $this->request->getTargetId();
302  $before_target = \ilTree::POS_FIRST_NODE;
303  foreach ($this->lm_tree->getChildsByType($parent, "pg") as $node) {
304  if ((int) $node["obj_id"] !== $target_id) {
305  $before_target = (int) $node["obj_id"];
306  } else {
307  break;
308  }
309  }
310  $this->insertPage(
311  $parent,
312  $before_target
313  );
314  }
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 249 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().

251  : void {
252  $user = $this->domain->user();
253  $ctrl = $this->gui->ctrl();
254 
255  $parent_id = $this->request->getObjId();
256 
257  // cut and paste
258  $pages = $user->getClipboardObjects("pg");
259  $copied_nodes = array();
260  foreach ($pages as $pg) {
261  $cid = ilLMObject::pasteTree(
262  $this->lm,
263  $pg["id"],
264  $parent_id,
265  $target,
266  (string) ($pg["insert_time"] ?? ""),
267  $copied_nodes,
268  (\ilEditClipboard::getAction() == "copy")
269  );
270  $target = $cid;
271  }
272  \ilLMObject::updateInternalLinks($copied_nodes);
273 
274  if (\ilEditClipboard::getAction() == "cut") {
275  $user->clipboardDeleteObjectsOfType("pg");
276  $user->clipboardDeleteObjectsOfType("st");
278  }
279 
280  $ctrl->redirect($this, "list");
281  }
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 242 of file class.EditSubObjectsGUI.php.

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

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

◆ insertPageClipBefore()

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

Definition at line 225 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.

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

◆ insertPageFromLayout()

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

Definition at line 751 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.

751  : void
752  {
753  global $DIC;
754 
755  $ctrl = $this->gui->ctrl();
756  $mt = $this->gui->mainTemplate();
757  $lng = $this->domain->lng();
758 
759 
760  $parent = $this->sub_obj_id;
761  $target_id = $this->request->getTargetId();
762 
763  $first_child = false;
764  if ($this->request->getBefore()) {
765  $before_target = \ilTree::POS_FIRST_NODE;
766  $first_child = true;
767  foreach ($this->lm_tree->getChildsByType($parent, "pg") as $node) {
768  if ((int) $node["obj_id"] !== $target_id) {
769  $before_target = (int) $node["obj_id"];
770  $first_child = false;
771  } else {
772  break;
773  }
774  }
775  $target_id = $before_target;
776  }
777 
778  $form = $this->initInsertTemplateForm();
779  $form = $form->withRequest($DIC->http()->request());
780  $data = $form->getData();
781  $layout_id = $data["sec"]["layout_id"];
783  $this->lm->getId(),
784  1,
785  $target_id,
786  $first_child,
787  (int) $layout_id,
788  $data["sec"]["title"]
789  );
790 
791  $mt->setOnScreenMessage("success", $lng->txt("lm_page_added"), true);
792 
793  $ctrl->redirect($this, "list");
794  }
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:25
global $lng
Definition: privfeed.php:32
+ Here is the call graph for this function:

◆ list()

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

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

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

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

◆ saveOrder()

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

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

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

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

◆ saveTitle()

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

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

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

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

◆ switchToLanguage()

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

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

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

◆ tableCommand()

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

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

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

99  : void
100  {
101  $this->getTable()->handleCommand();
102  }
+ 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: