pdf_signup.php
:
<?php
use Xmf\Request;
use XoopsModules\Tadtools\TadDataCenter;
use XoopsModules\Tad_signup\Tad_signup_actions;
use XoopsModules\Tad_signup\Tad_signup_data;
/*-----------引入檔案區--------------*/
require_once __DIR__ . '/header.php';
/*--略--*/
$TadDataCenter = new TadDataCenter('tad_signup');
$TadDataCenter->set_col('pdf_setup_id', $id);
$pdf_setup_col = $TadDataCenter->getData('pdf_setup_col', 0);
$col_arr = explode(',', $pdf_setup_col);
$col_count = count($col_arr);
if (empty($col_count)) {
$col_count = 1;
}
$h = 15;
$w = 120 / $col_count;
$maxh = 15;
$pdf->Cell(15, $h, '編號', 1, 0, 'C');
foreach ($col_arr as $col_name) {
$pdf->Cell($w, $h, $col_name, 1, 0, 'C');
}
$pdf->Cell(55, $h, '簽名', 1, 1, 'C');
$signup = Tad_signup_data::get_all($action['id'], null, true, true);
// Utility::dd($signup);
$i = 1;
foreach ($signup as $signup_data) {
$pdf->MultiCell(15, $h, $i, 1, 'C', false, 0, '', '', true, 0, false, true, $maxh, 'M');
foreach ($col_arr as $col_name) {
$pdf->MultiCell($w, $h, implode('、', $signup_data['tdc'][$col_name]), 1, 'C', false, 0, '', '', true, 0, false, true, $maxh, 'M');
}
$pdf->MultiCell(55, $h, '', 1, 'C', false, 1, '', '', true, 0, false, true, $maxh, 'M');
$i++;
}
$pdf->Output("{$title}.pdf", 'D');
$i = 1;
foreach ($signup as $signup_data) {
$pdf2 = clone $pdf;
$pdf2->SetMargins(15, 0);
$pdf2->AddPage();
$pdf2->MultiCell(15, $h, $i, 1, 'C', false, 0, '', '', true, 0, false, true, $maxh, 'M');
foreach ($col_arr as $col_name) {
$pdf2->MultiCell($w, $h, implode('、', $signup_data['tdc'][$col_name]), 1, 'C', false, 0, '', '', true, 0, false, true, $maxh, 'M');
}
$pdf2->MultiCell(55, $h, '', 1, 'C', false, 1, '', '', true, 0, false, true, $maxh, 'M');
$height = $pdf2->getY();
$pdf2->deletePage($pdf2->getPage());
$pdf->checkPageBreak($height);
$pdf->MultiCell(15, $h, $i, 1, 'C', false, 0, '', '', true, 0, false, true, $maxh, 'M');
foreach ($col_arr as $col_name) {
$pdf->MultiCell($w, $h, implode('、', $signup_data['tdc'][$col_name]), 1, 'C', false, 0, '', '', true, 0, false, true, $maxh, 'M');
}
$pdf->MultiCell(55, $h, '', 1, 'C', false, 1, '', '', true, 0, false, true, $maxh, 'M');
$i++;
}
$BarcodeStyle = array(
'border' => true,
'hpadding' => 'auto',
'vpadding' => 'auto',
'fgcolor' => array(0, 0, 0),
'bgcolor' => false, //array(255,255,255),
'text' => true,
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4,
);
$pdf->write1DBarcode('條碼內容', 'C39', $pdf->GetX(), $pdf->GetY(), 50, 16, 0.4, $BarcodeStyle, 'N');
link to https://github.com/tadlearn/tad_signup/commit/d5ba2d733007205dcafe76f1b03beb991b080b24 \
link to https://github.com/tadlearn/tad_signup/commit/d5ba2d733007205dcafe76f1b03beb991b080b24 \