ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 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 31 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 40 of file class.EditSubObjectsGUI.php.

46 {
47 $this->sub_obj_id = $this->gui->editing()->request()->getObjId();
48 $this->gui->ctrl()->saveParameterByClass(self::class, "sub_type");
49 $this->lm_id = $lm->getId();
50 $this->lm_tree = $this->domain->lmTree($this->lm_id);
51 $this->request = $this->gui->editing()->request();
52 $this->page_layouts = \ilPageLayout::activeLayouts(
54 );
55 $this->lang = $this->request->getTranslation();
56 $this->gui->initFetch();
57 }
static activeLayouts(int $a_module=0)
Get active layouts.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ activatePages()

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

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

654 : void
655 {
656 $ctrl = $this->gui->ctrl();
657 $mt = $this->gui->mainTemplate();
658 $lng = $this->domain->lng();
659 $lm_tree = $this->domain->lmTree($this->lm_id);
660
661 $ids = $ids;
662 if (count($ids) > 0) {
663 $act_items = array();
664 // get all "top" ids, i.e. remove ids, that have a selected parent
665 foreach ($ids as $id) {
667 $take = true;
668 foreach ($path as $path_id) {
669 if ($path_id != $id && in_array($path_id, $ids)) {
670 $take = false;
671 }
672 }
673 if ($take) {
674 $act_items[] = $id;
675 }
676 }
677
678
679 foreach ($act_items as $id) {
680 $childs = $lm_tree->getChilds($id);
681 foreach ($childs as $child) {
682 if (ilLMObject::_lookupType($child["child"]) == "pg") {
684 $child["child"],
685 $this->lm->getType()
686 );
688 $child["child"],
689 $this->lm->getType(),
690 !$act
691 );
692 }
693 }
694 if (ilLMObject::_lookupType($id) == "pg") {
696 $id,
697 $this->lm->getType()
698 );
700 $id,
701 $this->lm->getType(),
702 !$act
703 );
704 }
705 }
706 } else {
707 $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
708 }
709
710 $ctrl->redirect($this, "list");
711 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _lookupType(int $a_obj_id, int $a_lm_id=0)
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status
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
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...
$path
Definition: ltiservices.php:30
global $lng
Definition: privfeed.php:31

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

+ Here is the call graph for this function:

◆ cancelDelete()

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

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

540 : void
541 {
542 $this->gui->ctrl()->redirect($this, "list");
543 }

◆ 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 552 of file class.EditSubObjectsGUI.php.

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

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

+ Here is the call graph for this function:

◆ copyItems()

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

Copy items to clipboard.

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

624 : void
625 {
626
627 $ctrl = $this->gui->ctrl();
628 $lng = $this->domain->lng();
629 $mt = $this->gui->mainTemplate();
630
631 $items = $ids;
632 if (count($items) == 0) {
633 $mt->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
634 $ctrl->redirect($this, "list");
635 }
636
637 $todel = array(); // delete IDs < 0 (needed for non-js editing)
638 foreach ($items as $k => $item) {
639 if ($item < 0) {
640 $todel[] = $k;
641 }
642 }
643 foreach ($todel as $k) {
644 unset($items[$k]);
645 }
646
647 \ilLMObject::clipboardCopy($this->lm_id, $items);
649
650 $mt->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_copied"), true);
651 $ctrl->redirect($this, "list");
652 }
static setAction(string $a_action)
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.

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

+ 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 592 of file class.EditSubObjectsGUI.php.

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

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

+ 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 502 of file class.EditSubObjectsGUI.php.

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

References $id, $lng, and ilTree\POS_FIRST_NODE.

◆ editMasterLanguage()

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

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

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

◆ editPages()

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

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

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

◆ editTitle()

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

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

433 : void
434 {
435 $this->gui->clearAsnyOnloadCode();
436 $modal = $this->gui->modal()->form($this->getEditTitleForm($id));
437 $modal->send();
438 }

References $id.

◆ executeCommand()

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

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

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

◆ getEditTitleForm()

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

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

400 : FormAdapterGUI
401 {
402 $lng = $this->domain->lng();
403 $this->gui->ctrl()->setParameterByClass(self::class, "edit_id", $id);
404 $ot = (new TranslationsRepository($this->domain->database()))->getFor($this->lm->getId());
405 $ml = "";
406 if ($ot->getContentTranslationActivated()) {
407 $ml = " (" . $lng->txt("meta_l_" . $ot->getBaseLanguage()) . ")";
408 }
409
410 $form = $this
411 ->gui
412 ->form(self::class, "saveTitle")
413 ->text("title", $lng->txt('title') . $ml, "", ilLMObject::_lookupTitle($id));
414 if ($ot->getContentTranslationActivated()) {
415 foreach ($ot->getLanguages() as $lang) {
416 $code = $lang->getLanguageCode();
417 if ($code === $ot->getBaseLanguage()) {
418 continue;
419 }
420 $lmobjtrans = new \ilLMObjTranslation($id, $code);
421 $title = $lmobjtrans->getTitle();
422 $form = $form->text(
423 "title_" . $code,
424 $lng->txt('title') . " (" . $lng->txt("meta_l_" . $code) . ")",
425 "",
426 $title
427 );
428 }
429 }
430 return $form;
431 }
static _lookupTitle(int $a_obj_id)

References $id, $lang, $lng, and ilLMObject\_lookupTitle().

+ Here is the call graph for this function:

◆ getTable()

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

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

