ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Language.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use Generator;
28use ilLanguage;
30
31class 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
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
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
language handling
Class ilObjLanguage.
static countUsers(string $a_lang)
Count number of users that use a language.
buildDataRow(string $id, array $record)
global $DIC
Definition: shib_login.php:26