ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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...
 

Data Fields

const ACTIVATE = 'activate'
 
const DEACTIVATE = 'deactivate'
 
const 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

Member Function Documentation

◆ getActions()

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

Definition at line 92 of file AuthPageLanguagesOverviewTable.php.

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

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

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  }
+ 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, >

Definition at line 73 of file AuthPageLanguagesOverviewTable.php.

References ILIAS\Repository\lng().

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

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  }
+ 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.

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

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 Contains several chained tasks and infos about them.
+ 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.

References ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getRecords().

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  }
+ Here is the call graph for this function:

◆ getStatusIcon()

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

Definition at line 155 of file AuthPageLanguagesOverviewTable.php.

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

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

155  : \ILIAS\UI\Component\Symbol\Icon\Icon
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)
+ 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.

References ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\initRecords().

190  : ?int {
191  $this->initRecords();
192 
193  return \count($this->records);
194  }
+ Here is the call graph for this function:

◆ initRecords()

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

Definition at line 133 of file AuthPageLanguagesOverviewTable.php.

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

Referenced by ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getRecords(), and ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getTotalRowCount().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static lookupId(string $a_lang_key)
Lookup obj_id of language.
static getInstance(AuthPageEditorContext $context)
+ Here is the call graph for this function:
+ Here is the caller 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.

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

+ Here is the caller 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.

References ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\$records, and ilArrayUtil\stableSortArray().

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

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...
+ Here is the call graph for this function:
+ Here is the caller 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 ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable::ACTIVATE = 'activate'

Definition at line 33 of file AuthPageLanguagesOverviewTable.php.

◆ DEACTIVATE

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

Definition at line 34 of file AuthPageLanguagesOverviewTable.php.

◆ EDIT

const 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: