Ejemplo n.º 1
0
/**
 * Render cabinet properties into this view.
 *
 * The cabinet properties zone, row, model, maximum weight and installation date
 * are rendered to be for this page. It checks if the user is allowed to see the
 * content of the cabinet and only if the user does the information is provided.
 *
 * @param Cabinet $cab
 * @param CabinetAudit $audit
 * @param string $AuditorName
 */
function renderCabinetProps($cab, $audit, $AuditorName)
{
    $tmpDC = new DataCenter();
    $tmpDC->DataCenterID = $cab->DataCenterID;
    $tmpDC->GetDataCenter();
    $AuditorName = $AuditorName != '' ? "<br>{$AuditorName}" : "";
    $renderedHTML = "\t\t<table id=\"cabprop\">\n\t\t\t<tr><td>" . __("Last Audit") . ":</td><td id=\"lastaudit\">{$audit->AuditStamp}{$AuditorName}</td></tr>\n\t\t\t<tr><td>" . __("Model") . ":</td><td>{$cab->Model}</td></tr>\n\t\t\t<tr><td>" . __("Data Center") . ":</td><td>{$tmpDC->Name}</td></tr>\n\t\t\t<tr><td>" . __("Install Date") . ":</td><td>{$cab->InstallationDate}</td></tr>\n";
    if ($cab->ZoneID) {
        $zone = new Zone();
        $zone->ZoneID = $cab->ZoneID;
        $zone->GetZone();
        $renderedHTML .= "\t\t\t<tr><td>" . __("Zone") . ":</td><td>{$zone->Description}</td></tr>\n";
    }
    if ($cab->CabRowID) {
        $cabrow = new CabRow();
        $cabrow->CabRowID = $cab->CabRowID;
        $cabrow->GetCabRow();
        $renderedHTML .= "\t\t\t<tr><td>" . __("Row") . ":</td><td>{$cabrow->Name}</td></tr>\n";
    }
    $renderedHTML .= "\t\t\t<tr><td>" . __("Tags") . ":</td><td>" . renderTagsToString($cab) . "</td></tr>\n";
    //   This is out of context here and makes the information confusing.
    //    $renderedHTML .= '			<tr><td class="left">' . __('Front Edge') . ':</td>';
    //    $renderedHTML .= "<td class=\"right\">$cab->FrontEdge </td></tr>\n";
    $renderedHTML .= "\t\t</table>\n";
    return $renderedHTML;
}
Ejemplo n.º 2
0
});
//
//	URL:	/api/v1/zone/:zoneid
//	Method:	GET
//	Params:	none
//	Returns: Zone identified by :zoneid
//
$app->get('/zone/:zoneid', function ($zoneid) use($app) {
    $zone = new Zone();
    $zone->ZoneID = $zoneid;
    $response['error'] = false;
    $response['errorcode'] = 200;
    foreach ($app->request->get() as $prop => $val) {
        $dev->{$prop} = $val;
    }
    $response['zone'] = $zone->GetZone();
    echoResponse(200, $response);
});
//
//	URL:	/api/v1/cabrow
//	Method:	GET
//	Params:	none
//	Returns:  All cabinet rows for which the user's rights have access to view
//
$app->get('/cabrow', function () use($app) {
    $cabrow = new CabRow();
    $response['error'] = false;
    $response['errorcode'] = 200;
    foreach ($app->request->get() as $prop => $val) {
        $cabrow->{$prop} = $val;
    }
Ejemplo n.º 3
0
     $cabinet->DataCenterID = $dcid;
     foreach ($cabinet->ListCabinetsByDC() as $cab) {
         $device = new Device();
         $device->Cabinet = $cab->CabinetID;
         foreach ($device->ViewDevicesByCabinet(true) as $dev) {
             if (!isset($devList[$dev->DeviceType])) {
                 $devList[$dev->DeviceType] = array();
             }
             $devList[$dev->DeviceType][$dev->DeviceID] = array();
         }
     }
 } elseif (isset($_REQUEST['zoneid'])) {
     $zoneid = isset($_POST['zoneid']) ? $_POST['zoneid'] : $_GET['zoneid'];
     $zone = new Zone();
     $zone->ZoneID = $zoneid;
     $zone->GetZone();
     $datacenter = new DataCenter();
     $datacenter->DataCenterID = $zone->DataCenterID;
     $datacenter->GetDataCenter();
     $graphname .= "Zone " . $zone->Description . " in Data Center " . $datacenter->Name;
     $cabinet = new Cabinet();
     $cabinet->DataCenterID = $zone->DataCenterID;
     $cabinet->ZoneID = $zone->ZoneID;
     foreach ($cabinet->ListCabinetsByDC(true, true) as $cab) {
         $device = new Device();
         $device->Cabinet = $cab->CabinetID;
         foreach ($device->ViewDevicesByCabinet(true) as $dev) {
             if (!isset($devList[$dev->DeviceType])) {
                 $devList[$dev->DeviceType] = array();
             }
             $devList[$dev->DeviceType][$dev->DeviceID] = array();
Ejemplo n.º 4
0
/**
 * Return the name of the zone for a cabinet.
 *
 * @param Cabinet $cab
 * @param string|null $emptyVal
 * @return string
 */
function getZoneName($cab, $emptyVal = null)
{
    $zoneName = $emptyVal;
    if ($cab->ZoneID) {
        $zone = new Zone();
        $zone->ZoneID = $cab->ZoneID;
        $zone->GetZone();
        $zoneName = $zone->Description;
    }
    return $zoneName;
}
Ejemplo n.º 5
0
 function UpdateZone()
 {
     $this->MakeSafe();
     $oldzone = new Zone();
     $oldzone->ZoneID = $this->ZoneID;
     $oldzone->GetZone();
     //update all cabinets in this zone
     $sql = "UPDATE fac_Cabinet SET DataCenterID={$this->DataCenterID} WHERE \n\t\t\tZoneID={$this->ZoneID};";
     if (!$this->query($sql)) {
         return false;
     }
     //update zone
     $sql = "UPDATE fac_Zone SET Description=\"{$this->Description}\", \n\t\t\tDataCenterID={$this->DataCenterID},\n\t\t\tMapX1={$this->MapX1},\n\t\t\tMapY1={$this->MapY1},\n\t\t\tMapX2={$this->MapX2},\n\t\t\tMapY2={$this->MapY2}, \n\t\t\tMapZoom={$this->MapZoom} \n\t\t\tWHERE ZoneID={$this->ZoneID};";
     if (!$this->query($sql)) {
         return false;
     }
     class_exists('LogActions') ? LogActions::LogThis($this, $oldzone) : '';
     return true;
 }
Ejemplo n.º 6
0
			$payload=$dc->GetOverview();
		}

		header('Content-Type: application/json');
		echo json_encode($payload);
		exit;
	}
	
	if(!isset($_GET["zone"])){
		// No soup for you.
		header('Location: '.redirect());
		exit;
	}

	$zone->ZoneID=$_GET["zone"];
	if (!$zone->GetZone()){
		header('Location: '.redirect());
		exit;
	}
	$zoneStats=$zone->GetZoneStatistics();
	$dc->DataCenterID=$zone->DataCenterID;
	$dc->GetDataCenterbyID();

	function MakeImageMap($dc,$zone) {
		$zoom=$zone->MapZoom/100;
		$mapHTML="";

		if(strlen($dc->DrawingFileName)>0){
			$mapfile="drawings/".$dc->DrawingFileName;
			if(file_exists($mapfile)){
				list($width, $height, $type, $attr)=getimagesize($mapfile);