3 declare(strict_types=1);
27 require_once(
"./Services/Object/classes/class.ilObjectGUI.php");
28 require_once(
"Services/Language/classes/class.ilObjLanguageAccess.php");
62 public function __construct($a_data,
int $a_id = 0,
bool $a_call_by_reference =
false)
65 $ilClientIniFile = $DIC->clientIni();
66 $ilCtrl = $DIC->ctrl();
67 $lng = $DIC->language();
68 $this->
http = $DIC->http();
76 $ilCtrl->saveParameter($this,
"view_mode");
81 if ($this->
http->wrapper()->query()->has(
"obj_id")) {
82 $obj_id_get = $this->
http->wrapper()->query()->retrieve(
"obj_id", $this->
refinery->kindlyTo()->int());
84 if (!$this->
id = $obj_id_get) {
98 $this->langmode = $ilClientIniFile->readVariable(
"system",
"LANGMODE");
109 require_once(
"Services/Language/classes/class.ilObjLanguageExt.php");
128 $ilHelp = $DIC->help();
131 $this->error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
135 $cmd = $this->
ctrl->getCmd(
"view") .
"Object";
138 $ilHelp->setScreenIdComponent(
"lng");
155 include_once
"./Services/Language/classes/class.ilLanguageExtTableGUI.php";
157 "langmode" => $this->langmode,
158 "lang_key" => $this->
object->key,
167 public function viewObject(
int $changesSuccessBool = 0): void
176 $comments = $this->
object->getAllRemarks();
178 $compare_comments = [];
179 $missing_entries = [];
183 $compare = $table_gui->getFilterItemByPostVar(
"compare")->getValue();
184 if ($compare == $this->
object->key) {
185 $compare_object = $this->
object->getGlobalLanguageFile();
186 $compare_content = $compare_object->getAllValues();
187 $compare_comments = $compare_object->getAllComments();
197 $reset_offset_get =
false;
198 if ($this->
http->wrapper()->query()->has(
"reset_offset")) {
199 $reset_offset_get = $this->
http->wrapper()->query()->retrieve(
206 if ($reset_offset_get) {
207 $table_gui->resetOffset();
210 if (!isset($compare_content)) {
228 foreach ($translations as
$name => $translation) {
230 $db_found[] =
$keys[1];
232 $missing_entries = array_diff($topics, $db_found);
235 $filter_mode = $table_gui->getFilterItemByPostVar(
"mode")->getValue();
236 $filter_pattern = $table_gui->getFilterItemByPostVar(
"pattern")->getValue();
237 $filter_module = $table_gui->getFilterItemByPostVar(
"module")->getValue();
238 $filter_module = $filter_module ===
"all" ?
"" : $filter_module;
239 $filter_modules = $filter_module ? array($filter_module) : array();
240 $filter_identifier = $table_gui->getFilterItemByPostVar(
"identifier")->getValue();
241 $filter_topics = $filter_identifier ? array($filter_identifier) : array();
243 if (!isset($compare_content)) {
253 switch ($filter_mode) {
255 $translations = $this->
object->getChangedValues(
263 $translations = $this->
object->getAddedValues(
271 $translations = $this->
object->getUnchangedValues(
279 $translations = $this->
object->getCommentedValues(
287 $translations = $this->
object->getAllValues(
293 $translations = array_intersect_key($translations,
$comments);
297 $translations = $this->
object->getAllValues(
303 $translations = array_intersect_assoc($translations, $compare_content);
307 $translations = $this->
object->getAllValues(
313 $translations = array_diff_assoc($translations, $compare_content);
317 $former_file = $this->
object->getDataPath() .
"/ilias_" . $this->
object->key .
".lang";
318 if (!is_readable($former_file)) {
319 $this->tpl->setOnScreenMessage(
'failure', sprintf($this->
lng->txt(
"language_former_file_missing"), $former_file)
320 .
'<br />' . $this->
lng->txt(
"language_former_file_description"),
false);
321 $translations = array();
324 $global_file_obj = $this->
object->getGlobalLanguageFile();
326 $former_file_obj->read();
327 $global_changes = array_diff_assoc(
328 $global_file_obj->getAllValues(),
329 $former_file_obj->getAllValues()
331 if (!count($global_changes)) {
332 $this->tpl->setOnScreenMessage(
'info', sprintf($this->
lng->txt(
"language_former_file_equal"), $former_file)
333 .
'<br />' . $this->
lng->txt(
"language_former_file_description"),
false);
334 $translations = array();
337 $translations = $this->
object->getChangedValues(
343 $translations = array_intersect_key($translations, $global_changes);
348 $translations = $this->
object->getAllValues(
358 foreach ($translations as
$name => $translation) {
362 $row[
"module"] =
$keys[0];
363 $row[
"topic"] =
$keys[1];
364 $row[
"name"] =
$name;
365 $row[
"translation"] = $translation;
367 $row[
"default"] = $compare_content[
$name] ??
"";
368 $row[
"default_comment"] = $compare_comments[
$name] ??
"";
373 if ($changesSuccessBool) {
378 $table_gui->setData(
$data);
388 $table_gui->writeFilterToSession();
389 $table_gui->resetOffset();
399 $table_gui->resetOffset();
400 $table_gui->resetFilter();
410 $changesSuccessBool = 0;
412 $save_array = array();
413 $remarks_array = array();
414 $post = (array) ($this->
http->request()->getParsedBody() ?? []);
418 $key = str_replace([
"_POSTDOT_",
"_POSTSPACE_"], [
".",
" "],
$key);
424 if (count(
$keys) === 2) {
426 $value = preg_replace(
"/(\015\012)|(\015)|(\012)/",
"<br />", $value);
427 $value = str_replace(
"<<",
"«", $value);
428 $value =
ilUtil::stripSlashes($value,
true,
"<strong><em><u><strike><ol><li><ul><p><div><i><b><code><sup><pre><gap><a><img><bdo><br><span>");
429 $save_array[
$key] = $value;
440 $changesSuccessBool = 1;
452 $this->tpl->setContent($form->getHTML());
457 require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
459 $form->setFormAction($this->
ctrl->getFormAction($this));
460 $form->setTitle($this->
lng->txt(
"language_import_file"));
461 $form->addCommandButton(
"upload", $this->
lng->txt(
"upload"));
468 $ro =
new ilRadioOption($this->
lng->txt(
"language_mode_existing_keepall"),
"keepall");
469 $ro->
setInfo($this->
lng->txt(
"language_mode_existing_keepall_info"));
471 $ro =
new ilRadioOption($this->
lng->txt(
"language_mode_existing_keepnew"),
"keepnew");
472 $ro->
setInfo($this->
lng->txt(
"language_mode_existing_keepnew_info"));
474 $ro =
new ilRadioOption($this->
lng->txt(
"language_mode_existing_replace"),
"replace");
475 $ro->
setInfo($this->
lng->txt(
"language_mode_existing_replace_info"));
477 $ro =
new ilRadioOption($this->
lng->txt(
"language_mode_existing_delete"),
"delete");
478 $ro->
setInfo($this->
lng->txt(
"language_mode_existing_delete_info"));
480 $rg->setValue($this->
getSession()[
"import"][
"mode_existing"] ??
"keepall");
494 if ($form->checkInput()) {
495 $post_mode_existing = $this->
http->request()->getParsedBody()[
'mode_existing'] ??
"";
500 $upload = $DIC->upload();
502 if (!$upload->hasBeenProcessed()) {
507 if (!$upload->hasUploads()) {
508 throw new ilException($DIC->language()->txt(
"upload_error_file_not_found"));
510 $UploadResult = $upload->getResults()[$_FILES[
"userfile"][
"tmp_name"]];
512 $ProcessingStatus = $UploadResult->getStatus();
513 if ($ProcessingStatus->getCode() === ProcessingStatus::REJECTED) {
514 throw new ilException($ProcessingStatus->getMessage());
519 $upload->moveOneFileTo($UploadResult,
'', Location::TEMPORARY, basename($tempfile),
true);
520 $this->
object->importLanguageFile($tempfile, $post_mode_existing);
522 $tempfs = $DIC->filesystem()->temp();
523 $tempfs->delete(basename($tempfile));
525 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage(),
true);
526 $this->
ctrl->redirect($this,
'import');
529 $this->tpl->setOnScreenMessage(
'success',
530 sprintf($this->
lng->txt(
"language_file_imported"), $_FILES[
"userfile"][
"name"]),
true);
531 $this->
ctrl->redirect($this,
"import");
534 $form->setValuesByPost();
535 $this->tpl->setContent($form->getHTML());
543 require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
545 $form->setFormAction($this->
ctrl->getFormAction($this));
546 $form->setTitle($this->
lng->txt(
"language_export_file"));
547 $form->setPreventDoubleSubmission(
false);
548 $form->addCommandButton(
"download", $this->
lng->txt(
"download"));
551 $ro =
new ilRadioOption($this->
lng->txt(
"language_scope_global"),
"global");
552 $ro->
setInfo($this->
lng->txt(
"language_scope_global_info"));
555 $ro->
setInfo($this->
lng->txt(
"language_scope_local_info"));
557 if ($this->langmode) {
559 $ro->
setInfo($this->
lng->txt(
"language_scope_added_info"));
562 $ro =
new ilRadioOption($this->
lng->txt(
"language_scope_unchanged"),
"unchanged");
563 $ro->
setInfo($this->
lng->txt(
"language_scope_unchanged_info"));
565 if ($this->langmode) {
566 $ro =
new ilRadioOption($this->
lng->txt(
"language_scope_merged"),
"merged");
567 $ro->
setInfo($this->
lng->txt(
"language_scope_merged_info"));
571 $rg->setValue($this->
getSession()[
"export"][
"scope"] ??
"global");
574 $this->tpl->setContent($form->getHTML());
582 $post_scope = $this->
http->request()->getParsedBody()[
'scope'] ??
"";
587 $filename =
"ilias_" . $this->
object->key .
'_' 589 .
"-" . date(
"Y-m-d")
590 .
".lang." . $this->
getSession()[
"export"][
"scope"];
592 $global_file_obj = $this->
object->getGlobalLanguageFile();
595 if ($post_scope ===
"global") {
596 $local_file_obj->setParam(
"author", $global_file_obj->getParam(
"author"));
597 $local_file_obj->setParam(
"version", $global_file_obj->getParam(
"version"));
598 $local_file_obj->setAllValues($this->
object->getAllValues());
599 if ($this->langmode) {
600 $local_file_obj->setAllComments($this->
object->getAllRemarks());
602 } elseif ($post_scope ===
"local") {
603 $local_file_obj->setParam(
"based_on", $global_file_obj->getParam(
"version"));
604 $local_file_obj->setAllValues($this->
object->getChangedValues());
605 if ($this->langmode) {
606 $local_file_obj->setAllComments($this->
object->getAllRemarks());
608 } elseif ($post_scope ===
"added") {
609 $local_file_obj->setParam(
"author", $global_file_obj->getParam(
"author"));
610 $local_file_obj->setParam(
"version", $global_file_obj->getParam(
"version"));
611 $local_file_obj->setAllValues($this->
object->getAddedValues());
612 $local_file_obj->setAllComments($this->
object->getAllRemarks());
613 } elseif ($post_scope ===
"unchanged") {
614 $local_file_obj->setParam(
"author", $global_file_obj->getParam(
"author"));
615 $local_file_obj->setParam(
"version", $global_file_obj->getParam(
"version"));
616 $local_file_obj->setAllValues($this->
object->getUnchangedValues());
617 if ($this->langmode) {
618 $local_file_obj->setAllComments($this->
object->getAllRemarks());
620 } elseif ($post_scope ===
"merged") {
621 $local_file_obj->setParam(
"author", $global_file_obj->getParam(
"author"));
622 $local_file_obj->setParam(
"version", $global_file_obj->getParam(
"version"));
623 $local_file_obj->setAllValues($this->
object->getMergedValues());
624 $local_file_obj->setAllComments($this->
object->getMergedRemarks());
635 require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
637 $form->setFormAction($this->
ctrl->getFormAction($this));
638 $form->setTitle($this->
lng->txt(
"language_maintenance"));
639 $form->setPreventDoubleSubmission(
false);
640 $form->addCommandButton(
"maintainExecute", $this->
lng->txt(
"language_process_maintenance"));
643 $ro =
new ilRadioOption($this->
lng->txt(
"language_load_local_changes"),
"load");
644 $ro->
setInfo(sprintf($this->
lng->txt(
"language_load_local_changes_info"), $this->
object->key));
646 $ro =
new ilRadioOption($this->
lng->txt(
"language_clear_local_changes"),
"clear");
647 $ro->
setInfo(sprintf($this->
lng->txt(
"language_clear_local_changes_info"), $this->
object->key));
649 if ($this->langmode) {
650 $ro =
new ilRadioOption($this->
lng->txt(
"language_delete_local_additions"),
"delete_added");
651 $ro->
setInfo(sprintf($this->
lng->txt(
"language_delete_local_additions_info"), $this->
object->key));
653 $ro =
new ilRadioOption($this->
lng->txt(
"language_remove_local_file"),
"remove_local_file");
654 $ro->
setInfo(sprintf($this->
lng->txt(
"language_remove_local_file_info"), $this->
object->key));
656 $ro =
new ilRadioOption($this->
lng->txt(
"language_merge_local_changes"),
"merge");
657 $ro->
setInfo(sprintf($this->
lng->txt(
"language_merge_local_changes_info"), $this->
object->key));
660 $ro =
new ilRadioOption($this->
lng->txt(
"language_save_dist"),
"save_dist");
661 $ro->
setInfo(sprintf($this->
lng->txt(
"language_save_dist_info"), $this->
object->key));
663 $rg->setValue($this->
getSession()[
"maintain"] ??
"load");
666 $this->tpl->setContent($form->getHTML());
671 $post_maintain = $this->
http->request()->getParsedBody()[
'maintain'] ??
"";
672 if (isset($post_maintain)) {
677 switch ($post_maintain) {
681 $orig_file = $this->
object->getLangPath() .
"/ilias_" . $this->
object->key .
".lang";
682 $copy_file = $this->
object->getDataPath() .
"/ilias_" . $this->
object->key .
".lang";
683 if (@copy($orig_file, $copy_file)) {
684 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"language_saved_dist"),
true);
686 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"language_save_dist_failed"),
true);
692 $lang_file = $this->
object->getCustLangPath() .
"/ilias_" . $this->
object->key .
".lang.local";
693 if (is_file($lang_file) and is_readable($lang_file)) {
694 $this->
object->importLanguageFile($lang_file,
"replace");
695 $this->
object->setLocal(
true);
696 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"language_loaded_local"),
true);
698 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"language_error_read_local"),
true);
704 $lang_file = $this->
object->getLangPath() .
"/ilias_" . $this->
object->key .
".lang";
705 if (is_file($lang_file) and is_readable($lang_file)) {
706 $this->
object->importLanguageFile($lang_file,
"replace");
707 $this->
object->setLocal(
false);
708 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"language_cleared_local"),
true);
710 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"language_error_clear_local"),
true);
721 $orig_file = $this->
object->getLangPath() .
"/ilias_" . $this->
object->key .
".lang";
722 $copy_file = $this->
object->getCustLangPath() .
"/ilias_" . $this->
object->key .
".lang";
724 if (is_file($orig_file) and is_writable($orig_file)) {
726 @copy($orig_file, $copy_file);
729 $global_file_obj = $this->
object->getGlobalLanguageFile();
730 $global_file_obj->setAllValues($this->
object->getMergedValues());
731 $global_file_obj->setAllComments($this->
object->getMergedRemarks());
732 $global_file_obj->write();
733 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"language_merged_global"),
true);
735 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"language_error_write_global"),
true);
740 case "remove_local_file":
741 $lang_file = $this->
object->getCustLangPath() .
"/ilias_" . $this->
object->key .
".lang.local";
743 if (!is_file($lang_file)) {
744 $this->
object->setLocal(
false);
745 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"language_error_local_missed"),
true);
746 } elseif (@unlink($lang_file)) {
747 $this->
object->setLocal(
false);
748 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"language_local_file_deleted"),
true);
750 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"language_error_delete_local"),
true);
755 $this->
ctrl->redirect($this,
"maintain");
764 $this->tpl->setContent($form->getHTML());
775 $translate_key =
"lang_translate_" . $this->
object->key;
777 $post_translation = $this->
http->request()->getParsedBody()[
'translation'] ??
"";
779 $translate =
$ilSetting->get($translate_key,
'0');
780 if (!is_null($post_translation) && $post_translation != $translate) {
781 $ilSetting->set($translate_key, $post_translation);
782 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"));
786 $this->tpl->setContent($form->getHTML());
793 $translate_key =
"lang_translate_" . $this->
object->key;
794 $translate = (bool)
$ilSetting->get($translate_key,
'0');
796 require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
798 $form->setFormAction($this->
ctrl->getFormAction($this));
799 $form->setTitle($this->
lng->txt(
"language_settings"));
800 $form->setPreventDoubleSubmission(
false);
801 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
"language_change_settings"));
805 $ci->setInfo($this->
lng->txt(
"language_note_translation"));
820 foreach ($modules as $module) {
822 $row[
"module"] = $module;
823 $row[
"all"] = count($this->
object->getAllValues(array($module)));
824 $row[
"changed"] = count($this->
object->getChangedValues(array($module)));
825 $row[
"unchanged"] = $row[
"all"] - $row[
"changed"];
826 isset($total[
"all"]) ? $total[
"all"] += $row[
"all"] : $total[
"all"] = $row[
"all"];
827 isset($total[
"changed"]) ? $total[
"changed"] += $row[
"changed"] : $total[
"changed"] = $row[
"changed"];
828 isset($total[
"unchanged"]) ? $total[
"unchanged"] += $row[
"unchanged"] : $total[
"unchanged"] = $row[
"unchanged"];
831 $total[
"module"] =
"<b>" . $this->
lng->txt(
"language_all_modules") .
"</b>";
832 $total[
"all"] =
"<b>" . $total[
"all"] .
"</b>";
833 $total[
"changed"] =
"<b>" . $total[
"changed"] .
"</b>";
834 $total[
"unchanged"] =
"<b>" . $total[
"unchanged"] .
"</b>";
838 include_once
"Services/Table/classes/class.ilTable2GUI.php";
840 $table_gui->setRowTemplate(
"tpl.lang_statistics_row.html",
"Services/Language");
841 $table_gui->setEnableTitle(
false);
842 $table_gui->setEnableNumInfo(
false);
843 $table_gui->setLimit(count(
$data));
846 $table_gui->addColumn(ucfirst($this->
lng->txt(
"module")),
"",
"25%");
847 $table_gui->addColumn($this->
lng->txt(
"language_scope_global"),
"",
"25%");
848 $table_gui->addColumn($this->
lng->txt(
"language_scope_local"),
"",
"25%");
849 $table_gui->addColumn($this->
lng->txt(
"language_scope_unchanged"),
"",
"25%");
851 $table_gui->setData(
$data);
853 $this->tpl->setContent($table_gui->getHTML());
863 $ilCtrl = $DIC->ctrl();
864 $cmd = $ilCtrl->getCmd();
867 $this->tabs_gui->setBackTarget(
868 $this->
lng->txt(
"back"),
869 $this->
ctrl->getLinkTargetByClass(
"ilObjLanguageFolderGUI")
872 $this->tabs_gui->addTab(
874 $this->
lng->txt(
"edit"),
875 $this->
ctrl->getLinkTarget($this,
"view")
878 $this->tabs_gui->addTab(
880 $this->
lng->txt(
'export'),
881 $this->
ctrl->getLinkTarget($this,
"export")
884 $this->tabs_gui->addTab(
886 $this->
lng->txt(
"import"),
887 $this->
ctrl->getLinkTarget($this,
"import")
890 $this->tabs_gui->addTab(
892 $this->
lng->txt(
"language_maintain"),
893 $this->
ctrl->getLinkTarget($this,
"maintain")
896 $this->tabs_gui->addTab(
898 $this->
lng->txt(
"settings"),
899 $this->
ctrl->getLinkTarget($this,
"settings")
902 $this->tabs_gui->addTab(
904 $this->
lng->txt(
"language_statistics"),
905 $this->
ctrl->getLinkTarget($this,
"statistics")
914 $this->tabs_gui->activateTab(
"edit");
917 $this->tabs_gui->activateTab($cmd);
929 $ilLocator = $DIC[
"ilLocator"];
932 parent::addAdminLocatorItems(
true);
935 $this->
lng->txt(
"languages"),
936 $this->
ctrl->getLinkTargetByClass(
"ilobjlanguagefoldergui",
"")
940 $this->
lng->txt(
"meta_l_" . $this->object->getTitle()),
941 $this->
ctrl->getLinkTarget($this,
"view")
953 $this->tpl->setHeaderPageTitle($this->
lng->txt(
"translation"));
954 $this->tpl->setTitle($this->
lng->txt(
"translation") .
" " . $this->
lng->txt(
"meta_l_" . $this->
object->key));
956 $this->tpl->setTitle($this->
lng->txt(
"meta_l_" . $this->object->key));
958 $this->tpl->setTitleIcon(
ilUtil::getImagePath(
"icon_lngf.svg"), $this->
lng->txt(
"obj_" . $this->object->getType()));
969 $ilCtrl = $DIC->ctrl();
971 if (!count($a_missing)) {
975 $res = array(
"<h3>" . $this->
lng->txt(
"adm_missing_entries") .
"</h3>",
"<ul>");
977 foreach ($a_missing as $entry) {
978 $ilCtrl->setParameter($this,
"eid", $entry);
979 $res[] =
'<li>' . $entry .
980 ' <a href="' . $ilCtrl->getLinkTarget($this,
"addNewEntry") .
981 '">' . $this->
lng->txt(
"adm_missing_entry_add_action") .
'</a></li>';
982 $ilCtrl->setParameter($this,
"eid",
"");
987 return implode(
"\n",
$res);
996 if ($this->
http->wrapper()->query()->has(
"eid")) {
997 $id = trim($this->
http->wrapper()->query()->retrieve(
"eid", $this->
refinery->kindlyTo()->string()));
1009 $ilCtrl = $DIC->ctrl();
1012 $a_id = $this->
http->request()->getParsedBody()[
'id'] ??
"";
1017 $ilCtrl->redirect($this,
"view");
1020 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
1022 $form->setFormAction($ilCtrl->getFormAction($this,
"saveNewEntry"));
1023 $form->setTitle($this->
lng->txt(
"adm_missing_entry_add"));
1026 $options = array_combine($mods, $mods);
1029 $mod->setOptions(array(
"" => $this->
lng->txt(
"please_select")) + $options);
1030 $mod->setRequired(
true);
1031 $form->addItem($mod);
1034 $id->setValue($a_id);
1035 $id->setDisabled(
true);
1036 $form->addItem(
$id);
1038 foreach ($this->
lng->getInstalledLanguages() as $lang_key) {
1039 $trans =
new ilTextInputGUI($this->
lng->txt(
"meta_l_" . $lang_key),
"trans_" . $lang_key);
1040 if (in_array($lang_key, array(
"de",
"en"))) {
1041 $trans->setRequired(
true);
1043 $form->addItem($trans);
1046 $form->addCommandButton(
"saveNewEntry", $this->
lng->txt(
"save"));
1047 $form->addCommandButton(
"view", $this->
lng->txt(
"cancel"));
1055 $ilDB = $DIC->database();
1056 $ilCtrl = $DIC->ctrl();
1060 if ($form->checkInput()) {
1061 $mod = $form->getInput(
"mod");
1062 $id = $form->getInput(
"id");
1065 foreach ($this->
lng->getInstalledLanguages() as $lang_key) {
1066 $trans = trim($form->getInput(
"trans_" . $lang_key));
1074 date(
"Y-m-d H:i:s"),
1079 $set =
$ilDB->query(
"SELECT lang_array FROM lng_modules" .
1080 " WHERE lang_key = " .
$ilDB->quote($lang_key,
"text") .
1081 " AND module = " .
$ilDB->quote($mod,
"text"));
1082 $row =
$ilDB->fetchAssoc($set);
1083 $entries = unserialize($row[
"lang_array"], [
"allowed_classes" =>
false]);
1084 if (is_array($entries)) {
1085 $entries[
$id] = $trans;
1086 ilObjLanguage::replaceLangModule($lang_key, $mod, $entries);
1091 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
1092 $ilCtrl->redirect($this,
"view");
1095 $form->setValuesByPost();
1105 $f = $DIC->ui()->factory();
1106 $renderer = $DIC->ui()->renderer();
1108 return $renderer->render(
$f->messageBox()->success($this->
lng->txt(
"language_variables_saved")));
downloadObject()
Download a language file.
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
executeCommand()
execute command
assignObject()
Assign the extended language object.
getSuccessMessage()
Get success message after variables were saved.
uploadObject()
Process an uploaded language file.
applyFilterObject()
Apply filter.
getUserLanguage()
Return language of user.
static _isPageTranslation()
Check if the current request is a page translation.
static _getSavedModules()
Get the stored modules from the user session.
initAddNewEntryForm(string $a_id=null)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
getViewTable()
Get the table to view language entries.
static _lookupId(string $a_key)
Lookup the object ID for a language key.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
cancelObject()
Cancel the current action.
loadLanguageModule(string $a_module)
Load language module.
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions" ...
setVariable(string $variable, $value='')
Sets the given variable to the given value.
Class ilObjLanguageExtGUI.
resetFilterObject()
Reset filter.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
exportObject()
Show the screen to export a language file.
static _checkMaintenance()
Permission check for language maintenance (import/export)
const ILIAS_LANGUAGE_MODULE
saveSettingsObject()
Set the language settings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addAdminLocatorItems(bool $do_not_add_object=false)
Set the locator for admin mode (Overwritten from ilObjectGUI, called by prepareOutput) ...
importObject()
Show the screen to import a language file.
static _getValues(string $a_lang_key, array $a_modules=array(), array $a_topics=array(), string $a_pattern='', string $a_state='')
Get the translations of specified topics.
static http()
Fetches the global http state from ILIAS.
ilGlobalTemplateInterface $tpl
__construct($a_data, int $a_id=0, bool $a_call_by_reference=false)
Constructor.
setContent(string $a_html)
Sets content for standard template.
Class ilObjectGUI Basic methods of all Output classes.
getAdminTabs()
Get tabs for admin mode (Overwritten from ilObjectGUI, called by prepareOutput)
static _getModules(string $a_lang_key)
Get all modules of a language.
static _deleteValues(string $a_lang_key, array $a_values=array())
Delete a set of translation in the database.
buildMissingEntries(array $a_missing=null)
statisticsObject()
Print out statistics about the language.
settingsObject()
View the language settings.
setTitleAndDescription()
Set the Title and the description (Overwritten from ilObjectGUI, called by prepareOutput) ...
static _getSavedTopics()
Get the stored topics from the user session.
saveObject()
Save the changed translations.
static replaceLangEntry(string $a_module, string $a_identifier, string $a_lang_key, string $a_value, string $a_local_change=null, string $a_remarks=null)
Replace lang entry.
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
__construct(Container $dic, ilPlugin $plugin)
static _getRemarks(string $a_lang_key, bool $a_all_changed=false)
Get all remarks of a language.
addNewEntryObject(ilPropertyFormGUI $a_form=null)
viewObject(int $changesSuccessBool=0)
Show the edit screen.
maintainObject()
Process the language maintenance.
getId()
get the language object id (needed for filter serialization) Return language object id ...
static set(string $a_var, $a_val)
Set a value.
static _saveValues(string $a_lang_key, array $a_values=array(), array $a_remarks=array())
Save a set of translation in the database.