コード例 #1
0
 /**
  * Get clients
  *
  * @param
  * @return
  */
 function getClients()
 {
     global $lng;
     $clients = array();
     $clientlist = new ilClientList($this->setup->db_connections);
     $list = $clientlist->getClients();
     foreach ($list as $key => $client) {
         // check status
         $status_arr = $this->setup->getStatus($client);
         if (!$status_arr["db"]["status"]) {
             $status = "<a href=\"setup.php?cmd=db&client_id=" . $key . "&back=clientlist\">" . $status_arr["db"]["comment"] . "</a>";
         } elseif (!$status_arr["finish"]["status"]) {
             $status = $lng->txt("setup_not_finished");
         } else {
             $status = "<font color=\"green\"><strong>OK</strong></font>";
         }
         if ($status_arr["access"]["status"]) {
             $access = "online";
         } else {
             $access = "disabled";
         }
         if ($key == $this->setup->default_client) {
             $default = " checked=\"checked\"";
         } else {
             $default = "";
         }
         if ($status_arr["finish"]["status"] and $status_arr["access"]["status"]) {
             $login = "******"../login.php?client_id=" . $key . "\">Login</a>";
         } else {
             $login = "******";
         }
         $access_html = "<a href=\"setup.php?cmd=changeaccess&client_id=" . $key . "&back=clientlist\">" . $this->lng->txt($access) . "</a>";
         $client_name = $client->getName() ? $client->getName() : "&lt;" . $lng->txt("no_client_name") . "&gt;";
         // visible data part
         $clients[] = array("default" => "<input type=\"radio\" name=\"form[default]\" value=\"" . $key . "\"" . $default . "/>", "name" => $client_name, "desc" => $client->getDescription(), "id" => $key, "login" => $login, "details" => "<a href=\"setup.php?cmd=view&client_id=" . $key . "\">Details</a>", "status" => $status, "access_html" => $access_html);
     }
     $this->setData($clients);
 }
コード例 #2
0
 /**
  * Initialize clone form
  */
 function cloneInitForm()
 {
     global $lng, $ilCtrl;
     $this->checkDisplayMode();
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setId("clone_form");
     $this->form->setFormAction("setup.php?cmd=gateway");
     if ($this->setup->getClient()->status["access"]["status"] === false and stripos($this->setup->getClient()->getName(), "master") === false and $this->setup->getClient()->getdbType() == "mysql" and $this->setup->getClient()->db_exists) {
         $this->form->setTitle($this->lng->txt("clone_source"));
         $clients = array();
         $clientlist = new ilClientList($this->setup->db_connections);
         $list = $clientlist->getClients();
         $clientlistarray = array();
         foreach ($list as $key => $client) {
             if (strcmp($key, $this->setup->getClient()->getId()) != '0' && $client->getDbType() == 'mysql') {
                 // You cannot clone yourself
                 $clientlistarray[$client->id] = $client->id;
             }
         }
         $si = new ilSelectInputGUI($lng->txt("clone_selectsource"), "source");
         $si->setOptions(array_merge(array("" => "-- " . $lng->txt("please_select") . " --"), $clientlistarray));
         $si->setRequired(true);
         $this->form->addItem($si);
         $cb = new ilCheckboxInputGUI($lng->txt("clone_areyousure"), "iamsure");
         $cb->setRequired(true);
         $this->form->addItem($cb);
         $this->form->addCommandButton("cloneSaveSource", $lng->txt("cloneit"));
     } else {
         $disabledmessage = "<h1>" . $this->lng->txt("clone_disabledmessage") . "</h1><br>";
         if (!$this->setup->getClient()->status["access"]["status"] === false) {
             $disabledmessage .= $this->lng->txt("clone_clientnotdisabled") . "<br>";
         }
         if (!stripos($this->setup->getClient()->getName(), "aster") === false) {
             $disabledmessage .= $this->lng->txt("clone_clientismaster") . "<br>";
         }
         if ($this->setup->getClient()->getdbType() != "mysql") {
             $disabledmessage .= $this->lng->txt("clone_clientisnotmysql") . "<br>";
         }
         if (!$this->setup->getClient()->db_exists) {
             $disabledmessage .= $this->lng->txt("clone_clientnodatabase") . "<br>";
         }
         $this->form->setTitle($disabledmessage);
     }
 }
コード例 #3
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);
 }