} function _putcatalog() { parent::_putcatalog(); if (count($this->outlines) > 0) { $this->_out('/Outlines ' . $this->OutlineRoot . ' 0 R'); $this->_out('/PageMode /UseOutlines'); } } } // // // Begin Report Generation // // $pan = new PowerPanel(); $pdu = new PowerDistribution(); $dev = new Device(); $cab = new Cabinet(); $dept = new Department(); $dc = new DataCenter(); $pdf = new PDF(); $pdf->AliasNbPages(); include_once "loadfonts.php"; $pdf->SetFont($config->ParameterArray['PDFfont'], '', 8); $pdf->SetFillColor(0, 0, 0); $pdf->SetTextColor(255); $pdf->SetDrawColor(128, 0, 0); $pdf->SetLineWidth(0.3); $pdf->SetfillColor(224, 235, 255); $pdf->SetTextColor(0);
<body> <?php include 'header.inc.php'; ?> <div class="page"> <?php include 'sidebar.inc.php'; echo ' <div class="main"> <div class="center"> <div id="tablecontainer">'; // // // Begin Report Generation // // $pan = new PowerPanel(); $pdu = new PowerDistribution(); $dev = new Device(); $cab = new Cabinet(); $tmpPerson = new People(); $dept = new Department(); $dc = new DataCenter(); // Make some quick user defined sort comparisons for this report only function compareCab($a, $b) { if ($a->Location == $b->Location) { return 0; } return $a->Location > $b->Location ? +1 : -1; } $dc->DataCenterID = intval($_REQUEST['datacenterid']);
function DisplayPanel() { global $dbh; $html = "<table border=1>\n"; $pan = new PowerPanel(); $pan->PanelID = $this->PanelID; $pan->getPanel(); $sched = array_fill(1, $pan->NumberOfPoles, "<td> </td>"); $sql = "SELECT * FROM fac_PanelSchedule WHERE PanelID={$this->PanelID} ORDER BY PolePosition ASC;"; foreach ($dbh->query($sql) as $row) { $sched[$row["PolePosition"]] = "<td rowspan={$row["NumPoles"]}>{$row["Label"]}</td>"; if ($row["NumPoles"] > 1) { $sched[$row["PolePosition"] + 2] = ""; } if ($row["NumPoles"] > 2) { $sched[$row["PolePosition"] + 4] = ""; } for ($i = 1; $i < $pan->NumberOfPoles + 1; $i++) { $html .= "<tr><td>{$i}</td>{$sched[$i]}<td>" . ($i + 1) . "</td>{$sched[++$i]}</tr>\n"; } } $html .= "</table>\n"; return $html; }
$template->GetTemplate(); $powerConn->PDUID = $pdu->PDUID; $connList = $powerConn->GetConnectionsByPDU(); $tooltip .= __($row["Label"]) . ": " . count($connList) . "/" . ($template->NumOutlets + 1) . "<br>\n"; break; case "Uptime": $tooltip .= __($row["Label"]) . ": " . $pdu->GetSmartCDUUptime() . "<br>\n"; break; case "PanelID": $pan = new PowerPanel(); $pan->PanelID = $pdu->PanelID; $pan->GetPanel(); $tooltip .= __($row["Label"]) . ": {$pan->PanelLabel}<br>\n"; break; case "PanelVoltage": $pan = new PowerPanel(); $pan->PanelID = $pdu->PanelID; $pan->GetPanel(); $tooltip .= __($row["Label"]) . ": " . $pan->PanelVoltage . " / " . intval($pan->PanelVoltage / 1.73) . "<br>\n"; break; case "PanelPole": $tooltip .= __($row["Label"]) . ": " . $pdu->GetAllBreakerPoles() . "<br>\n"; break; case "PrimaryContact": $pc = new People(); $pc->PersonID = $dev->PrimaryContact; if ($pc->PersonID > 0) { $pc->GetPerson(); $tooltip .= __($row["Label"]) . ": " . $pc->LastName . ", " . $pc->FirstName . "<br>\n"; } else { $tooltip .= __($row["Label"]) . ": " . __("Unassigned") . "<br>\n";
<option value=0>', __("Select Panel"), '</option>'; $Panel = new PowerPanel(); $PanelList = $Panel->getPanelList(); foreach ($PanelList as $key => $value) { $selected = $value->PanelID == $pdu->PanelID ? ' selected' : ""; print "\n\t\t\t\t\t<option value=\"{$value->PanelID}\"{$selected}>{$value->PanelLabel}</option>\n"; } echo ' </select> </div> </div> <div> <div><label for="voltage">', __("Voltages:"), '</label></div> <div id="voltage">'; if ($pdu->PanelID > 0) { $pnl = new PowerPanel(); $pnl->PanelID = $pdu->PanelID; $pnl->getPanel(); print $pnl->PanelVoltage . " / " . intval($pnl->PanelVoltage / 1.73); } echo '</div> </div> <div> <div><label for="BreakerSize">', __("Breaker Size (# of Poles)"), '</label></div> <div> <select name="BreakerSize" id="BreakerSize">'; for ($i = 1; $i < 4; $i++) { if ($i == $pdu->BreakerSize) { $selected = " selected"; } else { $selected = "";
header('Location: ' . redirect()); exit; } // If you're deleting the cabinet, no need to pull in the rest of the information, so get it out of the way // Only a site administrator can create or delete a cabinet if (isset($_POST["delete"]) && $_POST["delete"] == "yes" && $person->SiteAdmin) { $cab->DeleteCabinet(); header('Content-Type: application/json'); echo json_encode(array('url' => redirect("dc_stats.php?dc={$cab->DataCenterID}"))); exit; } $head = $legend = $zeroheight = $body = $deptcolor = $AuditorName = ""; $audit = new CabinetAudit(); $dev = new Device(); $pdu = new PowerDistribution(); $pan = new PowerPanel(); $templ = new DeviceTemplate(); $tempPDU = new PowerDistribution(); $tempDept = new Department(); $dc = new DataCenter(); $dcID = $cab->DataCenterID; $dc->DataCenterID = $dcID; $dc->GetDataCenterbyID(); $audit->CabinetID = $cab->CabinetID; // You just have WriteAccess in order to perform/certify a rack audit if (isset($_POST["audit"]) && $_POST["audit"] == "yes" && $person->CanWrite($cab->AssignedTo)) { $audit->Comments = sanitize($_POST["comments"]); // Log the response $audit->CertifyAudit(); // I'm lazy as f**k so retrieve what we just wrong $audit->GetLastAudit();
<?php require_once "../db.inc.php"; require_once "../facilities.inc.php"; $pnl = new PowerPanel(); $searchTerm = ""; if (isset($_REQUEST["q"])) { $searchTerm = $_REQUEST["q"]; } //This will ensure that an empty json record set is returned if this is called directly or in some strange manner if ($searchTerm != "") { $pnl->PanelID = $searchTerm; $pnl->GetPanel(); } header('Content-Type: application/json'); echo json_encode($pnl);
<?php require_once "db.inc.php"; require_once "facilities.inc.php"; $subheader = __("Data Center Detail"); if (!$person->SiteAdmin) { // No soup for you. header('Location: ' . redirect()); exit; } $panel = new PowerPanel(); $pdu = new PowerDistribution(); $cab = new Cabinet(); $tmpl = new CDUTemplate(); $tmpList = $tmpl->GetTemplateList(); $script = ""; // AJAX if (isset($_POST['deletepanel'])) { $panel->PanelID = $_POST["PanelID"]; $return = 'no'; if ($panel->getPanel()) { $panel->deletePanel(); $return = 'ok'; } echo $return; exit; } // Set a default panel voltage based upon the configuration screen $panel->PanelVoltage = $config->ParameterArray["DefaultPanelVoltage"]; if (isset($_POST["action"]) && ($_POST["action"] == "Create" || $_POST["action"] == "Update")) { foreach ($panel as $prop => $val) {
<?php require_once 'db.inc.php'; require_once 'facilities.inc.php'; define('FPDF_FONTPATH', 'font/'); require 'fpdf.php'; $dept = new Department(); $device = new Device(); $cab = new Cabinet(); $dc = new DataCenter(); $pdu = new PowerDistribution(); $panel = new PowerPanel(); $mfg = new Manufacturer(); $templ = new DeviceTemplate(); $pport = new PowerPorts(); $audit = new CabinetAudit(); $audit->CabinetID = $_REQUEST['cabinetid']; $audit->AuditStamp = "Never"; $audit->GetLastAudit(); if ($audit->UserID != "") { $tmpPerson = new People(); $tmpPerson->UserID = $audit->UserID; $tmpPerson->GetUserRights(); $AuditorName = $tmpPerson->LastName . ", " . $tmpPerson->FirstName; } else { //If no audit has been completed $AuditorName will return an error $AuditorName = ""; } $_SESSION['AuditorName'] = $AuditorName; $_SESSION['AuditStamp'] = $audit->AuditStamp; class PDF extends FPDF