$pdf->SetFont($config->ParameterArray['PDFfont'], '', 8);
$pdf->SetFillColor(0, 0, 0);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(128, 0, 0);
$pdf->SetLineWidth(0.3);
$pdf->SetfillColor(224, 235, 255);
$pdf->SetTextColor(0);
$pdf->Bookmark('Departments');
$deptList = $dept->GetDepartmentList();
$VM = new ESX();
$vmList = $VM->GetInventory();
$vmCount = count($vmList);
$pdf->Cell(80, 5, __("Total Number of VMs"));
$pdf->Cell(0, 5, $vmCount);
$pdf->Ln();
$vmList = $VM->GetOrphanVMList();
$vmCount = 0;
$pdf->Cell(80, 12, __("Virtual Machines Unassigned to a Department"));
$pdf->Ln();
$headerTags = array(__("Index"), __("Virtual Machine Image Name"), __("Current Host Server"));
$cellWidths = array(10, 80, 80);
$maxval = count($headerTags);
for ($col = 0; $col < $maxval; $col++) {
    $pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, 'C', 1);
}
$pdf->Ln();
$fill = 0;
$lastDevice = 0;
foreach ($vmList as $esxRow) {
    if ($esxRow->DeviceID != $lastDevice) {
        $dev->DeviceID = $esxRow->DeviceID;
Exemple #2
0
} catch (Swift_RfcComplianceException $e) {
    $error .= __("MailFrom") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Add people to recipient list
try {
    $message->setTo($config->ParameterArray['MailToAddr']);
    /* // Add additional recipients below this section using the following examples
     * // Using addTo() to add recipients iteratively
     * $message->addTo('*****@*****.**');
     * $message->addTo('*****@*****.**', 'Person 2 Name');
     */
} catch (Swift_RfcComplianceException $e) {
    $error .= __("Data center team address") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Send email about Virtual Machines that don't have owners assigned
$esxList = $esx->GetOrphanVMList();
if (count($esxList) > 0) {
    $esxCount = count($esxList);
    $htmlMessage = "<html>\n\t\t\t<head>\n\t\t\t   <title>" . __("Virtual Machine Inventory Exception Report") . "</title>\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t<p>" . __("This is an automated message from the") . " {$config->ParameterArray["OrgName"]} " . __("Inventory\n\t\t\tProcess.  This process is scheduled to run once each business day.</p>\n\t\t\t<p>The following") . " {$esxCount} " . __("Virtual Machines were detected in the environment\n\t\t\tand do not have an associated owner record.  It is assumed that\n\t\t\tthese are new Virtual Machines.  Please click on the links below to update\n\t\t\townership information.") . "</p>\n\t\t\t<p>" . __("If the appropriate department is not listed as an option for ownership, please\n\t\t\tsend an email to") . " {$config->ParameterArray["FacMgrMail"]} " . __("to have it added.") . "</p>\n\t\t\t<p>\n\t\t\t<table width=\"100%\" border=\"1\" padding=\"0\" bgcolor=white>\n\t\t\t<tr><td>" . __("Server Name") . "</td><td>" . __("VM Name") . "</td><td>" . __("Status") . "</td><td>" . __("Last Updated") . "</td></tr>";
    foreach ($esxList as $esxRow) {
        $dev->DeviceID = $esxRow->DeviceID;
        $dev->GetDevice();
        $dept->DeptID = $esxRow->Owner;
        if ($dept->DeptID > 0) {
            $dept->GetDeptByID();
        } else {
            $dept->Name = __("Unknown");
        }
        $htmlMessage .= "<tr><td>{$dev->Label}</td><td><a href=\"" . $config->ParameterArray['InstallURL'] . "updatevmowner.php?vmindex={$esxRow->VMIndex}" . "\">{$esxRow->vmName}</a></td><td>{$esxRow->vmState}</td><td>{$esxRow->LastUpdated}</td></tr>\n";
    }
    $htmlMessage .= "</table></body></html>";