ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  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  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  {
67  // check status
68  $status_arr = $this->setup->getStatus($client);
69  if (!$status_arr["db"]["status"])
70  {
71  $status =
72  "<a href=\"setup.php?cmd=db&client_id=".$key."&back=clientlist\">".
73  $status_arr["db"]["comment"]."</a>";
74  }
75  elseif (!$status_arr["finish"]["status"])
76  {
77  $status = $lng->txt("setup_not_finished");
78  }
79  else
80  {
81  $status = "<font color=\"green\"><strong>OK</strong></font>";
82  }
83 
84  if ($status_arr["access"]["status"])
85  {
86  $access = "online";
87  }
88  else
89  {
90  $access = "disabled";
91  }
92 
93  if ($key == $this->setup->default_client)
94  {
95  $default = " checked=\"checked\"";
96  }
97  else
98  {
99  $default = "";
100  }
101 
102  if ($status_arr["finish"]["status"] and $status_arr["access"]["status"])
103  {
104  $login = "<a href=\"../login.php?client_id=".$key."\">Login</a>";
105  }
106  else
107  {
108  $login = "&nbsp;";
109  }
110 
111  $access_html = "<a href=\"setup.php?cmd=changeaccess&client_id=".$key."&back=clientlist\">".$this->lng->txt($access)."</a>";
112 
113  $client_name = ($client->getName()) ? $client->getName() : "&lt;".$lng->txt("no_client_name")."&gt;";
114 
115  // visible data part
116  $clients[] = array(
117  "default" => "<input type=\"radio\" name=\"form[default]\" value=\"".$key."\"".$default."/>",
118  "name" => $client_name,
119  "desc" => $client->getDescription(),
120  "id" => $key,
121  "login" => $login,
122  "details" => "<a href=\"setup.php?cmd=view&client_id=".$key."\">Details</a>",
123  "status" => $status,
124  "access_html" => $access_html
125  );
126  }
127 
128  $this->setData($clients);
129  }
130 
134  protected function fillRow($a_set)
135  {
136  global $lng;
137 
138  $this->tpl->setVariable("DEF_RADIO", $a_set["default"]);
139  $this->tpl->setVariable("NAME", $a_set["name"]);
140  $this->tpl->setVariable("DESC", $a_set["desc"]);
141  $this->tpl->setVariable("ID", $a_set["id"]);
142  $this->tpl->setVariable("LOGIN", $a_set["login"]);
143  $this->tpl->setVariable("DETAILS", $a_set["details"]);
144  $this->tpl->setVariable("STATUS", $a_set["status"]);
145  $this->tpl->setVariable("ACCESS", $a_set["access_html"]);
146  }
147 
148 }
149 ?>