ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilMemcacheServerTableGUI.php
Go to the documentation of this file.
1 <?php
2 require_once('class.ilMemcacheServer.php');
3 require_once('./Services/Table/classes/class.ilTable2GUI.php');
4 require_once('./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php');
5 require_once('./Services/Form/classes/class.ilMultiSelectInputGUI.php');
6 
14 
15  const TPL_ID = 'tbl_il_memcached _servers';
19  protected $filter = array();
20 
21 
22  public function __construct() {
23  global $lng;
24  parent::__construct(NULL, '');
25  $this->setTitle($lng->txt('memcache_servers'));
26  $this->setLimit(9999);
27  $this->initColumns();
28 
29  $this->setDefaultOrderField('status');
30  $this->setDefaultOrderDirection('asc');
31 
32  $this->setEnableHeader(true);
33  $this->setFormAction('setup.php?cmd=gateway');
34  $this->setRowTemplate('tpl.memcache_servers.html', 'Services/GlobalCache');
35  $this->disable('footer');
36  $this->setEnableTitle(true);
37 
38  $this->parseData();
39  }
40 
41 
45  public function fillRow($a_set) {
49  $server = ilMemcacheServer::find($a_set['id']);
50 
51  $this->tpl->setVariable('STATUS', $server->isActive() ? ilUtil::getImagePath('icon_ok.svg') : ilUtil::getImagePath('icon_not_ok.svg'));
52  $this->tpl->setVariable('STATUS_SERVER', $server->isReachable() ? ilUtil::getImagePath('icon_ok.svg') : ilUtil::getImagePath('icon_not_ok.svg'));
53  $this->tpl->setVariable('HOST', $server->getHost());
54  $this->tpl->setVariable('PORT', $server->getPort());
55  $this->tpl->setVariable('WEIGHT', $server->getWeight());
56  $this->addActionMenu($server);
57  }
58 
59 
63  protected function addActionMenu(ilMemcacheServer $server) {
64  $current_selection_list = new ilAdvancedSelectionListGUI();
65  $current_selection_list->setListTitle($this->lng->txt('memcache_actions'));
66  $current_selection_list->setId('request_overview_actions_' . $server->getId());
67  $current_selection_list->setUseImages(false);
68 
69  $current_selection_list->addItem($this->lng->txt('memcache_edit'), 'memcache_edit', 'setup.php?cmd=editMemcacheServer&mcsid='
70  . $server->getId());
71  $current_selection_list->addItem($this->lng->txt('memcache_delete'), 'memcache_delete', 'setup.php?cmd=deleteMemcacheServer&mcsid='
72  . $server->getId());
73  $this->tpl->setVariable('ACTIONS', $current_selection_list->getHTML());
74  }
75 
76 
77  protected function parseData() {
78  $servers = ilMemcacheServer::getArray();
79  $this->setData($servers);
80  }
81 
82 
83  protected function initColumns() {
84  $this->addColumn($this->txt('status'), '', '25px');
85  $this->addColumn($this->txt('status_server'), '', '25px');
86  $this->addColumn($this->txt('host'), '');
87  $this->addColumn($this->txt('port'), '');
88  $this->addColumn($this->txt('weight'), '');
89  $this->addColumn($this->txt('actions'), '', '10px');
90  }
91 
92 
98  protected function txt($key) {
99  return $this->lng->txt('memcache_' . $key);
100  }
101 }
Class ilMemcacheServerTableGUI.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addActionMenu(ilMemcacheServer $server)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
User interface class for advanced drop-down selection lists.
$server
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
global $lng
Definition: privfeed.php:40
setEnableHeader($a_enableheader)
Set Enable Header.
fillRow($a_set)
Standard Version of Fill Row.
Class ilMemcacheServer.
setEnableTitle($a_enabletitle)
Set Enable Title.
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.
static getArray($key=NULL, $values=NULL)
setLimit($a_limit=0, $a_default_limit=0)