if (isset($_GET["rear"])) { // if rear is specified we want the opposite of what the rack would be usually if ($frontedge == $cabinet->FrontEdge || $frontedge != $cabinet->FrontEdge) { $side = 'rear'; } else { $side = 'front'; } } else { if ($frontedge == $cabinet->FrontEdge || $frontedge != $cabinet->FrontEdge) { $side = 'front'; } else { $side = 'rear'; } } } $body .= BuildCabinet($cabinet->CabinetID, $side); } $dcID = $cabinets[0]->DataCenterID; $dc->DataCenterID = $dcID; $dc->GetDataCenterbyID(); foreach (Department::GetDepartmentListIndexedbyID() as $deptid => $d) { if ($d->DeptColor != "#FFFFFF") { // If head is empty then we don't have any custom colors defined above so add a style container for these $head = $head == "" ? "\t\t<style type=\"text/css\">\n" : $head; $head .= "\t\t\t.dept{$deptid} {background-color:{$d->DeptColor};}\n"; $legend .= "\t\t<div class=\"legenditem\"><span class=\"border colorbox dept{$deptid}\"></span> - <span>{$d->Name}</span></div>\n"; } } // If $head isn't empty then we must have added some style information so close the tag up. if ($head != "") { $head .= ' </style>';
for ($i = $currentHeight; $i > 0; $i--) { if ($i == $currentHeight) { $blankHeight = $currentHeight; $body .= "\t\t<tr><td class=\"cabpos freespace\">{$i}</td><td class=\"freespace\" rowspan={$blankHeight}> </td></tr>\n"; } else { $body .= "\t\t<tr><td class=\"cabpos freespace\">{$i}</td></tr>\n"; } } $body .= "\t</table>\n</div>\n"; reset($devList); } //END OF BuildCabinet // Generate rack view BuildCabinet(); // Generate rear rack view if needed $backside ? BuildCabinet('rear') : ''; if ($heighterr != '') { $legend .= '<div class="legenditem"><span style="background-color:' . $config->ParameterArray['CriticalColor'] . '; text-align:center" class="error colorbox border">*</span> - ' . __("Above defined rack height") . '</div>' . "\n"; } $CenterofGravity = @round($totalMoment / $totalWeight); $used = $cab->CabinetOccupancy($cab->CabinetID); @($SpacePercent = $cab->CabinetHeight > 0 ? number_format($used / $cab->CabinetHeight * 100, 0) : 0); @($WeightPercent = number_format($totalWeight / $cab->MaxWeight * 100, 0)); @($PowerPercent = number_format($totalWatts / 1000 / $cab->MaxKW * 100, 0)); $measuredWatts = $pdu->GetWattageByCabinet($cab->CabinetID); @($MeasuredPercent = number_format($measuredWatts / 1000 / $cab->MaxKW * 100, 0)); $CriticalColor = $config->ParameterArray["CriticalColor"]; $CautionColor = $config->ParameterArray["CautionColor"]; $GoodColor = $config->ParameterArray["GoodColor"]; if ($SpacePercent > 100) { $SpacePercent = 100;
$legend .= "\t\t<div class=\"legenditem hide\"><span class=\"reserved colorbox border\"></span> - " . __("Reservation") . "</div>\n"; } if ($config->ParameterArray["FreeSpaceColor"] != "#FFFFFF") { $legend .= '<div class="legenditem"><span class="freespace colorbox border"></span> - ' . __("Free Space") . '</div>' . "\n"; } } $noOwnerFlag = false; $noTemplFlag = false; $noReservationFlag = false; $backside = true; // This function with no argument will build the front cabinet face. Specify // rear and it will build the back. // Generate rack view $body .= BuildCabinet($cab->CabinetID); // Generate rear rack view if needed $body .= $backside ? BuildCabinet($cab->CabinetID, 'rear') : ''; $legend .= '<div class="legenditem hide"><span style="background-color:' . $config->ParameterArray['CriticalColor'] . '; text-align:center" class="error colorbox border">*</span> - ' . __("Above defined rack height") . '</div>' . "\n"; $CenterofGravity = @round($totalMoment / $totalWeight); $used = $cab->CabinetOccupancy($cab->CabinetID); @($SpacePercent = $cab->CabinetHeight > 0 ? number_format($used / $cab->CabinetHeight * 100, 0) : 0); @($WeightPercent = number_format($totalWeight / $cab->MaxWeight * 100, 0)); @($PowerPercent = number_format($totalWatts / 1000 / $cab->MaxKW * 100, 0)); $measuredWatts = $pdu->GetWattageByCabinet($cab->CabinetID); @($MeasuredPercent = number_format($measuredWatts / 1000 / $cab->MaxKW * 100, 0)); $CriticalColor = $config->ParameterArray["CriticalColor"]; $CautionColor = $config->ParameterArray["CautionColor"]; $GoodColor = $config->ParameterArray["GoodColor"]; if ($SpacePercent > 100) { $SpacePercent = 100; } if ($WeightPercent > 100) {
foreach ($cabList as $cabinet) { $dev->Cabinet = $cabinet->CabinetID; $devList = $dev->ViewDevicesByCabinet(); $currentHeight = $cabinet->CabinetHeight; $cab_color = get_cabinet_owner_color($cabinet, $deptswithcolor); if ($config->ParameterArray["ReservedColor"] != "#FFFFFF" || $config->ParameterArray["FreeSpaceColor"] != "#FFFFFF") { $head .= ".reserved{background-color: {$config->ParameterArray['ReservedColor']};}\n"; $head .= ".freespace{background-color: {$config->ParameterArray['FreeSpaceColor']};}\n"; } // build out the front and rear of the cabinet // these directly alter the $body variable // wrap it all in a table so both sides of a cabinet get on the same page $body .= "<table style=\"border:0px;\" width=\"100%\"><tr><td width=\"50%\" align=\"center\">"; BuildCabinet(); $body .= "</td><td width=\"50%\" align=\"center\">"; BuildCabinet("rear"); $body .= "</td></tr></table>"; } // Done with for each loop of cabinets if (!empty($deptswithcolor)) { foreach ($deptswithcolor as $deptid => $row) { $deptcolorheadstyle = ".dept{$deptid} {background-color: {$row['color']};}\n"; $head .= "table thead td{$deptcolorheadstyle}\n"; $head .= $deptcolorheadstyle . "\n"; } } $head .= "</style>\n"; $reportHead = $head; $reportHTML = $body; // generate the report using the template include 'template_mpdf_reports.inc.php';