case "Model": $template = new CDUTemplate(); $manufacturer = new Manufacturer(); $template->TemplateID = $pdu->TemplateID; $template->GetTemplate(); $manufacturer->ManufacturerID = $template->ManufacturerID; $manufacturer->GetManufacturerByID(); $tooltip .= __($row["Label"]) . ": [{$manufacturer->Name}] {$template->Model}<br>\n"; break; case "NumOutlets": $template = new CDUTemplate(); $powerConn = new PowerConnection(); $template->TemplateID = $pdu->TemplateID; $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();
function DeletePDU() { global $person; $this->MakeSafe(); // Do not attempt anything else if the lookup fails if (!$this->GetPDU()) { return false; } // Check rights $cab = new Cabinet(); $cab->CabinetID = $this->CabinetID; $cab->GetCabinet(); if (!$person->canWrite($cab->AssignedTo)) { return false; } // First, remove any connections to the PDU $tmpConn = new PowerConnection(); $tmpConn->PDUID = $this->PDUID; $connList = $tmpConn->GetConnectionsByPDU(); foreach ($connList as $delConn) { $delConn->RemoveConnection(); } // Clear out any records from PDUStats, possible S.U.T. involving changing // a devicetype but leaving behind a phantom reading for a non-power device $sql = "DELETE FROM fac_PDUStats WHERE PDUID={$this->PDUID};"; $this->exec($sql); $sql = "DELETE FROM fac_PowerDistribution WHERE PDUID={$this->PDUID};"; if (!$this->exec($sql)) { // Something went south and this didn't delete. return false; } else { class_exists('LogActions') ? LogActions::LogThis($this) : ''; return true; } }