/** * 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'); }
$tree->register(); $tree = new Tree\NestedTree\NestedTree(prefix_table("nested_tree"), 'id', 'parent_id', 'title'); //Constant used $nbElements = 20; // Construction de la requ?te en fonction du type de valeur switch ($_POST['type']) { #CASE generating the log for passwords renewal case "log_generate": //Prepare the PDF file include $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Pdf/Tfpdf/tfpdf.class.php'; $pdf = new TFPDF(); //Add font for utf-8 $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true); $pdf->aliasNbPages(); $pdf->addPage(); $pdf->SetFont('DejaVu', '', 16); $pdf->Cell(0, 10, $LANG['pdf_del_title'], 0, 1, 'C', false); $pdf->SetFont('DejaVu', '', 12); $pdf->Cell(0, 10, $LANG['pdf_del_date'] . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], time()), 0, 1, 'C', false); $pdf->SetFont('DejaVu', '', 10); $pdf->SetFillColor(15, 86, 145); $pdf->cell(80, 6, $LANG['label'], 1, 0, "C", 1); $pdf->cell(75, 6, $LANG['group'], 1, 0, "C", 1); $pdf->cell(21, 6, $LANG['date'], 1, 0, "C", 1); $pdf->cell(15, 6, $LANG['author'], 1, 1, "C", 1); $pdf->SetFont('DejaVu', '', 10); $rows = DB::query("SELECT u.login as login, i.label as label, i.id_tree as id_tree\n FROM " . prefix_table("log_items") . " as l\n INNER JOIN " . prefix_table("users") . " as u ON (u.id=l.id_user)\n INNER JOIN " . prefix_table("items") . " as i ON (i.id=l.id_item)\n WHERE l.action = %s AND l.raison = %s", "Modification", "Mot de passe changé"); foreach ($rows as $reccord) { if (date($_SESSION['settings']['date_format'], $reccord['date']) == $_POST['date']) { //get the tree grid $arbo = $tree->getPath($reccord['id_tree'], true);
$tree->register(); $tree = new Tree\NestedTree\NestedTree(prefix_table("nested_tree"), 'id', 'parent_id', 'title'); //Constant used $nbElements = 20; // Construction de la requ?te en fonction du type de valeur switch ($_POST['type']) { #CASE generating the log for passwords renewal case "log_generate": //Prepare the PDF file include $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Pdf/Tfpdf/tfpdf.class.php'; $pdf = new TFPDF(); //Add font for utf-8 $pdf->AddFont('helvetica', ''); $pdf->aliasNbPages(); $pdf->addPage(); $pdf->SetFont('helvetica', '', 16); $pdf->Cell(0, 10, $LANG['pdf_del_title'], 0, 1, 'C', false); $pdf->SetFont('helvetica', '', 12); $pdf->Cell(0, 10, $LANG['pdf_del_date'] . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], time()), 0, 1, 'C', false); $pdf->SetFont('helvetica', '', 10); $pdf->SetFillColor(15, 86, 145); $pdf->cell(80, 6, $LANG['label'], 1, 0, "C", 1); $pdf->cell(75, 6, $LANG['group'], 1, 0, "C", 1); $pdf->cell(21, 6, $LANG['date'], 1, 0, "C", 1); $pdf->cell(15, 6, $LANG['author'], 1, 1, "C", 1); $pdf->SetFont('helvetica', '', 10); $rows = DB::query("SELECT u.login as login, i.label as label, i.id_tree as id_tree\n FROM " . prefix_table("log_items") . " as l\n INNER JOIN " . prefix_table("users") . " as u ON (u.id=l.id_user)\n INNER JOIN " . prefix_table("items") . " as i ON (i.id=l.id_item)\n WHERE l.action = %s AND l.raison = %s", "Modification", "Mot de passe changé"); foreach ($rows as $record) { if (date($_SESSION['settings']['date_format'], $record['date']) == $_POST['date']) { //get the tree grid $arbo = $tree->getPath($record['id_tree'], true);