ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAdvancedMDTranslationGUI Class Reference
+ Inheritance diagram for ilAdvancedMDTranslationGUI:
+ Collaboration diagram for ilAdvancedMDTranslationGUI:

Public Member Functions

 __construct (ilAdvancedMDRecord $record)
 
 executeCommand ()
 Execute command and save parameter record id. More...
 

Protected Member Functions

 setTabs (string $active_tab)
 
 translations ()
 
 addTranslations (?ilPropertyFormGUI $form=null)
 show translation creation form More...
 
 initCreateTranslationForm ()
 
 getAvailableLanguagesOptions ()
 
 saveAdditionalTranslations ()
 

Protected Attributes

const CMD_DEFAULT = 'translations'
 
const CMD_ADD_TRANSLATION = 'addTranslations'
 
const CMD_SAVE_ADDITIONAL_TRANSLATIONS = 'saveAdditionalTranslations'
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 
ilLanguage $language
 
RequestInterface $request
 
ilLogger $logger
 
ilAdvancedMDRecord $record
 

Detailed Description

Definition at line 23 of file class.ilAdvancedMDTranslationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDTranslationGUI::__construct ( ilAdvancedMDRecord  $record)

@noinspection PhpUndefinedMethodInspection

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

39 {
40 global $DIC;
41
42 $this->ctrl = $DIC->ctrl();
43 $this->tpl = $DIC->ui()->mainTemplate();
44 $this->toolbar = $DIC->toolbar();
45 $this->tabs = $DIC->tabs();
46 $this->language = $DIC->language();
47 $this->language->loadLanguageModule('obj');
48 $this->request = $DIC->http()->request();
50 $this->logger = $DIC->logger()->amet();
51 $this->record = $record;
52 }
global $DIC
Definition: shib_login.php:26

