ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilClientListTableGUI.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 
15 {
16 
20  public function __construct($a_setup)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng;
23 
24  parent::__construct(null, "");
25  $this->setTitle($lng->txt("clients"));
26  $this->setLimit(9999);
27  $this->setup = $a_setup;
28 
29  $this->addColumn($this->lng->txt(""), "", "1");
30  $this->addColumn($this->lng->txt("name"), "");
31  $this->addColumn($this->lng->txt("id"), "");
32  $this->addColumn($this->lng->txt("login"), "");
33  $this->addColumn($this->lng->txt("details"), "");
34  $this->addColumn($this->lng->txt("status"), "");
35  $this->addColumn($this->lng->txt("access"), "");
36 
37  $this->setDefaultOrderField("name");
38  $this->setDefaultOrderDirection("asc");
39 
40  $this->setEnableHeader(true);
41  $this->setFormAction("setup.php?cmd=gateway");
42  $this->setRowTemplate("tpl.client_list_row.html", "setup");
43  $this->disable("footer");
44  $this->setEnableTitle(true);
45 
46  $this->getClients();
47 
48  $this->addMultiCommand("changedefault", $lng->txt("set_default_client"));
49  }
50 
57  public function getClients()
58  {
59  global $lng;
60 
61  $clients = array();
62  $clientlist = new ilClientList($this->setup->db_connections);
63  $list = $clientlist->getClients();
64 
65  foreach ($list as $key => $client) {
66  // check status
67  $status_arr = $this->setup->getStatus($client);
68  if (!$status_arr["db"]["status"]) {
69  $status =
70  "<a href=\"setup.php?cmd=db&client_id=" . $key . "&back=clientlist\">" .
71  $status_arr["db"]["comment"] . "</a>";
72  } elseif (!$status_arr["finish"]["status"]) {
73  $status = $lng->txt("setup_not_finished");
74  } else {
75  $status = "<font color=\"green\"><strong>OK</strong></font>";
76  }
77 
78  if ($status_arr["access"]["status"]) {
79  $access = "online";
80  } else {
81  $access = "disabled";
82  }
83 
84  if ($key == $this->setup->default_client) {
85  $default = " checked=\"checked\"";
86  } else {
87  $default = "";
88  }
89 
90  if ($status_arr["finish"]["status"] and $status_arr["access"]["status"]) {
91  $login = "<a href=\"../login.php?client_id=" . $key . "\">Login</a>";
92  } else {
93  $login = "&nbsp;";
94  }
95 
96  $access_html = "<a href=\"setup.php?cmd=changeaccess&client_id=" . $key . "&back=clientlist\">" . $this->lng->txt($access) . "</a>";
97 
98  $client_name = ($client->getName()) ? $client->getName() : "&lt;" . $lng->txt("no_client_name") . "&gt;";
99 
100  // visible data part
101  $clients[] = array(
102  "default" => "<input type=\"radio\" name=\"form[default]\" value=\"" . $key . "\"" . $default . "/>",
103  "name" => $client_name,
104  "desc" => $client->getDescription(),
105  "id" => $key,
106  "login" => $login,
107  "details" => "<a href=\"setup.php?cmd=view&client_id=" . $key . "\">Details</a>",
108  "status" => $status,
109  "access_html" => $access_html
110  );
111  }
112 
113  $this->setData($clients);
114  }
115 
119  protected function fillRow($a_set)
120  {
121  global $lng;
122 
123  $this->tpl->setVariable("DEF_RADIO", $a_set["default"]);
124  $this->tpl->setVariable("NAME", $a_set["name"]);
125  $this->tpl->setVariable("DESC", $a_set["desc"]);
126  $this->tpl->setVariable("ID", $a_set["id"]);
127  $this->tpl->setVariable("LOGIN", $a_set["login"]);
128  $this->tpl->setVariable("DETAILS", $a_set["details"]);
129  $this->tpl->setVariable("STATUS", $a_set["status"]);
130  $this->tpl->setVariable("ACCESS", $a_set["access_html"]);
131  }
132 }
fillRow($a_set)
Fill table row.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
client management
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
__construct($a_setup)
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
$default
Definition: build.php:20
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
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.
setEnableHeader($a_enableheader)
Set Enable Header.
$login
Definition: cron.php:13
setEnableTitle($a_enabletitle)
Set Enable Title.
$key
Definition: croninfo.php:18
setLimit($a_limit=0, $a_default_limit=0)