ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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(
41 DataRowBuilder $row_builder,
42 array $visible_column_ids,
44 Order $order,
45 mixed $additional_viewcontrol_data,
46 mixed $filter_data,
47 mixed $additional_parameters
48 ): Generator {
49 foreach (array_slice($this->lng->getInstalledLanguages(), $range->getStart(), $range->getLength()) as $key) {
50 $title = $this->lng->txt('meta_l_' . $key);
51 if ($key === $this->lng->getDefaultLanguage()) {
52 $title .= ' (' . $this->lng->txt('system_language') . ')';
53 }
54 yield $row_builder->buildDataRow($key, [
55 'name' => $title,
56 'user_count' => ilObjLanguage::countUsers($key)
57 ]);
58 }
59 }
60
61 public function getTotalRowCount(
62 mixed $additional_viewcontrol_data,
63 mixed $filter_data,
64 mixed $additional_parameters
65 ): ?int {
66 return count($this->lng->getInstalledLanguages());
67 }
68}
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 recor...
Definition: Language.php:61
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....
Definition: Language.php:40
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.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildDataRow(string $id, array $record)
global $DIC
Definition: shib_login.php:26