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 array $visible_column_ids,
103 mixed $additional_viewcontrol_data,
105 mixed $additional_parameters
107 foreach ($this->records as $record) {
108 $record[
"icon"] = $record[
"icon"] ??
"lti";
109 $record[
"icon"] = $this->ui_factory->symbol()->icon()->standard($record[
"icon"], $record[
"icon"], IconAlias::SMALL);
111 if ($this->selectProviderForm) {
112 $this->
ctrl->setParameter($this->parent_obj,
'provider_id', $record[
'id']);
113 $record[
"title"] = $this->ui_factory->link()->standard($record[
'title'], $this->
ctrl->getLinkTarget($this->parent_obj,
"save"));
115 $this->
ctrl->setParameter($this->parent_obj,
'provider_id', $record[
'id']);
129 yield $row_builder->
buildDataRow((
string) $record[
"id"], $record);
134 mixed $additional_viewcontrol_data,
136 mixed $additional_parameters
138 return count($this->records);
143 $this->records =
$data;
149 public function getHTML(
bool $hasWriteAccess =
false): string
151 $table = $this->ui_factory->table()
152 ->data($this->
lng->txt(
'tbl_provider_header'), $this->getColumns(), $this)
153 ->withOrder(
new Order(
'title', Order::ASC))
154 ->withRequest($this->request);
156 if ($hasWriteAccess) {
157 $table = $table->withActions($this->getActions());
160 return $this->ui_renderer->render($table);
166 'icon' => $this->ui_factory->table()->column()->statusIcon($this->
lng->txt(
'icon')),
167 'title' => $this->ui_factory->table()->column()->link($this->
lng->txt(
'title')),
168 'description' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_description')),
169 'category' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_category'))->withIsOptional(
true),
170 'keywords' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_keywords')),
171 'outcome' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_outcome'))->withIsOptional(
true),
172 'internal' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_internal'))->withIsOptional(
true),
173 'with_key' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_with_key')),
174 'availability' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_availability')),
175 'own_provider' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_own_provider'))->withIsOptional(
true),
176 'provider_creator' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_provider_creator'))->withIsOptional(
true),
177 'usages_untrashed' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_usages_untrashed')),
178 'usages_trashed' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'tbl_lti_prov_usages_trashed'))->withIsOptional(
true),
187 $df = new \ILIAS\Data\Factory();
188 $here_uri = $df->uri($this->request->getUri()->__toString());
191 $query_params_namespace = [
'provider',
'table'];
192 list($url_builder, $id_token, $action_token) = $url_builder->acquireParameters(
193 $query_params_namespace,
198 $query = $this->wrapper->query();
199 if ($query->has($action_token->getName())) {
200 $action = $query->retrieve($action_token->getName(), $this->refinery->to()->string());
201 $ids = $query->retrieve($id_token->getName(), $this->refinery->custom()->transformation(fn($v) => $v));
205 $id = $ids[0] ??
null;
206 $this->
ctrl->setParameter($this->parent_obj,
'provider_id',
$id);
209 case "delete_global":
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);
240 if (count($ids) > 1) {
241 $this->
ctrl->setParameter($this->parent_obj,
'provider_ids', implode(
",", $ids));
244 $id = $ids[0] ??
null;
245 $this->
ctrl->setParameter($this->parent_obj,
'provider_id',
$id);
254 "edit" => $this->ui_factory->table()->action()->single(
255 $this->
lng->txt(
'lti_action_edit_provider'),
256 $url_builder->withParameter($action_token,
"edit"),
261 if ($this->acceptProviderAsGlobal) {
262 $actions[
"global"] = $this->ui_factory->table()->action()->standard(
263 $this->
lng->txt(
'lti_action_accept_provider_as_global'),
264 $url_builder->withParameter($action_token,
"global"),
267 $actions[
"delete_user"] = $this->ui_factory->table()->action()->standard(
268 $this->
lng->txt(
'lti_delete_provider'),
269 $url_builder->withParameter($action_token,
"delete_user"),
274 if ($this->resetProviderToUserScope) {
275 $actions[
"reset"] = $this->ui_factory->table()->action()->standard(
276 $this->
lng->txt(
'lti_action_reset_provider_to_user_scope'),
277 $url_builder->withParameter($action_token,
"reset"),
280 $actions[
"delete_global"] = $this->ui_factory->table()->action()->standard(
281 $this->
lng->txt(
'lti_delete_provider'),
282 $url_builder->withParameter($action_token,
"delete_global"),
294 return $hasOutcome ?
$DIC->language()->txt(
'yes') :
'';
301 return $isInternal ?
$DIC->language()->txt(
'yes') :
'';
308 return $isWithKey ?
$DIC->language()->txt(
'yes') :
'';
314 return $categories[$category];
321 return match (
$data[
'availability']) {
333 if (
$data[
'creator'] ==
$DIC->user()->getId()) {
334 return $DIC->language()->txt(
'yes');
348 if (
$data[
'creator']) {
353 return $user->getFullname();
356 return $DIC->language()->txt(
'deleted_user');
368 'title' => $this->ui_factory->input()->field()->text($this->
lng->txt(
"title")),
369 'keywords' => $this->ui_factory->input()->field()->text($this->
lng->txt(
"tbl_lti_prov_keywords")),
370 'outcome' => $this->ui_factory->input()->field()->select($this->
lng->txt(
"tbl_lti_prov_outcome"), [
371 'yes' => $this->lng->txt(
'yes'),
372 'no' => $this->lng->txt(
'no'),
374 'internal' => $this->ui_factory->input()->field()->select($this->
lng->txt(
"tbl_lti_prov_internal"), [
375 'yes' => $this->lng->txt(
'yes'),
376 'no' => $this->lng->txt(
'no'),
378 'with_key' => $this->ui_factory->input()->field()->select($this->
lng->txt(
"tbl_lti_prov_with_key"), [
379 'yes' => $this->lng->txt(
'yes'),
380 'no' => $this->lng->txt(
'no'),
385 $active = array_fill(0, count($filter_inputs),
true);
387 return $this->ui_service->filter()->standard(
388 'lti_consumer_provider_table',
389 $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
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
getAvailabilityLabel(array $data)
ServerRequestInterface RequestInterface $request
getIsWithKeyFormatted(bool $isWithKey)
getHasOutcomeFormatted(bool $hasOutcome)
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
getIsInternalFormatted(bool $isInternal)
bool $resetProviderToUserScope
enableResetProviderToUserScope()
ILIAS UI Renderer $ui_renderer
getProviderCreatorLabel(array $data)
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
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...