90 : TableAdapterGUI
91 {
92 return $this->gui->editing()->subObjectTableBuilder(
93 $this->table_title,
94 $this->lm_id,
95 $this->sub_type,
96 $this,
97 "list"
98 )->getTable();
99 }

References ILIAS\Repository\Table\TableAdapterGUI\getTable().

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

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

◆ initInsertTemplateForm()

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

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

736 : Standard
737 {
738 $ui = $this->gui->ui();
739 $f = $ui->factory();
740 $ctrl = $this->gui->ctrl();
741 $lng = $this->domain->lng();
742
743 $fields["title"] = $f->input()->field()->text($lng->txt("title"), "");
744 $ts = \ilPageLayoutGUI::getTemplateSelection((string) \ilPageLayout::MODULE_LM);
745 if (!is_null($ts)) {
746 $fields["layout_id"] = $ts;
747 }
748
749 // section
750 $section1 = $f->input()->field()->section($fields, $lng->txt("cont_insert_pagelayout"));
751
752 $form_action = $ctrl->getLinkTarget($this, "insertPageFromLayout");
753 return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
754 }

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

◆ insertChapter()

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

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

380 : void {
381 $lng = $this->domain->lng();
382 $ctrl = $this->gui->ctrl();
383 $chap = new \ilStructureObject($this->lm);
384 $chap->setType("st");
385 $chap->setTitle($lng->txt("cont_new_chap"));
386 $chap->setLMId($this->lm_id);
387 $chap->create();
388 \ilLMObject::putInTree($chap, $parent_id, $target);
389
390 /*
391 if ($parent_id === $this->lm_tree->readRootId()) {
392 $ctrl->setParameterByClass(static::class, "obj_id", 0);
393 } else {
394 $ctrl->setParameterByClass(static::class, "obj_id", $parent_id);
395 }*/
396
397 $ctrl->redirect($this, "list");
398 }
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree

◆ insertChapterAfter()

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

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

347 : void
348 {
349 $target_id = $this->request->getTargetId();
350 $this->insertChapter(
351 $this->sub_obj_id,
352 $target_id
353 );
354 }
insertChapter(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)

◆ insertChapterBefore()

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

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

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

References ILIAS\Repository\int(), and ilTree\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 191 of file class.EditSubObjectsGUI.php.

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

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

+ Here is the caller graph for this function:

◆ insertChapterClipAfter()

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

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

184 : void
185 {
186 $this->insertChapterClip(
187 $this->request->getTargetId()
188 );
189 }

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

+ Here is the call graph for this function:

◆ insertChapterClipBefore()

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

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

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

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

+ Here is the call graph for this function:

◆ insertFirstChapter()

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

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

341 : void
342 {
343 $this->insertChapter(
344 $this->sub_obj_id
345 );
346 }

◆ insertFirstPage()

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

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

284 : void
285 {
286 $this->insertPage(
287 $this->sub_obj_id
288 );
289 }
insertPage(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)

◆ insertLayout()

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

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

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

References ilLMPageObjectGUI\getLayoutCssFix().

+ Here is the call graph for this function:

◆ insertLayoutAfter()

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

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

718 : void
719 {
720 $this->insertLayout();
721 }

◆ insertLayoutBefore()

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

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

713 : void
714 {
715 $this->insertLayout(true);
716 }

◆ insertPage()

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

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

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

◆ insertPageAfter()

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

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

290 : void
291 {
292 $target_id = $this->request->getTargetId();
293 $this->insertPage(
294 $this->sub_obj_id,
295 $target_id
296 );
297 }

◆ insertPageBefore()

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

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

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

References ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

+ Here is the call graph for this function:

◆ insertPageClip()

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

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

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

◆ insertPageClipAfter()

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

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

243 : void
244 {
245 $this->insertPageClip(
246 $this->request->getTargetId()
247 );
248 }

◆ insertPageClipBefore()

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

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

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

References ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

+ Here is the call graph for this function:

◆ insertPageFromLayout()

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

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

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

References $data, $DIC, $lng, ilLMPageObject\insertPagesFromTemplate(), ILIAS\Repository\int(), and ilTree\POS_FIRST_NODE.

+ Here is the call graph for this function:

◆ list()

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

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

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

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

+ Here is the call graph for this function:

◆ saveOrder()

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

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

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

References $data, $id, and $lng.

◆ saveTitle()

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

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

440 : void
441 {
442 $mt = $this->gui->mainTemplate();
443 $lng = $this->domain->lng();
444 $form = $this->getEditTitleForm($this->request->getEditId());
445 if ($form->isValid()) {
446 \ilLMObject::saveTitle($this->request->getEditId(), $form->getData("title"));
447
448 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
449 if ($ot->getContentTranslationActivated()) {
450 foreach ($ot->getLanguages() as $lang) {
451 $code = $lang->getLanguageCode();
452 if ($code === $ot->getBaseLanguage()) {
453 continue;
454 }
455 \ilLMObject::saveTitle($this->request->getEditId(), $form->getData("title_" . $code), $code);
456 }
457 }
458 }
459 $mt->setContent("success", $lng->txt("msg_obj_modified"), true);
460 $this->gui->ctrl()->redirect($this, "list");
461 }
static saveTitle(int $id, string $title, string $lang="-")

References $lang, $lng, and ilLMObject\saveTitle().

+ Here is the call graph for this function:

◆ switchToLanguage()

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

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

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

Field Documentation

◆ $lang

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

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

◆ $lm_id

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

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

◆ $lm_tree

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

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

◆ $page_layouts

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

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

◆ $request

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

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

◆ $sub_obj_id

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

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