コード例 #1
0
 private function makeReport()
 {
     print '<h2>' . _('FOG Hosts and Users Login') . '<a href="export.php?type=csv&filename=HostsandUsers" target="_blank"><img class="noBorder" src="images/csv.png" /></a><a href="export.php?type=pdf&filename=HostsandUsers" target="_blank"><img class="noBorder" src="images/pdf.png" /></a></h2>';
     $Hosts = $this->getClass('HostManager')->find();
     $report = new ReportMaker();
     $report->appendHTML('<table cellpadding="0" cellspacing="0" border="0" width="100%">');
     $report->appendHTML('<tr bgcolor="#BDBDBD"><td><b>Hostname</b></td><td><b>MAC</b></td><td><b>Registered</b></td></tr>');
     $report->addCSVCell('Hostname');
     $report->addCSVCell('MAC');
     $report->addCSVCell('Registered');
     $report->endCSVLine();
     $cnt = 0;
     foreach ($Hosts as $Host) {
         $bg = $cnt++ % 2 == 0 ? "#E7E7E7" : '';
         $report->appendHTML('<tr bgcolor="' . $bg . '"><td>' . $Host->get('name') . '</td><td>' . $Host->get('mac') . '</td><td>' . $Host->get('createdTime') . '</td></tr>');
         $report->addCSVCell($Host->get('name'));
         $report->addCSVCell($Host->get('mac'));
         $report->addCSVCell($Host->get('createdTime'));
         if ($Host->get('users')) {
             $report->endCSVLine();
             $report->appendHTML('<tr bgcolor="#BDBDBD"><td><b>Username</b></td><td><b>Action</b></td><td><b>Date</b></td><td><b>Time</b></td></tr>');
             $report->addCSVCell('Username');
             $report->addCSVCell('Action');
             $report->addCSVCell('Time');
             $report->endCSVLine();
             $cnt1 = 0;
             foreach ($Host->get('users') as $User) {
                 $bg1 = $cnt1++ % 2 == 0 ? "#E7E7E7" : '';
                 $logintext = $User->get('action') == 1 ? 'Login' : (!$User->get('action') ? 'Logout' : ($User->get('action') == 99 ? 'Service Start' : 'N/A'));
                 if ($logintext == 'Login' || $logintext == 'Logout') {
                     $report->appendHTML('<tr bgcolor="' . $bg1 . '"><td>' . $User->get('username') . '</td><td>' . $logintext . '</td><td>' . $User->get('date') . '</td><td>' . $User->get('datetime') . '</td></tr>');
                     $report->addCSVCell($User->get('username'));
                     $report->addCSVCell($logintext);
                     $report->addCSVCell($User->get('date'));
                     $report->addCSVCell($User->get('datetime'));
                     $report->endCSVLine();
                 }
             }
             $report->appendHTML('<table cellpadding="0" cellspacing="0" border="0" width="100%">');
             $report->appendHTML('<tr bgcolor="#BDBDBD"><td><b>Hostname</b></td><td><b>MAC</b></td><td><b>Registered</b></td></tr>');
             $report->addCSVCell('Hostname');
             $report->addCSVCell('MAC');
             $report->addCSVCell('Registered');
             $report->endCSVLine();
         } else {
             $report->endCSVLine();
         }
     }
     $report->appendHTML('</table>');
     $report->outputReport(ReportMaker::FOG_REPORT_HTML);
     $_SESSION['foglastreport'] = serialize($report);
 }
コード例 #2
0
 public function index()
 {
     $this->title = _('FOG Hosts and Users Login');
     print '<center><a href="export.php?type=csv" target="_blank"><i class="fa fa-file-excel-o fa-2x"></i></a><a href="export.php?type=pdf" target="_blank"><i class="fa fa-file-pdf-o fa-2x"></i></a></center><br/>';
     $report = new ReportMaker();
     $report->appendHTML('<table cellpadding="0" cellspacing="0" border="0" width="100%">');
     $report->appendHTML('<tr bgcolor="#BDBDBD"><td><b>Hostname</b></td><td><b>MAC</b></td><td><b>Registered</b></td></tr>');
     $report->addCSVCell('Hostname');
     $report->addCSVCell('MAC');
     $report->addCSVCell('Registered');
     $report->endCSVLine();
     $Hosts = $this->FOGCore->getClass('HostManager')->find('', '', '', '', '', 'name');
     $cnt = 0;
     foreach ($Hosts as $Host) {
         $bg = $cnt++ % 2 == 0 ? "#E7E7E7" : '';
         $report->appendHTML('<tr bgcolor="' . $bg . '"><td>' . $Host->get('name') . '</td><td>' . $Host->get('mac') . '</td><td>' . $Host->get('createdTime') . '</td></tr>');
         $report->addCSVCell($Host->get('name'));
         $report->addCSVCell($Host->get('mac'));
         $report->addCSVCell($Host->get('createdTime'));
         if ($Host->get('users')) {
             $report->endCSVLine();
             $report->appendHTML('<tr bgcolor="#BDBDBD"><td><b>Username</b></td><td><b>Action</b></td><td><b>Date</b></td><td><b>Time</b></td></tr>');
             $report->addCSVCell('Username');
             $report->addCSVCell('Action');
             $report->addCSVCell('Time');
             $report->endCSVLine();
             $cnt1 = 0;
             $Users = $this->getClass('UserTrackingManager')->find(array('hostID' => $Host->get('id'), 'action' => array(null, 0, 1)), '', array('username', 'datetime'), 'DESC', '', 'username');
             foreach ($Users as $User) {
                 if ($User->get('username') != 'Array') {
                     $bg1 = $cnt1++ % 2 == 0 ? "#E7E7E7" : '';
                     $logintext = $User->get('action') == 1 ? 'Login' : 'Logout';
                     $report->appendHTML('<tr bgcolor="' . $bg1 . '"><td>' . $User->get('username') . '</td><td>' . $logintext . '</td><td>' . $User->get('date') . '</td><td>' . $User->get('datetime') . '</td></tr>');
                     $report->addCSVCell($User->get('username'));
                     $report->addCSVCell($logintext);
                     $report->addCSVCell($User->get('date'));
                     $report->addCSVCell($User->get('datetime'));
                     $report->endCSVLine();
                 }
             }
             $report->appendHTML('<table cellpadding="0" cellspacing="0" border="0" width="100%">');
             $report->appendHTML('<tr bgcolor="#BDBDBD"><td><b>Hostname</b></td><td><b>MAC</b></td><td><b>Registered</b></td></tr>');
             $report->addCSVCell('Hostname');
             $report->addCSVCell('MAC');
             $report->addCSVCell('Registered');
             $report->endCSVLine();
         }
     }
     $report->appendHTML('</table>');
     $report->outputReport(0);
     $_SESSION['foglastreport'] = serialize($report);
 }
