ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAuthLoginPageEditorTableGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  public function __construct(?object $a_parent_obj, string $a_parent_cmd = "")
27  {
28  $this->setId('login_copage_tbl');
29  parent::__construct($a_parent_obj, $a_parent_cmd);
30 
31  $this->lng->loadLanguageModule('meta');
32 
33  $this->initTable();
34  }
35 
39  public function parse(): void
40  {
41  $installed = $this->lng->getInstalledLanguages();
42 
43  $tbl_data = array();
44  $counter = 0;
45  foreach ($installed as $langkey) {
46  $tbl_data[$counter]['key'] = $langkey;
47  $tbl_data[$counter]['id'] = ilLanguage::lookupId($langkey);
48  $tbl_data[$counter]['status'] = ilAuthLoginPageEditorSettings::getInstance()->isIliasEditorEnabled($langkey);
49  $tbl_data[$counter]['language'] = $this->lng->txt('meta_l_' . $langkey);
50 
51 
52  ++$counter;
53  }
54  $this->setData($tbl_data);
55  }
56 
61  protected function fillRow(array $a_set): void
62  {
63  $this->tpl->setVariable('LANGID', $a_set['key']);
64  $this->tpl->setVariable('LANGKEY_CHECKED', $a_set['status'] ? 'checked="checked' : '');
65  $this->tpl->setVariable('TXT_LANGUAGE', $a_set['language']);
66 
67  if ($this->lng->getDefaultLanguage() === $a_set['key']) {
68  $this->tpl->setVariable('TXT_SYSTEM', $this->lng->txt('system_language'));
69  }
70  if ($a_set['status']) {
71  $this->tpl->setVariable('STATUS_SRC', ilUtil::getImagePath('icon_ok.svg'));
72  $this->tpl->setVariable('STATUS_ALT', $this->lng->txt('active'));
73  $this->tpl->setVariable('CHECKED_LANGKEY', 'checked="checked"');
74  } else {
75  $this->tpl->setVariable('STATUS_SRC', ilUtil::getImagePath('icon_not_ok.svg'));
76  $this->tpl->setVariable('STATUS_ALT', $this->lng->txt('inactive'));
77  }
78  $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
79  $this->ctrl->setParameter($this->getParentObject(), 'key', $a_set['id']);
80  $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTargetByClass('illoginpagegui', 'edit'));
81  }
82 
83 
84 
88  protected function initTable(): void
89  {
90  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
91  $this->setRowTemplate('tpl.auth_login_page_editor_table_row.html', 'Services/Authentication');
92  $this->setId('loginpageeditor');
93  $this->setSelectAllCheckbox('languages');
94  $this->setFormName('login_pages');
95  $this->addColumn('', 'c', '1px');
96  $this->addColumn($this->lng->txt('language'), 'language', '85%');
97  $this->addColumn($this->lng->txt('active'), 'status', '5%');
98  $this->addColumn($this->lng->txt('actions'), '', '10%');
99 
100  $this->addMultiCommand('activate', $this->lng->txt('login_page_activate'));
101 
102  $this->setDefaultOrderField('language');
103  $this->enable('sort');
104  $this->enable('header');
105  $this->disable('numinfo');
106  $this->enable('select_all');
107  }
108 }
setData(array $a_data)
fillRow(array $a_set)
Fill table row template.
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setFormName(string $a_name="")
__construct(?object $a_parent_obj, string $a_parent_cmd="")
setId(string $a_val)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
static lookupId(string $a_lang_key)
Lookup obj_id of language.
__construct(Container $dic, ilPlugin $plugin)
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)
disable(string $a_module_name)
static getInstance()
Get singelton instance.
addMultiCommand(string $a_cmd, string $a_text)