Beispiel #1
0
            }
        } else {
            //update cabinet
            $cab->FrontEdge = $_POST["airflow"];
            $cab->UpdateCabinet();
        }
    }
    exit;
}
if (isset($_POST['dc']) && (isset($_POST['getobjects']) || isset($_POST['getoverview']))) {
    $payload = array();
    if (isset($_POST['getobjects'])) {
        $cab->DataCenterID = $_POST['dc'];
        $zone = new Zone();
        $zone->DataCenterID = $cab->DataCenterID;
        $payload = array('cab' => $cab->ListCabinetsByDC(true), 'zone' => $zone->GetZonesByDC(true));
    } else {
        $dc->DataCenterID = $_POST['dc'];
        $dc->GetDataCenterByID();
        $payload = $dc->GetOverview();
    }
    header('Content-Type: application/json');
    echo json_encode($payload);
    exit;
}
if (!isset($_GET["dc"])) {
    // No soup for you.
    header('Location: ' . redirect());
    exit;
}
$dc->DataCenterID = $_GET["dc"];
Beispiel #2
0
 function AddDCToTree($lev = 0)
 {
     $dept = new Department();
     $zone = new Zone();
     $classType = "liClosed";
     $tree = str_repeat(" ", $lev + 1) . "<li class=\"{$classType}\" id=\"dc{$this->DataCenterID}\"><a class=\"DC\" href=\"dc_stats.php?dc=" . "{$this->DataCenterID}\">{$this->Name}</a>\n";
     $tree .= str_repeat(" ", $lev + 2) . "<ul>\n";
     $zone->DataCenterID = $this->DataCenterID;
     $zoneList = $zone->GetZonesByDC();
     while (list($zoneNum, $myzone) = each($zoneList)) {
         $tree .= str_repeat(" ", $lev + 3) . "<li class=\"liClosed\" id=\"zone{$myzone->ZoneID}\"><a class=\"ZONE\" href=\"zone_stats.php?zone=" . "{$myzone->ZoneID}\">{$myzone->Description}</a>\n";
         $tree .= str_repeat(" ", $lev + 4) . "<ul>\n";
         //Rows
         $sql = "SELECT CabRowID, Name AS Fila FROM fac_CabRow WHERE \n\t\t\t\tZoneID={$myzone->ZoneID} ORDER BY Fila;";
         foreach ($this->query($sql) as $filaRow) {
             $tree .= str_repeat(" ", $lev + 5) . "<li class=\"liClosed\">" . "<a class=\"CABROW\" href=\"rowview.php?row={$filaRow['CabRowID']}\">" . __("Row ") . "{$filaRow['Fila']}</a>\n";
             $tree .= str_repeat(" ", $lev + 6) . "<ul>\n";
             // DataCenterID and ZoneID are redundant if fac_cabrow is defined and is CabrowID set in fac_cabinet
             $cabsql = "SELECT * FROM fac_Cabinet WHERE DataCenterID={$this->DataCenterID} \n\t\t\t\t\tAND ZoneID={$myzone->ZoneID} AND CabRowID={$filaRow['CabRowID']} ORDER \n\t\t\t\t\tBY Location REGEXP '^[A-Za-z]+\$', CAST(Location as SIGNED INTEGER),\n\t\t\t\t\tLocation;";
             foreach ($this->query($cabsql) as $cabRow) {
                 $tree .= str_repeat(" ", $lev + 7) . "<li id=\"cab{$cabRow['CabinetID']}\"><a class=\"RACK\" href=\"cabnavigator.php?cabinetid={$cabRow['CabinetID']}\">{$cabRow['Location']}</a></li>\n";
             }
             $tree .= str_repeat(" ", $lev + 6) . "</ul>\n";
             $tree .= str_repeat(" ", $lev + 5) . "</li>\n";
         }
         //Cabinets without CabRowID
         $cabsql = "SELECT * FROM fac_Cabinet WHERE DataCenterID={$this->DataCenterID} AND \n\t\t\t\tZoneID={$myzone->ZoneID} AND CabRowID=0 ORDER BY Location ASC;";
         foreach ($this->query($cabsql) as $cabRow) {
             $tree .= str_repeat(" ", $lev + 5) . "<li id=\"cab{$cabRow['CabinetID']}\"><a class=\"RACK\" href=\"cabnavigator.php?cabinetid={$cabRow['CabinetID']}\">{$cabRow['Location']}</a></li>\n";
         }
         $tree .= str_repeat(" ", $lev + 4) . "</ul>\n";
         $tree .= str_repeat(" ", $lev + 3) . "</li>\n";
     }
     //zone
     //Cabinets without ZoneID
     $cabsql = "SELECT * FROM fac_Cabinet WHERE DataCenterID={$this->DataCenterID} AND \n\t\t\tZoneID=0 ORDER BY Location ASC;";
     foreach ($this->query($cabsql) as $cabRow) {
         $tree .= str_repeat(" ", $lev + 3) . "<li id=\"cab{$cabRow['CabinetID']}\"><a class=\"RACK\" href=\"cabnavigator.php?cabinetid={$cabRow['CabinetID']}\">{$cabRow['Location']}</a></li>\n";
     }
     //StorageRoom for this DC
     $tree .= str_repeat(" ", $lev + 3) . "<li id=\"sr-{$this->DataCenterID}\"><a href=\"storageroom.php?dc={$this->DataCenterID}\">" . __("Storage Room") . "</a></li>\n";
     $tree .= str_repeat(" ", $lev + 2) . "</ul>\n";
     $tree .= str_repeat(" ", $lev + 1) . "</li>\n";
     return $tree;
 }