Exemplo n.º 1
0
 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>&nbsp;</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;
 }
Exemplo n.º 2
0
$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 = "";
    }
    print "\n\t\t\t\t\t<option value=\"{$i}\"{$selected}>{$i}</option>";
Exemplo n.º 3
0
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) {
        $panel->{$prop} = trim($_POST[$prop]);
    }
    if ($_POST["action"] == "Create") {
        if ($panel->createPanel()) {
            header('Location: ' . redirect("power_panel.php?PanelID={$panel->PanelID}"));
Exemplo n.º 4
0
			' . $cab->Keylock . '
		</div>
	</fieldset>
	<fieldset id="zerou" class="hide">
		<legend>' . __("Zero-U Devices") . '</legend>
		<div>
		</div>
	</fieldset>
	<fieldset name="pdu">
		<legend>' . __("Power Distribution") . '</legend>
		<div>';
foreach ($PDUList as $PDUdev) {
    $lastreading = $PDUdev->GetLastReading();
    $pduDraw = $lastreading ? $lastreading->Wattage : 0;
    $pan->PanelID = $PDUdev->PanelID;
    $pan->getPanel();
    if ($PDUdev->BreakerSize == 1) {
        $maxDraw = $PDUdev->InputAmperage * $pan->PanelVoltage / 1.732;
    } elseif ($PDUdev->BreakerSize == 2) {
        $maxDraw = $PDUdev->InputAmperage * $pan->PanelVoltage;
    } else {
        $maxDraw = $PDUdev->InputAmperage * $pan->PanelVoltage * 1.732;
    }
    // De-rate all breakers to 80% sustained load
    $maxDraw *= 0.8;
    if ($maxDraw > 0) {
        $PDUPercent = intval($pduDraw / $maxDraw * 100);
    } else {
        $PDUPercent = 0;
    }
    $PDUColor = $PDUPercent > intval($config->ParameterArray["PowerRed"]) ? $CriticalColor : ($PDUPercent > intval($config->ParameterArray["PowerYellow"]) ? $CautionColor : $GoodColor);
Exemplo n.º 5
0
$pdu->CabinetID = $cab->CabinetID;
$cabmessage = __("PDUs at") . ' ' . $cabmessage;
$pdf->SetFont($config->ParameterArray['PDFfont'], 'B', 10);
$pdf->Cell(0, 5, $cabmessage, 0, 1, 'C', 0);
$pdf->SetFont($config->ParameterArray['PDFfont'], '', 10);
$PDUList = $pdu->GetPDUbyCabinet();
$headerTags = array(__("Label"), __("NumOutputs"), __("Model"), __("PanelLabel"), __("PanelPole"));
$cellWidths = array(50, 30, 118, 70, 20);
$maxval = count($headerTags);
for ($col = 0; $col < $maxval; $col++) {
    $pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, 'C', 1);
}
$pdf->Ln();
foreach ($PDUList as $PDUrow) {
    $panel->PanelID = $PDUrow->PanelID;
    $panel->getPanel();
    $pdutemp = new CDUTemplate();
    $pdutemp->TemplateID = $PDUrow->TemplateID;
    $pdutemp->GetTemplate();
    $mfg->ManufacturerID = $pdutemp->ManufacturerID;
    $mfg->GetManufacturerByID();
    $pdf->Cell($cellWidths[0], 6, $PDUrow->Label, 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[1], 6, $pdutemp->NumOutlets, 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[2], 6, "[{$mfg->Name}] {$pdutemp->Model}", 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[3], 6, $panel->PanelLabel, 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[4], 6, $PDUrow->PanelPole, 'LBRT', 1, 'L', $fill);
    $pdf->Cell($cellWidths[0], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[1], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[2], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[3], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[4], 6, '', 'LBRT', 1, 'L', $fill);