/**
  * Output the certificate PDF.
  *
  * @param array $data Certificate data.
  */
 public function output_pdf($data)
 {
     require_once dirname(__FILE__) . '/../lib/tfpdf/tfpdf.php';
     if ('L' != $data['orientation']) {
         $data['orientation'] = 'P';
     }
     $pdf = new TFPDF($data['orientation'], 'pt', $data['page_size']);
     $pdf->SetAutoPageBreak(false);
     $pdf->AddPage();
     $pdf->SetFont('helvetica', '', 12);
     $w = $data['page_size'][0];
     $h = $data['page_size'][1];
     if ('L' == $data['orientation']) {
         $w = $data['page_size'][1];
         $h = $data['page_size'][0];
     }
     $pdf->Image($data['image'], 0, 0, $w, $h, '', '');
     $search = array('{date}', '{course_title}', '{student_name}');
     $replace = array($data['date'], $data['course_title'], $data['student_name']);
     $line_height = 1.6;
     $valid_align = array('L', 'C', 'R', 'J');
     foreach ($data['blocks'] as $block) {
         $x = $block['x'];
         $y = $block['y'];
         $width = $block['width'];
         $height = $block['height'];
         $align = in_array($block['align'], $valid_align) ? $block['align'] : 'L';
         $font_size_pt = $block['font_size'];
         $line_height_mm = $font_size_pt * $line_height;
         $pdf->SetFontSize($font_size_pt);
         $pdf->SetXY($x, $y);
         $pdf->MultiCell($width, $line_height_mm, str_replace($search, $replace, $block['content']), 0, $align, false);
     }
     $pdf->Output($data['file_name'], 'I');
 }
Ejemplo n.º 2
0
                 if (empty($arboTxt)) {
                     $arboTxt = $elem->title;
                 } else {
                     $arboTxt .= " > " . $elem->title;
                 }
             }
             $pdf->cell(80, 6, $reccord['label'], 1, 0, "L");
             $pdf->cell(75, 6, $arboTxt, 1, 0, "L");
             $pdf->cell(21, 6, $_POST['date'], 1, 0, "C");
             $pdf->cell(15, 6, $reccord['login'], 1, 1, "C");
         }
     }
     list($d, $m, $y) = explode('/', $_POST['date']);
     $nomFichier = "log_followup_passwords_" . date("Y-m-d", mktime(0, 0, 0, $m, $d, $y)) . ".pdf";
     //send the file
     $pdf->Output($_SESSION['settings']['path_to_files_folder'] . '/' . $nomFichier);
     echo '[{"text":"<a href=\'' . $_SESSION['settings']['url_to_files_folder'] . '/' . $nomFichier . '\' target=\'_blank\'>' . $LANG['pdf_download'] . '</a>"}]';
     break;
     /**
      * CASE display a full listing with all items deleted
      */
 /**
  * CASE display a full listing with all items deleted
  */
 case "lister_suppression":
     //FOLDERS deleted
     $arrFolders = array();
     $texte = "<table cellpadding=3><tr><td><u><b>" . $LANG['group'] . "</b></u></td></tr>";
     $rows = DB::query("SELECT valeur, intitule\n            FROM " . prefix_table("misc") . "\n            WHERE type  = %s", "folder_deleted");
     foreach ($rows as $reccord) {
         $tmp = explode(', ', $reccord['valeur']);