19declare(strict_types=1);
29use ILIAS\GlobalScreen\GUI\Hasher;
76 private bool $write_access
78 $this->ui_factory = $this->pons->out()->ui()->factory();
79 $this->ui_renderer = $this->pons->out()->ui()->renderer();
80 $this->url_builder = $token_container->
builder();
81 $this->token = $token_container->
token();
86 foreach ($this->
repository->getTopItems() as $top_item) {
87 $id = $top_item[
'identification'];
92 $link = $this->ui_factory->link()->standard(
93 $item->getDefaultTitle(),
94 (
string) $this->url_builder
98 ->withParameter($this->token, $this->hash(
$id))
101 !$item->canHaveChildren()
104 $remark = $item->getStatus() !==
null ? $this->ui_renderer->render($item->getStatus()) :
'';
106 if (preg_match(
'/-[^-]*-/', $remark)) {
108 $substr = substr($remark, 1, -1);
109 $remark = $this->pons->i18n()->t($substr);
116 'active' => $item->isActivated(),
118 'sub_items' => ($item->canHaveChildren() ? $item->getAmountOfChildren() :
'-'),
119 'css_id' =>
"mm_" . $item->identification()->getInternalIdentifier(),
120 'type' => $item->getTypeForPresentation(),
121 'provider' => $item->getProviderNameForPresentation(),
123 )->withDisabledAction(
124 self::ACTION_ACTIVATE,
125 !$this->write_access || $item->isActivated()
126 )->withDisabledAction(
127 self::ACTION_DEACTIVATE,
128 !$this->write_access || !$item->isActivated(),
129 )->withDisabledAction(
131 !$this->write_access || !$item->isInterchangeable()
132 )->withDisabledAction(
134 !$this->write_access || !$item->isCustom()
135 )->withDisabledAction(
138 )->withDisabledAction(
139 self::ACTION_TRANSLATE,
141 )->withDisabledAction(
142 self::ACTION_EDIT_SUB_TEMS,
143 !$item->canHaveChildren()
144 )->withDisabledAction(
145 self::ACTION_DEACTIVATE,
146 !$item->canBeDeactivated(),
153 $this->hash(
'lost_items'),
155 'title' => $this->ui_factory->link()->standard(
156 $this->pons->i18n()->t(
'mme_lost_items'),
157 (
string) $this->url_builder
161 ->withParameter($this->token, $this->hash(
'lost_items'))
167 'css_id' =>
"mm_lost_items",
171 )->withDisabledAction(
174 )->withDisabledAction(
175 self::ACTION_TRANSLATE,
177 )->withDisabledAction(
178 self::ACTION_ACTIVATE,
180 )->withDisabledAction(
181 self::ACTION_DEACTIVATE,
183 )->withDisabledAction(
186 )->withDisabledAction(
189 )->withDisabledAction(
190 self::ACTION_EDIT_SUB_TEMS,
201 self::ACTION_EDIT_SUB_TEMS => $this->ui_factory->table()->action()->single(
202 $this->pons->i18n()->t(
'edit_sub_tems'),
203 $this->url_builder->withURI(
209 if ($this->write_access) {
210 $actions = array_merge($actions, [
211 self::ACTION_EDIT => $this->ui_factory->table()->action()->single(
212 $this->pons->i18n()->t(
'edit'),
213 $this->url_builder->withURI(
218 self::ACTION_TRANSLATE => $this->ui_factory->table()->action()->single(
219 $this->pons->i18n()->t(
'translate'),
220 $this->url_builder->withURI(
221 $this->pons->flow()->getTranslationAsURI()
225 self::ACTION_ACTIVATE => $this->ui_factory->table()->action()->standard(
226 $this->pons->i18n()->t(
'activate'),
227 $this->url_builder->withURI(
232 self::ACTION_DEACTIVATE => $this->ui_factory->table()->action()->standard(
233 $this->pons->i18n()->t(
'deactivate'),
234 $this->url_builder->withURI(
239 self::ACTION_MOVE => $this->ui_factory->table()->action()->standard(
240 $this->pons->i18n()->t(
'move'),
241 $this->url_builder->withURI(
246 self::ACTION_DELETE => $this->ui_factory->table()->action()->standard(
247 $this->pons->i18n()->t(
'delete'),
248 $this->url_builder->withURI(
262 $this->pons->i18n()->t(
'subtab_topitems'),
264 'title' => $this->ui_factory->table()->column()->link(
265 $this->pons->i18n()->t(
'title',
'topitem'),
267 'active' => $this->ui_factory->table()->column()->boolean(
268 $this->pons->i18n()->t(
'active',
'topitem'),
269 $this->pons->out()->ok(),
270 $this->pons->out()->nok(),
272 'status' => $this->ui_factory->table()->column()->text(
273 $this->pons->i18n()->t(
'status',
'sub')
275 'sub_items' => $this->ui_factory->table()->column()->text(
276 $this->pons->i18n()->t(
'subentries',
'topitem'),
278 'type' => $this->ui_factory->table()->column()->text(
279 $this->pons->i18n()->t(
'type',
'topitem'),
281 'provider' => $this->ui_factory->table()->column()->text(
282 $this->pons->i18n()->t(
'provider',
'topitem'),
286 ->withOrderingDisabled(!$this->write_access)
287 ->withRequest($this->pons->in()->request())
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
__construct(private Pons $pons, TokenContainer $token_container, private ilMMItemRepository $repository, private bool $write_access)
getRows(OrderingRowBuilder $row_builder, array $visible_column_ids)
This is called by the (ordering-)table to retrieve rows; map data-records to rows using the $row_buil...
const ACTION_EDIT_SUB_TEMS
A component is the most general form of an entity in the UI.
buildOrderingRow(string $id, array $record)
This is how the factory for UI elements looks.
An entity that renders components to a string output.