ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSServerTableGUI.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 
13 {
19  public function __construct($a_parent_obj, $a_parent_cmd = "")
20  {
21  $this->setId('ecs_server_list');
22  parent::__construct($a_parent_obj, $a_parent_cmd);
23  }
24 
28  public function initTable()
29  {
30  $this->setTitle($this->lng->txt('ecs_available_ecs'));
31  $this->setRowTemplate('tpl.ecs_server_row.html','Services/WebServices/ECS');
32 
33  $this->addColumn($this->lng->txt('ecs_tbl_active'), '','1%');
34  $this->addColumn($this->lng->txt('title'), '','80%');
35  $this->addColumn($this->lng->txt('actions'), '', '19%');
36  }
37 
43  public function fillRow($set)
44  {
45  global $ilCtrl;
46 
47  $ilCtrl->setParameter($this->getParentObject(),'server_id',$set['server_id']);
48  $ilCtrl->setParameterByClass('ilecsmappingsettingsgui','server_id',$set['server_id']);
49 
50  if($set['active'])
51  {
52  $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_ok.png'));
53  $this->tpl->setVariable('TXT_OK', $this->lng->txt('ecs_activated'));
54  }
55  else
56  {
57  $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_not_ok.png'));
58  $this->tpl->setVariable('TXT_OK', $this->lng->txt('ecs_inactivated'));
59  }
60 
61  $this->tpl->setVariable('VAL_TITLE', ilECSSetting::getInstanceByServerId($set['server_id'])->getTitle());
62  $this->tpl->setVariable('LINK_EDIT', $ilCtrl->getLinkTarget($this->getParentObject(),'edit'));
63  $this->tpl->setVariable('TXT_SRV_ADDR', $this->lng->txt('ecs_server_addr'));
64 
65  if(ilECSSetting::getInstanceByServerId($set['server_id'])->getServer())
66  {
67  $this->tpl->setVariable('VAL_DESC', ilECSSetting::getInstanceByServerId($set['server_id'])->getServer());
68  }
69  else
70  {
71  $this->tpl->setVariable('VAL_DESC', $this->lng->txt('ecs_not_configured'));
72  }
73 
74  $dt = ilECSSetting::getInstanceByServerId($set['server_id'])->fetchCertificateExpiration();
75  if($dt != NULL)
76  {
77  $this->tpl->setVariable('TXT_CERT_VALID', $this->lng->txt('ecs_cert_valid_until'));
78  $this->tpl->setVariable('VAL_CERT', ilDatePresentation::formatDate($dt));
79  }
80 
81  // Actions
82  include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
83  $list = new ilAdvancedSelectionListGUI();
84  $list->setSelectionHeaderClass('small');
85  $list->setItemLinkClass('small');
86  $list->setId('actl_'.$set['server_id']);
87  $list->setListTitle($this->lng->txt('actions'));
88 
89  if(ilECSSetting::getInstanceByServerId($set['server_id'])->isEnabled())
90  {
91  $list->addItem($this->lng->txt('ecs_deactivate'), '', $ilCtrl->getLinkTarget($this->getParentObject(),'deactivate'));
92  }
93  else
94  {
95  $list->addItem($this->lng->txt('ecs_activate'), '', $ilCtrl->getLinkTarget($this->getParentObject(),'activate'));
96  }
97 
98  $list->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(),'edit'));
99  $list->addItem($this->lng->txt('copy'), '', $ilCtrl->getLinkTarget($this->getParentObject(),'cp'));
100  $list->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(),'delete'));
101  $this->tpl->setVariable('ACTIONS',$list->getHTML());
102 
103  $ilCtrl->clearParameters($this->getParentObject());
104  }
105 
110  public function parse(ilECSServerSettings $servers)
111  {
112  $rows = array();
113  foreach($servers->getServers() as $server_id => $server)
114  {
115  $tmp['server_id'] = $server->getServerId();
116  $tmp['active'] = $server->isEnabled();
117 
118  $rows[] = $tmp;
119  }
120  $this->setData($rows);
121  }
122 
123 }
124 ?>