ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDashboardPageLanguageSelectGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25
30{
31 protected Container $dic;
33
34 public function __construct()
35 {
36 global $DIC;
37 $this->dic = $DIC;
38 $this->page = new ilDashboardPage();
39 }
40
41 public function executeCommand(): void
42 {
43 if ($this->dic->ctrl()->getNextClass() === strtolower(ilDashboardPageGUI::class)) {
44 $lang = $this->dic->http()->wrapper()->query()->retrieve(
45 $this->page->getParentType() . '_lang',
46 $this->dic->refinery()->kindlyTo()->listOf($this->dic->refinery()->to()->string())
47 )[0] ?? '';
48 $this->dic->ui()->mainTemplate()->setContent($this->dic->ctrl()->forwardCommand(new ilDashboardPageGUI($lang)));
49 } else {
50 if ($this->dic->language()->getInstalledLanguages() === [$this->dic->language()->getDefaultLanguage()]) {
51 $this->dic->ctrl()->setParameterByClass(ilDashboardPageGUI::class, 'dshs_lang', $this->dic->language()->getDefaultLanguage());
52 $this->dic->ctrl()->redirectByClass(ilDashboardPageGUI::class, 'edit');
53 }
54 $this->select();
55 }
56 }
57
58 public function select(): void
59 {
60 $url_builder = new URLBuilder(new URI(
61 ILIAS_HTTP_PATH . '/' . $this->dic->ctrl()->getLinkTargetByClass(ilDashboardPageGUI::class, 'edit')
62 ));
63 list($builder, $token) = $url_builder->acquireParameters([$this->page->getParentType()], 'lang');
64 $actions[] = $this->dic->ui()->factory()->table()->action()->single(
65 $this->dic->language()->txt('edit'),
66 $builder,
67 $token
68 );
69
70 $table = $this->dic->ui()->factory()->table()->data(
71 new Language(),
72 $this->dic->language()->txt('dash_co_lang'),
73 [
74 'name' => $this->dic->ui()->factory()->table()->column()->text($this->dic->language()->txt('language'))->withIsSortable(false),
75 'user_count' => $this->dic->ui()->factory()->table()->column()->text($this->dic->language()->txt('users'))->withIsSortable(false)
76 ],
77 )->withActions($actions);
78
79 $this->dic->ui()->mainTemplate()->setContent(
80 $this->dic->ui()->renderer()->render($table->withRequest($this->dic->http()->request()))
81 );
82 }
83}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
@ilCtrl_Calls ilDashboardPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_isCalled...
@ilCtrl_isCalledBy ilDashboardPageLanguageSelectGUI: ilObjDashboardSettingsGUI
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
$token
Definition: xapitoken.php:70