ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMultilingualismTableGUI.php
Go to the documentation of this file.
1<?php
2
20
27{
28 protected int $nr;
29 protected string $master_lang;
30 protected string $base_cmd;
31 protected bool $incl_desc;
33 protected LOMServices $lom_services;
34
35 public function __construct(
36 object $a_parent_obj,
37 string $a_parent_cmd,
38 bool $a_incl_desc = true,
39 string $a_base_cmd = "HeaderTitle",
40 string $a_master_lang = ""
41 ) {
42 global $DIC;
43
44 $this->ctrl = $DIC->ctrl();
45 $this->lng = $DIC->language();
46 $this->access = $DIC->access();
47 $ilCtrl = $DIC->ctrl();
48 $this->lom_services = $DIC->learningObjectMetadata();
49
50 parent::__construct($a_parent_obj, $a_parent_cmd);
51 $this->incl_desc = $a_incl_desc;
52 $this->base_cmd = $a_base_cmd;
53 $this->master_lang = $a_master_lang;
54
55 $this->setLimit(9999);
56
57 $this->addColumn("", "", "1");
58 $this->addColumn($this->lng->txt("language"), "", "");
59 $this->addColumn($this->lng->txt("default"), "", "");
60 $this->addColumn($this->lng->txt("title"), "", "");
61 if ($a_incl_desc) {
62 $this->addColumn($this->lng->txt("description"), "", "");
63 }
64 // $this->addColumn($this->lng->txt("actions"), "", "");
65
66 $this->setEnableHeader(true);
67 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
68 $this->setRowTemplate("tpl.obj_translation2_row.html", "components/ILIAS/ILIASObject");
69 $this->disable("footer");
70 $this->setEnableTitle(true);
71
72 $this->nr = 0;
73 }
74
75 protected function prepareOutput(): void
76 {
78
79 $this->addMultiCommand("delete" . $this->base_cmd . "s", $lng->txt("remove"));
80 if ($this->dataExists()) {
81 $this->addCommandButton("save" . $this->base_cmd . "s", $lng->txt("save"));
82 }
83 }
84
85 protected function fillRow(array $a_set): void
86 {
88
89 $this->nr++;
90
91
92 if (!$a_set["default"] && $a_set["lang"] != $this->master_lang) {
93 $this->tpl->setCurrentBlock("cb");
94 $this->tpl->setVariable("CB_NR", $this->nr);
95 $this->tpl->parseCurrentBlock();
96 }
97
98 if ($this->master_lang === "") {
99 $this->tpl->setCurrentBlock("rb");
100 $this->tpl->setVariable("RB_NR", $this->nr);
101 if ($a_set["default"]) {
102 $this->tpl->setVariable("DEF_CHECKED", "checked=\"checked\"");
103 }
104 $this->tpl->parseCurrentBlock();
105 } elseif ($a_set["lang"] == $this->master_lang) {
106 $this->tpl->setVariable("MASTER_LANG", $lng->txt("obj_base_lang"));
107 }
108
109 if ($this->incl_desc) {
110 $this->tpl->setCurrentBlock("desc_row");
111 $this->tpl->setVariable("VAL_DESC", ilLegacyFormElementsUtil::prepareFormOutput($a_set["desc"]));
112 $this->tpl->setVariable("DNR", $this->nr);
113 $this->tpl->parseCurrentBlock();
114 }
115
116 $this->tpl->setVariable("NR", $this->nr);
117
118 // lang selection
119 $languages = [];
120 foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
121 $languages[$language->value()] = $language->presentableLabel();
122 }
123 $this->tpl->setVariable(
124 "LANG_SELECT",
126 $a_set["lang"],
127 "lang[" . $this->nr . "]",
128 $languages,
129 false,
130 true
131 )
132 );
133
134
135 $this->tpl->setVariable("VAL_TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
136 }
137}
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...
static prepareFormOutput($a_str, bool $a_strip=false)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
prepareOutput()
Anything that must be done before HTML is generated.
__construct(object $a_parent_obj, string $a_parent_cmd, bool $a_incl_desc=true, string $a_base_cmd="HeaderTitle", string $a_master_lang="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setEnableTitle(bool $a_enabletitle)
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
ilLanguage $lng
disable(string $a_module_name)
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26