19declare(strict_types=1);
24use ILIAS\GlobalScreen\GUI\I18n\Translator;
25use Psr\Http\Message\ServerRequestInterface;
58 private URI $ordering_target,
61 private bool $can_edit =
false,
63 $this->ui_factory = $pons->
out()->ui()->factory();
64 $this->i18n = $pons->
i18n();
65 $this->request = $pons->
in()->request();
66 $this->link_prefix = $config->
get(Config::ULTRA_SHORT)
68 : $config->
get(Config::STATIC_LINK_ENDPOINT) . $config->
get(Config::SHORTLINK_NAMESPACE) .
'/';
73 array $visible_column_ids
75 foreach ($this->
repository->getAll() as $shortlink) {
81 $this->pons->in()->hash($shortlink->getId()),
83 self::F_PREFIX => $this->link_prefix,
84 self::F_ALIAS => $this
88 $shortlink->getAliasForPresentation($this->link_prefix),
89 $this->link_prefix . $shortlink->getAlias()
91 ->withOpenInNewViewport(
true),
92 self::F_TARGET_LINK => $this
94 ->resolveLink($shortlink)
95 ?->withOpenInNewViewport(
true),
96 self::F_ACTIVE => $shortlink->isActive(),
98 )->withDisabledAction(
101 )->withDisabledAction(
104 )->withDisabledAction(
111 public function get(): \Generator
113 if ($this->can_edit) {
115 self::ACTION_TOGGLE => $this
120 $this->i18n->t(self::ACTION_TOGGLE,
'action'),
121 $this->token->builder()->withURI(
124 $this->token->token()
127 self::ACTION_EDIT => $this
132 $this->i18n->t(self::ACTION_EDIT,
'action'),
133 $this->token->builder()->withURI(
136 $this->token->token()
139 self::ACTION_DELETE => $this
144 $this->i18n->t(self::ACTION_DELETE,
'action'),
145 $this->token->builder()->withURI(
148 $this->token->token()
161 $this->ordering_target,
162 $this->i18n->t(
'shortlinks'),
167 self::F_ALIAS => $this->ui_factory->table()->column()->link(
168 $this->i18n->t(self::F_ALIAS),
170 self::F_TARGET_LINK => $this->ui_factory->table()->column()->link(
171 $this->i18n->t(self::F_TARGET_LINK),
173 self::F_ACTIVE => $this->ui_factory->table()->column()->boolean(
174 $this->i18n->t(self::F_ACTIVE),
175 $this->pons->out()->ok(),
176 $this->pons->out()->nok(),
180 ->withOrderingDisabled(
183 ->withRequest($this->request)
184 ->withActions($actions);
Builds a Color from either hex- or rgb values.
The scope of this class is split ilias-conform URI's into components.
const string ACTION_TOGGLE
const string ACTION_DELETE
__construct(private Pons $pons, private Repository $repository, private TargetLinkResolver $link_resolver, private URI $ordering_target, private TokenContainer $token, Configuration $config, private bool $can_edit=false,)
ServerRequestInterface $request
const string F_TARGET_LINK
const string CMD_CONFIRM_TOGGLE
const string CMD_CONFIRM_DELETE
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...
buildOrderingRow(string $id, array $record)
This is how the factory for UI elements looks.