ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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->create();
230 }
231
232 protected function checkPermissionBool(
233 string $perm,
234 string $cmd = "",
235 string $type = "",
236 ?int $node_id = null
237 ): bool {
238 if ($this->getAssignedObject() > 0) {
239 return true;
240 } else {
241 return parent::checkPermissionBool($perm, $cmd, $type, $node_id);
242 }
243 }
244
248 public function cancel(): void
249 {
250 $ilCtrl = $this->ctrl;
251 if ($this->getAssignedObject() > 0) {
252 $ilCtrl->redirectToURL($this->getSettingsBackUrl());
253 }
254 parent::cancel();
255 }
256
257 public function save(): void
258 {
259 if ($this->getAssignedObject() > 0) {
260 $this->requested_new_type = "tax";
261 }
262 parent::saveObject();
263 }
264
268 protected function afterSave(ilObject $a_new_object): void
269 {
270 $ilCtrl = $this->ctrl;
272
273 if ($this->getAssignedObject() > 0) {
275 $a_new_object->getId(),
276 $this->getAssignedObject()
277 );
278 $ilCtrl->setParameter($this, "tax_id", $a_new_object->getId());
279 $this->tpl->setOnScreenMessage('success', $lng->txt("tax_added"), true);
280 $ilCtrl->redirect($this, "editSettings");
281 }
282 }
283
284 public function showTree(bool $a_ass_items = false): void
285 {
286 global $DIC;
287
288 $tax = $this->getCurrentTaxonomy();
289 $ctrl = $this->ctrl;
290
291 $cmd = $a_ass_items
292 ? "listAssignedItems"
293 : "listNodes";
294
295 $DIC->globalScreen()->tool()->context()->current()
296 ->addAdditionalData(
298 true
299 );
300 $DIC->globalScreen()->tool()->context()->current()
301 ->addAdditionalData(
303 $ctrl->getCurrentClassPath()
304 );
305 $DIC->globalScreen()->tool()->context()->current()
306 ->addAdditionalData(
308 $tax->getId()
309 );
310 $DIC->globalScreen()->tool()->context()->current()
311 ->addAdditionalData(
313 $cmd
314 );
315 $DIC->globalScreen()->tool()->context()->current()
316 ->addAdditionalData(
318 "showTree"
319 );
320
321 $tax_exp = new ilTaxonomyExplorerGUI(
322 $this,
323 "showTree",
324 $tax->getId(),
325 "ilobjtaxonomygui",
326 $cmd
327 );
328 $tax_exp->handleCommand();
329 }
330
334 public function createTaxNode(): void
335 {
336 $tpl = $this->tpl;
337 $ilHelp = $this->help;
338
339 $this->setTabs("list_items");
340 $ilHelp->setSubScreenId("create_node");
341
342 $form = $this->initTaxNodeForm("create");
343 $tpl->setContent($form->getHTML());
344 }
345
346 // Init tax node form
347 public function initTaxNodeForm(string $a_mode = "edit"): ilPropertyFormGUI
348 {
350 $ilCtrl = $this->ctrl;
351
352 $form = new ilPropertyFormGUI();
353
354 // title
355 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
356 $form->addItem($ti);
357
358 // order nr
359 $tax = $this->getCurrentTaxonomy();
360 $or = null;
361 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
362 $or = new ilTextInputGUI($this->lng->txt("tax_order_nr"), "order_nr");
363 $or->setMaxLength(5);
364 $or->setSize(5);
365 $form->addItem($or);
366 }
367
368 if ($a_mode == "edit") {
369 $node = new ilTaxonomyNode($this->current_tax_node);
370 $ti->setValue($node->getTitle());
371 if (is_object($or)) {
372 $or->setValue($node->getOrderNr());
373 }
374 }
375
376 // save and cancel commands
377 if ($a_mode == "create") {
378 $form->addCommandButton("saveTaxNode", $lng->txt("save"));
379 $form->addCommandButton("listNodes", $lng->txt("cancel"));
380 $form->setTitle($lng->txt("tax_new_tax_node"));
381 } else {
382 $form->addCommandButton("updateTaxNode", $lng->txt("save"));
383 $form->addCommandButton("listNodes", $lng->txt("cancel"));
384 $form->setTitle($lng->txt("tax_edit_tax_node"));
385 }
386
387 $form->setFormAction($ilCtrl->getFormAction($this));
388
389 return $form;
390 }
391
395 public function saveTaxNode(): void
396 {
397 $tpl = $this->tpl;
399 $ilCtrl = $this->ctrl;
400
401 $form = $this->initTaxNodeForm("create");
402 if ($form->checkInput()) {
403 // create node
404 $node = new ilTaxonomyNode();
405 $node->setTitle($form->getInput("title"));
406
407 $tax = $this->getCurrentTaxonomy();
408 $order_nr = "";
409 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
410 $order_nr = $form->getInput("order_nr");
411 }
412 if ($order_nr === "") {
413 $order_nr = ilTaxonomyNode::getNextOrderNr($tax->getId(), $this->current_tax_node);
414 }
415 //echo $order_nr; exit;
416 $node->setOrderNr($order_nr);
417 $node->setTaxonomyId($tax->getId());
418 $node->create();
419
420 // put in tree
421 ilTaxonomyNode::putInTree($tax->getId(), $node, $this->current_tax_node);
422
423 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $this->current_tax_node);
424
425 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
426 $ilCtrl->redirect($this, "listNodes");
427 } else {
428 $form->setValuesByPost();
429 $tpl->setContent($form->getHTML());
430 }
431 }
432
436 public function updateTaxNode(): void
437 {
439 $ilCtrl = $this->ctrl;
440 $tpl = $this->tpl;
441
442 $form = $this->initTaxNodeForm("edit");
443 if ($form->checkInput()) {
444 // create node
445 $node = new ilTaxonomyNode($this->current_tax_node);
446 $node->setTitle($form->getInput("title"));
447
448 $tax = $this->getCurrentTaxonomy();
449 if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
450 $node->setOrderNr($form->getInput("order_nr"));
451 }
452
453 $node->update();
454
455 $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
456 $ilCtrl->redirect($this, "");
457 } else {
458 $form->setValuesByPost();
459 $tpl->setContent($form->getHTML());
460 }
461 }
462
466 public function deleteItems(): void
467 {
469 $tpl = $this->tpl;
470 $ilCtrl = $this->ctrl;
471 $ilHelp = $this->help;
472 $body = $this->request->getParsedBody();
473
474 if (!isset($body["id"])) {
475 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
476 $ilCtrl->redirect($this, "listNodes");
477 }
478
479 $this->setTabs("list_items");
480 $ilHelp->setSubScreenId("del_items");
481
482 // $ilTabs->clearTargets();
483
484 $confirmation_gui = new ilConfirmationGUI();
485
486 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
487 $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
488
489 // Add items to delete
490 foreach ($body["id"] as $id) {
491 $confirmation_gui->addItem(
492 "id[]",
493 $id,
495 );
496 }
497
498 $confirmation_gui->setCancel($lng->txt("cancel"), "listNodes");
499 $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
500
501 $tpl->setContent($confirmation_gui->getHTML());
502 }
503
507 public function confirmedDelete(): void
508 {
509 $ilCtrl = $this->ctrl;
510 $body = $this->request->getParsedBody();
511
512 // delete all selected objects
513 foreach ($body["id"] as $id) {
514 $node = new ilTaxonomyNode($id);
515 $tax = new ilObjTaxonomy($node->getTaxonomyId());
516 $tax_tree = $tax->getTree();
517 $node_data = $tax_tree->getNodeData($id);
518 if (is_object($node)) {
519 $node->delete();
520 }
521 if ($tax_tree->isInTree($id)) {
522 $tax_tree->deleteTree($node_data);
523 }
524 ilTaxonomyNode::fixOrderNumbers($node->getTaxonomyId(), $node_data["parent"]);
525 }
526
527 // feedback
528 $this->tpl->setOnScreenMessage('info', $this->lng->txt("info_deleted"), true);
529
530 $ilCtrl->redirect($this, "listNodes");
531 }
532
536 public function saveSorting(): void
537 {
538 $ilCtrl = $this->ctrl;
540 $body = $this->request->getParsedBody();
541
542 // save sorting
543 if (is_array($body["order"] ?? false)) {
544 foreach ($body["order"] as $k => $v) {
546 }
547 ilTaxonomyNode::fixOrderNumbers($this->getCurrentTaxonomyId(), $this->current_tax_node);
548 }
549
550 // save titles
551 if (is_array($body["title"] ?? false)) {
552 foreach ($body["title"] as $k => $v) {
554 (int) $k,
556 );
557 }
558 }
559 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"));
560 $ilCtrl->redirect($this, "listNodes");
561 }
562
566 public function moveItems(): void
567 {
568 $ilCtrl = $this->ctrl;
570 $ilToolbar = $this->toolbar;
571 $ilHelp = $this->help;
572 $body = $this->request->getParsedBody();
573
574 if (!isset($body["id"])) {
575 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
576 $ilCtrl->redirect($this, "listNodes");
577 }
578
579 $this->setTabs("list_items");
580 $ilHelp->setSubScreenId("move_items");
581
582 $ilToolbar->addButton(
583 $lng->txt("cancel"),
584 $ilCtrl->getLinkTarget($this, "listNodes")
585 );
586
587 $this->tpl->setOnScreenMessage('info', $lng->txt("tax_please_select_target"));
588
589 if (is_array($body["id"])) {
590 $ilCtrl->setParameter($this, "move_ids", implode(",", $body["id"]));
591
592 $tpl = $this->tpl;
593
594 $tax_exp = new ilTaxonomyExplorerGUI(
595 $this,
596 "moveItems",
597 $this->getCurrentTaxonomy()->getId(),
598 "ilobjtaxonomygui",
599 "pasteItems"
600 );
601 if (!$tax_exp->handleCommand()) {
602 //$tpl->setLeftNavContent($tax_exp->getHTML());
603 $tpl->setContent($tax_exp->getHTML(true) . "&nbsp;");
604 }
605 }
606 }
607
611 public function pasteItems(): void
612 {
614 $ilCtrl = $this->ctrl;
615 if ($this->requested_move_ids != "") {
616 $move_ids = explode(",", $this->requested_move_ids);
617 $tax = $this->getCurrentTaxonomy();
618 $tree = $tax->getTree();
619
620 $target_node = new ilTaxonomyNode($this->current_tax_node);
621 foreach ($move_ids as $m_id) {
622 // cross check taxonomy
623 $node = new ilTaxonomyNode((int) $m_id);
624 if ($node->getTaxonomyId() == $tax->getId() &&
625 ($target_node->getTaxonomyId() == $tax->getId() ||
626 $target_node->getId() == $tree->readRootId())) {
627 // check if target is not within the selected nodes
628 if ($tree->isGrandChild((int) $m_id, $target_node->getId()) ||
629 $m_id == $target_node->getId()) {
630 $this->tpl->setOnScreenMessage('failure', $lng->txt("tax_target_within_nodes"), true);
631 $this->ctrl->redirect($this, "listNodes");
632 }
633
634 // if target is not current place, move
635 $parent_id = $tree->getParentId((int) $m_id);
636 if ($parent_id != $target_node->getId()) {
637 $tree->moveTree((int) $m_id, $target_node->getId());
638 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $target_node->getId());
639 ilTaxonomyNode::fixOrderNumbers($tax->getId(), $parent_id);
640 }
641 }
642 }
643 }
644
645 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
646 $ilCtrl->redirect($this, "listNodes");
647 }
648
652 public function confirmDeleteTaxonomy(): void
653 {
654 $ilCtrl = $this->ctrl;
655 $tpl = $this->tpl;
657
658 $tax = $this->getCurrentTaxonomy();
659
660 $cgui = new ilConfirmationGUI();
661 $cgui->setFormAction($ilCtrl->getFormAction($this));
662 $cgui->setHeaderText($lng->txt("tax_confirm_deletion"));
663 $cgui->setCancel($lng->txt("cancel"), "returnToSettingsParent");
664 $cgui->setConfirm($lng->txt("delete"), "deleteTaxonomy");
665
666 $cgui->addItem("id[]", 0, $tax->getTitle());
667
668 $tpl->setContent($cgui->getHTML());
669 }
670
674 public function deleteTaxonomy(): void
675 {
676 $ilCtrl = $this->ctrl;
678
679 $tax = $this->getCurrentTaxonomy();
680 $tax->delete();
681
682 $this->tpl->setOnScreenMessage('success', $lng->txt("tax_tax_deleted"), true);
683 $this->returnToSettingsParent();
684 }
685
689 public function listTaxonomies(): void
690 {
691 $tpl = $this->tpl;
692 $ilToolbar = $this->toolbar;
694 $ilCtrl = $this->ctrl;
695
696 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getAssignedObject());
697 if (count($tax_ids) == 0 || $this->getMultiple()) {
698 $ilToolbar->addButton(
699 $lng->txt("tax_add_taxonomy"),
700 $ilCtrl->getLinkTarget($this, "createAssignedTaxonomy")
701 );
702 } else {
703 $this->tpl->setOnScreenMessage('info', $lng->txt("tax_max_one_tax"));
704 }
705
706 $tab = new ilTaxonomyListTableGUI(
707 $this,
708 "listTaxonomies",
709 $this->getAssignedObject(),
710 $this->getListInfo()
711 );
712
713 $tpl->setContent($tab->getHTML());
714 }
715
716 protected function getSettingsBackUrl(): string
717 {
718 return $this->ctrl->getParentReturn($this);
719 }
720
721 protected function returnToSettingsParent(): void
722 {
723 $this->ctrl->redirectToURL($this->getSettingsBackUrl());
724 }
725
729 protected function setTabs($a_id = ""): void
730 {
731 $ilTabs = $this->tabs;
732 $ilCtrl = $this->ctrl;
733 $tpl = $this->tpl;
735 $ilHelp = $this->help;
736
737 $ilTabs->clearTargets();
738
739 $ilHelp->setScreenIdComponent("tax");
740
741 $tpl->setTitle(ilObject::_lookupTitle($this->getCurrentTaxonomyId()));
742 $tpl->setDescription(ilObject::_lookupDescription($this->getCurrentTaxonomyId()));
743 $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_tax.svg"));
744
745 $ilTabs->setBackTarget(
746 $lng->txt("back"),
747 $this->getSettingsBackUrl()
748 );
749
750 $ilTabs->addTab(
751 "list_items",
752 $lng->txt("tax_nodes"),
753 $ilCtrl->getLinkTarget($this, "listNodes")
754 );
755 if ($this->assigned_item_sorting) {
756 $ilTabs->addTab(
757 "ass_items",
758 $lng->txt("tax_assigned_items"),
759 $ilCtrl->getLinkTarget($this, "listAssignedItems")
760 );
761 }
762 $ilTabs->addTab(
763 "settings",
764 $lng->txt("settings"),
765 $ilCtrl->getLinkTarget($this, "editSettings")
766 );
767
768 $ilTabs->activateTab($a_id);
769 }
770
774 public function editSettings(): void
775 {
776 $tpl = $this->tpl;
777
778 $this->setTabs("settings");
779
780 $form = $this->initSettingsForm();
781 $tpl->setContent($form->getHTML());
782 }
783
785 {
787 $ilCtrl = $this->ctrl;
788
789 $tax = $this->getCurrentTaxonomy();
790
791 $form = new ilPropertyFormGUI();
792
793 // title
794 $ti = new ilTextInputGUI($lng->txt("title"), "title");
795 $ti->setMaxLength(200);
796
797 $form->addItem($ti);
798 $ti->setValue($tax->getTitle());
799
800 // description
801 $ta = new ilTextAreaInputGUI($lng->txt("description"), "description");
802 //$ta->setCols();
803 //$ta->setRows();
804 $form->addItem($ta);
805 $ta->setValue($tax->getDescription());
806
807 // sorting
808 $options = array(
809 ilObjTaxonomy::SORT_ALPHABETICAL => $lng->txt("tax_alphabetical"),
810 ilObjTaxonomy::SORT_MANUAL => $lng->txt("tax_manual")
811 );
812 $si = new ilSelectInputGUI($lng->txt("tax_node_sorting"), "sorting");
813
814 $si->setOptions($options);
815 $form->addItem($si);
816 $si->setValue($tax->getSortingMode());
817
818 // assigned item sorting
819 if ($this->assigned_item_sorting) {
820 $cb = new ilCheckboxInputGUI($lng->txt("tax_item_sorting"), "item_sorting");
821 $cb->setChecked($tax->getItemSorting());
822 $form->addItem($cb);
823 }
824
825 $form->addCommandButton("updateSettings", $lng->txt("save"));
826
827 $form->setTitle($lng->txt("settings"));
828 $form->setFormAction($ilCtrl->getFormAction($this));
829
830 return $form;
831 }
832
836 public function updateSettings(): void
837 {
838 $tpl = $this->tpl;
840 $ilCtrl = $this->ctrl;
841
842 $form = $this->initSettingsForm();
843 if ($form->checkInput()) {
844 $tax = $this->getCurrentTaxonomy();
845 $tax->setTitle($form->getInput("title"));
846 $tax->setDescription($form->getInput("description"));
847 $tax->setSortingMode((int) $form->getInput("sorting"));
848 $tax->setItemSorting((bool) $form->getInput("item_sorting"));
849 $tax->update();
850
851 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
852 $ilCtrl->redirect($this, "editSettings");
853 } else {
854 $form->setValuesByPost();
855 $tpl->setContent($form->getHTML());
856 }
857 }
858
862 public function listAssignedItems(): void
863 {
864 $tpl = $this->tpl;
865
866 $this->setTabs("ass_items");
867
868 // show tree
869 $this->showTree(true);
870
871 // list assigned items
872 $table = new ilTaxAssignedItemsTableGUI(
873 $this,
874 "listAssignedItems",
875 $this->current_tax_node,
876 $this->getCurrentTaxonomy(),
877 $this->assigned_item_comp_id,
878 $this->assigned_item_obj_id,
879 $this->assigned_item_type,
880 $this->assigned_item_info_obj
881 );
882
883 $tpl->setContent($table->getHTML());
884 }
885
889 public function saveAssignedItemsSorting(): void
890 {
892 $ilCtrl = $this->ctrl;
893 $body = $this->request->getParsedBody();
894
895 if (is_array($body["order"])) {
896 $order = $body["order"];
897 $tax_node = $this->current_tax_node;
898 foreach ($order as $a_item_id => $ord_nr) {
899 $tax_ass = new ilTaxNodeAssignment(
900 $this->assigned_item_comp_id,
901 $this->assigned_item_obj_id,
902 $this->assigned_item_type,
903 (int) $this->getCurrentTaxonomyId()
904 );
905 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
906 }
907 $tax_ass = new ilTaxNodeAssignment(
908 $this->assigned_item_comp_id,
909 $this->assigned_item_obj_id,
910 $this->assigned_item_type,
911 $this->getCurrentTaxonomyId()
912 );
913 $tax_ass->fixOrderNr($tax_node);
914 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
915 }
916 $ilCtrl->redirect($this, "listAssignedItems");
917 }
918}
$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