ILIAS  release_8 Revision v8.24
class.ilNewItemGroupTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected bool $has_write;
28
29 public function __construct(
30 ilObjRepositorySettingsGUI $a_parent_obj,
31 string $a_parent_cmd = "",
32 bool $a_has_write = false
33 ) {
34 global $DIC;
35 $this->main_tpl = $DIC->ui()->mainTemplate();
36
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39 $ilCtrl = $DIC->ctrl();
40 $lng = $DIC->language();
41
42 $this->has_write = $a_has_write;
43
44 parent::__construct($a_parent_obj, $a_parent_cmd);
45
46 $this->setId("repnwitgrptbl");
47
48 $this->setTitle($lng->txt("rep_new_item_groups"));
49
50 if ($this->has_write) {
51 $this->addColumn("", "", '1');
52 }
53 $this->addColumn($lng->txt("cmps_add_new_rank"), "");
54 $this->addColumn($lng->txt("title"), "");
55 $this->addColumn($lng->txt("rep_new_item_group_nr_subitems"), "");
56
57 if ($this->has_write) {
58 $this->addColumn($lng->txt("action"), "");
59 }
60
61 if ($this->has_write) {
62 $this->addCommandButton("saveNewItemGroupOrder", $lng->txt("cmps_save_options"));
63 $this->addMultiCommand("confirmDeleteNewItemGroup", $lng->txt("delete"));
64 }
65
66 $this->setEnableHeader(true);
67 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
68 $this->setRowTemplate("tpl.table_row_new_item_group.html", "Services/Repository/Administration");
69 $this->setLimit(10000);
70
71 $this->setExternalSorting(true);
72 $this->getGroups();
73 }
74
75 public function getGroups(): void
76 {
78
79 $data = [];
80
82
83 if ($subitems[0] ?? false) {
84 $this->main_tpl->setOnScreenMessage('info', sprintf(
85 $lng->txt("rep_new_item_group_unassigned_subitems"),
86 is_array($subitems[0]) ? count($subitems[0]) : 0
87 ));
88 unset($subitems[0]);
89 }
90
92 $data[] = [
93 "id" => $item["id"],
94 "pos" => $item["pos"],
95 "title" => $item["title"],
96 "type" => $item["type"],
97 "subitems" => is_array($subitems[$item["id"]] ?? false) ? count($subitems[$item["id"]]) : 0
98 ];
99 }
100
101 $data = ilArrayUtil::sortArray($data, "pos", "asc", true);
102
103 $this->setData($data);
104 }
105
106 protected function fillRow(array $a_set): void
107 {
109 $ilCtrl = $this->ctrl;
110
111 if ($this->has_write) {
112 $this->tpl->setVariable("VAR_MULTI", "grp_ids[]");
113 $this->tpl->setVariable("VAL_MULTI", $a_set["id"]);
114 }
115
116 $this->tpl->setVariable("VAR_POS", "grp_order[" . $a_set["id"] . "]");
117 $this->tpl->setVariable("VAL_POS", $a_set["pos"]);
118 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
119
120 if ((int) $a_set["type"] === ilObjRepositorySettings::NEW_ITEM_GROUP_TYPE_GROUP) {
121 $this->tpl->setVariable("VAL_ITEMS", $a_set["subitems"]);
122
123 if ($this->has_write) {
124 $ilCtrl->setParameter($this->parent_obj, "grp_id", $a_set["id"]);
125 $url = $ilCtrl->getLinkTarget($this->parent_obj, "editNewItemGroup");
126 $ilCtrl->setParameter($this->parent_obj, "grp_id", "");
127
128 $this->tpl->setVariable("URL_EDIT", $url);
129 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
130 }
131 }
132 }
133}
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(ilObjRepositorySettingsGUI $a_parent_obj, string $a_parent_cmd="", bool $a_has_write=false)
ilGlobalTemplateInterface $main_tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
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)
setEnableHeader(bool $a_enableheader)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
ilLanguage $lng
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url