19 declare(strict_types=1);
49 $this->ui_factory = $DIC->ui()->factory();
50 $this->ui_renderer = $DIC->ui()->renderer();
56 self::RECORD_LANGUAGE_TABLE_ID_PREFIX . $this->record->getRecordId()
63 public function init(): void
65 $this->
lng->loadLanguageModule(
'meta');
66 $this->
setTitle($this->
lng->txt(
'md_adv_record_lng_table'));
69 $this->
addColumn($this->
lng->txt(
'md_adv_record_lng_table_lng'), self::COL_LANGUAGE,
'25%');
70 $this->
addColumn($this->
lng->txt(
'md_adv_record_lng_table_default'), self::COL_DEFAULT,
'25%');
71 $this->
addColumn($this->
lng->txt(
'md_adv_record_lng_table_active'), self::COL_ACTIVE,
'25%');
72 $this->
addColumn($this->
lng->txt(
'md_adv_record_lng_table_inst'), self::COL_INSTALLED,
'25%');
74 $this->
addMultiCommand(self::CMD_SAVE_ACTION, $this->
lng->txt(
'md_adv_record_activate_languages'));
76 $this->
enable(
'select_all');
78 $this->
setRowTemplate(
'tpl.record_language_selection_row.html',
'components/ILIAS/AdvancedMetaData');
97 foreach ($all_languages as $language_code) {
99 $row[self::COL_LANGUAGE_CODE] = $language_code;
100 $row[self::COL_LANGUAGE] = $this->
lng->txt(
'meta_l_' . $language_code);
101 $row[self::COL_INSTALLED] = in_array($language_code, $installed_languages);
102 if ($this->record_translation->isConfigured($language_code)) {
103 $row[self::COL_ACTIVE] =
true;
104 $translation = $this->record_translation->getTranslation($language_code);
105 $row[self::COL_DEFAULT] = ($translation->getLangKey() == $this->record->getDefaultLanguage());
107 $row[self::COL_ACTIVE] =
false;
108 $row[self::COL_DEFAULT] =
false;
116 protected function fillRow(array $a_set): void
118 $this->tpl->setVariable(
'VAL_ID', $a_set[self::COL_LANGUAGE_CODE]);
120 if ($a_set[self::COL_ACTIVE]) {
121 $this->tpl->setVariable(
'ACTIVATION_CHECKED',
'checked="checked"');
124 $this->tpl->setVariable(
'TXT_LANGUAGE', $a_set[self::COL_LANGUAGE]);
125 if ($a_set[self::COL_DEFAULT]) {
126 $this->tpl->setVariable(
'DEFAULT_CHECKED',
'checked="checked"');
128 if ($a_set[self::COL_ACTIVE]) {
129 $this->tpl->setVariable(
131 $this->ui_renderer->render(
132 $this->ui_factory->symbol()->glyph()->apply()
136 if ($a_set[self::COL_INSTALLED]) {
137 $this->tpl->setVariable(
139 $this->ui_renderer->render(
140 $this->ui_factory->symbol()->glyph()->apply()
152 $parsed_languages = [];
153 foreach ($languages as $language) {
154 $parsed_languages[] = $language[
'title'];
156 return $parsed_languages;
enable(string $a_module_name)
static _getObjectsByType(string $obj_type="", ?int $owner=null)
setFormAction(string $a_form_action, bool $a_multipart=false)
const RECORD_LANGUAGE_TABLE_ID_PREFIX
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
ilAdvancedMDRecordTranslations $record_translation
Class ilAdvancedMDRecordTranslation.
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setDefaultOrderField(string $a_defaultorderfield)
This is how the factory for UI elements looks.
__construct(ilAdvancedMDRecord $record, object $a_parent_obj, string $a_parent_cmd="")
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
ilAdvancedMDRecord $record
addMultiCommand(string $a_cmd, string $a_text)
static _getInstalledLanguages()
Get installed languages.
setMaxCount(int $a_max_count)
set max.
static getInstanceByRecordId(int $record_id)