ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilLTIProviderReleasedObjectsTableGUI Class Reference

Description of class ilLTIProviderReleasedObjectsTableGUI. More...

+ Inheritance diagram for ilLTIProviderReleasedObjectsTableGUI:
+ Collaboration diagram for ilLTIProviderReleasedObjectsTableGUI:

Public Member Functions

 __construct (string $a_id='')
 
 getColumns ()
 
 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 records available. More...
 
 getHtml ()
 
 getId ()
 
- Public Member Functions inherited from ILIAS\UI\Component\Table\DataRetrieval
 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.g. More...
 
 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 records available. More...
 

Protected Member Functions

 applyOrdering (array $records, Order $order, ?Range $range=null)
 

Protected Attributes

ilLanguage $lng
 
Factory $ui_factory
 
ILIAS UI Renderer $ui_renderer
 
ILIAS Data Factory $data_factory
 
ilCtrlInterface $ctrl
 
WrapperFactory $wrapper
 
ILIAS Refinery Factory $refinery
 

Private Member Functions

 getRecords ()
 

Private Attributes

ServerRequestInterface RequestInterface $request
 
array $records
 
string $id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLTIProviderReleasedObjectsTableGUI::__construct ( string  $a_id = '')

Definition at line 52 of file class.ilLTIProviderReleasedObjectsTableGUI.php.

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 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), getRecords(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyOrdering()

ilLTIProviderReleasedObjectsTableGUI::applyOrdering ( array  $records,
Order  $order,
?Range  $range = null 
)
protected

Definition at line 164 of file class.ilLTIProviderReleasedObjectsTableGUI.php.

164 : array
165 {
166 [$order_field, $order_direction] = $order->join(
167 [],
168 fn($ret, $key, $value) => [$key, $value]
169 );
170
171 usort($records, static function (array $left, array $right) use ($order_field): int {
172 $left_val = $left[$order_field] ?? '';
173 $right_val = $right[$order_field] ?? '';
174 return ilStr::strCmp($left_val, $right_val);
175 });
176
177 if ($order_direction === Order::DESC) {
178 $records = array_reverse($records);
179 }
180
181 if ($range !== null) {
182 $records = array_slice($records, $range->getStart(), $range->getLength());
183 }
184
185 return $records;
186 }
join($init, callable $fn)
Definition: Order.php:75
static strCmp(string $a, string $b)
Definition: class.ilStr.php:87

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), ILIAS\Data\Order\join(), and ilStr\strCmp().

+ Here is the call graph for this function:

◆ getColumns()

ilLTIProviderReleasedObjectsTableGUI::getColumns ( )

Definition at line 69 of file class.ilLTIProviderReleasedObjectsTableGUI.php.

69 : 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 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getHtml()

ilLTIProviderReleasedObjectsTableGUI::getHtml ( )

Definition at line 148 of file class.ilLTIProviderReleasedObjectsTableGUI.php.

148 : string
149 {
150 $table = $this->ui_factory->table()
151 ->data($this, $this->lng->txt('lti_released_objects'), $this->getColumns())
152 ->withOrder(new Order('title', Order::ASC))
153 ->withRange(new Range(0, 20))
154 ->withRequest($this->request);
155
156 return $this->ui_renderer->render($table);
157 }
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

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilLTIProviderReleasedObjectsTableGUI::getId ( )

Definition at line 159 of file class.ilLTIProviderReleasedObjectsTableGUI.php.

References $id.

◆ getRecords()

ilLTIProviderReleasedObjectsTableGUI::getRecords ( )
private

Definition at line 78 of file class.ilLTIProviderReleasedObjectsTableGUI.php.

78 : 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 }
static readReleaseObjects()
Read released objects.
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
$ref_id
Definition: ltiauth.php:66

References $ref_id, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Repository\int(), and ilObjLTIAdministration\readReleaseObjects().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTotalRowCount()

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 records available.

Given the nature of a DataTable, which is, opposite to a PresentationTable, rather administrative than explorative, this information will increase user experience quite a bit. However, you may return null, if the call is to costly, but expect the View Control to look a little different in this case.

Make sure that potential filters or user restrictions are being applied to the count.

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 138 of file class.ilLTIProviderReleasedObjectsTableGUI.php.

142 : ?int {
143 return count($this->records);
144 }

Field Documentation

◆ $ctrl

ilCtrlInterface ilLTIProviderReleasedObjectsTableGUI::$ctrl
protected

◆ $data_factory

ILIAS Data Factory ilLTIProviderReleasedObjectsTableGUI::$data_factory
protected

◆ $id

string ilLTIProviderReleasedObjectsTableGUI::$id
private

◆ $lng

ilLanguage ilLTIProviderReleasedObjectsTableGUI::$lng
protected

◆ $records

array ilLTIProviderReleasedObjectsTableGUI::$records
private

◆ $refinery

ILIAS Refinery Factory ilLTIProviderReleasedObjectsTableGUI::$refinery
protected

◆ $request

ServerRequestInterface RequestInterface ilLTIProviderReleasedObjectsTableGUI::$request
private

◆ $ui_factory

Factory ilLTIProviderReleasedObjectsTableGUI::$ui_factory
protected

◆ $ui_renderer

ILIAS UI Renderer ilLTIProviderReleasedObjectsTableGUI::$ui_renderer
protected

◆ $wrapper

WrapperFactory ilLTIProviderReleasedObjectsTableGUI::$wrapper
protected

The documentation for this class was generated from the following file: