50 $this->db = $DIC->database();
51 $this->lng = $DIC->language();
52 $this->lng->loadLanguageModule(
'meta');
64 if (!isset(self::$instances[$record_id])) {
92 return isset($this->translations[$lang_key]);
104 return $this->translations[$lang_key];
131 $recordTranslation->setRecordId($new_record_id);
132 $recordTranslation->insert();
142 $this->translations = [];
145 (
int) $row->record_id,
146 (
string) $row->title,
147 (
string) $row->description,
148 (
string) $row->lang_code
153 $this->default_language = $this->record->getDefaultLanguage();
165 $this->translations[$language_code]->insert();
174 if ($translation->getLangKey() != $default) {
175 $translation->setLangDefault(
false);
176 $translation->update();
178 if ($translation->getLangKey() == $default) {
179 $translation->setLangDefault(
true);
180 $translation->update();
190 if (count($this->translations) <= 1) {
194 $txt = $this->lng->txt(
'md_adv_int_current').
' ' . $this->lng->txt(
'meta_l_' . $active_language);
196 foreach ($this->translations as $translation) {
198 $txt .= ($this->lng->txt(
'md_adv_int_default') .
' ' . $this->lng->txt(
'meta_l_' . $translation->getLangKey()));
211 if (count($this->translations) <= 1) {
215 if ($default->getLangKey() != $active_language) {
216 $title->
setInfo($default->getLangKey() .
': ' . $default->getTitle());
229 if (count($this->translations) <= 1) {
233 if ($default->getLangKey() != $active_language) {
234 $description->
setInfo($default->getLangKey() .
': ' . $default->getDescription());
252 $translation->setTitle($title);
253 $translation->setDescription($description);
254 $translation->update();
266 return $this->record->getTitle();
277 return $this->record->getDescription();
291 'RecordTranslations',
300 'language' => $translation->getLangKey()
303 $writer->
xmlElement(
'RecordTranslationTitle', [], $translation->getTitle());
304 $writer->
xmlElement(
'RecordTranslationDescription', [], $translation->getDescription());
307 $writer->
xmlEndTag(
'RecordTranslations');
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
toXML(ilXmlWriter $writer)
getTitleForLanguage(string $language)
isConfigured(string $lang_key)
setValue($a_value)
Set Value.
Class ilAdvancedMDRecordTranslation.
modifyTranslationInfoForDescription(ilPropertyFormGUI $form, ilTextAreaInputGUI $description, string $active_language)
xmlEndTag($tag)
Writes an endtag.
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
foreach($_POST as $key=> $value) $res
modifyTranslationInfoForTitle(ilPropertyFormGUI $form, ilTextInputGUI $title, string $active_language)
getDescriptionForLanguage(string $language)
Class ilAdvancedMDRecordTranslation.
addTranslationEntry(string $language_code, bool $default=false)
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
updateTranslations(string $active_language, string $title, string $description)
getFormTranslationInfo(string $active_language)
This class represents a text area property in a property form.
__construct(int $record_id)
updateDefault(string $default)
cloneRecord(int $new_record_id)
getTranslation(string $lang_key)
setValue($a_value)
Set Value.
static getInstanceByRecordId(int $record_id)