ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilLTIConsumerProviderUsageTableGUI Class Reference
+ Inheritance diagram for ilLTIConsumerProviderUsageTableGUI:
+ Collaboration diagram for ilLTIConsumerProviderUsageTableGUI:

Public Member Functions

 __construct ()
 
 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...
 
 setData (array $data)
 
 getHTML ()
 
- 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
 
 $request
 
array $records
 

Private Member Functions

 getColumns ()
 

Detailed Description

Definition at line 38 of file class.ilLTIConsumerProviderUsageTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLTIConsumerProviderUsageTableGUI::__construct ( )

Definition at line 46 of file class.ilLTIConsumerProviderUsageTableGUI.php.

47 {
48 global $DIC;
49
50 $this->lng = $DIC->language();
51 $this->ui_factory = $DIC->ui()->factory();
52 $this->ui_renderer = $DIC->ui()->renderer();
53 $this->request = $DIC->http()->request();
54 }
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ applyOrdering()

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

Definition at line 102 of file class.ilLTIConsumerProviderUsageTableGUI.php.

102 : array
103 {
104 [$order_field, $order_direction] = $order->join(
105 [],
106 fn($ret, $key, $value) => [$key, $value]
107 );
108
109 usort($records, static function (array $left, array $right) use ($order_field): int {
110 $left_val = $left[$order_field] ?? '';
111 $right_val = $right[$order_field] ?? '';
112 return ilStr::strCmp($left_val, $right_val);
113 });
114
115 if ($order_direction === Order::DESC) {
116 $records = array_reverse($records);
117 }
118
119 if ($range !== null) {
120 $records = array_slice($records, $range->getStart(), $range->getLength());
121 }
122
123 return $records;
124 }
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()

ilLTIConsumerProviderUsageTableGUI::getColumns ( )
private

Definition at line 137 of file class.ilLTIConsumerProviderUsageTableGUI.php.

137 : array
138 {
139 return [
140 "icon" => $this->ui_factory->table()->column()->statusIcon($this->lng->txt('tbl_lti_prov_icon')),
141 "title" => $this->ui_factory->table()->column()->text($this->lng->txt('tbl_lti_prov_title')),
142 "usedByIsTrashed" => $this->ui_factory->table()->column()->boolean(
143 $this->lng->txt('tbl_lti_prov_usages_trashed'),
144 $this->ui_factory->symbol()->icon()->custom('assets/images/standard/icon_ok.svg', $this->lng->txt('icon_ok'), Icon::SMALL),
145 $this->ui_factory->symbol()->icon()->custom('assets/images/standard/icon_not_ok.svg', $this->lng->txt('icon_not_ok'), Icon::SMALL)
146 ),
147 "used_by" => $this->ui_factory->table()->column()->link($this->lng->txt('tbl_lti_prov_used_by'))
148 ];
149 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getHTML()

ilLTIConsumerProviderUsageTableGUI::getHTML ( )

Definition at line 126 of file class.ilLTIConsumerProviderUsageTableGUI.php.

126 : string
127 {
128 $table = $this->ui_factory->table()
129 ->data($this, $this->lng->txt('tbl_provider_usage_header'), $this->getColumns())
130 ->withOrder(new Order('title', Order::ASC))
131 ->withRange(new Range(0, 20))
132 ->withRequest($this->request);
133
134 return $this->ui_renderer->render($table);
135 }
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:

◆ getTotalRowCount()

ilLTIConsumerProviderUsageTableGUI::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 89 of file class.ilLTIConsumerProviderUsageTableGUI.php.

93 : ?int {
94 return count($this->records);
95 }

◆ setData()

ilLTIConsumerProviderUsageTableGUI::setData ( array  $data)

Definition at line 97 of file class.ilLTIConsumerProviderUsageTableGUI.php.

97 : void
98 {
99 $this->records = $data;
100 }

References $data.

Field Documentation

◆ $lng

ilLanguage ilLTIConsumerProviderUsageTableGUI::$lng
protected

Definition at line 40 of file class.ilLTIConsumerProviderUsageTableGUI.php.

◆ $records

array ilLTIConsumerProviderUsageTableGUI::$records
protected

Definition at line 44 of file class.ilLTIConsumerProviderUsageTableGUI.php.

◆ $request

ilLTIConsumerProviderUsageTableGUI::$request
protected

Definition at line 43 of file class.ilLTIConsumerProviderUsageTableGUI.php.

◆ $ui_factory

Factory ilLTIConsumerProviderUsageTableGUI::$ui_factory
protected

Definition at line 41 of file class.ilLTIConsumerProviderUsageTableGUI.php.

◆ $ui_renderer

ILIAS UI Renderer ilLTIConsumerProviderUsageTableGUI::$ui_renderer
protected

Definition at line 42 of file class.ilLTIConsumerProviderUsageTableGUI.php.


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