39 protected \ilBiblAdminFactoryFacadeInterface
$facade;
40 protected \ilBiblFieldInterface
$field;
51 $DIC->language()->loadLanguageModule(
'obj');
52 $this->main_tpl = $DIC->ui()->mainTemplate();
55 $this->
ctrl = $DIC[
'ilCtrl'];
56 $this->lom_services = $DIC->learningObjectMetadata();
62 switch ($this->
ctrl->getNextClass()) {
64 $cmd = $this->
ctrl->getCmd(self::CMD_DEFAULT);
70 protected function index(): void
75 $this->tpl()->setContent($table->getHTML());
81 $this->
toolbar()->addButton($this->
lng()->txt(
"obj_add_languages"), $this->
ctrl 82 ->getLinkTarget($this, self::CMD_ADD_LANGUAGE));
88 $to_translate = (array) $this->
http()->request()->getParsedBody()[self::P_TRANSLATIONS];
89 foreach ($to_translate as
$id =>
$data) {
90 $translation = $this->facade->translationFactory()->findById(
$id);
91 $translation->setTranslation(
$data[
'translation']);
92 $translation->setDescription(
$data[
'description']);
93 $translation->store();
95 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng()->txt(
'bibl_msg_translations_saved'),
true);
102 $to_delete = (array) $this->
http()->request()->getParsedBody()[self::P_DELETE];
103 foreach ($to_delete as
$id) {
104 $this->facade->translationFactory()->deleteById($id);
106 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng()->txt(
'bibl_msg_translations_deleted'),
true);
115 $this->tpl()->setContent($form->getHTML());
122 if ($form->checkInput()) {
123 $ad = $form->getInput(
"additional_langs");
125 foreach ($ad as $language_key) {
126 $this->facade->translationFactory()
127 ->findArCreateInstanceForFieldAndlanguage($this->field, $language_key);
130 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng()->txt(
"msg_obj_modified"),
true);
134 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng()->txt(
'err_check_input'));
135 $form->setValuesByPost();
136 $this->tpl()->setContent($form->getHTML());
143 $form->setFormAction($this->
ctrl->getFormAction($this));
154 foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
155 $options[$language->value()] = $language->presentableLabel();
157 $options = array(
"" => $this->
lng()->txt(
"please_select")) + $options;
159 $si->setOptions($options);
163 $form->setTitle($this->
lng()->txt(
"obj_add_languages"));
164 $form->addCommandButton(self::CMD_SAVE_LANGUAGES, $this->
lng()->txt(
"save"));
165 $form->addCommandButton(self::CMD_DEFAULT, $this->
lng()->txt(
"cancel"));
173 $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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilBiblAdminFactoryFacadeInterface $facade
static http()
Fetches the global http state from ILIAS.
ilBiblFieldInterface $field
const CMD_DELETE_TRANSLATIONS
ilGlobalTemplateInterface $main_tpl
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(ilBiblAdminFactoryFacadeInterface $facade, \ilBiblFieldInterface $field)
ilBiblTranslationGUI constructor.
const CMD_SAVE_TRANSLATIONS