function LogManualWattage($Wattage) { $this->MakeSafe(); $oldpdu = new PowerDistribution(); $oldpdu->PDUID = $this->PDUID; $oldpdu->GetPDU(); $oldreading = $oldpdu->GetLastReading(); $oldpdu->Wattage = $oldreading->Wattage; $Wattage = intval($Wattage); $this->Wattage = $Wattage; $sql = "INSERT INTO fac_PDUStats SET Wattage={$Wattage}, PDUID={$this->PDUID}, \n\t\t\tLastRead=NOW() ON DUPLICATE KEY UPDATE Wattage={$Wattage}, LastRead=NOW();"; class_exists('LogActions') ? LogActions::LogThis($this, $oldpdu) : ''; return $this->query($sql) ? $this->GetLastReading() : false; }
if (count($tags) > 0) { // We have some tags so build the javascript elements we need to create the tags themselves $taginsert = "\t\ttags: {items: " . json_encode($tags) . "},\n"; } // Since a device exists we're gonna need some additional info, but only if it's not a copy if (!$copy) { // clearing errors for now $LastWattage = $LastRead = $upTime = 0; $pwrConnection->DeviceID = $dev->ParentDevice > 0 ? $dev->GetRootDeviceID() : $dev->DeviceID; $pwrCords = $pwrConnection->getPorts(); if ($dev->DeviceType == 'Switch') { $linkList = SwitchInfo::getPortStatus($dev->DeviceID); } elseif ($dev->DeviceType == 'CDU') { $pdu->PDUID = $dev->DeviceID; $pdu->GetPDU(); $lastreading = $pdu->GetLastReading(); $LastWattage = $lastreading ? $lastreading->Wattage : 0; $LastRead = $lastreading ? strftime("%c", strtotime($lastreading->LastRead)) : "Never"; } } if ($dev->ChassisSlots > 0 || $dev->RearChassisSlots > 0) { $childList = $dev->GetDeviceChildren(); } if ($dev->ParentDevice > 0) { $pDev = new Device(); $pDev->DeviceID = $dev->ParentDevice; $pDev->GetDevice(); $parentList = $pDev->GetParentDevices(); //$cab->CabinetID=$pDev->Cabinet; //JMGA: changed for multichassis $cab->CabinetID = $pDev->GetDeviceCabinetID();