// library. // // Author: Alberto //============================================================+ if (isset($_GET["did"])){ // Include the main TCPDF library (search for installation path). require_once('lib/tcpdf/tcpdf_include.php'); $ip = 0; $name = 0; $description = 0; $data = 0; mactrack_report($_GET["did"]); // extend TCPF with custom functions class PDFREPORT extends TCPDF { //Page header public function Header() { // Logo $image_file = K_PATH_IMAGES.'logoUrjc.jpg'; // Image ($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()) $this->Image($image_file, 20, 15, '', '15', 'JPG', '', 'L', false, 300, '', false, false, 0, false, false, false); // Set font $this->SetFont('helvetica', 'B', 10); //Set color $this->SetColor('text',255,0,0); //Cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
$upTime = $days . "d:" . $hours . "h:" . $minutes . "m"; } } $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A'.$i, $stat["ifName"]) ->setCellValue('B'.$i, $stat["ifOperStatus"]) ->setCellValue('C'.$i, $upTime) ->setCellValue('D'.$i, mactrack_date($stat["last_rundate"])); $i++; } // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle($hostname); foreach(range('A','G') as $columnID) { $objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true); } // Redirect output to a client’s web browser (Excel2007) ob_end_clean(); ob_start(); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="'.$hostname.'.xls"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); } mactrack_report('102'); ?>