Example #1
0
 /**
  * show client list
  */
 function showClientList()
 {
     global $tpl, $ilIliasIniFile, $ilCtrl;
     //echo "1";
     if (!$ilIliasIniFile->readVariable("clients", "list")) {
         $this->processIndexPHP();
         return;
     }
     //echo "2";
     $tpl = new ilTemplate("tpl.main.html", true, true);
     $tpl->setAddFooter(false);
     // no client yet
     // to do: get standard style
     $tpl->setVariable("PAGETITLE", "Client List");
     $tpl->setVariable("LOCATION_STYLESHEET", "./templates/default/delos.css");
     // load client list template
     self::initStartUpTemplate("tpl.client_list.html");
     // load template for table
     $tpl->addBlockfile("CLIENT_LIST", "client_list", "tpl.table.html");
     // load template for table content data
     $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
     // load table content data
     require_once "setup/classes/class.ilClientList.php";
     require_once "setup/classes/class.ilClient.php";
     require_once "setup/classes/class.ilDBConnections.php";
     require_once "./Services/Table/classes/class.ilTableGUI.php";
     $this->db_connections = new ilDBConnections();
     $clientlist = new ilClientList($this->db_connections);
     $list = $clientlist->getClients();
     if (count($list) == 0) {
         header("Location: ./setup/setup.php");
         exit;
     }
     $hasPublicSection = false;
     foreach ($list as $key => $client) {
         $client->setDSN();
         if ($client->checkDatabaseExists(true) and $client->ini->readVariable("client", "access") and $client->getSetting("setup_ok")) {
             $this->ctrl->setParameter($this, "client_id", $key);
             $tmp = array();
             $tmp[] = $client->getName();
             $tmp[] = "<a href=\"" . "login.php?cmd=force_login&client_id=" . urlencode($key) . "\">Login page</a>";
             if ($client->getSetting('pub_section')) {
                 $hasPublicSection = true;
                 $tmp[] = "<a href=\"" . "ilias.php?baseClass=ilRepositoryGUI&client_id=" . urlencode($key) . "\">Start page</a>";
             } else {
                 $tmp[] = '';
             }
             $data[] = $tmp;
         }
     }
     // create table
     $tbl = new ilTableGUI();
     // title & header columns
     if ($hasPublicSection) {
         $tbl->setTitle("Available Clients");
         $tbl->setHeaderNames(array("Installation Name", "Login", "Public Access"));
         $tbl->setHeaderVars(array("name", "index", "login"));
         $tbl->setColumnWidth(array("50%", "25%", "25%"));
     } else {
         $tbl->setTitle("Available Clients");
         $tbl->setHeaderNames(array("Installation Name", "Login", ''));
         $tbl->setHeaderVars(array("name", "login", ''));
         $tbl->setColumnWidth(array("70%", "25%", '1px'));
     }
     // control
     $tbl->setOrderColumn($_GET["sort_by"], "name");
     $tbl->setOrderDirection($_GET["sort_order"]);
     $tbl->setLimit($_GET["limit"]);
     $tbl->setOffset($_GET["offset"]);
     // content
     $tbl->setData($data);
     $tbl->disable("icon");
     $tbl->disable("numinfo");
     $tbl->disable("sort");
     $tbl->disable("footer");
     // render table
     $tbl->render();
     $tpl->show("DEFAULT", true, true);
 }