19 declare(strict_types=1);
61 $this->db = $DIC->database();
62 $this->
lng = $DIC->language();
63 $this->
lng->loadLanguageModule(
'meta');
72 if (!isset(self::$instances[$record_id])) {
96 foreach ($this->
getTranslations($field_id) as $language => $translation) {
97 if ($language == self::getDefaultLanguage() && !$with_default) {
100 $activated[] = $language;
107 if (!$this->record_translations->isConfigured($lang_key)) {
110 return isset($this->translations[$field_id][$lang_key]);
118 return $this->translations[$field_id][$lang_key];
126 if (isset($this->translations[$field_id])) {
127 return $this->translations[$field_id];
147 $query =
'select fi.field_id tfield, de.field_id ofield, fi.title, fi.description, ri.lang_code ' .
148 'from adv_md_record_int ri join adv_mdf_definition de on ri.record_id = de.record_id ' .
149 'left join adv_md_field_int fi on (ri.lang_code = fi.lang_code and de.field_id = fi.field_id) ' .
151 $res = $this->db->query($query);
154 $this->default_language = $this->record->getDefaultLanguage();
156 $this->translations = [];
161 (
string) $row->title,
162 (
string) $row->description,
163 (
string) $row->lang_code
165 if ((
string) $row->lang_code == $this->default_language && $row->tfield ==
null) {
166 $this->translations[(
int) $row->ofield][(
string) $row->lang_code]->setTitle($this->definitions[(
int) $row->ofield]->getTitle());
167 $this->translations[(
int) $row->ofield][(
string) $row->lang_code]->setDescription(
168 $this->definitions[(
int) $row->ofield]->getDescription()
181 $txt = $this->
lng->txt(
'md_adv_int_current') .
' ' . $this->
lng->txt(
'meta_l_' . $active_language);
185 $txt .= ($this->
lng->txt(
'md_adv_int_default') .
' ' . $this->
lng->txt(
'meta_l_' . $translation->getLangKey()));
196 string $active_language
198 if (!strlen($active_language)) {
204 $title->
setInfo($default->getLangKey() .
': ' . $default->getTitle());
215 string $active_language
217 if (!strlen($active_language)) {
223 $description->
setInfo($default->getLangKey() .
': ' . $default->getDescription());
232 $translation = $this->
getTranslation($field_id, $active_language);
236 $translation->setTitle($form->
getInput(
'title'));
237 $translation->setDescription($form->
getInput(
'description'));
238 $translation->update();
256 return $this->definitions[$field_id]->getTitle();
266 )->getDescription())) {
267 return $this->
getTranslation($field_id, $language)->getDescription();
275 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.
ilAdvancedMDRecord $record
getActivatedLanguages(int $field_id, bool $with_default=true)
Class ilAdvancedMDRecordTranslation.
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
getDescriptionForLanguage(int $field_id, string $language)
setValue(string $a_value)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getInstanceByRecordId(int $a_record_id)
getTranslation(int $field_id, string $lang_key)
isConfigured(int $field_id, string $lang_key)
getTitleForLanguage(int $field_id, string $language)
ilAdvancedMDRecordTranslations $record_translations
getTranslations(int $field_id)
static getInstanceByRecordId(int $record_id)
This class represents a text area property in a property form.
getFormTranslationInfo(int $field_id, string $active_language)
Class ilAdvancedMDFieldTranslation.
updateFromForm(int $field_id, string $active_language, ilPropertyFormGUI $form)
static getInstanceByRecordId(int $record_id)