/** * 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; }
<?php require_once "db.inc.php"; require_once "facilities.inc.php"; $subheader = __("Map Selector"); if (!$person->SiteAdmin) { // No soup for you. header("Location: " . redirect()); exit; } $dc = new DataCenter(); $cab = new Cabinet(); $cab->CabinetID = $_REQUEST["cabinetid"]; $cab->GetCabinet(); $dc->DataCenterID = $cab->DataCenterID; $dc->GetDataCenter(); if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "Submit") { $cab->MapX1 = intval($_REQUEST["x1"]); $cab->MapX2 = intval($_REQUEST["x2"]); $cab->MapY1 = intval($_REQUEST["y1"]); $cab->MapY2 = intval($_REQUEST["y2"]); $cab->FrontEdge = $_REQUEST["frontedge"]; $cab->UpdateCabinet(); $url = redirect("cabnavigator.php?cabinetid={$cab->CabinetID}"); header("Location: {$url}"); } $height = 0; $width = 0; if (strlen($dc->DrawingFileName) > 0) { $mapfile = "drawings/{$dc->DrawingFileName}"; if (file_exists($mapfile)) {
<div> <button id="generate" type="submit">' . __("Generate") . '</button> </div> </div> </div> </form> </div> <!-- END .center --> </div> <!-- END .main --> </div> <!-- END .page --> </body> </html>'; } else { $cab = new Cabinet(); $dev = new Device(); $datacenter->DataCenterID = $_REQUEST["datacenterid"]; $datacenter->GetDataCenter(); $cab->DataCenterID = $datacenter->DataCenterID; $cabList = $cab->ListCabinetsByDC(); header('Content-type: text/xml'); header('Cache-Control: no-store, NO-CACHE'); header('Content-Disposition: attachment; filename="opendcim.xml"'); print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<datacenter>\n\n\t<ID>{$datacenter->DataCenterID}</ID>\n\t<Name>{$datacenter->Name}</Name>\n\t<Size>{$datacenter->SquareFootage}</Size>\n"; foreach ($cabList as $cabRow) { print "\t<cabinet>\n\t\t<ID>{$cabRow->CabinetID}</ID>\n\t\t<Location>{$cabRow->Location}</Location>\n\t\t<Height>{$cabRow->CabinetHeight}</Height>\n\t\t<FrontEdge>{$cabRow->FrontEdge}</FrontEdge>\n\t\t<MapX1>{$cabRow->MapX1}</MapX1>\n\t\t<MapY1>{$cabRow->MapY1}</MapY1>\n\t\t<MapX2>{$cabRow->MapX2}</MapX2>\n\t\t<MapY2>{$cabRow->MapY2}</MapY2>\n"; $dev->Cabinet = $cabRow->CabinetID; $devList = $dev->ViewDevicesByCabinet(); $totalWatts = 0; foreach ($devList as $devRow) { $power = $devRow->GetDeviceTotalPower(); $totalWatts += $power; print "\t\t<Device>\n\t\t\t<ID>{$devRow->DeviceID}</ID>\n\t\t\t<Label>{$devRow->Label}</Label>\n\t\t\t<Position>{$devRow->Position}</Position>\n\t\t\t<Height>{$devRow->Height}</Height>\n\t\t\t<Watts>{$power}</Watts>\n\t\t</Device>\n";
static function RowToObject($dbRow, $filterrights = true) { /* * Generic function that will take any row returned from the fac_Cabinet * table and convert it to an object for use in array or other */ $cab = new Cabinet(); $cab->CabinetID = $dbRow["CabinetID"]; $cab->DataCenterID = $dbRow["DataCenterID"]; $cab->Location = $dbRow["Location"]; $cab->LocationSortable = $dbRow["LocationSortable"]; $cab->AssignedTo = $dbRow["AssignedTo"]; $cab->ZoneID = $dbRow["ZoneID"]; $cab->CabRowID = $dbRow["CabRowID"]; $cab->CabinetHeight = $dbRow["CabinetHeight"]; $cab->Model = $dbRow["Model"]; $cab->Keylock = $dbRow["Keylock"]; $cab->MaxKW = $dbRow["MaxKW"]; $cab->MaxWeight = $dbRow["MaxWeight"]; $cab->InstallationDate = $dbRow["InstallationDate"]; $cab->SensorIPAddress = $dbRow["SensorIPAddress"]; $cab->SensorCommunity = $dbRow["SensorCommunity"]; $cab->SensorTemplateID = $dbRow["SensorTemplateID"]; $cab->MapX1 = $dbRow["MapX1"]; $cab->MapY1 = $dbRow["MapY1"]; $cab->MapX2 = $dbRow["MapX2"]; $cab->MapY2 = $dbRow["MapY2"]; $cab->FrontEdge = $dbRow["FrontEdge"]; $cab->Notes = $dbRow["Notes"]; $cab->U1Position = $dbRow["U1Position"]; if ($filterrights) { $cab->FilterRights(); } if ($cab->U1Position == "Default") { $dc = new DataCenter(); $dc->DataCenterID = $cab->DataCenterID; $dc->GetDataCenter(); if ($dc->U1Position == "Default") { global $config; $cab->U1Position = $config->ParameterArray["U1Position"]; } else { $cab->U1Position = $dc->U1Position; } } return $cab; }
function UpdateDataCenter() { $this->MakeSafe(); $sql = "UPDATE fac_DataCenter SET Name=\"{$this->Name}\", \n\t\t\tSquareFootage={$this->SquareFootage}, DeliveryAddress=\"{$this->DeliveryAddress}\", \n\t\t\tAdministrator=\"{$this->Administrator}\", MaxkW={$this->MaxkW}, \n\t\t\tDrawingFileName=\"{$this->DrawingFileName}\", EntryLogging=0,\t\n\t\t\tContainerID={$this->ContainerID},\tMapX={$this->MapX}, MapY={$this->MapY}, \n\t\t\tU1Position=\"{$this->U1Position}\" WHERE DataCenterID={$this->DataCenterID};"; $this->MakeDisplay(); $old = new DataCenter(); $old->DataCenterID = $this->DataCenterID; $old->GetDataCenter(); class_exists('LogActions') ? LogActions::LogThis($this, $old) : ''; return $this->query($sql); }