ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Language.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use Generator;
28 use ilLanguage;
29 use ilObjLanguage;
30 
31 class Language implements DataRetrieval
32 {
33  protected ilLanguage $lng;
34 
35  public function __construct()
36  {
37  global $DIC;
38  $this->lng = $DIC->language();
39  }
40  public function getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters): Generator
41  {
42  foreach (array_slice($this->lng->getInstalledLanguages(), $range->getStart(), $range->getLength()) as $key) {
43  $title = $this->lng->txt('meta_l_' . $key);
44  if ($key === $this->lng->getDefaultLanguage()) {
45  $title .= ' (' . $this->lng->txt('system_language') . ')';
46  }
47  yield $row_builder->buildDataRow($key, [
48  'name' => $title,
49  'user_count' => ilObjLanguage::countUsers($key)
50  ]);
51  }
52  }
53 
54  public function getTotalRowCount(?array $filter_data, ?array $additional_parameters): ?int
55  {
56  return count($this->lng->getInstalledLanguages());
57  }
58 }
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...
Definition: Language.php:40
static countUsers(string $a_lang)
Count number of users that use a language.
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:28
buildDataRow(string $id, array $record)
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
Definition: Language.php:54
global $DIC
Definition: shib_login.php:22
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28