19declare(strict_types=1);
31use Psr\Http\Message\ServerRequestInterface;
32use Psr\Http\Message\RequestInterface;
48 private ServerRequestInterface|RequestInterface
$request;
60 public function __construct(?
object $a_parent_obj, ?
string $a_parent_cmd)
64 $this->
lng = $DIC->language();
65 $this->ui_factory =
$DIC->ui()->factory();
66 $this->ui_renderer =
$DIC->ui()->renderer();
67 $this->ui_service =
$DIC->uiService();
68 $this->request =
$DIC->http()->request();
69 $this->data_factory = new \ILIAS\Data\Factory();
70 $this->
ctrl = $DIC->ctrl();
71 $this->wrapper =
$DIC->http()->wrapper();
74 $this->parent_obj = $a_parent_obj;
75 $this->parent_cmd = $a_parent_cmd;
80 $this->acceptProviderAsGlobal =
true;
85 $this->resetProviderToUserScope =
true;
90 $this->selectProviderForm =
true;
100 foreach ($this->records as $record) {
101 $record[
"icon"] = $record[
"icon"] ??
"lti";
102 $record[
"icon"] = $this->ui_factory->symbol()->icon()->standard($record[
"icon"], $record[
"icon"], IconAlias::SMALL);
104 if ($this->selectProviderForm) {
105 $this->
ctrl->setParameter($this->parent_obj,
'provider_id', $record[
'id']);
106 $record[
"title"] = $this->ui_factory->link()->standard($record[
'title'], $this->
ctrl->getLinkTarget($this->parent_obj,
"save"));
108 $this->
ctrl->setParameter($this->parent_obj,
'provider_id', $record[
'id']);
122 yield $row_builder->
buildDataRow((
string) $record[
"id"], $record);
128 return count($this->records);
133 $this->records =
$data;
139 public function getHTML(
bool $hasWriteAccess =
false): string
141 $table = $this->ui_factory->table()
142 ->data($this->
lng->txt(
'tbl_provider_header'), $this->getColumns(), $this)
143 ->withOrder(
new Order(
'title', Order::ASC))
144 ->withRequest($this->request);
146 if ($hasWriteAccess) {
147 $table = $table->withActions($this->
getActions());
150 return $this->ui_renderer->render($table);
156 'icon' => $this->ui_factory->table()->column()->statusIcon($this->
lng->txt(
'icon')),
157 'title' => $this->ui_factory->table()->column()->link($this->
lng->txt(
'title')),
158 'description' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_description')),
159 'category' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_category'))->withIsOptional(
true),
160 'keywords' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_keywords')),
161 'outcome' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_outcome'))->withIsOptional(
true),
162 'internal' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_internal'))->withIsOptional(
true),
163 'with_key' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_with_key')),
164 'availability' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_availability')),
165 'own_provider' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_own_provider'))->withIsOptional(
true),
166 'provider_creator' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_provider_creator'))->withIsOptional(
true),
167 'usages_untrashed' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_usages_untrashed')),
168 'usages_trashed' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_usages_trashed'))->withIsOptional(
true),
177 $df = new \ILIAS\Data\Factory();
178 $here_uri = $df->uri($this->request->getUri()->__toString());
181 $query_params_namespace = [
'provider',
'table'];
182 list($url_builder, $id_token, $action_token) = $url_builder->acquireParameters(
183 $query_params_namespace,
188 $query = $this->wrapper->query();
189 if ($query->has($action_token->getName())) {
190 $action = $query->retrieve($action_token->getName(), $this->refinery->to()->string());
191 $ids = $query->retrieve($id_token->getName(), $this->refinery->custom()->transformation(fn($v) => $v));
195 $id = $ids[0] ??
null;
196 $this->
ctrl->setParameter($this->parent_obj,
'provider_id',
$id);
199 case "delete_global":
200 if (count($ids) > 1) {
201 $this->
ctrl->setParameter($this->parent_obj,
'provider_ids', implode(
",", $ids));
204 $id = $ids[0] ??
null;
205 $this->
ctrl->setParameter($this->parent_obj,
'provider_id',
$id);
210 if (count($ids) > 1) {
211 $this->
ctrl->setParameter($this->parent_obj,
'provider_ids', implode(
",", $ids));
214 $id = $ids[0] ??
null;
215 $this->
ctrl->setParameter($this->parent_obj,
'provider_id',
$id);
220 if (count($ids) > 1) {
221 $this->
ctrl->setParameter($this->parent_obj,
'provider_ids', implode(
",", $ids));
224 $id = $ids[0] ??
null;
225 $this->
ctrl->setParameter($this->parent_obj,
'provider_id',
$id);
230 if (count($ids) > 1) {
231 $this->
ctrl->setParameter($this->parent_obj,
'provider_ids', implode(
",", $ids));
234 $id = $ids[0] ??
null;
235 $this->
ctrl->setParameter($this->parent_obj,
'provider_id',
$id);
244 "edit" => $this->ui_factory->table()->action()->single(
245 $this->
lng->txt(
'lti_action_edit_provider'),
246 $url_builder->withParameter($action_token,
"edit"),
251 if ($this->acceptProviderAsGlobal) {
252 $actions[
"global"] = $this->ui_factory->table()->action()->standard(
253 $this->
lng->txt(
'lti_action_accept_provider_as_global'),
254 $url_builder->withParameter($action_token,
"global"),
257 $actions[
"delete_user"] = $this->ui_factory->table()->action()->standard(
258 $this->
lng->txt(
'lti_delete_provider'),
259 $url_builder->withParameter($action_token,
"delete_user"),
264 if ($this->resetProviderToUserScope) {
265 $actions[
"reset"] = $this->ui_factory->table()->action()->standard(
266 $this->
lng->txt(
'lti_action_reset_provider_to_user_scope'),
267 $url_builder->withParameter($action_token,
"reset"),
270 $actions[
"delete_global"] = $this->ui_factory->table()->action()->standard(
271 $this->
lng->txt(
'lti_delete_provider'),
272 $url_builder->withParameter($action_token,
"delete_global"),
284 return $hasOutcome ?
$DIC->language()->txt(
'yes') :
'';
291 return $isInternal ?
$DIC->language()->txt(
'yes') :
'';
298 return $isWithKey ?
$DIC->language()->txt(
'yes') :
'';
304 return $categories[$category];
311 return match (
$data[
'availability']) {
323 if (
$data[
'creator'] ==
$DIC->user()->getId()) {
324 return $DIC->language()->txt(
'yes');
338 if (
$data[
'creator']) {
343 return $user->getFullname();
346 return $DIC->language()->txt(
'deleted_user');
358 'title' => $this->ui_factory->input()->field()->text($this->
lng->txt(
"title")),
359 'keywords' => $this->ui_factory->input()->field()->text($this->
lng->txt(
"tbl_lti_prov_keywords")),
360 'outcome' => $this->ui_factory->input()->field()->select($this->
lng->txt(
"tbl_lti_prov_outcome"), [
361 'yes' => $this->lng->txt(
'yes'),
362 'no' => $this->lng->txt(
'no'),
364 'internal' => $this->ui_factory->input()->field()->select($this->
lng->txt(
"tbl_lti_prov_internal"), [
365 'yes' => $this->lng->txt(
'yes'),
366 'no' => $this->lng->txt(
'no'),
368 'with_key' => $this->ui_factory->input()->field()->select($this->
lng->txt(
"tbl_lti_prov_with_key"), [
369 'yes' => $this->lng->txt(
'yes'),
370 'no' => $this->lng->txt(
'no'),
375 $active = array_fill(0, count($filter_inputs),
true);
377 return $this->ui_service->filter()->standard(
378 'lti_consumer_provider_table',
379 $this->
ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd),
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
static getCategoriesSelectOptions()
const AVAILABILITY_CREATE
const AVAILABILITY_EXISTING
const CMD_RESET_PROVIDER_TO_USER_SCOPE_MULTI
const CMD_DELETE_GLOBAL_PROVIDER_MULTI
const CMD_SHOW_GLOBAL_PROVIDER_FORM
const CMD_SHOW_USER_PROVIDER_FORM
const CMD_DELETE_USER_PROVIDER
const CMD_RESET_PROVIDER_TO_USER_SCOPE
const CMD_DELETE_GLOBAL_PROVIDER
const CMD_ACCEPT_PROVIDER_AS_GLOBAL_MULTI
const CMD_ACCEPT_PROVIDER_AS_GLOBAL
const CMD_DELETE_USER_PROVIDER_MULTI
getAvailabilityLabel(array $data)
ServerRequestInterface RequestInterface $request
getIsWithKeyFormatted(bool $isWithKey)
getHasOutcomeFormatted(bool $hasOutcome)
getIsInternalFormatted(bool $isInternal)
bool $resetProviderToUserScope
enableResetProviderToUserScope()
ILIAS UI Renderer $ui_renderer
getProviderCreatorLabel(array $data)
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
getCategoryTranslation(string $category)
getHTML(bool $hasWriteAccess=false)
enableAcceptProviderAsGlobal()
bool $acceptProviderAsGlobal
enableSelectProviderForm()
ILIAS Data Factory $data_factory
getOwnProviderLabel(array $data)
__construct(?object $a_parent_obj, ?string $a_parent_cmd)
ILIAS Refinery Factory $refinery
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This describes how an icon could be modified during construction of UI.
buildDataRow(string $id, array $record)
This is how the factory for UI elements looks.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...