ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBiblTranslationGUI Class Reference

Class ilBiblTranslationGUI. More...

+ Collaboration diagram for ilBiblTranslationGUI:

Public Member Functions

 __construct (ilBiblAdminFactoryFacadeInterface $facade, \ilBiblFieldInterface $field)
 ilBiblTranslationGUI constructor. More...
 
 executeCommand ()
 

Data Fields

const P_TRANSLATIONS = 'translations'
 
const P_DELETE = 'delete'
 
const CMD_ADD_LANGUAGE = "addLanguages"
 
const CMD_SAVE_LANGUAGES = "saveLanguages"
 
const CMD_SAVE_TRANSLATIONS = "saveTranslations"
 
const CMD_DELETE_TRANSLATIONS = "deleteTranslations"
 
const CMD_DEFAULT = 'index'
 

Protected Member Functions

 index ()
 
 initToolbar ()
 
 saveTranslations ()
 
 deleteTranslations ()
 
 addLanguages ()
 
 saveLanguages ()
 
 getLanguagesForm ()
 
 cancel ()
 

Protected Attributes

ilBiblAdminFactoryFacadeInterface $facade
 
ilBiblFieldInterface $field
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblTranslationGUI::__construct ( ilBiblAdminFactoryFacadeInterface  $facade,
\ilBiblFieldInterface  $field 
)

ilBiblTranslationGUI constructor.

Definition at line 45 of file class.ilBiblTranslationGUI.php.

References $DIC, $facade, and $field.

46  {
47  global $DIC;
48  $DIC->language()->loadLanguageModule('obj');
49  $this->main_tpl = $DIC->ui()->mainTemplate();
50  $this->facade = $facade;
51  $this->field = $field;
52  }
ilBiblAdminFactoryFacadeInterface $facade
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ addLanguages()

ilBiblTranslationGUI::addLanguages ( )
protected

Definition at line 107 of file class.ilBiblTranslationGUI.php.

References getLanguagesForm().

107  : void
108  {
109  $form = $this->getLanguagesForm();
110 
111  $this->tpl()->setContent($form->getHTML());
112  }
+ Here is the call graph for this function:

◆ cancel()

ilBiblTranslationGUI::cancel ( )
protected

Definition at line 164 of file class.ilBiblTranslationGUI.php.

References ILIAS\Repository\ctrl().

Referenced by deleteTranslations(), saveLanguages(), and saveTranslations().

