49 $DIC->language()->loadLanguageModule(
'obj');
50 $this->main_tpl = $DIC->ui()->mainTemplate();
51 $this->
ctrl = $DIC[
'ilCtrl'];
52 $this->lom_services = $DIC->learningObjectMetadata();
58 $cmd = $this->
ctrl->getCmd(self::CMD_DEFAULT);
63 protected function index(): void
68 $this->tpl()->setContent($table->getHTML());
74 $this->
toolbar()->addButton($this->
lng()->txt(
"obj_add_languages"), $this->
ctrl 75 ->getLinkTarget($this, self::CMD_ADD_LANGUAGE));
81 $to_translate = (array) $this->
http()->request()->getParsedBody()[self::P_TRANSLATIONS];
82 foreach ($to_translate as
$id =>
$data) {
83 $translation = $this->facade->translationFactory()->findById(
$id);
84 $translation->setTranslation(
$data[
'translation']);
85 $translation->setDescription(
$data[
'description']);
86 $translation->store();
88 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng()->txt(
'bibl_msg_translations_saved'),
true);
95 $to_delete = (array) $this->
http()->request()->getParsedBody()[self::P_DELETE];
96 foreach ($to_delete as
$id) {
97 $this->facade->translationFactory()->deleteById($id);
99 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng()->txt(
'bibl_msg_translations_deleted'),
true);
108 $this->tpl()->setContent($form->getHTML());
115 if ($form->checkInput()) {
116 $ad = $form->getInput(
"additional_langs");
118 foreach ($ad as $language_key) {
119 $this->facade->translationFactory()
120 ->findArCreateInstanceForFieldAndlanguage($this->field, $language_key);
123 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng()->txt(
"msg_obj_modified"),
true);
127 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng()->txt(
'err_check_input'));
128 $form->setValuesByPost();
129 $this->tpl()->setContent($form->getHTML());
136 $form->setFormAction($this->
ctrl->getFormAction($this));
147 foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
148 $options[$language->value()] = $language->presentableLabel();
150 $options = [
"" => $this->
lng()->txt(
"please_select")] + $options;
152 $si->setOptions($options);
156 $form->setTitle($this->
lng()->txt(
"obj_add_languages"));
157 $form->addCommandButton(self::CMD_SAVE_LANGUAGES, $this->
lng()->txt(
"save"));
158 $form->addCommandButton(self::CMD_DEFAULT, $this->
lng()->txt(
"cancel"));
166 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
LOMServices $lom_services
Class ilBiblTranslationTableGUI.
static http()
Fetches the global http state from ILIAS.
const CMD_DELETE_TRANSLATIONS
ilGlobalTemplateInterface $main_tpl
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(protected \ilBiblAdminFactoryFacadeInterface $facade, protected \ilBiblFieldInterface $field)
ilBiblTranslationGUI constructor.
const CMD_SAVE_TRANSLATIONS