62 $this->db = $DIC->database();
63 $this->lng = $DIC->language();
64 $this->lng->loadLanguageModule(
'meta');
77 if (!isset(self::$instances[$record_id])) {
103 foreach ($this->
getTranslations($field_id) as $language => $translation)
105 if ($language == self::getDefaultLanguage() && !$with_default) {
108 $activated[] = $language;
121 if (!$this->record_translations->isConfigured($lang_key)) {
124 return isset($this->translations[$field_id][$lang_key]);
137 return $this->translations[$field_id][$lang_key];
145 if (isset($this->translations[$field_id])) {
146 return $this->translations[$field_id];
166 $query =
'select fi.field_id tfield, de.field_id ofield, fi.title, fi.description, ri.lang_code ' .
167 'from adv_md_record_int ri join adv_mdf_definition de on ri.record_id = de.record_id ' .
168 'left join adv_md_field_int fi on (ri.lang_code = fi.lang_code and de.field_id = fi.field_id) ' .
173 $this->default_language = $this->record->getDefaultLanguage();
175 $this->translations = [];
180 (
string) $row->title,
181 (
string) $row->description,
182 (
string) $row->lang_code
185 $row->lang_code == $this->default_language &&
188 $this->translations[$row->ofield][$row->lang_code]->setTitle($this->definitions[$row->ofield]->getTitle());
189 $this->translations[$row->ofield][$row->lang_code]->setDescription((
string) $this->definitions[$row->ofield]->getDescription());
204 $txt = $this->lng->txt(
'md_adv_int_current').
' ' . $this->lng->txt(
'meta_l_' . $active_language);
208 $txt .= ($this->lng->txt(
'md_adv_int_default') .
' ' . $this->lng->txt(
'meta_l_' . $translation->getLangKey()));
221 if (!strlen($active_language)) {
227 $title->
setInfo($default->getLangKey() .
': ' . $default->getTitle());
240 if (!strlen($active_language)) {
246 $description->
setInfo($default->getLangKey() .
': ' . $default->getDescription());
260 $translation = $this->
getTranslation($field_id, $active_language);
264 $translation->setTitle($form->
getInput(
'title'));
265 $translation->setDescription($form->
getInput(
'description'));
266 $translation->update();
281 $translation->setTitle($title);
282 $translation->setDescription($description);
283 $translation->update();
302 return $this->definitions[$field_id]->getTitle();
313 return $this->
getTranslation($field_id, $language)->getDescription();
321 return $this->definitions[$field_id]->getDescription();
getDefaultTranslation(int $field_id)
Class ilAdvancedMDFieldTranslations.
modifyTranslationInfoForDescription(int $field_id, ilPropertyFormGUI $form, ilTextAreaInputGUI $description, string $active_language)
__construct(int $record_id)
modifyTranslationInfoForTitle(int $field_id, ilPropertyFormGUI $form, ilTextInputGUI $title, string $active_language)
AMD field abstract base class.
setValue($a_value)
Set Value.
getActivatedLanguages(int $field_id, bool $with_default=true)
getDescriptionForLanguage(int $field_id, string $language)
getTranslation(int $field_id, string $lang_key)
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
foreach($_POST as $key=> $value) $res
isConfigured(int $field_id, string $lang_key)
Class ilAdvancedMDRecordTranslation.
getTitleForLanguage(int $field_id, string $language)
getTranslations(int $field_id)
static getInstanceByRecordId(int $record_id)
This class represents a text area property in a property form.
updateTranslations(string $active_language, string $title, string $description)
setValue($a_value)
Set Value.
getFormTranslationInfo(int $field_id, string $active_language)
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
Class ilAdvancedMDFieldTranslation.
updateFromForm(int $field_id, string $active_language, ilPropertyFormGUI $form)
static getInstanceByRecordId(int $record_id)