コード例 #3
0
 /** equip_loan_post()
 		Display the form for printing/pdf output.
 	*/
 public function equip_loan_post()
 {
     $Inventory = new Inventory($_REQUEST['user']);
     // Set title
     $this->title = _('FOG Equipment Loan Form');
     // This gets the download links for which type of file you want.
     print "\n\t\t\t\t<h2>" . '<a href="export.php?type=pdf&filename=' . $Inventory->get('primaryuser') . 'EquipmentLoanForm" alt="Export PDF" title="Export PDF" target="_blank">' . $this->pdffile . '</a></h2>';
     // Report Maker
     $ReportMaker = new ReportMaker();
     // Get the current Inventory based on what was selected.
     // Title Information
     $ReportMaker->appendHTML("<!-- " . _("FOOTER CENTER") . " \"" . '$PAGE' . " " . _("of") . " " . '$PAGES' . " - " . _("Printed") . ": " . $this->nice_date()->format("D M j G:i:s T Y") . "\" -->");
     $ReportMaker->appendHTML("<center><h2>" . _("[YOUR ORGANIZATION HERE]") . "</h2></center>");
     $ReportMaker->appendHTML("<center><h3>" . _("[sub-unit here]") . "</h3></center>");
     $ReportMaker->appendHTML("<center><h2><u>" . _("PC Check-Out Agreement") . "</u></h2></center>");
     // Personal Information
     $ReportMaker->appendHTML("<h4><u>" . _("Personal Information") . "</u></h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Name") . ": </b><u>" . $Inventory->get('primaryUser') . "</u></h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Location") . ": </b><u>" . _("Your Location Here") . "</u></h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Home Address") . ": </b>__________________________________________________________________</h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("City / State / Zip") . ": </b>__________________________________________________________________</h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Extension") . ":</b>_________________ &nbsp;&nbsp;&nbsp;<b>" . _("Home Phone") . ":</b> (__________)_____________________________</h4>");
     // Computer Information
     $ReportMaker->appendHTML("<h4><u>" . _("Computer Information") . "</u></h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Serial Number / Service Tag") . ": </b><u>" . $Inventory->get('sysserial') . " / " . $Inventory->get('caseasset') . "_____________________</u></h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Barcode Numbers") . ": </b><u>" . $Inventory->get('other1') . "   " . $Inventory->get('other2') . "</u>________________________</h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Date of Checkout") . ": </b>____________________________________________</h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Notes / Miscellaneous / Included Items") . ": </b></h4>");
     $ReportMaker->appendHTML("<h4><b>_____________________________________________________________________________________________</b></h4>");
     $ReportMaker->appendHTML("<h4><b>_____________________________________________________________________________________________</b></h4>");
     $ReportMaker->appendHTML("<h4><b>_____________________________________________________________________________________________</b></h4>");
     $ReportMaker->appendHTML("<hr />");
     $ReportMaker->appendHTML("<h4><b>" . _("Releasing Staff Initials") . ": </b>_____________________     " . _("(To be released only by XXXXXXXXX)") . "</h4>");
     $ReportMaker->appendHTML("<h4>" . _("I have read, understood, and agree to all the Terms and Condidtions on the following pages of this document.") . "</h4>");
     $ReportMaker->appendHTML("<br />");
     $ReportMaker->appendHTML("<h4><b>" . _("Signed") . ": </b>X _____________________________  " . _("Date") . ": _________/_________/20_______</h4>");
     $ReportMaker->appendHTML(_("<!-- " . _("NEW PAGE") . " -->"));
     $ReportMaker->appendHTML("<!-- " . _("FOOTER CENTER") . " \"" . '$PAGE' . " " . _("of") . " " . '$PAGES' . " - " . _("Printed") . ": " . $this->nice_date()->format("D M j G:i:s T Y") . "\" -->");
     $ReportMaker->appendHTML("<center><h3>" . _("Terms and Conditions") . "</h3></center>");
     $ReportMaker->appendHTML("<hr />");
     $ReportMaker->appendHTML("<h4>" . _("Your terms and conditions here") . "</h4>");
     $ReportMaker->appendHTML("<h4><b>" . _("Signed") . ": </b>" . _("X") . " _____________________________  " . _("Date") . ": _________/_________/20_______</h4>");
     print "\n\t\t\t<p>" . _('Your form is ready.') . '</p>';
     $_SESSION['foglastreport'] = serialize($ReportMaker);
 }