ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLanguageExtTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-20014 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Table/classes/class.ilTable2GUI.php";
5
7{
12 private $inputsize = 40;
13 private $commentsize = 30;
14
18 private $params = array();
19
20 public function __construct($a_parent_obj, $a_parent_cmd, $a_params = array())
21 {
22 global $ilCtrl, $lng;
23
24 // allow a different sorting/paging for admin and translation tables
25 $this->params = $a_params;
26 $this->setId("lang_ext_" . (ilObjLanguageAccess::_isPageTranslation() ? 'trans' : 'admin'));
27
28 parent::__construct($a_parent_obj, $a_parent_cmd);
29
30 $this->setRowTemplate("tpl.lang_items_row.html", "Services/Language");
31 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
32 $this->setDisableFilterHiding(true);
33
34 $this->initFilter();
35
36 // set the compare language
37 $compare = $this->getFilterItemByPostVar('compare')->getValue();
38 if ($compare == $this->params['lang_key']) {
39 $compare_note = " " . $lng->txt("language_default_entries");
40 }
41
42 $this->addColumn(ucfirst($lng->txt("module")), "module", "10em");
43 $this->addColumn(ucfirst($lng->txt("identifier")), "topic", "10em");
44 $this->addColumn($lng->txt("meta_l_" . $this->params['lang_key']), "translation");
45 $this->addColumn($lng->txt("meta_l_" . $compare) . $compare_note, "default");
46 $this->addCommandButton('save', $lng->txt('save'));
47 }
48
49
53 protected function fillRow($data)
54 {
55 global $lng, $ilCtrl;
56
57 // mantis #25237
58 // @see https://php.net/manual/en/language.variables.external.php
59 $data['name'] = str_replace('.', '_POSTDOT_', $data['name']);
60 $data['name'] = str_replace(' ', '_POSTSPACE_', $data['name']);
61
62 if ($this->params['langmode']) {
63 $this->tpl->setCurrentBlock('comment');
64 $this->tpl->setVariable("COM_ID", ilUtil::prepareFormOutput($data["name"] . $lng->separator . "comment"));
65 $this->tpl->setVariable("COM_NAME", ilUtil::prepareFormOutput($data["name"] . $lng->separator . "comment"));
66 $this->tpl->setVariable("COM_VALUE", ilUtil::prepareFormOutput($data["comment"]));
67 $this->tpl->setVariable("COM_SIZE", $this->commentsize);
68 $this->tpl->setVariable("COM_MAX", 250);
69 $this->tpl->setVariable("TXT_COMMENT", $lng->txt('comment'));
70 $this->tpl->parseCurrentBlock();
71 } else {
72 $this->tpl->setCurrentBlock('hidden_comment');
73 $this->tpl->setVariable("COM_NAME", ilUtil::prepareFormOutput($data["name"] . $lng->separator . "comment"));
74 $this->tpl->setVariable("COM_VALUE", ilUtil::prepareFormOutput($data["comment"]));
75 $this->tpl->parseCurrentBlock();
76 }
77
78 $this->tpl->setVariable("T_ROWS", ceil(strlen($data["translation"]) / $this->inputsize));
79 $this->tpl->setVariable("T_SIZE", $this->inputsize);
80 $this->tpl->setVariable("T_NAME", ilUtil::prepareFormOutput($data["name"]));
81 $this->tpl->setVariable("T_USER_VALUE", ilUtil::prepareFormOutput($data["translation"]));
82
83 $this->tpl->setVariable("MODULE", ilUtil::prepareFormOutput($data["module"]));
84 $this->tpl->setVariable("TOPIC", ilUtil::prepareFormOutput($data["topic"]));
85
86 $this->tpl->setVariable("DEFAULT_VALUE", ilUtil::prepareFormOutput($data["default"]));
87 $this->tpl->setVariable("COMMENT", ilUtil::prepareFormOutput($data["default_comment"]));
88 }
89
93 public function initFilter()
94 {
95 global $lng;
96
97 // most filters are only
99 // pattern
100 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
101 $ti = new ilTextInputGUI($lng->txt("search"), "pattern");
102 $ti->setParent($this->parent_obj);
103 $ti->setMaxLength(64);
104 $ti->setSize(20);
105 $this->addFilterItem($ti);
106 $ti->readFromSession();
107
108 // module
109 $options = array();
110 $options["all"] = $lng->txt("language_all_modules");
111 $modules = ilObjLanguageExt::_getModules($lng->getLangKey());
112 foreach ($modules as $mod) {
113 $options[$mod] = $mod;
114 }
115
116 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
117 $si = new ilSelectInputGUI(ucfirst($lng->txt("module")), "module");
118 $si->setParent($this->parent_obj);
119 $si->setOptions($options);
120 $this->addFilterItem($si);
121 $si->readFromSession();
122 if (!$si->getValue()) {
123 $si->setValue('administration');
124 }
125
126 // identifier
127 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
128 $ti = new ilTextInputGUI(ucfirst($lng->txt("identifier")), "identifier");
129 $ti->setParent($this->parent_obj);
130 $ti->setMaxLength(200);
131 $ti->setSize(20);
132 $this->addFilterItem($ti);
133 $ti->readFromSession();
134
135 // mode
136 $options = array();
137 $options["all"] = $lng->txt("language_scope_global");
138 $options["changed"] = $lng->txt("language_scope_local");
139 if ($this->params['langmode']) {
140 $options["added"] = $lng->txt("language_scope_added");
141 }
142 $options["unchanged"] = $lng->txt("language_scope_unchanged");
143 $options["equal"] = $lng->txt("language_scope_equal");
144 $options["different"] = $lng->txt("language_scope_different");
145 $options["commented"] = $lng->txt("language_scope_commented");
146 if ($this->params['langmode']) {
147 $options["dbremarks"] = $lng->txt("language_scope_dbremarks");
148 }
149 $options["conflicts"] = $lng->txt("language_scope_conflicts");
150
151 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
152 $si = new ilSelectInputGUI($lng->txt("filter"), "mode");
153 $si->setParent($this->parent_obj);
154 $si->setOptions($options);
155 $this->addFilterItem($si);
156 $si->readFromSession();
157 if (!$si->getValue()) {
158 $si->setValue('all');
159 }
160 }
161
162 //compare
163 $options = array();
164 $langlist = $lng->getInstalledLanguages();
165 foreach ($langlist as $lang_key) {
166 $options[$lang_key] = $lng->txt("meta_l_" . $lang_key);
167 }
168
169 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
170 $si = new ilSelectInputGUI($lng->txt("language_compare"), "compare");
171 $si->setParent($this->parent_obj);
172 $si->setOptions($options);
173 $this->addFilterItem($si);
174 $si->readFromSession();
175 if (!$si->getValue()) {
176 $si->setValue($lng->getDefaultLanguage());
177 }
178 }
179}
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
An exception for terminatinating execution or to throw for unit testing.
__construct($a_parent_obj, $a_parent_cmd, $a_params=array())
ilTable2GUI constructor.
fillRow($data)
Fill a single data row.
static _isPageTranslation()
Check if the current request is a page translation.
static _getModules($a_lang_key)
Get all modules of a language.
This class represents a selection list property in a property form.
Class ilTable2GUI.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
getFilterItemByPostVar($a_post_var)
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
This class represents a text property in a property form.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18