ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTaxonomyTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
26 protected string $requested_tax_node;
29 protected int $node_id;
30
34 public function __construct(
35 object $a_parent_obj,
36 string $a_parent_cmd,
37 ilTaxonomyTree $a_tree,
38 int $a_node_id,
39 ilObjTaxonomy $a_tax
40 ) {
41 global $DIC;
42 $this->ctrl = $DIC->ctrl();
43 $this->lng = $DIC->language();
44 $this->access = $DIC->access();
45
46 // @todo introduce request wrapper
47 $params = $DIC->http()->request()->getQueryParams();
48
49 $this->requested_tax_node = $params["tax_node"] ?? "";
50
51 $ilCtrl = $DIC->ctrl();
52 $lng = $DIC->language();
53
54 if ($a_node_id == "") {
55 $a_node_id = $a_tree->readRootId();
56 }
57
58 $this->tree = $a_tree;
59 $this->tax = $a_tax;
60 $this->node_id = $a_node_id;
61
62 parent::__construct($a_parent_obj, $a_parent_cmd);
63
64 $childs = $this->tree->getChildsByTypeFilter(
65 $a_node_id,
66 array("taxn")
67 );
68
70 $childs = ilArrayUtil::sortArray($childs, "order_nr", "asc", false);
71 } else {
72 $childs = ilArrayUtil::sortArray($childs, "title", "asc", false);
73 }
74 $this->setData($childs);
75
76 $this->setTitle($lng->txt("tax_nodes"));
77
78 $this->addColumn($this->lng->txt(""), "", "1px", true);
79 if ($this->tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
80 $this->addColumn($this->lng->txt("tax_order"), "order_nr", "1px");
81 $this->setDefaultOrderField("order_nr");
82 $this->setDefaultOrderDirection("asc");
83 }
84 $this->addColumn($this->lng->txt("title"));
85
86 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
87 $this->setRowTemplate("tpl.tax_row.html", "components/ILIAS/Taxonomy");
88
89 $this->addMultiCommand("deleteItems", $lng->txt("delete"));
90 $this->addMultiCommand("moveItems", $lng->txt("move"));
91 $this->addCommandButton("saveSorting", $lng->txt("save"));
92 }
93
94 public function numericOrdering(string $a_field): bool
95 {
96 if ($a_field == "order_nr") {
97 return true;
98 }
99 return false;
100 }
101
102 protected function fillRow(array $a_set): void
103 {
104 $ilCtrl = $this->ctrl;
105
106 $ilCtrl->setParameter($this->parent_obj, "tax_node", $a_set["child"]);
107 $ret = $ilCtrl->getLinkTargetByClass("ilobjtaxonomygui", "listNodes");
108 $ilCtrl->setParameter($this->parent_obj, "tax_node", $this->requested_tax_node);
109 if ($this->tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
110 $this->tpl->setCurrentBlock("order");
111 $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
112 $this->tpl->setVariable("ONODE_ID", $a_set["child"]);
113 $this->tpl->parseCurrentBlock();
114 }
115
116 $this->tpl->setVariable("HREF_TITLE", $ret);
117
118 $this->tpl->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
119 $this->tpl->setVariable("NODE_ID", $a_set["child"]);
120 }
121}
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
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...
static prepareFormOutput($a_str, bool $a_strip=false)
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...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
numericOrdering(string $a_field)
Should this field be sorted numeric?
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $a_parent_obj, string $a_parent_cmd, ilTaxonomyTree $a_tree, int $a_node_id, ilObjTaxonomy $a_tax)
Constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26