ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable Class Reference
+ Inheritance diagram for ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable:
+ Collaboration diagram for ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable:

Public Member Functions

 __construct (private readonly ilCtrlInterface $ctrl, private readonly ilLanguage $lng, \ILIAS\HTTP\Services $http, private readonly \ILIAS\UI\Factory $ui_factory, private readonly \ILIAS\UI\Renderer $ui_renderer, private readonly AuthPageEditorContext $context)
 
 getComponent ()
 
 getRows (UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Data\Range $range, Data\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 records available. More...
 
- Public Member Functions inherited from ILIAS\UI\Component\Table\DataRetrieval
 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.g. More...
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 

Data Fields

const string ACTIVATE = 'activate'
 
const string DEACTIVATE = 'deactivate'
 
const string EDIT = 'edit'
 

Protected Member Functions

 getActions ()
 

Private Member Functions

 getColumns ()
 
 initRecords ()
 
 getStatusIcon (bool $status)
 
 sortedRecords (Data\Order $order)
 
 getRecords (Data\Range $range, Data\Order $order)
 
 limitRecords (array $records, Data\Range $range)
 

Private Attributes

ServerRequestInterface $request
 
Data Factory $data_factory
 
array $records = null
 

Detailed Description

Definition at line 31 of file AuthPageLanguagesOverviewTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::__construct ( private readonly ilCtrlInterface  $ctrl,
private readonly ilLanguage  $lng,
\ILIAS\HTTP\Services  $http,
private readonly \ILIAS\UI\Factory  $ui_factory,
private readonly \ILIAS\UI\Renderer  $ui_renderer,
private readonly AuthPageEditorContext  $context 
)

Definition at line 44 of file AuthPageLanguagesOverviewTable.php.

51 {
52 $this->request = $http->request();
53 $this->data_factory = new Data\Factory();
54 }
$http
Definition: deliver.php:30

References $http.

Member Function Documentation

◆ getActions()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::getActions ( )
protected
Returns
array<string, \ILIAS\UI\Component\Table\Action\Action>

Definition at line 92 of file AuthPageLanguagesOverviewTable.php.

92 : array
93 {
94 $query_params_namespace = ['authpage', 'languages'];
95
96 $overview_uri = $this->data_factory->uri(
97 ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
98 \ilAuthPageEditorGUI::class,
100 )
101 );
102
103 $overview_url_builder = new UI\URLBuilder($overview_uri);
104 [
105 $overview_url_builder,
106 $overview_action_parameter,
107 $overview_row_id
108 ] = $overview_url_builder->acquireParameters(
109 $query_params_namespace,
110 'action',
111 'key'
112 );
113
114 return [
115 self::EDIT => $this->ui_factory->table()->action()->single(
116 $this->lng->txt('edit'),
117 $overview_url_builder->withParameter($overview_action_parameter, self::EDIT),
118 $overview_row_id
119 ),
120 self::ACTIVATE => $this->ui_factory->table()->action()->standard(
121 $this->lng->txt('page_design_activate'),
122 $overview_url_builder->withParameter($overview_action_parameter, self::ACTIVATE),
123 $overview_row_id
124 ),
125 self::DEACTIVATE => $this->ui_factory->table()->action()->standard(
126 $this->lng->txt('page_design_deactivate'),
127 $overview_url_builder->withParameter($overview_action_parameter, self::DEACTIVATE),
128 $overview_row_id
129 )
130 ];
131 }
final const string LANGUAGE_TABLE_ACTIONS_COMMAND

References ILIAS\Repository\ctrl(), ilAuthPageEditorGUI\LANGUAGE_TABLE_ACTIONS_COMMAND, and ILIAS\Repository\lng().

Referenced by ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getComponent().

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

◆ getColumns()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::getColumns ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Column\Column>

Definition at line 73 of file AuthPageLanguagesOverviewTable.php.

73 : array
74 {
75 return [
76 'language' => $this->ui_factory
77 ->table()
78 ->column()
79 ->text($this->lng->txt($this->context->pageLanguageIdentifier()))
80 ->withIsSortable(true),
81 'status_icon' => $this->ui_factory
82 ->table()
83 ->column()
84 ->statusIcon($this->lng->txt('active'))
85 ->withIsSortable(true)
86 ];
87 }

References ILIAS\Repository\lng().

Referenced by ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getComponent().

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

◆ getComponent()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::getComponent ( )

Definition at line 56 of file AuthPageLanguagesOverviewTable.php.