References $DIC, $record, ILIAS\Repository\ctrl(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\logger(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ addTranslations()

ilAdvancedMDTranslationGUI::addTranslations ( ?ilPropertyFormGUI  $form = null)
protected

show translation creation form

Definition at line 86 of file class.ilAdvancedMDTranslationGUI.php.

87 {
88 $this->tabs->activateTab(self::CMD_DEFAULT);
89 if (!$form instanceof ilPropertyFormGUI) {
90 $form = $this->initCreateTranslationForm();
91 }
92 $this->tpl->setContent($form->getHTML());
93 }
This class represents a property form user interface.

References initCreateTranslationForm(), and ILIAS\Repository\tabs().

Referenced by saveAdditionalTranslations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilAdvancedMDTranslationGUI::executeCommand ( )

Execute command and save parameter record id.

Definition at line 57 of file class.ilAdvancedMDTranslationGUI.php.

58 {
59 $this->ctrl->setParameterByClass(
60 strtolower(get_class($this)),
61 'record_id',
62 $this->record->getRecordId()
63 );
64
65 $next_class = $this->ctrl->getNextClass($this);
66 $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
67 switch ($next_class) {
68 default:
69 $this->$cmd();
70 }
71 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getAvailableLanguagesOptions()

ilAdvancedMDTranslationGUI::getAvailableLanguagesOptions ( )
protected
Returns
array<string, string>
Todo:
handle generic isConfigured

Definition at line 126 of file class.ilAdvancedMDTranslationGUI.php.

126 : array
127 {
128 $languages = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
129
130 $this->language->loadLanguageModule('meta');
131 $installed_languages = ilLanguage::_getInstalledLanguages();
132 $options = [];
133 $options[''] = $this->language->txt('select_one');
134 foreach ($installed_languages as $key => $language) {
135 if ($languages->isConfigured($language)) {
136 continue;
137 }
138 $options[$language] = $this->language->txt('meta_l_' . $language);
139 }
140 return $options;
141 }
static _getInstalledLanguages()
Get installed languages.

References $language, ilLanguage\_getInstalledLanguages(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by initCreateTranslationForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreateTranslationForm()

ilAdvancedMDTranslationGUI::initCreateTranslationForm ( )
protected

Definition at line 95 of file class.ilAdvancedMDTranslationGUI.php.

96 {
97 $form = new \ilPropertyFormGUI();
98 $form->setFormAction($this->ctrl->getFormAction($this));
99 $form->setTitle($this->language->txt('obj_add_languages'));
100
101 $language_options = $this->getAvailableLanguagesOptions();
102 $languages = new ilSelectInputGUI(
103 $this->language->txt('obj_additional_langs'),
104 'languages'
105 );
106 $languages->setOptions($language_options);
107 $languages->setMulti(true);
108 $languages->setRequired(true);
109 $form->addItem($languages);
110
111 $form->addCommandButton(
112 self::CMD_SAVE_ADDITIONAL_TRANSLATIONS,
113 $this->language->txt('save')
114 );
115 $form->addCommandButton(
116 self::CMD_DEFAULT,
117 $this->language->txt('cancel')
118 );
119 return $form;
120 }
This class represents a selection list property in a property form.

References ILIAS\Repository\ctrl(), getAvailableLanguagesOptions(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by addTranslations(), and saveAdditionalTranslations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAdditionalTranslations()

ilAdvancedMDTranslationGUI::saveAdditionalTranslations ( )
protected

Definition at line 143 of file class.ilAdvancedMDTranslationGUI.php.

143 : void
144 {
145 $form = $this->initCreateTranslationForm();
146 if (!$form->checkInput()) {
147 $form->setValuesByPost();
148 $this->tpl->setOnScreenMessage('failure', $this->language->txt('err_check_input'));
149 $this->addTranslations($form);
150 return;
151 }
152 foreach (array_unique((array) $form->getInput('languages')) as $language_code) {
153 $languages = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
154 $languages->addTranslationEntry($language_code);
155 }
156
157 $this->tpl->setOnScreenMessage('success', $this->language->txt('settings_saved'), true);
158 $this->ctrl->redirect($this, self::CMD_DEFAULT);
159 }
addTranslations(?ilPropertyFormGUI $form=null)
show translation creation form

References addTranslations(), ILIAS\Repository\ctrl(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), initCreateTranslationForm(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ setTabs()

ilAdvancedMDTranslationGUI::setTabs ( string  $active_tab)
protected

Definition at line 73 of file class.ilAdvancedMDTranslationGUI.php.

74 {
75 $this->tabs->activateTab($active_tab);
76 }

References ILIAS\Repository\tabs().

Referenced by ilAdvancedMDRecordTranslationGUI\translations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translations()

ilAdvancedMDTranslationGUI::translations ( )
abstractprotected
Returns
void

Reimplemented in ilAdvancedMDRecordTranslationGUI.

Field Documentation

◆ $ctrl

ilCtrl ilAdvancedMDTranslationGUI::$ctrl
protected

Definition at line 29 of file class.ilAdvancedMDTranslationGUI.php.

◆ $language

ilLanguage ilAdvancedMDTranslationGUI::$language
protected

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

Referenced by getAvailableLanguagesOptions().

◆ $logger

ilLogger ilAdvancedMDTranslationGUI::$logger
protected

Definition at line 35 of file class.ilAdvancedMDTranslationGUI.php.

◆ $record

ilAdvancedMDRecord ilAdvancedMDTranslationGUI::$record
protected

Definition at line 36 of file class.ilAdvancedMDTranslationGUI.php.

Referenced by __construct().

◆ $request

RequestInterface ilAdvancedMDTranslationGUI::$request
protected

Definition at line 34 of file class.ilAdvancedMDTranslationGUI.php.

◆ $tabs

ilTabsGUI ilAdvancedMDTranslationGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilAdvancedMDTranslationGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilAdvancedMDTranslationGUI::$tpl
protected

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

◆ CMD_ADD_TRANSLATION

const ilAdvancedMDTranslationGUI::CMD_ADD_TRANSLATION = 'addTranslations'
protected

Definition at line 26 of file class.ilAdvancedMDTranslationGUI.php.

◆ CMD_DEFAULT

const ilAdvancedMDTranslationGUI::CMD_DEFAULT = 'translations'
protected

Definition at line 25 of file class.ilAdvancedMDTranslationGUI.php.

◆ CMD_SAVE_ADDITIONAL_TRANSLATIONS

const ilAdvancedMDTranslationGUI::CMD_SAVE_ADDITIONAL_TRANSLATIONS = 'saveAdditionalTranslations'
protected

Definition at line 27 of file class.ilAdvancedMDTranslationGUI.php.


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