ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPageMultiLangGUI.php
Go to the documentation of this file.
1<?php
2
21
29{
30 protected Translations $ot;
31 protected \ilCtrl $ctrl;
32 protected ilLanguage $lng;
33 protected bool $single_page_mode = false;
34
42 public function __construct(
43 string $a_parent_type,
44 int $a_parent_id,
45 bool $a_single_page_mode = false
46 ) {
47 global $DIC;
48
49 $this->ctrl = $DIC->ctrl();
50 $this->lng = $DIC->language();
51 //$this->ml = new ilPageMultiLang($a_parent_type, $a_parent_id);
52
53 // object translation
54 $this->ot = (new TranslationsRepository($DIC->database()))->getFor($a_parent_id);
55 }
56
60 public function executeCommand(): void
61 {
62 $ilCtrl = $this->ctrl;
63
64 $next_class = $ilCtrl->getNextClass();
65
66 switch ($next_class) {
67 default:
68 $cmd = $ilCtrl->getCmd("settings");
69 if (in_array($cmd, array("settings", "activateMultilinguality", "cancel",
70 "saveMultilingualitySettings", "confirmDeactivateMultiLanguage", "addLanguage",
71 "saveLanguages", "deactivateMultiLang", "confirmRemoveLanguages",
72 "removeLanguages"))) {
73 $this->$cmd();
74 }
75 break;
76 }
77 }
78
79 public function getMultiLangInfo(
80 string $a_page_lang = "-"
81 ): string {
82 $lng = $this->lng;
83
84 if ($a_page_lang == "") {
85 $a_page_lang = "-";
86 }
87
88 $lng->loadLanguageModule("meta");
89
90 $tpl = new ilTemplate("tpl.page_multi_lang_info.html", true, true, "components/ILIAS/COPage");
91 $tpl->setVariable("TXT_MASTER_LANG", $lng->txt("obj_base_lang"));
92 $tpl->setVariable("VAL_ML", $lng->txt("meta_l_" . $this->ot->getBaseLanguage()));
93 $cl = ($a_page_lang == "-")
94 ? $this->ot->getBaseLanguage()
95 : $a_page_lang;
96 $tpl->setVariable("TXT_CURRENT_LANG", $lng->txt("cont_current_lang"));
97 $tpl->setVariable("VAL_CL", $lng->txt("meta_l_" . $cl));
98 return $tpl->get();
99 }
100}
Class handles translation mode for an object.
getNextClass($a_gui_class=null)
@inheritDoc
language handling
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Page multilinguality GUI class.
__construct(string $a_parent_type, int $a_parent_id, bool $a_single_page_mode=false)
Constructur.
getMultiLangInfo(string $a_page_lang="-")
executeCommand()
Execute command.
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: shib_login.php:26