//print $MyQuery;exit; $Rs = safe_r_sql($MyQuery); if ($Rs) { $Etichetta = 0; while ($MyRow = safe_fetch($Rs)) { if ($Etichetta == 0) { $pdf->AddPage(); } //Cerchia Etichetta // $pdf->Rect($pageMarginL+(($Etichetta % $Label4Column) * ($lblW+$lblSpaceH)),$pageMarginT+(intval($Etichetta / $Label4Column) * ($lblH+$lblSpaceV)),$lblW,$lblH,"D"); $pdf->SetXY(0, 0); $pdf->SetLeftMargin($pageMarginL + $lblMarginH + $Etichetta % $Label4Column * ($lblW + $lblSpaceH)); $pdf->SetTopMargin($pageMarginT + $lblMarginV + intval($Etichetta / $Label4Column) * ($lblH + $lblSpaceV)); //Piazzola, Turno & Classe.Divisione $pdf->SetFont($pdf->FontStd, 'B', 20); $pdf->Cell(0.25 * ($lblW - 2 * $lblMarginH), 8, $MyRow->IndRank, 0, 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->SetXY($pdf->GetX() - 3, $pdf->GetY() + 2); $pdf->Cell(0.35 * ($lblW - 2 * $lblMarginH), 7, get_text('Score', 'Tournament') . ': ' . $MyRow->QuScore, 0, 0, 'C', 0); $pdf->Cell(0.4 * ($lblW - 2 * $lblMarginH), 6, $MyRow->EvCode, 0, 1, 'R', 0); //Arciere & Società $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->Cell($lblW - 2 * $lblMarginH, 6, $MyRow->FirstName . ' ' . $MyRow->Name, 0, 1, 'L', 0); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(0.3 * $lblW - 2 * $lblMarginH, 5, $MyRow->NationCode, 0, 0, 'L', 0); // stampa l'elenco delle piazzole a cui dovrà andare... $tgts = array(); $pos = array(); $n = 2; /* * il ?: mi serve perchè 48*2>64 e 24*2>32 e non riuscirei a fare la prima fase se parto dai 1/48 o dai 1/24.
while ($MyRow = safe_fetch($Rs)) { $pdf->SetDefaultColor(); $PosX = $cntPass % 2 == 0 ? 5 : $pdf->getPageWidth() / 2 + 5; $PosY = $cntPass % 6 < 2 ? 5 : ($cntPass % 6 < 4 ? $pdf->getPageHeight() / 3 + 5 : $pdf->getPageHeight() * 2 / 3 + 5); $AccColor = array(255, 255, 255); if (!is_null($MyRow->AcColor)) { $AccColor = array(base_convert(substr($MyRow->AcColor, 0, 2), 16, 10), base_convert(substr($MyRow->AcColor, 2, 2), 16, 10), base_convert(substr($MyRow->AcColor, 4, 2), 16, 10)); } //Every 4 Accreditation I change page if ($cntPass % 6 == 0) { $pdf->AddPage(); } //PRIMA Area dell'accredito: Logo SX e Nome/Country + sfondo colore - Altezza 6/20 (ne restano 14/20)) $pdf->SetXY($PosX, $PosY); $pdf->SetFont('', 'B', 12); $pdf->Cell($AccW, $AccH * 0.05, $pdf->Name, 0, 0, 'C', 0); $pdf->Rect($PosX, $PosY + $AccH * 0.05, $AccW, $AccH * 0.2, 'F', array(), $AccColor); $tmpX = $PosX + 2; if (!is_null($ImgSxSize)) { //Immagine Sinistra if ($ImgSxSize[0] / $ImgSxSize[1] <= ($AccW * 0.4 - 4) / ($AccH * 0.2 - 4)) { //Immagine troppo larga $pdf->Image($pdf->ToPaths['ToLeft'], $tmpX, $PosY + $AccH * 0.05 + 2, 0, $AccH * 0.2 - 4); } else { $pdf->Image($pdf->ToPaths['ToLeft'], $tmpX, $PosY + $AccH * 0.05 + ($AccW * 0.4 - 4) / $ImgSxSize[0] * $ImgSxSize[1] / 2 / $pdf->getScaleFactor(), $AccW * 0.4 - 4, 0); } $tmpX = $pdf->getImageRBX() + 2; } if ($MyRow->AcTitleReverse) { $pdf->SetTextColor(255); }
$MyQuery .= "ORDER BY AtTargetNo, CoCode, Name, CoName, FirstName "; $Rs = safe_r_sql($MyQuery); if ($Rs) { $Etichetta = 0; while ($MyRow = safe_fetch($Rs)) { if ($Etichetta == 0) { $pdf->AddPage(); } //Cerchia Etichetta //$pdf->Rect($pageMarginL+(($Etichetta % $Label4Column) * ($lblW+$lblSpaceH)),$pageMarginT+(intval($Etichetta / $Label4Column) * ($lblH+$lblSpaceV)),$lblW,$lblH,"D"); $pdf->SetXY(0, 0); $pdf->SetLeftMargin($pageMarginL + $lblMarginH + $Etichetta % $Label4Column * ($lblW + $lblSpaceH)); $pdf->SetTopMargin($pageMarginT + $lblMarginV + intval($Etichetta / $Label4Column) * ($lblH + $lblSpaceV)); //Piazzola, Turno & Classe.Divisione $pdf->SetFont($pdf->FontStd, 'B', 20); $pdf->Cell(0.25 * ($lblW - 2 * $lblMarginH), 8, $MyRow->TargetNo, 0, 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->SetXY($pdf->GetX(), $pdf->GetY() + 2); $pdf->Cell(0.35 * ($lblW - 2 * $lblMarginH), 6, get_text('Session') . ": " . $MyRow->Session, 0, 0, 'C', 0); $pdf->Cell(0.4 * ($lblW - 2 * $lblMarginH), 6, $MyRow->DivCode . ' ' . $MyRow->ClassCode, 0, 1, 'R', 0); //Arciere & Società $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->Cell($lblW - 2 * $lblMarginH, 6, $MyRow->FirstName . ' ' . $MyRow->Name, 0, 1, 'L', 0); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell($lblW - 2 * $lblMarginH, 5, $MyRow->NationCode . " - " . $MyRow->Nation, 0, 1, 'L', 0); //Barcode if ($printBarcode) { $pdf->SetFont('barcode', '', 28); $pdf->Cell($lblW - 2 * $lblMarginH, 10, mb_convert_encoding('*$' . $MyRow->EnId, "UTF-8", "cp1252") . "*", 0, 0, 'C', 0); } /*
$pdf->SetFillColor(base_convert(substr($MyRow->AcColor, 0, 2), 16, 10), base_convert(substr($MyRow->AcColor, 2, 2), 16, 10), base_convert(substr($MyRow->AcColor, 4, 2), 16, 10)); } else { $pdf->SetFillColor(255, 255, 255); } $pdf->SetDrawColor(0x0, 0x0, 0x0); // riquadro colore $pdf->Rect($myPosX, $myPosY, 93, 93, 'F'); // $pdf->Rect($myPosX, $myPosY, 93, 20, 'F'); // $pdf->Rect($myPosX, $myPosY+20, 93, 10, 'F'); // $pdf->Rect($myPosX, $myPosY+65, 93, 10, 'F'); // $pdf->Rect($myPosX, $myPosY+85, 93, 10, 'F'); // bordo $pdf->Rect($myPosX, $myPosY, 93, 136, 'D'); //Header $pdf->SetXY($myPosX, $myPosY + 7.5); $pdf->Cell(93, 6, $rowInfo->ToName, 0, 1, 'C', 0); $pdf->SetFont($pdf->FontStd, 'I', 8); $pdf->SetX($myPosX); $pdf->Cell(93, 6, $rowInfo->ToWhere . ', ' . TournamentDate2String($rowInfo->DtFrom, $rowInfo->DtTo), 0, 1, 'C', 2); $pdf->SetDrawColor(0x99, 0x0, 0x0); if (!is_null($MyRow->PhPhoto)) { $im = imagecreatefromstring(base64_decode($MyRow->PhPhoto)); $height = imagesy($im) * 20 / imagesx($im); imagedestroy($im); $pdf->Image('@' . base64_decode($MyRow->PhPhoto), $myPosX + 36.5, $pdf->GetY() + 5, 20, 0); $pdf->Rect($myPosX + 36.5, $pdf->GetY() + 5, 20, $height, 'D'); } //Matricola if (is_null($MyRow->PhPhoto) && $MyRow->AcIsAthlete == 1) { $pdf->SetXY($myPosX + 5, $myPosY + 30); } else {
if ($Rs) { $Etichetta = 0; while ($MyRow = safe_fetch($Rs)) { if ($Etichetta == 0) { $pdf->AddPage(); } //Cerchia Etichetta //$pdf->Rect((($Etichetta % 3) * $lblW),(intval($Etichetta / 3) * $lblH),$lblW,$lblH,"D"); //Status if ($MyRow->Status > 1) { $pdf->Rect($Etichetta % 3 * $lblW + 4, intval($Etichetta / 3) * $lblH + 4, $lblW - 8, $lblH - 10 * $lblSp, "FD"); } //Piazzola, Turno & Classe.Divisione $pdf->SetXY($Etichetta % 3 * $lblW + 5, intval($Etichetta / 3) * $lblH + 2 * $lblSp); $pdf->SetFont($pdf->FontStd, 'B', 20); $pdf->Cell(15, 8, $MyRow->TargetNo, 0, 0, 'L', 0); $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->SetXY($pdf->GetX(), intval($Etichetta / 3) * $lblH + 3 * $lblSp); $pdf->Cell(25, 6, get_text('Session') . ": " . $MyRow->Session, 0, 0, 'C', 0); $pdf->Cell($lblW - 50, 6, $MyRow->DivCode . ' ' . $MyRow->ClassCode, 0, 0, 'R', 0); //Arciere & Società $pdf->SetXY($Etichetta % 3 * $lblW + 5, intval($Etichetta / 3) * $lblH + 6 * $lblSp); $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->Cell($lblW - 10, 6, $MyRow->FirstName . ' ' . $MyRow->Name, 0, 0, 'L', 0); $pdf->SetXY($Etichetta % 3 * $lblW + 5, intval($Etichetta / 3) * $lblH + 9 * $lblSp); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell($lblW - 10, 5, $MyRow->NationCode . " - " . $MyRow->Nation, 0, 0, 'L', 0); //Barcode $pdf->SetXY($Etichetta % 3 * $lblW + 5, intval($Etichetta / 3) * $lblH + 12 * $lblSp); $pdf->SetFont('barcode', '', 28); $pdf->Cell($lblW - 10, 10, mb_convert_encoding('*$' . $MyRow->EnId, "UTF-8", "cp1252") . "*", 0, 0, 'C', 0);
$TargetToPrint = $NumTarget . '-' . $Indices[ceil(intval($MyRow->TargetNo) / $NumEnd) - 2]; } if ($CurrentTarget != $MyRow->Session . $MyRow->TargetNo) { $Etichetta = ++$Etichetta % 12; $NewTarget = true; } $CurrentTarget = $MyRow->Session . $MyRow->TargetNo; if ($Etichetta == 0 && $NewTarget) { $pdf->AddPage(); } if ($NewTarget) { $aths = $ath4target; $CurHeight = $CellHeight; $pdf->SetXY($Etichetta % 3 * 70 + 5, intval($Etichetta / 3) * ($BlockHeight + 5) + 5); $pdf->SetFont($pdf->FontStd, 'B', 25); $pdf->Cell(60, $CurHeight, $TargetToPrint, 1, 0, 'C', 1); $pdf->SetFont($pdf->FontStd, 'B', 20); //for($i=1; $i<=$MyRow->{"ToAth4Target" . $MyRow->Session}; $i++) for ($i = 1; $i <= $aths; $i++) { $pdf->SetXY($Etichetta % 3 * 70 + 5, intval($Etichetta / 3) * ($BlockHeight + 5) + 5 + $i * $CurHeight); $pdf->Cell(20, $CurHeight, chr(ord("A") - 1 + $i), '1', 0, 'C', 0, '', 1, '', '', 'T'); $pdf->Cell(40, $CurHeight, '', '1', 0, 'C'); } $NewTarget = false; } $pdf->SetXY($Etichetta % 3 * 70 + 5, intval($Etichetta / 3) * ($BlockHeight + 5) + 5 + (ord($MyRow->BackNo) - ord("A") + 1) * $CurHeight + 0.6 * $CurHeight); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(20, 0.4 * $CurHeight, $MyRow->FirstName, 0, 0, 'C', 0); } safe_free_result($Rs); }
if (!empty($PdfData->Data['Items'])) { foreach ($PdfData->Data['Items'] as $Entry) { if (!$Entry->Athlete) { continue; } if ($Etichetta == 0) { $pdf->AddPage(); } //Cerchia Etichetta // $pdf->Rect($pageMarginL+(($Etichetta % $Label4Column) * ($lblW+$lblSpaceH)),$pageMarginT+(intval($Etichetta / $Label4Column) * ($lblH+$lblSpaceV)),$lblW,$lblH,"D"); $pdf->SetXY(0, 0); $pdf->SetLeftMargin($pageMarginL + $lblMarginH + $Etichetta % $Label4Column * ($lblW + $lblSpaceH)); $pdf->SetTopMargin($pageMarginT + $lblMarginV + intval($Etichetta / $Label4Column) * ($lblH + $lblSpaceV)); //Piazzola, Turno & Classe.Divisione $pdf->SetFont($pdf->FontStd, 'B', 20); $pdf->Cell(17, 8, ltrim($Entry->TargetNo, '0'), 0, 0, 'C', 0); $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->SetX($pdf->GetX() + 1); $pdf->Cell(22, 8, $Entry->SesName, 0, 0, 'C', 0, '', '1', false, 'T', 'B'); $pdf->SetX($pdf->GetX() + 1); $pdf->SetFont($pdf->FontStd, '', 10); $X = $pdf->GetX(); $Y = $pdf->GetY(); $pdf->Cell($lblW - 2 * $lblMarginH - 41, 4, $Entry->DivDescription, 0, 1, 'R', 0, '', '1', false, 'T', 'T'); $pdf->SetXY($X, $Y + 4); $pdf->Cell($lblW - 2 * $lblMarginH - 41, 4, $Entry->ClDescription . ' ' . intval($Entry->SubClass), 0, 1, 'R', 0, '', '1', false, 'T', 'B'); //Arciere & Società $pdf->SetFont($pdf->FontStd, 'B', 12); $pdf->Cell($lblW - 2 * $lblMarginH - 10, 6, $Entry->Athlete, 0, 0, 'L', 0); $pdf->SetFont($pdf->FontStd, '', 10); $pdf->SetX($pdf->GetX() + 1);
if (!empty($Element->Options['BackCat'])) { $pdf->SetFillColor(hexdec(substr($MyRow->AcColor, 0, 2)), hexdec(substr($MyRow->AcColor, 2, 2)), hexdec(substr($MyRow->AcColor, 4, 2))); $Fill = true; } elseif ($Element->Options['BackCol']) { $pdf->SetFillColor(hexdec(substr($Element->Options['BackCol'], 1, 2)), hexdec(substr($Element->Options['BackCol'], 3, 2)), hexdec(substr($Element->Options['BackCol'], 5, 2))); $Fill = true; } if (!empty($Element->Options['BackCat']) and $MyRow->AcTitleReverse) { $pdf->setColor('text', 255, 255, 255); } elseif ($Element->Options['Col']) { $pdf->setColor('text', hexdec(substr($Element->Options['Col'], 1, 2)), hexdec(substr($Element->Options['Col'], 3, 2)), hexdec(substr($Element->Options['Col'], 5, 2))); } else { $pdf->setColor('text', 0, 0, 0); } $pdf->SetXY($ElX, $ElY + $k * $Element->Options['H']); $pdf->Cell($Element->Options['W'], $Element->Options['H'], '', '', true, '', $Fill); $TotW = 0; $TotAc = 0; if ($MyRow->AcTransport) { $TotW += $AcTransport['size'][$MyRow->AcTransport][0]; $TotAc++; } if ($MyRow->AcAccomodation) { $TotW += $AcAccomodation[0]; $TotAc++; } if ($MyRow->AcMeal) { $TotW += $AcMeal[0]; $TotAc++; } // now we know the total width of the original images...
//Every X Accreditation I change page if ($cntPass % $CardsPerPage == 0) { $pdf->AddPage(); } // Image Left if ($pdf->ToPaths['ToLeft']) { $pdf->Image($pdf->ToPaths['ToLeft'], $PosX + 2, $PosY + 2, 0, $ImgLHeight); } // Image Right if ($pdf->ToPaths['ToRight']) { $pdf->Image($pdf->ToPaths['ToRight'], $PosX + $AccW - $ImgRWidth - 2, $PosY + 2, 0, $ImgRHeight); } // Competition $pdf->SetXY($PosX + $ImgLWidth + 4, $PosY + 2); $pdf->SetFont('', 'B', 12); $pdf->Cell($AccW - $ImgLWidth - $ImgRWidth - 8, 7, $pdf->Name, 0, 0, 'C', 0); $pdf->SetXY($PosX + $ImgLWidth + 4, $PosY + 9); //Luogo $pdf->SetFont('', '', 7); $pdf->Cell($AccW - $ImgLWidth - $ImgRWidth - 8, 5, $pdf->Where . ", " . TournamentDate2String($pdf->WhenF, $pdf->WhenT), 0, 0, 'C', 0); // Category $pdf->SetFont('', 'BI', 16); //SE atleta --> Classe e Divisione $pdf->SetXY($PosX + 2, $PosY + 19); $pdf->Cell($AccW - 4, 0, get_text($MyRow->DivDescription, '', '', true), 0, 0, 'C', 0); $pdf->SetXY($PosX + 2, $PosY + 27); $pdf->Cell($AccW - 4, 0, get_text($MyRow->ClDescription, '', '', true), 0, 0, 'C', 0); $pdf->SetFont('', 'B', 20); //Cognome e Nome $pdf->SetXY($PosX + 2, $PosY + 39); $pdf->Cell($AccW - 4, 0, $MyRow->FirstName . ' ' . $MyRow->Name, 0, 0, 'C', 0);