ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLTIProviderReleasedObjectsTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
30use Psr\Http\Message\ServerRequestInterface;
31use Psr\Http\Message\RequestInterface;
32
40{
41 protected ilLanguage $lng;
43 protected \ILIAS\UI\Renderer $ui_renderer;
44 private ServerRequestInterface|RequestInterface $request;
45 protected \ILIAS\Data\Factory $data_factory;
48 protected \ILIAS\Refinery\Factory $refinery;
49 private array $records;
50 private string $id;
51
52 public function __construct(string $a_id = '')
53 {
54 global $DIC;
55
56 $this->lng = $DIC->language();
57 $this->ui_factory = $DIC->ui()->factory();
58 $this->ui_renderer = $DIC->ui()->renderer();
59 $this->request = $DIC->http()->request();
60 $this->data_factory = new \ILIAS\Data\Factory();
61 $this->ctrl = $DIC->ctrl();
62 $this->wrapper = $DIC->http()->wrapper();
63 $this->refinery = $DIC->refinery();
64 $this->id = $a_id ?: 'lti_released_objects';
65
66 $this->records = $this->getRecords();
67 }
68
69 public function getColumns(): array
70 {
71 return [
72 'type' => $this->ui_factory->table()->column()->statusIcon($this->lng->txt('type')),
73 'title' => $this->ui_factory->table()->column()->link($this->lng->txt('title')),
74 'consumer' => $this->ui_factory->table()->column()->text($this->lng->txt('lti_consumer'))
75 ];
76 }
77
78 private function getRecords(): array
79 {
81
82 $result = array();
83 foreach ($rows as $row) {
84 $ref_id = (int) $row['ref_id'];
85
87 if ($type == 'rolf') {
88 continue;
89 }
90
91 $result[] = array(
92 'id' => $ref_id,
93 'ref_id' => $ref_id,
95 'type' => $type,
97 'consumer' => $row['title']
98 );
99 }
100
101 return $result;
102 }
103
107 public function getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters): Generator
108 {
109 global $DIC;
110
112 $static_url = $DIC["static_url"];
113
114 foreach ($this->records as $record) {
115 $link = (string) $static_url->builder()->build(
116 $record['type'],
117 new ReferenceId($record['ref_id'])
118 );
119
120 $display_record = [
121 'type' => $this->ui_factory->symbol()->icon()->standard($record['type'], $record['type'], Icon::SMALL),
122 'title' => $this->ui_factory->link()->standard($record['title'], $link),
123 'consumer' => $record['consumer']
124 ];
125
126 yield $row_builder->buildDataRow((string) $record['id'], $display_record);
127 }
128 }
129
130 public function getTotalRowCount(?array $filter_data, ?array $additional_parameters): ?int
131 {
132 return count($this->records);
133 }
134
137 public function getHtml(): string
138 {
139 $table = $this->ui_factory->table()
140 ->data($this->lng->txt('lti_released_objects'), $this->getColumns(), $this)
141 ->withOrder(new Order('title', Order::ASC))
142 ->withRequest($this->request);
143
144 return $this->ui_renderer->render($table);
145 }
146
147 public function getId(): string
148 {
149 return $this->id;
150 }
151}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
Class Services.
Definition: Services.php:38
Description of class ilLTIProviderReleasedObjectsTableGUI.
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...
language handling
static readReleaseObjects()
Read released objects.
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
$static_url
Definition: goto.php:29
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:29
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e....
buildDataRow(string $id, array $record)
This is how the factory for UI elements looks.
Definition: Factory.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26