Exemplo n.º 1
0
 /**
  * Print generic footer
  *
  * @param $type   display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
  * @param $title  title of file : used for PDF (default '')
  *
  * @return string to display
  **/
 static function showFooter($type, $title = "")
 {
     $out = "";
     switch ($type) {
         case self::PDF_OUTPUT_LANDSCAPE:
             //pdf
         //pdf
         case self::PDF_OUTPUT_PORTRAIT:
             global $PDF_TABLE;
             if ($type == self::PDF_OUTPUT_LANDSCAPE) {
                 $pdf = new GLPIPDF('L', 'mm', 'A4', true, 'UTF-8', false);
             } else {
                 $pdf = new GLPIPDF('P', 'mm', 'A4', true, 'UTF-8', false);
             }
             $pdf->SetCreator('GLPI');
             $pdf->SetAuthor('GLPI');
             $pdf->SetTitle($title);
             $pdf->SetHeaderData('', '', $title, '');
             $font = 'helvetica';
             //$subsetting = true;
             $fonsize = 8;
             if (isset($_SESSION['glpipdffont']) && $_SESSION['glpipdffont']) {
                 $font = $_SESSION['glpipdffont'];
                 //$subsetting = false;
             }
             $pdf->setHeaderFont(array($font, 'B', 8));
             $pdf->setFooterFont(array($font, 'B', 8));
             //set margins
             $pdf->SetMargins(10, 15, 10);
             $pdf->SetHeaderMargin(10);
             $pdf->SetFooterMargin(10);
             //set auto page breaks
             $pdf->SetAutoPageBreak(TRUE, 15);
             // For standard language
             //$pdf->setFontSubsetting($subsetting);
             // set font
             $pdf->SetFont($font, '', 8);
             $pdf->AddPage();
             $PDF_TABLE .= '</table>';
             $pdf->writeHTML($PDF_TABLE, true, false, true, false, '');
             $pdf->Output('glpi.pdf', 'I');
             break;
         case self::SYLK_OUTPUT:
             //sylk
             global $SYLK_HEADER, $SYLK_ARRAY, $SYLK_SIZE;
             // largeurs des colonnes
             foreach ($SYLK_SIZE as $num => $val) {
                 $out .= "F;W" . $num . " " . $num . " " . min(50, $val) . "\n";
             }
             $out .= "\n";
             // Header
             foreach ($SYLK_HEADER as $num => $val) {
                 $out .= "F;SDM4;FG0C;" . ($num == 1 ? "Y1;" : "") . "X{$num}\n";
                 $out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n";
                 $out .= "\n";
             }
             // Datas
             foreach ($SYLK_ARRAY as $row => $tab) {
                 foreach ($tab as $num => $val) {
                     $out .= "F;P3;FG0L;" . ($num == 1 ? "Y" . $row . ";" : "") . "X{$num}\n";
                     $out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n";
                 }
             }
             $out .= "E\n";
             break;
         case self::CSV_OUTPUT:
             //csv
             break;
         default:
             $out = "</table></div>\n";
     }
     return $out;
 }