164  : void
165  {
166  $this->ctrl()->redirect($this, self::CMD_DEFAULT);
167  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteTranslations()

ilBiblTranslationGUI::deleteTranslations ( )
protected

Definition at line 96 of file class.ilBiblTranslationGUI.php.

References $id, cancel(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

96  : void
97  {
98  $to_delete = (array) $this->http()->request()->getParsedBody()[self::P_DELETE];
99  foreach ($to_delete as $id) {
100  $this->facade->translationFactory()->deleteById($id);
101  }
102  $this->main_tpl->setOnScreenMessage('info', $this->lng()->txt('bibl_msg_translations_deleted'), true);
103  $this->cancel();
104  }
static http()
Fetches the global http state from ILIAS.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ executeCommand()

ilBiblTranslationGUI::executeCommand ( )

Definition at line 55 of file class.ilBiblTranslationGUI.php.

References ILIAS\Repository\ctrl(), and ilBiblAdminFieldGUI\FIELD_IDENTIFIER.

55  : void
56  {
57  $this->ctrl()->saveParameter($this, ilBiblAdminFieldGUI::FIELD_IDENTIFIER);
58  switch ($this->ctrl()->getNextClass()) {
59  default:
60  $cmd = $this->ctrl()->getCmd(self::CMD_DEFAULT);
61  $this->{$cmd}();
62  }
63  }
+ Here is the call graph for this function:

◆ getLanguagesForm()

ilBiblTranslationGUI::getLanguagesForm ( )
protected

Definition at line 136 of file class.ilBiblTranslationGUI.php.

References ilMDLanguageItem\_getLanguages(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by addLanguages(), and saveLanguages().

137  {
138  $form = new ilPropertyFormGUI();
139  $form->setFormAction($this->ctrl()->getFormAction($this));
140 
141  // master language
142  // $options = ilMDLanguageItem::_getLanguages();
143  // $si = new ilSelectInputGUI($this->lng()->txt("obj_master_lang"), "master_lang");
144  // $si->setOptions($options);
145  // $si->setValue($this->user()->getLanguage());
146  // $form->addItem($si);
147 
148  // additional languages
149  $options = ilMDLanguageItem::_getLanguages();
150  $options = array("" => $this->lng()->txt("please_select")) + $options;
151  $si = new ilSelectInputGUI($this->lng()->txt("obj_additional_langs"), "additional_langs");
152  $si->setOptions($options);
153  $si->setMulti(true);
154  $form->addItem($si);
155 
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"));
159 
160  return $form;
161  }
This class represents a property form user interface.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilBiblTranslationGUI::index ( )
protected

Definition at line 66 of file class.ilBiblTranslationGUI.php.

References initToolbar().

66  : void
67  {
68  $this->initToolbar();
69 
70  $table = new ilBiblTranslationTableGUI($this, $this->field, $this->facade->translationFactory());
71  $this->tpl()->setContent($table->getHTML());
72  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ initToolbar()

ilBiblTranslationGUI::initToolbar ( )
protected

Definition at line 75 of file class.ilBiblTranslationGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by index().

75  : void
76  {
77  $this->toolbar()->addButton($this->lng()->txt("obj_add_languages"), $this->ctrl()
78  ->getLinkTarget($this, self::CMD_ADD_LANGUAGE));
79  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveLanguages()

ilBiblTranslationGUI::saveLanguages ( )
protected

Definition at line 115 of file class.ilBiblTranslationGUI.php.

References cancel(), getLanguagesForm(), and ILIAS\Repository\lng().

115  : void
116  {
117  $form = $this->getLanguagesForm();
118  if ($form->checkInput()) {
119  $ad = $form->getInput("additional_langs");
120  if (is_array($ad)) {
121  foreach ($ad as $language_key) {
122  $this->facade->translationFactory()
123  ->findArCreateInstanceForFieldAndlanguage($this->field, $language_key);
124  }
125  }
126  $this->main_tpl->setOnScreenMessage('info', $this->lng()->txt("msg_obj_modified"), true);
127  $this->cancel();
128  }
129 
130  $this->main_tpl->setOnScreenMessage('failure', $this->lng()->txt('err_check_input'));
131  $form->setValuesByPost();
132  $this->tpl()->setContent($form->getHTML());
133  }
+ Here is the call graph for this function:

◆ saveTranslations()

ilBiblTranslationGUI::saveTranslations ( )
protected

Definition at line 82 of file class.ilBiblTranslationGUI.php.

References $data, $id, cancel(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

82  : void
83  {
84  $to_translate = (array) $this->http()->request()->getParsedBody()[self::P_TRANSLATIONS];
85  foreach ($to_translate as $id => $data) {
86  $translation = $this->facade->translationFactory()->findById($id);
87  $translation->setTranslation($data['translation']);
88  $translation->setDescription($data['description']);
89  $translation->store();
90  }
91  $this->main_tpl->setOnScreenMessage('info', $this->lng()->txt('bibl_msg_translations_saved'), true);
92  $this->cancel();
93  }
static http()
Fetches the global http state from ILIAS.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Field Documentation

◆ $facade

ilBiblAdminFactoryFacadeInterface ilBiblTranslationGUI::$facade
protected

Definition at line 37 of file class.ilBiblTranslationGUI.php.

Referenced by __construct().

◆ $field

ilBiblFieldInterface ilBiblTranslationGUI::$field
protected

Definition at line 38 of file class.ilBiblTranslationGUI.php.

Referenced by __construct().

◆ $main_tpl

ilGlobalTemplateInterface ilBiblTranslationGUI::$main_tpl
private

Definition at line 39 of file class.ilBiblTranslationGUI.php.

◆ CMD_ADD_LANGUAGE

const ilBiblTranslationGUI::CMD_ADD_LANGUAGE = "addLanguages"

Definition at line 32 of file class.ilBiblTranslationGUI.php.

◆ CMD_DEFAULT

const ilBiblTranslationGUI::CMD_DEFAULT = 'index'

◆ CMD_DELETE_TRANSLATIONS

const ilBiblTranslationGUI::CMD_DELETE_TRANSLATIONS = "deleteTranslations"

◆ CMD_SAVE_LANGUAGES

const ilBiblTranslationGUI::CMD_SAVE_LANGUAGES = "saveLanguages"

Definition at line 33 of file class.ilBiblTranslationGUI.php.

◆ CMD_SAVE_TRANSLATIONS

const ilBiblTranslationGUI::CMD_SAVE_TRANSLATIONS = "saveTranslations"

◆ P_DELETE

const ilBiblTranslationGUI::P_DELETE = 'delete'

Definition at line 31 of file class.ilBiblTranslationGUI.php.

◆ P_TRANSLATIONS

const ilBiblTranslationGUI::P_TRANSLATIONS = 'translations'

Definition at line 30 of file class.ilBiblTranslationGUI.php.


The documentation for this class was generated from the following file: