ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilObjTaxonomyGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected \ILIAS\DI\UIServices $ui;
27 protected \ILIAS\Taxonomy\InternalGUIService $gui;
28 protected \ILIAS\Taxonomy\InternalDomainService $domain;
29 protected ilTabsGUI $tabs;
30 protected ilHelpGUI $help;
31 protected bool $multiple = false;
32 protected bool $assigned_item_sorting = false;
33 protected int $assigned_object_id = 0;
35 protected string $assigned_item_comp_id = "";
36 protected int $assigned_item_obj_id = 0;
37 protected string $assigned_item_type = "";
38 protected string $list_info = '';
39 protected int $current_tax_node = 0;
40 protected int $requested_tax_id = 0;
41 protected string $requested_move_ids = "";
42
46 public function __construct()
47 {
48 global $DIC;
49
50 $service = $DIC->taxonomy()->internal();
51 $this->gui = $gui = $service->gui();
52 $this->domain = $domain = $service->domain();
53
54 $this->ctrl = $gui->ctrl();
55 $this->tabs = $gui->tabs();
56 $this->toolbar = $gui->toolbar();
57 $this->tpl = $gui->ui()->mainTemplate();
58 $this->help = $gui->help();
59 // @todo introduce request wrapper
60 $this->request = $gui->http()->request();
61
62 $this->lng = $domain->lng();
63 $this->user = $domain->user();
64 $this->ui = $gui->ui();
65
66
68
69 $this->ctrl->saveParameter($this, "tax_node");
70 $this->ctrl->saveParameter($this, "tax_id");
71
72 $this->lng->loadLanguageModule("tax");
73
74 // @todo introduce request wrapper
75 $params = $this->request->getQueryParams();
76 $this->current_tax_node = (int) ($params["tax_node"] ?? null);
77 $this->requested_tax_id = (int) ($params["tax_id"] ?? null);
78 $this->requested_move_ids = (string) ($params["move_ids"] ?? "");
79 }
80
81 public function getType(): string
82 {
83 return "tax";
84 }
85
89 public function setAssignedObject(int $a_val): void
90 {
91 $this->assigned_object_id = $a_val;
92 }
93
94 public function getAssignedObject(): int
95 {
97 }
98
103 public function setMultiple(bool $a_val): void
104 {
105 $this->multiple = $a_val;
106 }
107
108 public function getMultiple(): bool
109 {
110 return $this->multiple;
111 }
112
113 public function setListInfo(string $a_val): void
114 {
115 $this->list_info = trim($a_val);
116 }
117
118 public function getListInfo(): string
119 {
120 return $this->list_info;
121 }
122
127 ilTaxAssignedItemInfo $a_item_info_obj,
128 string $a_component_id,
129 int $a_obj_id,
130 string $a_item_type
131 ): void {
132 $this->assigned_item_sorting = true;
133 $this->assigned_item_info_obj = $a_item_info_obj;
134 $this->assigned_item_comp_id = $a_component_id;
135 $this->assigned_item_obj_id = $a_obj_id;
136 $this->assigned_item_type = $a_item_type;
137 }
138
142 public function executeCommand(): void
143 {
144 $ilCtrl = $this->ctrl;
145 $this->tabs->activateSubTab("tax_settings");
146
147 $cmd = $ilCtrl->getCmd("listTaxonomies");
148 $this->$cmd();
149 }
150
154
155 public function editAOTaxonomySettings(): void
156 {
157 $this->listTaxonomies();
158 }
159
160 public function getCurrentTaxonomyId(): ?int
161 {
162 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getAssignedObject());
163 $tax_id = $this->requested_tax_id;
164 if (in_array($tax_id, $tax_ids)) {
165 return $tax_id;
166 }
167 return null;
168 }
169
171 {
172 $tax_id = $this->getCurrentTaxonomyId();
173 if ($tax_id > 0) {
174 return new ilObjTaxonomy($tax_id);
175 }
176 return null;
177 }
178
182 public function listNodes(): void
183 {
184 $tpl = $this->tpl;
185 $ilToolbar = $this->toolbar;
187 $ilCtrl = $this->ctrl;
188
189 $tax = $this->getCurrentTaxonomy();
190
191 $this->setTabs("list_items");
192
193 // show toolbar
194 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
195 $ilToolbar->addFormButton($lng->txt("tax_create_node"), "createTaxNode");
196
197 $ilToolbar->setCloseFormTag(false);
198
199 // show tree
200 $this->showTree();
201
202 $tax_node = $this->current_tax_node;
203 if ($tax_node === 0) {
204 $tax = $this->getCurrentTaxonomy();
205 if ($tax) {
206 $tree = $tax->getTree();
207 $tax_node = $tree->readRootId();
208 }
209 }
210
211 // show subitems
212 $table = new ilTaxonomyTableGUI(
213 $this,
214 "listNodes",
215 $tax->getTree(),
216 $tax_node,
217 $this->getCurrentTaxonomy()
218 );
219 $table->setOpenFormTag(false);
220
221 $tpl->setContent($table->getHTML());
222 }
223
227 public function createAssignedTaxonomy(): void
228 {
229 $this->requested_new_type = "tax";
230 $this->create();
231 }
232
233 protected function checkPermissionBool(
234 string $perm,
235 string $cmd = "",
236 string $type = "",
237 ?int $node_id = null
238 ): bool {
239 if ($this->getAssignedObject() > 0) {
240 return true;
241 } else {
242 return parent::checkPermissionBool($perm, $cmd, $type, $node_id);
243 }
244 }
245
249 public function cancel(): void
250 {
251 $ilCtrl = $this->ctrl;
252 if ($this->getAssignedObject() > 0) {
253 $ilCtrl->redirectToURL($this->getSettingsBackUrl());
254 }
255 parent::cancel();
256 }
257
258 public function save(): void
259 {
260 if ($this->getAssignedObject() > 0) {
261 $this->requested_new_type = "tax";
262 }
263 parent::saveObject();
264 }
265
269 protected function afterSave(ilObject $a_new_object): void
270 {
271 $ilCtrl = $this->ctrl;
273
274 if ($this->getAssignedObject() > 0) {
276 $a_new_object->getId(),
277 $this->getAssignedObject()
278 );
279 $ilCtrl->setParameter($this, "tax_id", $a_new_object->getId());
280 $this->tpl->setOnScreenMessage('success', $lng->txt("tax_added"), true);
281 $ilCtrl->redirect($this, "editSettings");
282 }
283 }
284
285 public function showTree(bool $a_ass_items = false): void
286 {
287 global $DIC;
288
289 $tax = $this->getCurrentTaxonomy();
290 $ctrl = $this->ctrl;
291
292 $cmd = $a_ass_items
293 ? "listAssignedItems"
294 : "listNodes";
295
296 $DIC->globalScreen()->tool()->context()->current()
297 ->addAdditionalData(
299 true
300 );
301 $DIC->globalScreen()->tool()->context()->current()
302 ->addAdditionalData(
304 $ctrl->getCurrentClassPath()
305 );
306 $DIC->globalScreen()->tool()->context()->current()
307 ->addAdditionalData(
309 $tax->getId()
310 );
311 $DIC->globalScreen()->tool()->context()->current()
312 ->addAdditionalData(
314 $cmd
315 );
316 $DIC->globalScreen()->tool()->context()->current()
317 ->addAdditionalData(
319 "showTree"
320 );
321
322 $tax_exp = new ilTaxonomyExplorerGUI(
323 $this,
324 "showTree",
325 $tax->getId(),
326 "ilobjtaxonomygui",
327 $cmd
328 );
329 $tax_exp->handleCommand();
330 }
331
335 public function createTaxNode(): void
336 {
337 $tpl = $this->tpl;
338 $ilHelp = $this->help;
339
340 $this->showTree();
341 $this->setTabs("list_items");
342 $ilHelp->setSubScreenId("create_node");
343
344 $form = $this->initTaxNodeForm("create");
345 $tpl->setContent($form->getHTML());
346 }
347
348 // Init tax node form
349 public function initTaxNodeForm(string $a_mode = "edit"): ilPropertyFormGUI
350 {
352 $ilCtrl = $this->ctrl;
353
354 $form = new ilPropertyFormGUI();
355
356 // title
357 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
358 $form->addItem($ti);
359
360 // order nr
361 $tax = $this->getCurrentTaxonomy();
362 $or = null;
363 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
364 $or = new ilTextInputGUI($this->lng->txt("tax_order_nr"), "order_nr");
365 $or->setMaxLength(5);
366 $or->setSize(5);
367 $form->addItem($or);
368 }
369
370 if ($a_mode == "edit") {
371 $node = new ilTaxonomyNode($this->current_tax_node);
372 $ti->setValue($node->getTitle());
373 if (is_object($or)) {
374 $or->setValue($node->getOrderNr());
375 }
376 }
377
378 // save and cancel commands
379 if ($a_mode == "create") {
380 $form->addCommandButton("saveTaxNode", $lng->txt("save"));
381 $form->addCommandButton("listNodes", $lng->txt("cancel"));
382 $form->setTitle($lng->txt("tax_new_tax_node"));
383 } else {
384 $form->addCommandButton("updateTaxNode", $lng->txt("save"));
385 $form->addCommandButton("listNodes", $lng->txt("cancel"));
386 $form->setTitle($lng->txt("tax_edit_tax_node"));
387 }
388
389 $form->setFormAction($ilCtrl->getFormAction($this));
390
391 return $form;
392 }
393
397 public function saveTaxNode(): void
398 {
399 $tpl = $this->tpl;
401 $ilCtrl = $this->ctrl;
402
403 $form = $this->initTaxNodeForm("create");
404 if ($form->checkInput()) {
405 // create node
406 $node = new ilTaxonomyNode();
407 $node->setTitle($form->getInput("title"));
408
409 $tax = $this->getCurrentTaxonomy();
410 $order_nr = "";
411 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
412 $order_nr = $form->getInput("order_nr");
413 }
414 if ($order_nr === "") {
415 $order_nr = ilTaxonomyNode::getNextOrderNr($tax->getId(), $this->current_tax_node);
416 }
417 //echo $order_nr; exit;
418 $node->setOrderNr($order_nr);
419 $node->setTaxonomyId($tax->getId());
420 $node->create();
421
422 // put in tree
423 ilTaxonomyNode::putInTree($tax->getId(), $node, $this->current_tax_node);
424
425 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $this->current_tax_node);
426
427 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
428 $ilCtrl->redirect($this, "listNodes");
429 } else {
430 $form->setValuesByPost();
431 $tpl->setContent($form->getHTML());
432 }
433 }
434
438 public function updateTaxNode(): void
439 {
441 $ilCtrl = $this->ctrl;
442 $tpl = $this->tpl;
443
444 $form = $this->initTaxNodeForm("edit");
445 if ($form->checkInput()) {
446 // create node
447 $node = new ilTaxonomyNode($this->current_tax_node);
448 $node->setTitle($form->getInput("title"));
449
450 $tax = $this->getCurrentTaxonomy();
451 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
452 $node->setOrderNr($form->getInput("order_nr"));
453 }
454
455 $node->update();
456
457 $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
458 $ilCtrl->redirect($this, "");
459 } else {
460 $form->setValuesByPost();
461 $tpl->setContent($form->getHTML());
462 }
463 }
464
468 public function deleteItems(): void
469 {
471 $tpl = $this->tpl;
472 $ilCtrl = $this->ctrl;
473 $ilHelp = $this->help;
474 $body = $this->request->getParsedBody();
475 $this->showTree();
476
477 if (!isset($body["id"])) {
478 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
479 $ilCtrl->redirect($this, "listNodes");
480 }
481
482 $this->setTabs("list_items");
483 $ilHelp->setSubScreenId("del_items");
484
485 // $ilTabs->clearTargets();
486
487 $confirmation_gui = new ilConfirmationGUI();
488
489 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
490 $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
491
492 // Add items to delete
493 foreach ($body["id"] as $id) {
494 $confirmation_gui->addItem(
495 "id[]",
496 $id,
498 );
499 }
500
501 $confirmation_gui->setCancel($lng->txt("cancel"), "listNodes");
502 $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
503
504 $tpl->setContent($confirmation_gui->getHTML());
505 }
506
510 public function confirmedDelete(): void
511 {
512 $ilCtrl = $this->ctrl;
513 $body = $this->request->getParsedBody();
514
515 // delete all selected objects
516 foreach ($body["id"] as $id) {
517 $node = new ilTaxonomyNode($id);
518 $tax = new ilObjTaxonomy($node->getTaxonomyId());
519 $tax_tree = $tax->getTree();
520 $node_data = $tax_tree->getNodeData($id);
521 if (is_object($node)) {
522 $node->delete();
523 }
524 if ($tax_tree->isInTree($id)) {
525 $tax_tree->deleteTree($node_data);
526 }
527 ilTaxonomyNode::fixOrderNumbers($node->getTaxonomyId(), $node_data["parent"]);
528 }
529
530 // feedback
531 $this->tpl->setOnScreenMessage('info', $this->lng->txt("info_deleted"), true);
532
533 $ilCtrl->redirect($this, "listNodes");
534 }
535
539 public function saveSorting(): void
540 {
541 $ilCtrl = $this->ctrl;
543 $body = $this->request->getParsedBody();
544
545 // save sorting
546 if (is_array($body["order"] ?? false)) {
547 foreach ($body["order"] as $k => $v) {
549 }
550 ilTaxonomyNode::fixOrderNumbers($this->getCurrentTaxonomyId(), $this->current_tax_node);
551 }
552
553 // save titles
554 if (is_array($body["title"] ?? false)) {
555 foreach ($body["title"] as $k => $v) {
557 (int) $k,
559 );
560 }
561 }
562 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"));
563 $ilCtrl->redirect($this, "listNodes");
564 }
565
569 public function moveItems(): void
570 {
571 $ilCtrl = $this->ctrl;
573 $ilToolbar = $this->toolbar;
574 $ilHelp = $this->help;
575 $body = $this->request->getParsedBody();
576
577 if (!isset($body["id"])) {
578 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
579 $ilCtrl->redirect($this, "listNodes");
580 }
581
582 $this->setTabs("list_items");
583 $ilHelp->setSubScreenId("move_items");
584
585 $ilToolbar->addButton(
586 $lng->txt("cancel"),
587 $ilCtrl->getLinkTarget($this, "listNodes")
588 );
589
590 $this->tpl->setOnScreenMessage('info', $lng->txt("tax_please_select_target"));
591
592 if (is_array($body["id"])) {
593 $ilCtrl->setParameter($this, "move_ids", implode(",", $body["id"]));
594
595 $tpl = $this->tpl;
596
597 $tax_exp = new ilTaxonomyExplorerGUI(
598 $this,
599 "moveItems",
600 $this->getCurrentTaxonomy()->getId(),
601 "ilobjtaxonomygui",
602 "pasteItems"
603 );
604 if (!$tax_exp->handleCommand()) {
605 //$tpl->setLeftNavContent($tax_exp->getHTML());
606 $tpl->setContent($tax_exp->getHTML(true) . "&nbsp;");
607 }
608 }
609 }
610
614 public function pasteItems(): void
615 {
617 $ilCtrl = $this->ctrl;
618 if ($this->requested_move_ids != "") {
619 $move_ids = explode(",", $this->requested_move_ids);
620 $tax = $this->getCurrentTaxonomy();
621 $tree = $tax->getTree();
622
623 $target_node = new ilTaxonomyNode($this->current_tax_node);
624 foreach ($move_ids as $m_id) {
625 // cross check taxonomy
626 $node = new ilTaxonomyNode((int) $m_id);
627 if ($node->getTaxonomyId() == $tax->getId() &&
628 ($target_node->getTaxonomyId() == $tax->getId() ||
629 $target_node->getId() == $tree->readRootId())) {
630 // check if target is not within the selected nodes
631 if ($tree->isGrandChild((int) $m_id, $target_node->getId()) ||
632 $m_id == $target_node->getId()) {
633 $this->tpl->setOnScreenMessage('failure', $lng->txt("tax_target_within_nodes"), true);
634 $this->ctrl->redirect($this, "listNodes");
635 }
636
637 // if target is not current place, move
638 $parent_id = $tree->getParentId((int) $m_id);
639 if ($parent_id != $target_node->getId()) {
640 $tree->moveTree((int) $m_id, $target_node->getId());
641 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $target_node->getId());
642 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $parent_id);
643 }
644 }
645 }
646 }
647
648 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
649 $ilCtrl->redirect($this, "listNodes");
650 }
651
655 public function confirmDeleteTaxonomy(): void
656 {
657 $ilCtrl = $this->ctrl;
658 $tpl = $this->tpl;
660
661 $tax = $this->getCurrentTaxonomy();
662
663 $cgui = new ilConfirmationGUI();
664 $cgui->setFormAction($ilCtrl->getFormAction($this));
665 $cgui->setHeaderText($lng->txt("tax_confirm_deletion"));
666 $cgui->setCancel($lng->txt("cancel"), "returnToSettingsParent");
667 $cgui->setConfirm($lng->txt("delete"), "deleteTaxonomy");
668
669 $cgui->addItem("id[]", 0, $tax->getTitle());
670
671 $tpl->setContent($cgui->getHTML());
672 }
673
677 public function deleteTaxonomy(): void
678 {
679 $ilCtrl = $this->ctrl;
681
682 $tax = $this->getCurrentTaxonomy();
683 $tax->delete();
684
685 $this->tpl->setOnScreenMessage('success', $lng->txt("tax_tax_deleted"), true);
686 $this->returnToSettingsParent();
687 }
688
692 public function listTaxonomies(): void
693 {
694 $tpl = $this->tpl;
695 $ilToolbar = $this->toolbar;
697 $ilCtrl = $this->ctrl;
698
699 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getAssignedObject());
700 if (count($tax_ids) == 0 || $this->getMultiple()) {
701 $ilToolbar->addButton(
702 $lng->txt("tax_add_taxonomy"),
703 $ilCtrl->getLinkTarget($this, "createAssignedTaxonomy")
704 );
705 } else {
706 $this->tpl->setOnScreenMessage('info', $lng->txt("tax_max_one_tax"));
707 }
708
709 $tab = new ilTaxonomyListTableGUI(
710 $this,
711 "listTaxonomies",
712 $this->getAssignedObject(),
713 $this->getListInfo()
714 );
715
716 $tpl->setContent($tab->getHTML());
717 }
718
719 protected function getSettingsBackUrl(): string
720 {
721 return $this->ctrl->getParentReturn($this);
722 }
723
724 protected function returnToSettingsParent(): void
725 {
726 $this->ctrl->redirectToURL($this->getSettingsBackUrl());
727 }
728
732 protected function setTabs($a_id = ""): void
733 {
734 $ilTabs = $this->tabs;
735 $ilCtrl = $this->ctrl;
736 $tpl = $this->tpl;
738 $ilHelp = $this->help;
739
740 $ilTabs->clearTargets();
741
742 $ilHelp->setScreenIdComponent("tax");
743
744 $tpl->setTitle(ilObject::_lookupTitle($this->getCurrentTaxonomyId()));
745 $tpl->setDescription(ilObject::_lookupDescription($this->getCurrentTaxonomyId()));
746 $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_tax.svg"));
747
748 $ilTabs->setBackTarget(
749 $lng->txt("back"),
750 $this->getSettingsBackUrl()
751 );
752
753 $ilTabs->addTab(
754 "list_items",
755 $lng->txt("tax_nodes"),
756 $ilCtrl->getLinkTarget($this, "listNodes")
757 );
758 if ($this->assigned_item_sorting) {
759 $ilTabs->addTab(
760 "ass_items",
761 $lng->txt("tax_assigned_items"),
762 $ilCtrl->getLinkTarget($this, "listAssignedItems")
763 );
764 }
765 $ilTabs->addTab(
766 "settings",
767 $lng->txt("settings"),
768 $ilCtrl->getLinkTarget($this, "editSettings")
769 );
770
771 $ilTabs->activateTab($a_id);
772 }
773
777 public function editSettings(): void
778 {
779 $tpl = $this->tpl;
780
781 $this->showTree();
782 $this->setTabs("settings");
783
784 $form = $this->initSettingsForm();
785 $tpl->setContent($form->getHTML());
786 }
787
789 {
791 $ilCtrl = $this->ctrl;
792
793 $tax = $this->getCurrentTaxonomy();
794
795 $form = new ilPropertyFormGUI();
796
797 // title
798 $ti = new ilTextInputGUI($lng->txt("title"), "title");
799 $ti->setMaxLength(200);
800
801 $form->addItem($ti);
802 $ti->setValue($tax->getTitle());
803
804 // description
805 $ta = new ilTextAreaInputGUI($lng->txt("description"), "description");
806 //$ta->setCols();
807 //$ta->setRows();
808 $form->addItem($ta);
809 $ta->setValue($tax->getDescription());
810
811 // sorting
812 $options = array(
813 ilObjTaxonomy::SORT_ALPHABETICAL => $lng->txt("tax_alphabetical"),
814 ilObjTaxonomy::SORT_MANUAL => $lng->txt("tax_manual")
815 );
816 $si = new ilSelectInputGUI($lng->txt("tax_node_sorting"), "sorting");
817
818 $si->setOptions($options);
819 $form->addItem($si);
820 $si->setValue($tax->getSortingMode());
821
822 // assigned item sorting
823 if ($this->assigned_item_sorting) {
824 $cb = new ilCheckboxInputGUI($lng->txt("tax_item_sorting"), "item_sorting");
825 $cb->setChecked($tax->getItemSorting());
826 $form->addItem($cb);
827 }
828
829 $form->addCommandButton("updateSettings", $lng->txt("save"));
830
831 $form->setTitle($lng->txt("settings"));
832 $form->setFormAction($ilCtrl->getFormAction($this));
833
834 return $form;
835 }
836
840 public function updateSettings(): void
841 {
842 $tpl = $this->tpl;
844 $ilCtrl = $this->ctrl;
845
846 $form = $this->initSettingsForm();
847 if ($form->checkInput()) {
848 $tax = $this->getCurrentTaxonomy();
849 $tax->setTitle($form->getInput("title"));
850 $tax->setDescription($form->getInput("description"));
851 $tax->setSortingMode((int) $form->getInput("sorting"));
852 $tax->setItemSorting((bool) $form->getInput("item_sorting"));
853 $tax->update();
854
855 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
856 $ilCtrl->redirect($this, "editSettings");
857 } else {
858 $form->setValuesByPost();
859 $tpl->setContent($form->getHTML());
860 }
861 }
862
866 public function listAssignedItems(): void
867 {
868 $tpl = $this->tpl;
869
870 $this->setTabs("ass_items");
871
872 // show tree
873 $this->showTree(true);
874
875 // list assigned items
876 $table = new ilTaxAssignedItemsTableGUI(
877 $this,
878 "listAssignedItems",
879 $this->current_tax_node,
880 $this->getCurrentTaxonomy(),
881 $this->assigned_item_comp_id,
882 $this->assigned_item_obj_id,
883 $this->assigned_item_type,
884 $this->assigned_item_info_obj
885 );
886
887 $tpl->setContent($table->getHTML());
888 }
889
893 public function saveAssignedItemsSorting(): void
894 {
896 $ilCtrl = $this->ctrl;
897 $body = $this->request->getParsedBody();
898
899 if (is_array($body["order"])) {
900 $order = $body["order"];
901 $tax_node = $this->current_tax_node;
902 foreach ($order as $a_item_id => $ord_nr) {
903 $tax_ass = new ilTaxNodeAssignment(
904 $this->assigned_item_comp_id,
905 $this->assigned_item_obj_id,
906 $this->assigned_item_type,
907 (int) $this->getCurrentTaxonomyId()
908 );
909 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
910 }
911 $tax_ass = new ilTaxNodeAssignment(
912 $this->assigned_item_comp_id,
913 $this->assigned_item_obj_id,
914 $this->assigned_item_type,
915 $this->getCurrentTaxonomyId()
916 );
917 $tax_ass->fixOrderNr($tax_node);
918 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
919 }
920 $ilCtrl->redirect($this, "listAssignedItems");
921 }
922}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
return true
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Help GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
pasteItems()
Paste items (move operation)
createTaxNode()
Create tax node.
confirmDeleteTaxonomy()
Confirm taxonomy deletion.
saveSorting()
Save settings and sorting.
ILIAS Taxonomy InternalDomainService $domain
deleteItems()
Confirm deletion screen for items.
ilTaxAssignedItemInfo $assigned_item_info_obj
afterSave(ilObject $a_new_object)
After saving,.
listTaxonomies()
List taxonomies.
editSettings()
Edit settings.
executeCommand()
Execute command.
confirmedDelete()
Delete taxonomy nodes.
createAssignedTaxonomy()
Create assigned taxonomy.
getType()
Functions that must be overwritten.
setTabs($a_id="")
@inheritDoc
updateTaxNode()
Update tax node.
ILIAS DI UIServices $ui
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
deleteTaxonomy()
Delete taxonomy.
updateSettings()
Update taxonomy settings.
saveAssignedItemsSorting()
Save assigned items sorting.
initTaxNodeForm(string $a_mode="edit")
activateAssignedItemSorting(ilTaxAssignedItemInfo $a_item_info_obj, string $a_component_id, int $a_obj_id, string $a_item_type)
Activate sorting mode of assigned objects.
setMultiple(bool $a_val)
Set multiple.
listAssignedItems()
List assigned items.
cancel()
Cancel creation.
showTree(bool $a_ass_items=false)
ILIAS Taxonomy InternalGUIService $gui
saveTaxNode()
Save tax node form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
static saveUsage(int $a_tax_id, int $a_obj_id)
New implementation of ilObjectGUI.
Class ilObject Basic functions for all objects.
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
This class represents a property form user interface.
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNextOrderNr(int $a_tax_id, int $a_parent_id)
Put this node into the taxonomy tree.
static writeTitle(int $a_node_id, string $a_title)
Write title.
static writeOrderNr(int $a_node_id, int $a_order_nr)
static _lookupTitle(int $a_obj_id)
static putInTree(int $a_tax_id, ilTaxonomyNode $a_node, int $a_parent_id=0, int $a_target_node_id=0, int $a_order_nr=0)
static fixOrderNumbers(int $a_tax_id, int $a_parent_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
$service
Definition: ltiresult.php:36
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26