ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAuthLoginPageEditorTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 include_once './Services/Authentication/classes/class.ilAuthLoginPageEditorSettings.php';
6 
14 {
15  protected $lng = null;
16 
22  public function __construct($a_parent_obj, $a_parent_cmd = "")
23  {
24  global $DIC;
25 
26  $lng = $DIC['lng'];
27 
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29 
30  $this->lng = $lng;
31  $this->lng->loadLanguageModule('meta');
32 
33  $this->initTable();
34  }
35 
39  public function parse()
40  {
41  $installed = $this->lng->getInstalledLanguages();
42 
43  $tbl_data = array();
44  $counter = 0;
45  foreach ($installed as $key => $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($a_set)
62  {
63  global $DIC;
64 
65  $ilCtrl = $DIC['ilCtrl'];
66 
67  $this->tpl->setVariable('LANGID', $a_set['key']);
68  $this->tpl->setVariable('LANGKEY_CHECKED', $a_set['status'] ? 'checked="checked' : '');
69  $this->tpl->setVariable('TXT_LANGUAGE', $a_set['language']);
70 
71  if ($this->lng->getDefaultLanguage() == $a_set['key']) {
72  $this->tpl->setVariable('TXT_SYSTEM', $this->lng->txt('system_language'));
73  }
74  if ($a_set['status']) {
75  $this->tpl->setVariable('STATUS_SRC', ilUtil::getImagePath('icon_ok.svg'));
76  $this->tpl->setVariable('STATUS_ALT', $this->lng->txt('active'));
77  $this->tpl->setVariable('CHECKED_LANGKEY', 'checked="checked"');
78  } else {
79  $this->tpl->setVariable('STATUS_SRC', ilUtil::getImagePath('icon_not_ok.svg'));
80  $this->tpl->setVariable('STATUS_ALT', $this->lng->txt('inactive'));
81  }
82  $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
83  $ilCtrl->setParameter($this->getParentObject(), 'key', $a_set['id']);
84  $this->tpl->setVariable('LINK_NAME', $ilCtrl->getLinkTargetByClass('illoginpagegui', 'edit'));
85  }
86 
87 
88 
92  protected function initTable()
93  {
94  global $DIC;
95 
96  $ilCtrl = $DIC['ilCtrl'];
97 
98  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
99  $this->setRowTemplate('tpl.auth_login_page_editor_table_row.html', 'Services/Authentication');
100  $this->setId('loginpageeditor');
101  $this->setSelectAllCheckbox('languages');
102  $this->setFormName('login_pages');
103  $this->addColumn('', 'c', '1px');
104  $this->addColumn($this->lng->txt('language'), 'language', '85%');
105  $this->addColumn($this->lng->txt('active'), 'status', '5%');
106  $this->addColumn($this->lng->txt('actions'), '', '10%');
107 
108  $this->addMultiCommand('activate', $this->lng->txt('login_page_activate'));
109 
110  $this->setDefaultOrderField('language');
111  $this->enable('sort');
112  $this->enable('header');
113  $this->disable('numinfo');
114  $this->enable('select_all');
115  }
116 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
setFormName($a_formname="")
Set Form name.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
static lookupId($a_lang_key)
Lookup obj_id of language ilDB $ilDB.
static getInstance()
Get singelton instance.
$key
Definition: croninfo.php:18