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