ILIAS  release_8 Revision v8.24
class.ilObjLearningSequenceContentTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22{
25 protected string $cmd;
26 protected ilAccess $access;
31
32 public function __construct(
35 string $cmd,
39 ILIAS\UI\Factory $ui_factory,
40 ILIAS\UI\Renderer $ui_renderer,
43 ) {
45
46 $this->parent_gui = $parent_gui;
47 $this->container_gui = $container_gui;
48 $this->ctrl = $ctrl;
49 $this->lng = $lng;
50 $this->access = $access;
51 $this->ui_factory = $ui_factory;
52 $this->ui_renderer = $ui_renderer;
53 $this->advanced_selection_list_gui = $advanced_selection_list_gui;
54 $this->ls_item_online_status = $ls_item_online_status;
55
56 $this->setTitle($this->lng->txt("table_sequence_content"));
57 $this->setRowTemplate("tpl.content_table.html", "Modules/LearningSequence");
58 $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
59 $this->setExternalSorting(true);
60 $this->setEnableAllCommand(true);
61 $this->setShowRowsSelector(false);
62 $this->setTopCommands(true);
63 $this->setEnableHeader(true);
64
65 $this->addColumn("", "", "1", true);
66 $this->addColumn("");
67 $this->addColumn($this->lng->txt("table_position"));
68 $this->addColumn($this->lng->txt("table_title"));
69 $this->addColumn($this->lng->txt("table_online"));
70 $this->addColumn($this->lng->txt("table_may_proceed"));
71 $this->addColumn($this->lng->txt("table_actions"));
72
73 $this->setLimit(9999);
74 }
75
76 protected function fillRow(array $a_set): void
77 {
79 $ls_item = $a_set[0];
80
81 $ni = new ilNumberInputGUI(
82 "",
83 $this->parent_gui->getFieldName($this->parent_gui::FIELD_ORDER, $ls_item->getRefId())
84 );
85 $ni->setSize(3);
86 $ni->setValue((string) (($ls_item->getOrderNumber() + 1) * 10));
87
88 if ($this->ls_item_online_status->hasOnlineStatus($ls_item->getRefId())) {
89 $cb = new ilCheckboxInputGUI(
90 "",
91 $this->parent_gui->getFieldName($this->parent_gui::FIELD_ONLINE, $ls_item->getRefId())
92 );
93 $cb->setChecked($ls_item->isOnline());
94 } else {
95 $cb = new ilCheckboxInputGUI("", "");
96 $cb->setChecked(true);
97 $cb->setDisabled(true);
98 }
99 $this->tpl->setVariable("ONLINE", $cb->render());
100
101 $si = new ilSelectInputGUI(
102 "",
103 $this->parent_gui->getFieldName($this->parent_gui::FIELD_POSTCONDITION_TYPE, $ls_item->getRefId())
104 );
105 $options = $this->parent_gui->getPossiblePostConditionsForType($ls_item->getType());
106
107 $si->setOptions($options);
108 $si->setValue($ls_item->getPostCondition()->getConditionOperator());
109
110 $action_items = $this->getActionMenuItems($ls_item->getRefId(), $ls_item->getType());
111 $obj_link = $this->getEditLink($ls_item->getRefId(), $ls_item->getType(), $action_items);
112
113 $title = $ls_item->getTitle();
114 $title = sprintf(
115 '<a href="%s">%s</a>',
116 $obj_link,
117 $title
118 );
119
120 $this->tpl->setVariable("ID", $ls_item->getRefId());
121
122 $this->tpl->setVariable(
123 "IMAGE",
124 $this->ui_renderer->render(
125 $this->ui_factory->symbol()->icon()->custom(
126 $ls_item->getIconPath(),
127 $ls_item->getType()
128 )->withSize('medium')
129 )
130 );
131
132 $this->tpl->setVariable("ORDER", $ni->render());
133 $this->tpl->setVariable("TITLE", $title);
134 $this->tpl->setVariable("POST_CONDITIONS", $si->render());
135 $this->tpl->setVariable("ACTIONS", $this->getItemActionsMenu($ls_item->getRefId(), $ls_item->getType()));
136 $this->tpl->setVariable("TYPE", $ls_item->getType());
137 }
138
139 protected function getItemActionsMenu(int $ref_id, string $type): string
140 {
141 $item_obj_id = $this->getObjIdFor($ref_id);
142 $item_list_gui = $this->getListGuiFor($type);
143 $item_list_gui->initItem($ref_id, $item_obj_id, $type);
144
145 $item_list_gui->enableCut(true);
146 $item_list_gui->enableDelete(true);
147 $item_list_gui->enableLink(true);
148 $item_list_gui->enableTimings(false);
149
150 $item_list_gui->setContainerObject($this->container_gui);
151
152 return $item_list_gui->getCommandsHTML();
153 }
154
165 protected function getActionMenuItems(int $ref_id, string $type): array
166 {
167 $item_obj_id = $this->getObjIdFor($ref_id);
168 $item_list_gui = $this->getListGuiFor($type);
169 $item_list_gui->initItem($ref_id, $item_obj_id, $type);
170 return $item_list_gui->getCommands();
171 }
172
173 protected function getEditLink(int $ref_id, string $type, array $action_items): ?string
174 {
175 switch ($type) {
176 case $this->ls_item_online_status::S_LEARNMODULE_IL:
177 case $this->ls_item_online_status::S_LEARNMODULE_HTML:
178 case $this->ls_item_online_status::S_SURVEY:
179 $prop_for_type = 'properties';
180 break;
181
182 case $this->ls_item_online_status::S_SAHS:
183 case $this->ls_item_online_status::S_CONTENTPAGE:
184 case $this->ls_item_online_status::S_EXERCISE:
185 case $this->ls_item_online_status::S_FILE:
186 $prop_for_type = 'edit';
187 break;
188
189 case $this->ls_item_online_status::S_TEST:
190 $prop_for_type = 'ilObjTestSettingsGeneralGUI::showForm';
191 break;
192
193 case $this->ls_item_online_status::S_IND_ASSESSMENT:
194 default:
195 return $this->getStdLink($ref_id, $type);
196 }
197
198 $props = array_filter(
199 $action_items,
200 fn ($action_item) => $action_item['cmd'] === $prop_for_type
201 );
202
203 if ($props !== []) {
204 return array_shift($props)['link'];
205 }
206 return null;
207 }
208
209 protected function getObjIdFor(int $ref_id): int
210 {
212 }
213
214 protected function getListGuiFor(string $type): ilObjectListGUI
215 {
217 }
218
219 protected function getStdLink(int $ref_id, string $type): string
220 {
222 }
223}
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 class represents a checkbox property in a property form.
Class ilCtrl provides processing control methods.
language handling
This class represents a number property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjLearningSequenceContentGUI $parent_gui, ilObjLearningSequenceGUI $container_gui, string $cmd, ilCtrl $ctrl, ilLanguage $lng, ilAccess $access, ILIAS\UI\Factory $ui_factory, ILIAS\UI\Renderer $ui_renderer, ilAdvancedSelectionListGUI $advanced_selection_list_gui, LSItemOnlineStatus $ls_item_online_status)
getEditLink(int $ref_id, string $type, array $action_items)
Class ilObjLearningSequenceGUI @ilCtrl_isCalledBy ilObjLearningSequenceGUI: ilRepositoryGUI @ilCtrl_i...
static _getListGUIByType(string $type, int $context=ilObjectListGUI::CONTEXT_REPOSITORY)
static _lookupObjId(int $ref_id)
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...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setEnableAllCommand(bool $a_value)
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
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)
fillRow(array $a_set)
Standard Version of Fill Row.
setTopCommands(bool $a_val)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
ilLanguage $lng
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
$ref_id
Definition: ltiauth.php:67
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
$type