ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAdvancedMDTranslationGUI Class Reference
+ Inheritance diagram for ilAdvancedMDTranslationGUI:
+ Collaboration diagram for ilAdvancedMDTranslationGUI:

Public Member Functions

 __construct (ilAdvancedMDRecord $record)
 ilAdvancedMDTranslationGUI constructor. More...
 
 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 ()
 
 addToolbarLanguageCreation ()
 
 getAvailableLanguagesOptions ()
 
 saveAdditionalTranslations ()
 

Protected Attributes

const CMD_DEFAULT = 'translations'
 Default command. More...
 
const CMD_ADD_TRANSLATION = 'addTranslations'
 
const CMD_SAVE_ADDITIONAL_TRANSLATIONS = 'saveAdditionalTranslations'
 
 $ctrl
 
 $tpl
 
 $toolbar
 
 $tabs
 
 $language
 
 $request
 
 $logger
 
 $record
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDTranslationGUI::__construct ( ilAdvancedMDRecord  $record)

ilAdvancedMDTranslationGUI constructor.

Parameters
ilAdvancedMDRecord$record

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

60 {
61 global $DIC;
62
63 $this->ctrl = $DIC->ctrl();
64 $this->tabs = $DIC->tabs();
65 $this->tpl = $DIC->ui()->mainTemplate();
66 $this->logger = $DIC->logger()->amet();
67 $this->toolbar = $DIC->toolbar();
68 $this->language = $DIC->language();
69 $this->language->loadLanguageModule('obj');
70 $this->request = $DIC->http()->request();
71 $this->record = $record;
72 }
global $DIC
Definition: goto.php:24
language()
Definition: language.php:2

References $DIC, $record, and language().

+ Here is the call graph for this function:

Member Function Documentation

◆ addToolbarLanguageCreation()

ilAdvancedMDTranslationGUI::addToolbarLanguageCreation ( )
protected

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

151 {
152 $button = ilLinkButton::getInstance();
153 $button->setCaption('obj_add_languages');
154 $button->setUrl(
155 $this->ctrl->getLinkTargetByClass(
156 strtolower(get_class($this)),
157 self::CMD_ADD_TRANSLATION
158 )
159 );
160 $this->toolbar->addButtonInstance($button);
161 }
static getInstance()
Factory.

References ilLinkButton\getInstance().

+ Here is the call graph for this function:

◆ addTranslations()

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

show translation creation form

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

110 {
111 $this->tabs->activateTab(self::CMD_DEFAULT);
112 if (!$form instanceof ilPropertyFormGUI)
113 {
114 $form = $this->initCreateTranslationForm();
115 }
116 $this->tpl->setContent($form->getHTML());
117 }
This class represents a property form user interface.

References initCreateTranslationForm().

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 77 of file class.ilAdvancedMDTranslationGUI.php.

78 {
79 $this->ctrl->setParameterByClass(
80 strtolower(get_class($this)),
81 'record_id',
82 $this->record->getRecordId()
83 );
84
85 $next_class = $this->ctrl->getNextClass($this);
86 $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
87 switch ($next_class) {
88 default:
89 $this->$cmd();
90 }
91 }

◆ getAvailableLanguagesOptions()

ilAdvancedMDTranslationGUI::getAvailableLanguagesOptions ( )
protected
Todo:
handle generic isConfigured
Returns
array

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

168 {
169 $languages = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
170
171 $this->language->loadLanguageModule('meta');
172 $installed_languages = ilLanguage::_getInstalledLanguages();
173 $options = [];
174 $options[''] = $this->language->txt('select_one');
175 foreach ($installed_languages as $key => $language) {
176
177 if ($languages->isConfigured($language)) {
178 continue;
179 }
180 $options[$language] = $this->language->txt('meta_l_' . $language);
181 }
182 return $options;
183 }
static _getInstalledLanguages()

References $language, ilLanguage\_getInstalledLanguages(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), and language().

Referenced by initCreateTranslationForm().

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

◆ initCreateTranslationForm()

ilAdvancedMDTranslationGUI::initCreateTranslationForm ( )
protected
Returns
ilPropertyFormGUI

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

123 {
124 $form = new \ilPropertyFormGUI();
125 $form->setFormAction($this->ctrl->getFormAction($this));
126 $form->setTitle($this->language->txt('obj_add_languages'));
127
128 $language_options = $this->getAvailableLanguagesOptions();
129 $languages = new ilSelectInputGUI(
130 $this->language->txt('obj_additional_langs'),
131 'languages'
132 );
133 $languages->setOptions($language_options);
134 $languages->setMulti(true);
135 $languages->setRequired(true);
136 $form->addItem($languages);
137
138 $form->addCommandButton(
139 self::CMD_SAVE_ADDITIONAL_TRANSLATIONS,
140 $this->language->txt('save')
141 );
142 $form->addCommandButton(
143 self::CMD_DEFAULT,
144 $this->language->txt('cancel')
145 );
146
147 return $form;
148 }
This class represents a selection list property in a property form.

References getAvailableLanguagesOptions(), and 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 185 of file class.ilAdvancedMDTranslationGUI.php.

186 {
187 $form = $this->initCreateTranslationForm();
188 if (!$form->checkInput()) {
189 $form->setValuesByPost();
190 ilUtil::sendFailure($this->language->txt('err_check_input'));
191 return $this->addTranslations($form);
192 }
193 foreach (array_unique((array) $form->getInput('languages')) as $language_code) {
194
195 $languages = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
196 $languages->addTranslationEntry($language_code);
197 }
198
199 ilUtil::sendSuccess($this->language->txt('settings_saved'), true);
200 $this->ctrl->redirect($this, self::CMD_DEFAULT);
201 }
addTranslations(ilPropertyFormGUI $form=null)
show translation creation form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References addTranslations(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), initCreateTranslationForm(), language(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ setTabs()

ilAdvancedMDTranslationGUI::setTabs ( string  $active_tab)
protected
Parameters
string$active_tab

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

97 {
98 $this->tabs->activateTab($active_tab);
99 }

Referenced by ilAdvancedMDRecordTranslationGUI\translations().

+ Here is the caller graph for this function:

◆ translations()

ilAdvancedMDTranslationGUI::translations ( )
abstractprotected
Returns
void

Reimplemented in ilAdvancedMDRecordTranslationGUI.

Field Documentation

◆ $ctrl

ilAdvancedMDTranslationGUI::$ctrl
protected

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

◆ $language

ilAdvancedMDTranslationGUI::$language
protected

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

Referenced by getAvailableLanguagesOptions().

◆ $logger

ilAdvancedMDTranslationGUI::$logger
protected

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

◆ $record

ilAdvancedMDTranslationGUI::$record
protected

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

Referenced by __construct().

◆ $request

ilAdvancedMDTranslationGUI::$request
protected

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

◆ $tabs

ilAdvancedMDTranslationGUI::$tabs
protected

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

◆ $toolbar

ilAdvancedMDTranslationGUI::$toolbar
protected

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

◆ $tpl

ilAdvancedMDTranslationGUI::$tpl
protected

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

◆ CMD_ADD_TRANSLATION

const ilAdvancedMDTranslationGUI::CMD_ADD_TRANSLATION = 'addTranslations'
protected

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

◆ CMD_DEFAULT

const ilAdvancedMDTranslationGUI::CMD_DEFAULT = 'translations'
protected

Default command.

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

◆ CMD_SAVE_ADDITIONAL_TRANSLATIONS

const ilAdvancedMDTranslationGUI::CMD_SAVE_ADDITIONAL_TRANSLATIONS = 'saveAdditionalTranslations'
protected

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


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