本文整理汇总了PHP中Device::ViewDevicesByCabinet方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::ViewDevicesByCabinet方法的具体用法?PHP Device::ViewDevicesByCabinet怎么用?PHP Device::ViewDevicesByCabinet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::ViewDevicesByCabinet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
{
header('Content-Type: application/json');
echo json_encode($array);
exit;
}
if (isset($_POST['dc'])) {
$cab = new Cabinet();
$cab->DataCenterID = $_POST['dc'];
displayjson($cab->ListCabinetsByDC());
}
if (isset($_POST['cab'])) {
$dev = new Device();
$dev->Cabinet = $_POST['cab'];
// Filter devices by rights
$devs = array();
foreach ($dev->ViewDevicesByCabinet(true) as $d) {
if ($d->Rights == "Write") {
$devs[] = $d;
}
}
displayjson($devs);
}
if (isset($_POST['dev'])) {
$dp = new DevicePorts();
$dp->DeviceID = $_POST['dev'];
$dev = new Device();
$dev->DeviceID = $dp->DeviceID;
$dev->GetDevice();
$ports = $dev->Rights == "Write" ? $dp->getPorts() : array();
displayjson($ports);
}
示例2: Cabinet
</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";
}
print "\t\t<TotalWatts>{$totalWatts}</TotalWatts>\n\t</cabinet>\n";
}
print "</datacenter>\n";
}
示例3: computeSheetBodyDCInventory
/**
* Compute the full inventory on devices in the data centers and return the data
* center summary statistics
*
* @param PHPExcel_Worksheet $worksheet
* @param array $DProps properties defined for the Excel document
* @return (array|array|array|boolean)[]
* statistics array, device inventory, cabinet inventory
*/
function computeSheetBodyDCInventory($DProps)
{
global $person;
global $sessID;
$dc = new DataCenter();
$cab = new Cabinet();
$device = new Device();
$invData = array();
$invCab = array();
$sheetColumns = $DProps['DC Inventory']['Columns'];
$cabinetColumns = $DProps['Rack Inventory']['Columns'];
$devTemplates = DeviceTemplate::getTemplateListIndexedbyID();
$deptList = Department::GetDepartmentListIndexedbyID();
$contactList = $person->GetUserList('indexed');
$limitedUser = false;
$dcList = $dc->GetDCList();
$Stats = array();
// A little code to update the counter
$percentDone = 0;
$sectionMaxPercent = 40;
$incrementalPercent = 1 / sizeof($dcList) * $sectionMaxPercent;
foreach ($dcList as $dc) {
$dcContainerList = $dc->getContainerList();
$dcStats = array();
$cab->DataCenterID = $dc->DataCenterID;
$dcStats['Fl_Spc'] = $dc->SquareFootage;
$dcStats['DesignPower'] = $dc->MaxkW;
$dcStats['Watts'] = 0;
$dcStats['Rk_Num'] = 0;
$dcStats['Rk_UtT'] = 0;
$dcStats['Rk_UtU'] = 0;
$dcStats['Rk_UtE'] = 0;
$dcStats['Rk_Res'] = 0;
$cabList = $cab->ListCabinetsByDC();
if (count($cabList) == 0) {
// empty data center room
$devSpec = makeEmptySpec($sheetColumns, $dcContainerList);
$devSpec['DC Name'] = $dc->Name;
$invData[] = $devSpec;
} else {
foreach ($cabList as $cab) {
if (!$person->ReadAccess and $cab->AssignedTo == 0 or $cab->AssignedTo > 0 and !$person->canRead($cab->AssignedTo)) {
// User is not allowed to see anything in here
$limitedUser = true;
continue;
}
$zoneName = getZoneName($cab);
$rowName = getRowName($cab);
addRackStat($invCab, $cab, $cabinetColumns, $dc, $dcContainerList);
$cab_height = $cab->CabinetHeight;
if (mb_strtoupper($cab->Model) == 'RESERVED') {
$dcStats['Rk_Res']++;
} else {
$dcStats['Rk_Num']++;
}
$dcStats['Rk_UtT'] += $cab_height;
$device->Cabinet = $cab->CabinetID;
$device_list = $device->ViewDevicesByCabinet();
// empty cabinet
if (count($device_list) == 0 && $cab->CabinetHeight > 0) {
$dcStats['Rk_UtE'] += $cab_height;
$devSpec = makeEmptySpec($sheetColumns, $dcContainerList);
$devSpec['Zone'] = $zoneName;
$devSpec['Row'] = $rowName;
$devSpec['DC Name'] = $dc->Name;
$devSpec['Cabinet'] = $cab->Location;
$devSpec['Position'] = 1;
$devSpec['Height'] = $cab->CabinetHeight;
$devSpec['Device'] = '__EMPTY';
$invData[] = $devSpec;
} else {
usort($device_list, 'cmpDevPos');
$low_idx = 1;
foreach ($device_list as $dev) {
if ($low_idx < $dev->Position) {
// range of empty slots
if ($dev->Position <= $cab_height) {
$height = $dev->Position - $low_idx;
} else {
$height = $cab_height - $low_idx + 1;
}
if ($height > 0) {
$dcStats['Rk_UtE'] += $height;
$devSpec = makeEmptySpec($sheetColumns, $dcContainerList);
${$devSpec}['Zone'] = $zoneName;
$devSpec['Row'] = $rowName;
$devSpec['DC Name'] = $dc->Name;
$devSpec['Cabinet'] = $cab->Location;
$devSpec['Position'] = $low_idx;
$devSpec['Height'] = $height;
$devSpec['Device'] = '__EMPTY';
//.........这里部分代码省略.........
示例4: DeleteCabinet
function DeleteCabinet()
{
global $dbh;
/* Need to delete all devices and CDUs first */
$tmpDev = new Device();
$tmpCDU = new PowerDistribution();
$tmpDev->Cabinet = $this->CabinetID;
$devList = $tmpDev->ViewDevicesByCabinet();
foreach ($devList as &$delDev) {
$delDev->DeleteDevice();
}
$tmpCDU->CabinetID = $this->CabinetID;
$cduList = $tmpCDU->GetPDUbyCabinet();
foreach ($cduList as &$delCDU) {
$delCDU->DeletePDU();
}
$sql = "DELETE FROM fac_Cabinet WHERE CabinetID={$this->CabinetID};";
if (!$dbh->exec($sql)) {
$info = $dbh->errorInfo();
error_log("PDO Error::DeleteCabinet: {$info[2]} SQL={$sql}");
return false;
}
class_exists('LogActions') ? LogActions::LogThis($this) : '';
return true;
}
示例5: printRow
$pdf = new PDF();
$pdf->SetLeftMargin(5);
$pdf->SetRightMargin(5);
include_once "loadfonts.php";
$cab->CabinetID = $_REQUEST['cabinetid'];
$cab->GetCabinet();
$device->Cabinet = $cab->CabinetID;
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFillColor(224, 235, 255);
$fill = 0;
$cabmessage = __("Cabinet Location") . ': ' . $cab->Location;
$pdf->SetFont($config->ParameterArray['PDFfont'], 'B', 10);
$pdf->Cell(0, 5, $cabmessage, 0, 1, 'C', 0);
$pdf->SetFont($config->ParameterArray['PDFfont'], '', 10);
$deviceList = $device->ViewDevicesByCabinet();
$headerTags = array(__("Label"), __("SerialNo"), __("AssetTag"), __("Position"), __("Rack Units"), __("#Ports"), __("#PS"), __("PowerConnection1"), __("PowerConnection2"), __("DeviceType"));
$cellWidths = array(45, 40, 20, 18, 20, 15, 10, 35, 35, 50);
$maxval = count($headerTags);
for ($col = 0; $col < $maxval; $col++) {
$pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, 'C', 1);
}
$pdf->Ln();
function printRow($devRow, $pport, $pdf, $templ, $fill, $cellWidths, $pdu, $mfg)
{
global $fill;
$pport->DeviceID = $devRow->DeviceID;
$connList = $pport->getPorts();
$pdf->Cell($cellWidths[0], 6, $devRow->Label, 'LBRT', 0, 'L', $fill);
$pdf->Cell($cellWidths[1], 6, $devRow->SerialNo, 'LBRT', 0, 'L', $fill);
$pdf->Cell($cellWidths[2], 6, $devRow->AssetTag, 'LBRT', 0, 'L', $fill);