ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjTaxonomyGUI.php
Go to the documentation of this file.
1<?php
2
25{
27 protected \ILIAS\DI\UIServices $ui;
28 protected \ILIAS\Taxonomy\InternalGUIService $gui;
29 protected \ILIAS\Taxonomy\InternalDomainService $domain;
30 protected ilTabsGUI $tabs;
31 protected ilHelpGUI $help;
32 protected bool $multiple = false;
33 protected bool $assigned_item_sorting = false;
34 protected int $assigned_object_id = 0;
36 protected string $assigned_item_comp_id = "";
37 protected int $assigned_item_obj_id = 0;
38 protected string $assigned_item_type = "";
39 protected string $list_info = '';
40 protected int $current_tax_node = 0;
41 protected int $requested_tax_id = 0;
42 protected string $requested_move_ids = "";
43
47 public function __construct()
48 {
49 global $DIC;
50
51 $service = $DIC->taxonomy()->internal();
52 $this->gui = $gui = $service->gui();
53 $this->domain = $domain = $service->domain();
54
55 $this->ctrl = $gui->ctrl();
56 $this->tabs = $gui->tabs();
57 $this->toolbar = $gui->toolbar();
58 $this->tpl = $gui->ui()->mainTemplate();
59 $this->help = $gui->help();
60 // @todo introduce request wrapper
61 $this->request = $gui->http()->request();
62
63 $this->lng = $domain->lng();
64 $this->user = $domain->user();
65 $this->ui = $gui->ui();
66
67
69
70 $this->ctrl->saveParameter($this, "tax_node");
71 $this->ctrl->saveParameter($this, "tax_id");
72
73 $this->lng->loadLanguageModule("tax");
74
75 // @todo introduce request wrapper
76 $params = $this->request->getQueryParams();
77 $this->current_tax_node = (int) ($params["tax_node"] ?? null);
78 $this->requested_tax_id = (int) ($params["tax_id"] ?? null);
79 $this->requested_move_ids = (string) ($params["move_ids"] ?? "");
80 }
81
82 public function getType(): string
83 {
84 return "tax";
85 }
86
90 public function setAssignedObject(int $a_val): void
91 {
92 $this->assigned_object_id = $a_val;
93 }
94
95 public function getAssignedObject(): int
96 {
98 }
99
104 public function setMultiple(bool $a_val): void
105 {
106 $this->multiple = $a_val;
107 }
108
109 public function getMultiple(): bool
110 {
111 return $this->multiple;
112 }
113
114 public function setModifier(?\ILIAS\Taxonomy\TaxonomyModifierGUI $modifier): void
115 {
116 $this->modifier = $modifier;
117 }
118
119 public function setListInfo(string $a_val): void
120 {
121 $this->list_info = trim($a_val);
122 }
123
124 public function getListInfo(): string
125 {
126 return $this->list_info;
127 }
128
133 ilTaxAssignedItemInfo $a_item_info_obj,
134 string $a_component_id,
135 int $a_obj_id,
136 string $a_item_type
137 ): void {
138 $this->assigned_item_sorting = true;
139 $this->assigned_item_info_obj = $a_item_info_obj;
140 $this->assigned_item_comp_id = $a_component_id;
141 $this->assigned_item_obj_id = $a_obj_id;
142 $this->assigned_item_type = $a_item_type;
143 }
144
148 public function executeCommand(): void
149 {
150 $ilCtrl = $this->ctrl;
151 $this->tabs->activateSubTab("tax_settings");
152
153 $cmd = $ilCtrl->getCmd("listTaxonomies");
154 $this->$cmd();
155 }
156
160
161 public function editAOTaxonomySettings(): void
162 {
163 $this->listTaxonomies();
164 }
165
166 public function getCurrentTaxonomyId(): ?int
167 {
168 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getAssignedObject());
169 $tax_id = $this->requested_tax_id;
170 if (in_array($tax_id, $tax_ids)) {
171 return $tax_id;
172 }
173 return null;
174 }
175
177 {
178 $tax_id = $this->getCurrentTaxonomyId();
179 if ($tax_id > 0) {
180 return new ilObjTaxonomy($tax_id);
181 }
182 return null;
183 }
184
188 public function listNodes(): void
189 {
190 $tpl = $this->tpl;
191 $ilToolbar = $this->toolbar;
193 $ilCtrl = $this->ctrl;
194
195 $tax = $this->getCurrentTaxonomy();
196
197 $this->setTabs("list_items");
198
199 // show toolbar
200 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
201 $ilToolbar->addFormButton($lng->txt("tax_create_node"), "createTaxNode");
202
203 $ilToolbar->setCloseFormTag(false);
204
205 // show tree
206 $this->showTree();
207
208 $tax_node = $this->current_tax_node;
209 if ($tax_node === 0) {
210 $tax = $this->getCurrentTaxonomy();
211 if ($tax) {
212 $tree = $tax->getTree();
213 $tax_node = $tree->readRootId();
214 }
215 }
216
217 // show subitems
218 $table = new ilTaxonomyTableGUI(
219 $this,
220 "listNodes",
221 $tax->getTree(),
222 $tax_node,
223 $this->getCurrentTaxonomy()
224 );
225 $table->setOpenFormTag(false);
226
227 $tpl->setContent($table->getHTML());
228 }
229
233 public function createAssignedTaxonomy(): void
234 {
235 $this->create();
236 }
237
238 protected function checkPermissionBool(
239 string $perm,
240 string $cmd = "",
241 string $type = "",
242 ?int $node_id = null
243 ): bool {
244 if ($this->getAssignedObject() > 0) {
245 return true;
246 } else {
247 return parent::checkPermissionBool($perm, $cmd, $type, $node_id);
248 }
249 }
250
254 public function cancel(): void
255 {
256 $ilCtrl = $this->ctrl;
257 if ($this->getAssignedObject() > 0) {
258 $ilCtrl->redirectToURL($this->getSettingsBackUrl());
259 }
260 parent::cancel();
261 }
262
263 public function save(): void
264 {
265 if ($this->getAssignedObject() > 0) {
266 $this->requested_new_type = "tax";
267 }
268 parent::saveObject();
269 }
270
274 protected function afterSave(ilObject $a_new_object): void
275 {
276 $ilCtrl = $this->ctrl;
278
279 if ($this->getAssignedObject() > 0) {
281 $a_new_object->getId(),
282 $this->getAssignedObject()
283 );
284 $ilCtrl->setParameter($this, "tax_id", $a_new_object->getId());
285 $this->tpl->setOnScreenMessage('success', $lng->txt("tax_added"), true);
286 $ilCtrl->redirect($this, "editSettings");
287 }
288 }
289
290 public function showTree(bool $a_ass_items = false): void
291 {
292 global $DIC;
293
294 $tax = $this->getCurrentTaxonomy();
295 $ctrl = $this->ctrl;
296
297 $cmd = $a_ass_items
298 ? "listAssignedItems"
299 : "listNodes";
300
301 $DIC->globalScreen()->tool()->context()->current()
302 ->addAdditionalData(
304 true
305 );
306 $DIC->globalScreen()->tool()->context()->current()
307 ->addAdditionalData(
309 $ctrl->getCurrentClassPath()
310 );
311 $DIC->globalScreen()->tool()->context()->current()
312 ->addAdditionalData(
314 $tax->getId()
315 );
316 $DIC->globalScreen()->tool()->context()->current()
317 ->addAdditionalData(
319 $cmd
320 );
321 $DIC->globalScreen()->tool()->context()->current()
322 ->addAdditionalData(
324 "showTree"
325 );
326
327 $tax_exp = new ilTaxonomyExplorerGUI(
328 $this,
329 "showTree",
330 $tax->getId(),
331 "ilobjtaxonomygui",
332 $cmd
333 );
334 $tax_exp->handleCommand();
335 }
336
340 public function createTaxNode(): void
341 {
342 $tpl = $this->tpl;
343 $ilHelp = $this->help;
344
345 $this->setTabs("list_items");
346 $ilHelp->setSubScreenId("create_node");
347
348 $form = $this->initTaxNodeForm("create");
349 $tpl->setContent($form->getHTML());
350 }
351
352 // Init tax node form
353 public function initTaxNodeForm(string $a_mode = "edit"): ilPropertyFormGUI
354 {
356 $ilCtrl = $this->ctrl;
357
358 $form = new ilPropertyFormGUI();
359
360 // title
361 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
362 $form->addItem($ti);
363
364 // order nr
365 $tax = $this->getCurrentTaxonomy();
366 $or = null;
367 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
368 $or = new ilTextInputGUI($this->lng->txt("tax_order_nr"), "order_nr");
369 $or->setMaxLength(5);
370 $or->setSize(5);
371 $form->addItem($or);
372 }
373
374 if ($a_mode == "edit") {
375 $node = new ilTaxonomyNode($this->current_tax_node);
376 $ti->setValue($node->getTitle());
377 if (is_object($or)) {
378 $or->setValue($node->getOrderNr());
379 }
380 }
381
382 // save and cancel commands
383 if ($a_mode == "create") {
384 $form->addCommandButton("saveTaxNode", $lng->txt("save"));
385 $form->addCommandButton("listNodes", $lng->txt("cancel"));
386 $form->setTitle($lng->txt("tax_new_tax_node"));
387 } else {
388 $form->addCommandButton("updateTaxNode", $lng->txt("save"));
389 $form->addCommandButton("listNodes", $lng->txt("cancel"));
390 $form->setTitle($lng->txt("tax_edit_tax_node"));
391 }
392
393 $form->setFormAction($ilCtrl->getFormAction($this));
394
395 return $form;
396 }
397
401 public function saveTaxNode(): void
402 {
403 $tpl = $this->tpl;
405 $ilCtrl = $this->ctrl;
406
407 $form = $this->initTaxNodeForm("create");
408 if ($form->checkInput()) {
409 // create node
410 $node = new ilTaxonomyNode();
411 $node->setTitle($form->getInput("title"));
412
413 $tax = $this->getCurrentTaxonomy();
414 $order_nr = "";
415 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
416 $order_nr = $form->getInput("order_nr");
417 }
418 if ($order_nr === "") {
419 $order_nr = ilTaxonomyNode::getNextOrderNr($tax->getId(), $this->current_tax_node);
420 }
421 //echo $order_nr; exit;
422 $node->setOrderNr($order_nr);
423 $node->setTaxonomyId($tax->getId());
424 $node->create();
425
426 // put in tree
427 ilTaxonomyNode::putInTree($tax->getId(), $node, $this->current_tax_node);
428
429 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $this->current_tax_node);
430
431 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
432 $ilCtrl->redirect($this, "listNodes");
433 } else {
434 $form->setValuesByPost();
435 $tpl->setContent($form->getHTML());
436 }
437 }
438
442 public function updateTaxNode(): void
443 {
445 $ilCtrl = $this->ctrl;
446 $tpl = $this->tpl;
447
448 $form = $this->initTaxNodeForm("edit");
449 if ($form->checkInput()) {
450 // create node
451 $node = new ilTaxonomyNode($this->current_tax_node);
452 $node->setTitle($form->getInput("title"));
453
454 $tax = $this->getCurrentTaxonomy();
455 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
456 $node->setOrderNr($form->getInput("order_nr"));
457 }
458
459 $node->update();
460
461 $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
462 $ilCtrl->redirect($this, "");
463 } else {
464 $form->setValuesByPost();
465 $tpl->setContent($form->getHTML());
466 }
467 }
468
472 public function deleteItems(): void
473 {
475 $tpl = $this->tpl;
476 $ilCtrl = $this->ctrl;
477 $ilHelp = $this->help;
478 $body = $this->request->getParsedBody();
479
480 if (!isset($body["id"])) {
481 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
482 $ilCtrl->redirect($this, "listNodes");
483 }
484
485 $this->setTabs("list_items");
486 $ilHelp->setSubScreenId("del_items");
487
488 // $ilTabs->clearTargets();
489
490 $confirmation_gui = new ilConfirmationGUI();
491
492 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
493 $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
494
495 // Add items to delete
496 foreach ($body["id"] as $id) {
497 $confirmation_gui->addItem(
498 "id[]",
499 $id,
501 );
502 }
503
504 $confirmation_gui->setCancel($lng->txt("cancel"), "listNodes");
505 $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
506
507 $tpl->setContent($confirmation_gui->getHTML());
508 }
509
513 public function confirmedDelete(): void
514 {
515 $ilCtrl = $this->ctrl;
516 $body = $this->request->getParsedBody();
517
518 // delete all selected objects
519 foreach ($body["id"] as $id) {
520 $node = new ilTaxonomyNode($id);
521 $tax = new ilObjTaxonomy($node->getTaxonomyId());
522 $tax_tree = $tax->getTree();
523 $node_data = $tax_tree->getNodeData($id);
524 if (is_object($node)) {
525 $node->delete();
526 }
527 if ($tax_tree->isInTree($id)) {
528 $tax_tree->deleteTree($node_data);
529 }
530 ilTaxonomyNode::fixOrderNumbers($node->getTaxonomyId(), $node_data["parent"]);
531 }
532
533 // feedback
534 $this->tpl->setOnScreenMessage('info', $this->lng->txt("info_deleted"), true);
535
536 $ilCtrl->redirect($this, "listNodes");
537 }
538
542 public function saveSorting(): void
543 {
544 $ilCtrl = $this->ctrl;
546 $body = $this->request->getParsedBody();
547
548 // save sorting
549 if (is_array($body["order"] ?? false)) {
550 foreach ($body["order"] as $k => $v) {
552 }
553 ilTaxonomyNode::fixOrderNumbers($this->getCurrentTaxonomyId(), $this->current_tax_node);
554 }
555
556 // save titles
557 if (is_array($body["title"] ?? false)) {
558 foreach ($body["title"] as $k => $v) {
560 (int) $k,
562 );
563 }
564 }
565 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"));
566 $ilCtrl->redirect($this, "listNodes");
567 }
568
572 public function moveItems(): void
573 {
574 $ilCtrl = $this->ctrl;
576 $ilToolbar = $this->toolbar;
577 $ilHelp = $this->help;
578 $body = $this->request->getParsedBody();
579
580 if (!isset($body["id"])) {
581 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
582 $ilCtrl->redirect($this, "listNodes");
583 }
584
585 $this->setTabs("list_items");
586 $ilHelp->setSubScreenId("move_items");
587
588 $ilToolbar->addButton(
589 $lng->txt("cancel"),
590 $ilCtrl->getLinkTarget($this, "listNodes")
591 );
592
593 $this->tpl->setOnScreenMessage('info', $lng->txt("tax_please_select_target"));
594
595 if (is_array($body["id"])) {
596 $ilCtrl->setParameter($this, "move_ids", implode(",", $body["id"]));
597
598 $tpl = $this->tpl;
599
600 $tax_exp = new ilTaxonomyExplorerGUI(
601 $this,
602 "moveItems",
603 $this->getCurrentTaxonomy()->getId(),
604 "ilobjtaxonomygui",
605 "pasteItems"
606 );
607 if (!$tax_exp->handleCommand()) {
608 //$tpl->setLeftNavContent($tax_exp->getHTML());
609 $tpl->setContent($tax_exp->getHTML(true) . "&nbsp;");
610 }
611 }
612 }
613
617 public function pasteItems(): void
618 {
620 $ilCtrl = $this->ctrl;
621 if ($this->requested_move_ids != "") {
622 $move_ids = explode(",", $this->requested_move_ids);
623 $tax = $this->getCurrentTaxonomy();
624 $tree = $tax->getTree();
625
626 $target_node = new ilTaxonomyNode($this->current_tax_node);
627 foreach ($move_ids as $m_id) {
628 // cross check taxonomy
629 $node = new ilTaxonomyNode((int) $m_id);
630 if ($node->getTaxonomyId() == $tax->getId() &&
631 ($target_node->getTaxonomyId() == $tax->getId() ||
632 $target_node->getId() == $tree->readRootId())) {
633 // check if target is not within the selected nodes
634 if ($tree->isGrandChild((int) $m_id, $target_node->getId()) ||
635 $m_id == $target_node->getId()) {
636 $this->tpl->setOnScreenMessage('failure', $lng->txt("tax_target_within_nodes"), true);
637 $this->ctrl->redirect($this, "listNodes");
638 }
639
640 // if target is not current place, move
641 $parent_id = $tree->getParentId((int) $m_id);
642 if ($parent_id != $target_node->getId()) {
643 $tree->moveTree((int) $m_id, $target_node->getId());
644 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $target_node->getId());
645 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $parent_id);
646 }
647 }
648 }
649 }
650
651 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
652 $ilCtrl->redirect($this, "listNodes");
653 }
654
658 public function confirmDeleteTaxonomy(): void
659 {
660 $ilCtrl = $this->ctrl;
661 $tpl = $this->tpl;
663
664 $tax = $this->getCurrentTaxonomy();
665
666 $cgui = new ilConfirmationGUI();
667 $cgui->setFormAction($ilCtrl->getFormAction($this));
668 $cgui->setHeaderText($lng->txt("tax_confirm_deletion"));
669 $cgui->setCancel($lng->txt("cancel"), "returnToSettingsParent");
670 $cgui->setConfirm($lng->txt("delete"), "deleteTaxonomy");
671
672 $cgui->addItem("id[]", 0, $tax->getTitle());
673
674 $tpl->setContent($cgui->getHTML());
675 }
676
680 public function deleteTaxonomy(): void
681 {
682 $ilCtrl = $this->ctrl;
684
685 $tax = $this->getCurrentTaxonomy();
686 $tax->delete();
687
688 $this->tpl->setOnScreenMessage('success', $lng->txt("tax_tax_deleted"), true);
689 $this->returnToSettingsParent();
690 }
691
695 public function listTaxonomies(): void
696 {
697 $tpl = $this->tpl;
698 $ilToolbar = $this->toolbar;
700 $ilCtrl = $this->ctrl;
701
702 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getAssignedObject());
703 if (count($tax_ids) == 0 || $this->getMultiple()) {
704 $ilToolbar->addButton(
705 $lng->txt("tax_add_taxonomy"),
706 $ilCtrl->getLinkTarget($this, "createAssignedTaxonomy")
707 );
708 } else {
709 $this->tpl->setOnScreenMessage('info', $lng->txt("tax_max_one_tax"));
710 }
711
712 $tab = new ilTaxonomyListTableGUI(
713 $this,
714 "listTaxonomies",
715 $this->getAssignedObject(),
716 $this->getListInfo()
717 );
718
719 $tpl->setContent($tab->getHTML());
720 }
721
722 protected function getSettingsBackUrl(): string
723 {
724 return $this->ctrl->getParentReturn($this);
725 }
726
727 protected function returnToSettingsParent(): void
728 {
729 $this->ctrl->redirectToURL($this->getSettingsBackUrl());
730 }
731
735 protected function setTabs($a_id = ""): void
736 {
737 $ilTabs = $this->tabs;
738 $ilCtrl = $this->ctrl;
739 $tpl = $this->tpl;
741 $ilHelp = $this->help;
742
743 $ilTabs->clearTargets();
744
745 $ilHelp->setScreenIdComponent("tax");
746
747 $tpl->setTitle(ilObject::_lookupTitle($this->getCurrentTaxonomyId()));
748 $tpl->setDescription(ilObject::_lookupDescription($this->getCurrentTaxonomyId()));
749 $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_tax.svg"));
750
751 $ilTabs->setBackTarget(
752 $lng->txt("back"),
753 $this->getSettingsBackUrl()
754 );
755
756 $ilTabs->addTab(
757 "list_items",
758 $lng->txt("tax_nodes"),
759 $ilCtrl->getLinkTarget($this, "listNodes")
760 );
761 if ($this->assigned_item_sorting) {
762 $ilTabs->addTab(
763 "ass_items",
764 $lng->txt("tax_assigned_items"),
765 $ilCtrl->getLinkTarget($this, "listAssignedItems")
766 );
767 }
768 $ilTabs->addTab(
769 "settings",
770 $lng->txt("settings"),
771 $ilCtrl->getLinkTarget($this, "editSettings")
772 );
773
774 $ilTabs->activateTab($a_id);
775 }
776
780 public function editSettings(): void
781 {
782 $tpl = $this->tpl;
783
784 $this->setTabs("settings");
785
786 $form = $this->initSettingsForm();
787 $tpl->setContent($form->getHTML());
788 }
789
791 {
793 $ilCtrl = $this->ctrl;
794
795 $tax = $this->getCurrentTaxonomy();
796
797 $form = new ilPropertyFormGUI();
798
799 // title
800 $ti = new ilTextInputGUI($lng->txt("title"), "title");
801 $ti->setMaxLength(200);
802
803 $form->addItem($ti);
804 $ti->setValue($tax->getTitle());
805
806 // description
807 $ta = new ilTextAreaInputGUI($lng->txt("description"), "description");
808 //$ta->setCols();
809 //$ta->setRows();
810 $form->addItem($ta);
811 $ta->setValue($tax->getDescription());
812
813 // sorting
814 $options = array(
815 ilObjTaxonomy::SORT_ALPHABETICAL => $lng->txt("tax_alphabetical"),
816 ilObjTaxonomy::SORT_MANUAL => $lng->txt("tax_manual")
817 );
818 $si = new ilSelectInputGUI($lng->txt("tax_node_sorting"), "sorting");
819
820 $si->setOptions($options);
821 $form->addItem($si);
822 $si->setValue($tax->getSortingMode());
823
824 // assigned item sorting
825 if ($this->assigned_item_sorting) {
826 $cb = new ilCheckboxInputGUI($lng->txt("tax_item_sorting"), "item_sorting");
827 $cb->setChecked($tax->getItemSorting());
828 $form->addItem($cb);
829 }
830
831 $form->addCommandButton("updateSettings", $lng->txt("save"));
832
833 $form->setTitle($lng->txt("settings"));
834 $form->setFormAction($ilCtrl->getFormAction($this));
835
836 return $form;
837 }
838
842 public function updateSettings(): void
843 {
844 $tpl = $this->tpl;
846 $ilCtrl = $this->ctrl;
847
848 $form = $this->initSettingsForm();
849 if ($form->checkInput()) {
850 $tax = $this->getCurrentTaxonomy();
851 $tax->setTitle($form->getInput("title"));
852 $tax->setDescription($form->getInput("description"));
853 $tax->setSortingMode((int) $form->getInput("sorting"));
854 $tax->setItemSorting((bool) $form->getInput("item_sorting"));
855 $tax->update();
856
857 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
858 $ilCtrl->redirect($this, "editSettings");
859 } else {
860 $form->setValuesByPost();
861 $tpl->setContent($form->getHTML());
862 }
863 }
864
868 public function listAssignedItems(): void
869 {
870 $tpl = $this->tpl;
871
872 $this->setTabs("ass_items");
873
874 // show tree
875 $this->showTree(true);
876
877 // list assigned items
878 $table = new ilTaxAssignedItemsTableGUI(
879 $this,
880 "listAssignedItems",
881 $this->current_tax_node,
882 $this->getCurrentTaxonomy(),
883 $this->assigned_item_comp_id,
884 $this->assigned_item_obj_id,
885 $this->assigned_item_type,
886 $this->assigned_item_info_obj
887 );
888
889 $tpl->setContent($table->getHTML());
890 }
891
895 public function saveAssignedItemsSorting(): void
896 {
898 $ilCtrl = $this->ctrl;
899 $body = $this->request->getParsedBody();
900
901 if (is_array($body["order"])) {
902 $order = $body["order"];
903 $tax_node = $this->current_tax_node;
904 foreach ($order as $a_item_id => $ord_nr) {
905 $tax_ass = new ilTaxNodeAssignment(
906 $this->assigned_item_comp_id,
907 $this->assigned_item_obj_id,
908 $this->assigned_item_type,
909 (int) $this->getCurrentTaxonomyId()
910 );
911 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
912 }
913 $tax_ass = new ilTaxNodeAssignment(
914 $this->assigned_item_comp_id,
915 $this->assigned_item_obj_id,
916 $this->assigned_item_type,
917 $this->getCurrentTaxonomyId()
918 );
919 $tax_ass->fixOrderNr($tax_node);
920 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
921 }
922 $ilCtrl->redirect($this, "listAssignedItems");
923 }
924}
$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,.
setModifier(?\ILIAS\Taxonomy\TaxonomyModifierGUI $modifier)
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
ILIAS Taxonomy Settings ModifierGUIInterface $modifier
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
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26