ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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(
108 DataRowBuilder $row_builder,
109 array $visible_column_ids,
111 Order $order,
112 mixed $additional_viewcontrol_data,
113 mixed $filter_data,
114 mixed $additional_parameters
115 ): Generator {
116 global $DIC;
117
119 $static_url = $DIC["static_url"];
120
121 foreach ($this->records as $record) {
122 $link = (string) $static_url->builder()->build(
123 $record['type'],
124 new ReferenceId($record['ref_id'])
125 );
126
127 $display_record = [
128 'type' => $this->ui_factory->symbol()->icon()->standard($record['type'], $record['type'], Icon::SMALL),
129 'title' => $this->ui_factory->link()->standard($record['title'], $link),
130 'consumer' => $record['consumer']
131 ];
132
133 yield $row_builder->buildDataRow((string) $record['id'], $display_record);
134 }
135 }
136
137 public function getTotalRowCount(
138 mixed $additional_viewcontrol_data,
139 mixed $filter_data,
140 mixed $additional_parameters
141 ): ?int {
142 return count($this->records);
143 }
144
147 public function getHtml(): string
148 {
149 $table = $this->ui_factory->table()
150 ->data($this->lng->txt('lti_released_objects'), $this->getColumns(), $this)
151 ->withOrder(new Order('title', Order::ASC))
152 ->withRequest($this->request);
153
154 return $this->ui_renderer->render($table);
155 }
156
157 public function getId(): string
158 {
159 return $this->id;
160 }
161}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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(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...
language handling
static readReleaseObjects()
Read released objects.
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$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, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $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