56 : UI\Component\Table\Data
57 {
58 $columns = $this->getColumns();
59 $actions = $this->getActions();
60
61 return $this->ui_factory
62 ->table()
63 ->data($this, $this->lng->txt($this->context->pageLanguageIdentifier(true)), $columns)
64 ->withId(self::class . '_' . $this->context->value)
65 ->withOrder(new \ILIAS\Data\Order('language', \ILIAS\Data\Order::ASC))
66 ->withActions($actions)
67 ->withRequest($this->request);
68 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\Data\Order\ASC, ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getActions(), ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getColumns(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getRecords()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::getRecords ( Data\Range  $range,
Data\Order  $order 
)
private

◆ getRows()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::getRows ( UI\Component\Table\DataRowBuilder  $row_builder,
array  $visible_column_ids,
Data\Range  $range,
Data\Order  $order,
?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 170 of file AuthPageLanguagesOverviewTable.php.

177 : \Generator {
178 $records = $this->getRecords($range, $order);
179
180 foreach ($records as $record) {
181 $row_id = (string) $record['key'];
182 $deactivate_action = (bool) $record['status'] === true ? self::ACTIVATE : self::DEACTIVATE;
183 yield $row_builder->buildDataRow($row_id, $record)->withDisabledAction($deactivate_action);
184 }
185 }

◆ getStatusIcon()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::getStatusIcon ( bool  $status)
private

Definition at line 155 of file AuthPageLanguagesOverviewTable.php.

156 {
157 if ($status) {
158 return $this->ui_factory->symbol()->icon()->custom(
159 \ilUtil::getImagePath('standard/icon_ok.svg'),
160 $this->lng->txt('active')
161 );
162 }
163
164 return $this->ui_factory->symbol()->icon()->custom(
165 \ilUtil::getImagePath('standard/icon_not_ok.svg'),
166 $this->lng->txt('inactive')
167 );
168 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:29

References ilUtil\getImagePath(), and ILIAS\Repository\lng().

Referenced by ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\initRecords().

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

◆ getTotalRowCount()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::getTotalRowCount ( ?array  $filter_data,
?array  $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 187 of file AuthPageLanguagesOverviewTable.php.

190 : ?int {
191 $this->initRecords();
192
193 return \count($this->records);
194 }

◆ initRecords()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::initRecords ( )
private

Definition at line 133 of file AuthPageLanguagesOverviewTable.php.

133 : void
134 {
135 if ($this->records === null) {
136 $this->records = [];
137 $i = 0;
138 $entries = $this->lng->getInstalledLanguages();
139 foreach ($entries as $langkey) {
140 $this->records[$i]['key'] = $langkey;
141 $this->records[$i]['id'] = ilLanguage::lookupId($langkey);
142 $status = ilAuthPageEditorSettings::getInstance($this->context)->isIliasEditorEnabled(
143 $langkey
144 );
145
146 $this->records[$i]['status'] = $status;
147 $this->records[$i]['status_icon'] = $this->getStatusIcon($status);
148 $this->records[$i]['language'] = $this->lng->txt('meta_l_' . $langkey);
149
150 ++$i;
151 }
152 }
153 }
static getInstance(AuthPageEditorContext $context)
static lookupId(string $a_lang_key)
Lookup obj_id of language.

References ilAuthPageEditorSettings\getInstance(), ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getStatusIcon(), ILIAS\Repository\lng(), and ilLanguage\lookupId().

+ Here is the call graph for this function:

◆ limitRecords()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::limitRecords ( array  $records,
Data\Range  $range 
)
private
Parameters
list<array<string,mixed>>$records
Returns
list<array<string, mixed>>

Definition at line 227 of file AuthPageLanguagesOverviewTable.php.

227 : array
228 {
229 return \array_slice($records, $range->getStart(), $range->getLength());
230 }

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

+ Here is the call graph for this function:

◆ sortedRecords()

ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::sortedRecords ( Data\Order  $order)
private
Returns
list<array<string, mixed>>

Definition at line 199 of file AuthPageLanguagesOverviewTable.php.

199 : array
200 {
202 [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
203
204 if ($order_field === 'status_icon') {
205 $order_field = 'status';
206 }
207
208 return ilArrayUtil::stableSortArray($records, $order_field, strtolower($order_direction));
209 }
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...

References ilArrayUtil\stableSortArray().

+ Here is the call graph for this function:

Field Documentation

◆ $data_factory

Data Factory ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::$data_factory
private

Definition at line 38 of file AuthPageLanguagesOverviewTable.php.

◆ $records

array ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::$records = null
private

◆ $request

ServerRequestInterface ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::$request
private

Definition at line 37 of file AuthPageLanguagesOverviewTable.php.

◆ ACTIVATE

const string ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::ACTIVATE = 'activate'

Definition at line 33 of file AuthPageLanguagesOverviewTable.php.

◆ DEACTIVATE

const string ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::DEACTIVATE = 'deactivate'

Definition at line 34 of file AuthPageLanguagesOverviewTable.php.

◆ EDIT

const string ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::EDIT = 'edit'

Definition at line 35 of file AuthPageLanguagesOverviewTable.php.


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