ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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  protected function initCreationForms(string $a_new_type): array
161  {
162  return array(
163  self::CFORM_NEW => $this->initCreateForm("tax")
164  );
165  }
166 
167 
171 
172  public function editAOTaxonomySettings(): void
173  {
174  $this->listTaxonomies();
175  }
176 
177  public function getCurrentTaxonomyId(): ?int
178  {
180  $tax_id = $this->requested_tax_id;
181  if (in_array($tax_id, $tax_ids)) {
182  return $tax_id;
183  }
184  return null;
185  }
186 
187  public function getCurrentTaxonomy(): ?ilObjTaxonomy
188  {
189  $tax_id = $this->getCurrentTaxonomyId();
190  if ($tax_id > 0) {
191  return new ilObjTaxonomy($tax_id);
192  }
193  return null;
194  }
195 
199  public function listNodes(): void
200  {
201  $tpl = $this->tpl;
202  $ilToolbar = $this->toolbar;
203  $lng = $this->lng;
204  $ilCtrl = $this->ctrl;
205 
206  $tax = $this->getCurrentTaxonomy();
207 
208  $this->setTabs("list_items");
209 
210  // show toolbar
211  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
212  $ilToolbar->addFormButton($lng->txt("tax_create_node"), "createTaxNode");
213 
214  $ilToolbar->setCloseFormTag(false);
215 
216  // show tree
217  $this->showTree();
218 
219  $tax_node = $this->current_tax_node;
220  if ($tax_node === 0) {
221  $tax = $this->getCurrentTaxonomy();
222  if ($tax) {
223  $tree = $tax->getTree();
224  $tax_node = $tree->readRootId();
225  }
226  }
227 
228  // show subitems
229  $table = new ilTaxonomyTableGUI(
230  $this,
231  "listNodes",
232  $tax->getTree(),
233  $tax_node,
234  $this->getCurrentTaxonomy()
235  );
236  $table->setOpenFormTag(false);
237 
238  $tpl->setContent($table->getHTML());
239  }
240 
244  public function createAssignedTaxonomy(): void
245  {
246  $this->create();
247  }
248 
249  protected function checkPermissionBool(
250  string $perm,
251  string $cmd = "",
252  string $type = "",
253  ?int $node_id = null
254  ): bool {
255  if ($this->getAssignedObject() > 0) {
256  return true;
257  } else {
258  return parent::checkPermissionBool($perm, $cmd, $type, $node_id);
259  }
260  }
261 
265  public function cancel(): void
266  {
267  $ilCtrl = $this->ctrl;
268  if ($this->getAssignedObject() > 0) {
269  $ilCtrl->redirectToURL($this->getSettingsBackUrl());
270  }
271  parent::cancel();
272  }
273 
274  public function save(): void
275  {
276  if ($this->getAssignedObject() > 0) {
277  $this->requested_new_type = "tax";
278  }
279  parent::saveObject();
280  }
281 
285  protected function afterSave(ilObject $a_new_object): void
286  {
287  $ilCtrl = $this->ctrl;
288  $lng = $this->lng;
289 
290  if ($this->getAssignedObject() > 0) {
292  $a_new_object->getId(),
293  $this->getAssignedObject()
294  );
295  $ilCtrl->setParameter($this, "tax_id", $a_new_object->getId());
296  $this->tpl->setOnScreenMessage('success', $lng->txt("tax_added"), true);
297  $ilCtrl->redirect($this, "editSettings");
298  }
299  }
300 
301  public function showTree(bool $a_ass_items = false): void
302  {
303  global $DIC;
304 
305  $tax = $this->getCurrentTaxonomy();
306  $ctrl = $this->ctrl;
307 
308  $cmd = $a_ass_items
309  ? "listAssignedItems"
310  : "listNodes";
311 
312  $DIC->globalScreen()->tool()->context()->current()
313  ->addAdditionalData(
315  true
316  );
317  $DIC->globalScreen()->tool()->context()->current()
318  ->addAdditionalData(
321  );
322  $DIC->globalScreen()->tool()->context()->current()
323  ->addAdditionalData(
325  $tax->getId()
326  );
327  $DIC->globalScreen()->tool()->context()->current()
328  ->addAdditionalData(
330  $cmd
331  );
332  $DIC->globalScreen()->tool()->context()->current()
333  ->addAdditionalData(
335  "showTree"
336  );
337 
338  $tax_exp = new ilTaxonomyExplorerGUI(
339  $this,
340  "showTree",
341  $tax->getId(),
342  "ilobjtaxonomygui",
343  $cmd
344  );
345  $tax_exp->handleCommand();
346  }
347 
351  public function createTaxNode(): void
352  {
353  $tpl = $this->tpl;
354  $ilHelp = $this->help;
355 
356  $this->setTabs("list_items");
357  $ilHelp->setSubScreenId("create_node");
358 
359  $form = $this->initTaxNodeForm("create");
360  $tpl->setContent($form->getHTML());
361  }
362 
363  // Init tax node form
364  public function initTaxNodeForm(string $a_mode = "edit"): ilPropertyFormGUI
365  {
366  $lng = $this->lng;
367  $ilCtrl = $this->ctrl;
368 
369  $form = new ilPropertyFormGUI();
370 
371  // title
372  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
373  $form->addItem($ti);
374 
375  // order nr
376  $tax = $this->getCurrentTaxonomy();
377  $or = null;
378  if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
379  $or = new ilTextInputGUI($this->lng->txt("tax_order_nr"), "order_nr");
380  $or->setMaxLength(5);
381  $or->setSize(5);
382  $form->addItem($or);
383  }
384 
385  if ($a_mode == "edit") {
386  $node = new ilTaxonomyNode($this->current_tax_node);
387  $ti->setValue($node->getTitle());
388  if (is_object($or)) {
389  $or->setValue($node->getOrderNr());
390  }
391  }
392 
393  // save and cancel commands
394  if ($a_mode == "create") {
395  $form->addCommandButton("saveTaxNode", $lng->txt("save"));
396  $form->addCommandButton("listNodes", $lng->txt("cancel"));
397  $form->setTitle($lng->txt("tax_new_tax_node"));
398  } else {
399  $form->addCommandButton("updateTaxNode", $lng->txt("save"));
400  $form->addCommandButton("listNodes", $lng->txt("cancel"));
401  $form->setTitle($lng->txt("tax_edit_tax_node"));
402  }
403 
404  $form->setFormAction($ilCtrl->getFormAction($this));
405 
406  return $form;
407  }
408 
412  public function saveTaxNode(): void
413  {
414  $tpl = $this->tpl;
415  $lng = $this->lng;
416  $ilCtrl = $this->ctrl;
417 
418  $form = $this->initTaxNodeForm("create");
419  if ($form->checkInput()) {
420  // create node
421  $node = new ilTaxonomyNode();
422  $node->setTitle($form->getInput("title"));
423 
424  $tax = $this->getCurrentTaxonomy();
425  $order_nr = "";
426  if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
427  $order_nr = $form->getInput("order_nr");
428  }
429  if ($order_nr === "") {
430  $order_nr = ilTaxonomyNode::getNextOrderNr($tax->getId(), $this->current_tax_node);
431  }
432  //echo $order_nr; exit;
433  $node->setOrderNr($order_nr);
434  $node->setTaxonomyId($tax->getId());
435  $node->create();
436 
437  // put in tree
438  ilTaxonomyNode::putInTree($tax->getId(), $node, $this->current_tax_node);
439 
441 
442  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
443  $ilCtrl->redirect($this, "listNodes");
444  } else {
445  $form->setValuesByPost();
446  $tpl->setContent($form->getHTML());
447  }
448  }
449 
453  public function updateTaxNode(): void
454  {
455  $lng = $this->lng;
456  $ilCtrl = $this->ctrl;
457  $tpl = $this->tpl;
458 
459  $form = $this->initTaxNodeForm("edit");
460  if ($form->checkInput()) {
461  // create node
462  $node = new ilTaxonomyNode($this->current_tax_node);
463  $node->setTitle($form->getInput("title"));
464 
465  $tax = $this->getCurrentTaxonomy();
466  if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
467  $node->setOrderNr($form->getInput("order_nr"));
468  }
469 
470  $node->update();
471 
472  $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
473  $ilCtrl->redirect($this, "");
474  } else {
475  $form->setValuesByPost();
476  $tpl->setContent($form->getHTML());
477  }
478  }
479 
483  public function deleteItems(): void
484  {
485  $lng = $this->lng;
486  $tpl = $this->tpl;
487  $ilCtrl = $this->ctrl;
488  $ilHelp = $this->help;
489  $body = $this->request->getParsedBody();
490 
491  if (!isset($body["id"])) {
492  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
493  $ilCtrl->redirect($this, "listNodes");
494  }
495 
496  $this->setTabs("list_items");
497  $ilHelp->setSubScreenId("del_items");
498 
499  // $ilTabs->clearTargets();
500 
501  $confirmation_gui = new ilConfirmationGUI();
502 
503  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
504  $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
505 
506  // Add items to delete
507  foreach ($body["id"] as $id) {
508  $confirmation_gui->addItem(
509  "id[]",
510  $id,
512  );
513  }
514 
515  $confirmation_gui->setCancel($lng->txt("cancel"), "listNodes");
516  $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
517 
518  $tpl->setContent($confirmation_gui->getHTML());
519  }
520 
524  public function confirmedDelete(): void
525  {
526  $ilCtrl = $this->ctrl;
527  $body = $this->request->getParsedBody();
528 
529  // delete all selected objects
530  foreach ($body["id"] as $id) {
531  $node = new ilTaxonomyNode($id);
532  $tax = new ilObjTaxonomy($node->getTaxonomyId());
533  $tax_tree = $tax->getTree();
534  $node_data = $tax_tree->getNodeData($id);
535  if (is_object($node)) {
536  $node->delete();
537  }
538  if ($tax_tree->isInTree($id)) {
539  $tax_tree->deleteTree($node_data);
540  }
541  ilTaxonomyNode::fixOrderNumbers($node->getTaxonomyId(), $node_data["parent"]);
542  }
543 
544  // feedback
545  $this->tpl->setOnScreenMessage('info', $this->lng->txt("info_deleted"), true);
546 
547  $ilCtrl->redirect($this, "listNodes");
548  }
549 
553  public function saveSorting(): void
554  {
555  $ilCtrl = $this->ctrl;
556  $lng = $this->lng;
557  $body = $this->request->getParsedBody();
558 
559  // save sorting
560  if (is_array($body["order"] ?? false)) {
561  foreach ($body["order"] as $k => $v) {
563  }
564  ilTaxonomyNode::fixOrderNumbers($this->getCurrentTaxonomyId(), $this->current_tax_node);
565  }
566 
567  // save titles
568  if (is_array($body["title"] ?? false)) {
569  foreach ($body["title"] as $k => $v) {
571  (int) $k,
573  );
574  }
575  }
576  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"));
577  $ilCtrl->redirect($this, "listNodes");
578  }
579 
583  public function moveItems(): void
584  {
585  $ilCtrl = $this->ctrl;
586  $lng = $this->lng;
587  $ilToolbar = $this->toolbar;
588  $ilHelp = $this->help;
589  $body = $this->request->getParsedBody();
590 
591  if (!isset($body["id"])) {
592  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
593  $ilCtrl->redirect($this, "listNodes");
594  }
595 
596  $this->setTabs("list_items");
597  $ilHelp->setSubScreenId("move_items");
598 
599  $ilToolbar->addButton(
600  $lng->txt("cancel"),
601  $ilCtrl->getLinkTarget($this, "listNodes")
602  );
603 
604  $this->tpl->setOnScreenMessage('info', $lng->txt("tax_please_select_target"));
605 
606  if (is_array($body["id"])) {
607  $ilCtrl->setParameter($this, "move_ids", implode(",", $body["id"]));
608 
609  $tpl = $this->tpl;
610 
611  $tax_exp = new ilTaxonomyExplorerGUI(
612  $this,
613  "moveItems",
614  $this->getCurrentTaxonomy()->getId(),
615  "ilobjtaxonomygui",
616  "pasteItems"
617  );
618  if (!$tax_exp->handleCommand()) {
619  //$tpl->setLeftNavContent($tax_exp->getHTML());
620  $tpl->setContent($tax_exp->getHTML() . "&nbsp;");
621  }
622  }
623  }
624 
628  public function pasteItems(): void
629  {
630  $lng = $this->lng;
631  $ilCtrl = $this->ctrl;
632  if ($this->requested_move_ids != "") {
633  $move_ids = explode(",", $this->requested_move_ids);
634  $tax = $this->getCurrentTaxonomy();
635  $tree = $tax->getTree();
636 
637  $target_node = new ilTaxonomyNode($this->current_tax_node);
638  foreach ($move_ids as $m_id) {
639  // cross check taxonomy
640  $node = new ilTaxonomyNode((int) $m_id);
641  if ($node->getTaxonomyId() == $tax->getId() &&
642  ($target_node->getTaxonomyId() == $tax->getId() ||
643  $target_node->getId() == $tree->readRootId())) {
644  // check if target is not within the selected nodes
645  if ($tree->isGrandChild((int) $m_id, $target_node->getId()) ||
646  $m_id == $target_node->getId()) {
647  $this->tpl->setOnScreenMessage('failure', $lng->txt("tax_target_within_nodes"), true);
648  $this->ctrl->redirect($this, "listNodes");
649  }
650 
651  // if target is not current place, move
652  $parent_id = $tree->getParentId((int) $m_id);
653  if ($parent_id != $target_node->getId()) {
654  $tree->moveTree((int) $m_id, $target_node->getId());
655  ilTaxonomyNode::fixOrderNumbers($tax->getId(), $target_node->getId());
657  }
658  }
659  }
660  }
661 
662  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
663  $ilCtrl->redirect($this, "listNodes");
664  }
665 
669  public function confirmDeleteTaxonomy(): void
670  {
671  $ilCtrl = $this->ctrl;
672  $tpl = $this->tpl;
673  $lng = $this->lng;
674 
675  $tax = $this->getCurrentTaxonomy();
676 
677  $cgui = new ilConfirmationGUI();
678  $cgui->setFormAction($ilCtrl->getFormAction($this));
679  $cgui->setHeaderText($lng->txt("tax_confirm_deletion"));
680  $cgui->setCancel($lng->txt("cancel"), "returnToSettingsParent");
681  $cgui->setConfirm($lng->txt("delete"), "deleteTaxonomy");
682 
683  $cgui->addItem("id[]", 0, $tax->getTitle());
684 
685  $tpl->setContent($cgui->getHTML());
686  }
687 
691  public function deleteTaxonomy(): void
692  {
693  $ilCtrl = $this->ctrl;
694  $lng = $this->lng;
695 
696  $tax = $this->getCurrentTaxonomy();
697  $tax->delete();
698 
699  $this->tpl->setOnScreenMessage('success', $lng->txt("tax_tax_deleted"), true);
700  $this->returnToSettingsParent();
701  }
702 
706  public function listTaxonomies(): void
707  {
708  $tpl = $this->tpl;
709  $ilToolbar = $this->toolbar;
710  $lng = $this->lng;
711  $ilCtrl = $this->ctrl;
712 
714  if (count($tax_ids) == 0 || $this->getMultiple()) {
715  $ilToolbar->addButton(
716  $lng->txt("tax_add_taxonomy"),
717  $ilCtrl->getLinkTarget($this, "createAssignedTaxonomy")
718  );
719  } else {
720  $this->tpl->setOnScreenMessage('info', $lng->txt("tax_max_one_tax"));
721  }
722 
723  $tab = new ilTaxonomyListTableGUI(
724  $this,
725  "listTaxonomies",
726  $this->getAssignedObject(),
727  $this->getListInfo()
728  );
729 
730  $tpl->setContent($tab->getHTML());
731  }
732 
733  protected function getSettingsBackUrl(): string
734  {
735  return $this->ctrl->getParentReturn($this);
736  }
737 
738  protected function returnToSettingsParent(): void
739  {
740  $this->ctrl->redirectToURL($this->getSettingsBackUrl());
741  }
742 
746  protected function setTabs($a_id = ""): void
747  {
748  $ilTabs = $this->tabs;
749  $ilCtrl = $this->ctrl;
750  $tpl = $this->tpl;
751  $lng = $this->lng;
752  $ilHelp = $this->help;
753 
754  $ilTabs->clearTargets();
755 
756  $ilHelp->setScreenIdComponent("tax");
757 
760  $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_tax.svg"));
761 
762  $ilTabs->setBackTarget(
763  $lng->txt("back"),
764  $this->getSettingsBackUrl()
765  );
766 
767  $ilTabs->addTab(
768  "list_items",
769  $lng->txt("tax_nodes"),
770  $ilCtrl->getLinkTarget($this, "listNodes")
771  );
772  if ($this->assigned_item_sorting) {
773  $ilTabs->addTab(
774  "ass_items",
775  $lng->txt("tax_assigned_items"),
776  $ilCtrl->getLinkTarget($this, "listAssignedItems")
777  );
778  }
779  $ilTabs->addTab(
780  "settings",
781  $lng->txt("settings"),
782  $ilCtrl->getLinkTarget($this, "editSettings")
783  );
784 
785  $ilTabs->activateTab($a_id);
786  }
787 
791  public function editSettings(): void
792  {
793  $tpl = $this->tpl;
794 
795  $this->setTabs("settings");
796 
797  $form = $this->initSettingsForm();
798  $tpl->setContent($form->getHTML());
799  }
800 
802  {
803  $lng = $this->lng;
804  $ilCtrl = $this->ctrl;
805 
806  $tax = $this->getCurrentTaxonomy();
807 
808  $form = new ilPropertyFormGUI();
809 
810  // title
811  $ti = new ilTextInputGUI($lng->txt("title"), "title");
812  $ti->setMaxLength(200);
813 
814  $form->addItem($ti);
815  $ti->setValue($tax->getTitle());
816 
817  // description
818  $ta = new ilTextAreaInputGUI($lng->txt("description"), "description");
819  //$ta->setCols();
820  //$ta->setRows();
821  $form->addItem($ta);
822  $ta->setValue($tax->getDescription());
823 
824  // sorting
825  $options = array(
826  ilObjTaxonomy::SORT_ALPHABETICAL => $lng->txt("tax_alphabetical"),
827  ilObjTaxonomy::SORT_MANUAL => $lng->txt("tax_manual")
828  );
829  $si = new ilSelectInputGUI($lng->txt("tax_node_sorting"), "sorting");
830 
831  $si->setOptions($options);
832  $form->addItem($si);
833  $si->setValue($tax->getSortingMode());
834 
835  // assigned item sorting
836  if ($this->assigned_item_sorting) {
837  $cb = new ilCheckboxInputGUI($lng->txt("tax_item_sorting"), "item_sorting");
838  $cb->setChecked($tax->getItemSorting());
839  $form->addItem($cb);
840  }
841 
842  $form->addCommandButton("updateSettings", $lng->txt("save"));
843 
844  $form->setTitle($lng->txt("settings"));
845  $form->setFormAction($ilCtrl->getFormAction($this));
846 
847  return $form;
848  }
849 
853  public function updateSettings(): void
854  {
855  $tpl = $this->tpl;
856  $lng = $this->lng;
857  $ilCtrl = $this->ctrl;
858 
859  $form = $this->initSettingsForm();
860  if ($form->checkInput()) {
861  $tax = $this->getCurrentTaxonomy();
862  $tax->setTitle($form->getInput("title"));
863  $tax->setDescription($form->getInput("description"));
864  $tax->setSortingMode((int) $form->getInput("sorting"));
865  $tax->setItemSorting((bool) $form->getInput("item_sorting"));
866  $tax->update();
867 
868  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
869  $ilCtrl->redirect($this, "editSettings");
870  } else {
871  $form->setValuesByPost();
872  $tpl->setContent($form->getHTML());
873  }
874  }
875 
879  public function listAssignedItems(): void
880  {
881  $tpl = $this->tpl;
882 
883  $this->setTabs("ass_items");
884 
885  // show tree
886  $this->showTree(true);
887 
888  // list assigned items
889  $table = new ilTaxAssignedItemsTableGUI(
890  $this,
891  "listAssignedItems",
892  $this->current_tax_node,
893  $this->getCurrentTaxonomy(),
894  $this->assigned_item_comp_id,
895  $this->assigned_item_obj_id,
896  $this->assigned_item_type,
897  $this->assigned_item_info_obj
898  );
899 
900  $tpl->setContent($table->getHTML());
901  }
902 
906  public function saveAssignedItemsSorting(): void
907  {
908  $lng = $this->lng;
909  $ilCtrl = $this->ctrl;
910  $body = $this->request->getParsedBody();
911 
912  if (is_array($body["order"])) {
913  $order = $body["order"];
914  $tax_node = $this->current_tax_node;
915  foreach ($order as $a_item_id => $ord_nr) {
916  $tax_ass = new ilTaxNodeAssignment(
917  $this->assigned_item_comp_id,
918  $this->assigned_item_obj_id,
919  $this->assigned_item_type,
920  (int) $this->getCurrentTaxonomyId()
921  );
922  $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
923  }
924  $tax_ass = new ilTaxNodeAssignment(
925  $this->assigned_item_comp_id,
926  $this->assigned_item_obj_id,
927  $this->assigned_item_type,
928  $this->getCurrentTaxonomyId()
929  );
930  $tax_ass->fixOrderNr($tax_node);
931  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
932  }
933  $ilCtrl->redirect($this, "listAssignedItems");
934  }
935 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
showTree(bool $a_ass_items=false)
moveTree(int $a_source_id, int $a_target_id, int $a_location=self::POS_LAST_NODE)
Move Tree Implementation public.
deleteTaxonomy()
Delete taxonomy.
static getNextOrderNr(int $a_tax_id, int $a_parent_id)
Put this node into the taxonomy tree.
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...
editSettings()
Edit settings.
ILIAS Taxonomy InternalDomainService $domain
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...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
deleteItems()
Confirm deletion screen for items.
saveTaxNode()
Save tax node form.
New implementation of ilObjectGUI.
cancel()
Cancel creation.
updateSettings()
Update taxonomy settings.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
Class ChatMainBarProvider .
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
listTaxonomies()
List taxonomies.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Help GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static writeTitle(int $a_node_id, string $a_title)
Write title.
initCreationForms(string $a_new_type)
Init creation forms.
createTaxNode()
Create tax node.
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)
executeCommand()
Execute command.
setOptions(array $a_options)
saveAssignedItemsSorting()
Save assigned items sorting.
createAssignedTaxonomy()
Create assigned taxonomy.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
handleCommand()
Handle explorer internal command.
confirmDeleteTaxonomy()
Confirm taxonomy deletion.
afterSave(ilObject $a_new_object)
After saving,.
isGrandChild(int $a_startnode_id, int $a_querynode_id)
checks if a node is in the path of an other node
global $DIC
Definition: feed.php:28
activateAssignedItemSorting(ilTaxAssignedItemInfo $a_item_info_obj, string $a_component_id, int $a_obj_id, string $a_item_type)
Activate sorting mode of assigned objects.
ilToolbarGUI $toolbar
ilTaxAssignedItemInfo $assigned_item_info_obj
__construct(VocabulariesInterface $vocabularies)
ILIAS Taxonomy InternalGUIService $gui
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setScreenIdComponent(string $a_comp)
static _lookupTitle(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
pasteItems()
Paste items (move operation)
ilGlobalTemplateInterface $tpl
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)
updateTaxNode()
Update tax node.
getParentId(int $a_node_id)
get parent id of given node
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
static _lookupDescription(int $obj_id)
confirmedDelete()
Delete taxonomy nodes.
setTabs()
create tabs (repository/workspace switch)
static saveUsage(int $a_tax_id, int $a_obj_id)
static writeOrderNr(int $a_node_id, int $a_order_nr)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
listAssignedItems()
List assigned items.
getCurrentClassPath()
setDescription(string $a_descr)
Sets description below title in standard template.
initCreateForm(string $new_type)
This class represents a text area property in a property form.
multiple()
description: > The example shows the behaviour of multiple File Field&#39;s inside the same Form Contain...
Definition: multiple.php:20
initTaxNodeForm(string $a_mode="edit")
saveSorting()
Save settings and sorting.
redirectToURL(string $target_url)
ILIAS Taxonomy Settings ModifierGUIInterface $modifier
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOpenFormTag(bool $a_val)
$service
Definition: ltiservices.php:43
setModifier(?\ILIAS\Taxonomy\TaxonomyModifierGUI $modifier)
static fixOrderNumbers(int $a_tax_id, int $a_parent_id)
ILIAS DI UIServices $ui
setMultiple(bool $a_val)
Set multiple.