19declare(strict_types=1);
29use Psr\Http\Message\ServerRequestInterface;
30use Psr\Http\Message\RequestInterface;
45 private ServerRequestInterface|RequestInterface
$request;
57 $this->
lng = $DIC->language();
58 $this->ui_factory =
$DIC->ui()->factory();
59 $this->ui_renderer =
$DIC->ui()->renderer();
60 $this->request =
$DIC->http()->request();
61 $this->data_factory = new \ILIAS\Data\Factory();
62 $this->
ctrl = $DIC->ctrl();
63 $this->wrapper =
$DIC->http()->wrapper();
72 'active' => $this->ui_factory->table()->column()->statusIcon($this->
lng->txt(
'active')),
73 'title' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'title')),
74 'description' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'description')),
75 'prefix' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'prefix')),
76 'language' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'in_use')),
77 'objects' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'objects')),
78 'role' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'role'))
86 $consumer_data = $dataConnector->getGlobalToolConsumerSettings();
90 foreach ($consumer_data as $cons) {
92 "id" => $cons->getExtConsumerId(),
93 "active" => $cons->getActive(),
94 "title" => $cons->getTitle(),
95 "description" => $cons->getDescription(),
96 "prefix" => $cons->getPrefix(),
97 "language" => $cons->getLanguage(),
98 "role" => $cons->getRole(),
114 $df = new \ILIAS\Data\Factory();
115 $here_uri = $df->uri($this->request->getUri()->__toString());
118 $query_params_namespace = [
'lti_consumer_table'];
119 list($url_builder, $id_token, $action_token) = $url_builder->acquireParameters(
120 $query_params_namespace,
125 $query = $this->wrapper->query();
126 if ($query->has($action_token->getName())) {
127 $action = $query->retrieve($action_token->getName(), $this->refinery->to()->string());
128 $ids = $query->retrieve($id_token->getName(), $this->refinery->custom()->transformation(fn($v) => $v));
129 $id = $ids[0] ??
null;
133 $this->
ctrl->setParameterByClass(ilObjLTIAdministrationGUI::class,
'cid',
$id);
134 $this->
ctrl->redirectByClass(ilObjLTIAdministrationGUI::class,
'editConsumer');
137 $this->
ctrl->setParameterByClass(ilObjLTIAdministrationGUI::class,
'cid',
$id);
138 $this->
ctrl->redirectByClass(ilObjLTIAdministrationGUI::class,
'deleteLTIConsumer');
141 $this->
ctrl->setParameterByClass(ilObjLTIAdministrationGUI::class,
'cid',
$id);
142 $this->
ctrl->redirectByClass(ilObjLTIAdministrationGUI::class,
'changeStatusLTIConsumer');
148 $this->ui_factory->table()->action()->single(
149 $this->
lng->txt(
'edit'),
150 $url_builder->withParameter($action_token,
"edit"),
153 $this->ui_factory->table()->action()->single(
154 $this->
lng->txt(
'delete'),
155 $url_builder->withParameter($action_token,
"delete"),
158 $this->ui_factory->table()->action()->single(
159 $this->
lng->txt(
'activate') .
" / " . $this->lng->txt(
'deactivate'),
160 $url_builder->withParameter($action_token,
"status"),
172 foreach ($this->records as $record) {
173 $record[
"active"] = $this->ui_factory->symbol()->icon()->custom(
175 'assets/images/standard/icon_ok.svg' :
176 'assets/images/standard/icon_not_ok.svg',
177 $record[
"active"] ? $this->
lng->txt(
'active') : $this->lng->txt(
'inactive'),
183 $record[
'role'] = $role->getTitle();
185 $record[
'role'] =
'';
188 $record[
"objects"] =
'';
191 foreach ($obj_types as $obj_type) {
192 $record[
"objects"] .=
$GLOBALS[
'DIC']->language()->txt(
'objs_' . $obj_type) .
'<br/>';
196 yield $row_builder->
buildDataRow((
string) $record[
"id"], $record);
202 return count($this->records);
210 $table = $this->ui_factory->table()
211 ->data($this->
lng->txt(
'lti_object_consumer'), $this->getColumns(), $this)
212 ->withOrder(
new Order(
'title', Order::ASC))
214 ->withRequest($this->request);
216 return $this->ui_renderer->render($table);
226 $this->editable = $a_editable;
$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 getActiveObjectTypes(int $a_consumer_id)
TableGUI class for LTI consumer listing.
ILIAS Refinery Factory $refinery
ILIAS Data Factory $data_factory
setEditable(bool $a_editable)
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...
ServerRequestInterface RequestInterface $request
ILIAS UI Renderer $ui_renderer
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...