ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAdvancedMDRecordTranslationGUI.php
Go to the documentation of this file.
1 <?php
2 
9 {
10 
14  protected function translations()
15  {
16  $this->setTabs(self::CMD_DEFAULT);
17 
18  $language_table = new ilAdvancedMDRecordLanguageTableGUI(
19  $this->record,
20  $this,
21  self::CMD_DEFAULT
22  );
23  $language_table->init();
24  $language_table->parse();
25 
26  $this->tpl->setContent($language_table->getHTML());
27  }
28 
29  protected function saveTranslations()
30  {
31  $languages = (array) $this->request->getParsedBody()['active_languages'];
32  $default = (string) $this->request->getParsedBody()['default'];
33 
34  if (!in_array($default, $languages)) {
35  ilUtil::sendFailure($this->language->txt('err_check_input'), true);
36  ilUtil::sendInfo($this->language->txt('md_adn_int_error_no_default'), true);
37  $this->ctrl->redirect($this, self::CMD_DEFAULT);
38  }
39 
40  $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
41  foreach ($translations->getTranslations() as $translation) {
42  if (!in_array($translation->getLangKey(), $languages)) {
43  $translation->delete();
44  }
45  }
46  foreach ($languages as $lang_key) {
47  if (!$translations->isConfigured($lang_key)) {
48  $translations->addTranslationEntry($lang_key);
49  }
50  }
51 
52  $this->record->setDefaultLanguage($default);
53  $this->record->update();
54 
55  #$default = $translations->getTranslation($default);
56  #$default->setTitle($this->record->getTitle());
57  #$default->setDescription($this->record->getDescription());
58  #$default->update();
59 
60  ilUtil::sendSuccess($this->language->txt('settings_saved'), true);
61  $this->ctrl->redirect($this, self::CMD_DEFAULT);
62 
63 
64  }
65 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilAdvancedMDRecordTranslationGUI ilAdvancedMDRecordTranslationGUI: ilAdvancedMDSettingsGUI.
language()
Definition: language.php:2
Class ilAdvancedMDRecordLanguageTableGUI.