ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
16  protected $lng = null;
17 
23  public function __construct($a_parent_obj, $a_parent_cmd = "")
24  {
25  global $lng;
26 
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28 
29  $this->lng = $lng;
30  $this->lng->loadLanguageModule('meta');
31 
32  $this->initTable();
33  }
34 
38  public function parse()
39  {
40  $installed = $this->lng->getInstalledLanguages();
41 
42  $tbl_data = array();
43  $counter = 0;
44  foreach($installed as $key => $langkey)
45  {
46  $tbl_data[$counter]['key'] = $langkey;
47  $tbl_data[$counter]['id'] = ilLanguage::lookupId($langkey);
48  $tbl_data[$counter]['status'] = ilAuthLoginPageEditorSettings::getInstance()->isIliasEditorEnabled($langkey);
49 
50  ++$counter;
51  }
52  $this->setData($tbl_data);
53  }
54 
59  protected function fillRow($a_set)
60  {
61  global $ilCtrl;
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',$this->lng->txt('meta_l_'.$a_set['key']));
66 
67  if($this->lng->getDefaultLanguage() == $a_set['key'])
68  {
69  $this->tpl->setVariable('TXT_SYSTEM', $this->lng->txt('system_language'));
70  }
71  if($a_set['status'])
72  {
73  $this->tpl->setVariable('STATUS_SRC',ilUtil::getImagePath('icon_ok.png'));
74  $this->tpl->setVariable('STATUS_ALT', $this->lng->txt('active'));
75  $this->tpl->setVariable('CHECKED_LANGKEY', 'checked="checked"');
76  }
77  else
78  {
79  $this->tpl->setVariable('STATUS_SRC',ilUtil::getImagePath('icon_not_ok.png'));
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('ilpageobjectgui','edit'));
85  }
86 
87 
88 
92  protected function initTable()
93  {
94  global $ilCtrl;
95 
96  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
97  $this->setRowTemplate('tpl.auth_login_page_editor_table_row.html','Services/Authentication');
98  $this->setId('loginpageeditor');
99  $this->setSelectAllCheckbox('languages');
100  $this->setFormName('login_pages');
101  $this->addColumn('','c','1px');
102  $this->addColumn($this->lng->txt('language'), 'language','85%');
103  $this->addColumn($this->lng->txt('active'), 'active','5%');
104  $this->addColumn($this->lng->txt('actions'), 'actions','10%');
105 
106  $this->addMultiCommand('activate', $this->lng->txt('login_page_activate'));
107 
108  $this->setDefaultOrderField('language');
109  $this->enable('sort');
110  $this->enable('header');
111  $this->disable('numinfo');
112  $this->enable('select_all');
113  }
114 }
115 ?>