$MyQuery .= ' ORDER BY EvCode, s64, s32, s16, s8, s4, s2'; //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; /*
$AccW = $pdf->getPageWidth() / 2 - 10; 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);
default: $PosX = $cntPass % 2 == 0 ? 5 : $pdf->getPageWidth() / 2 + 5; $PosY = $cntPass % 4 < 2 ? 5 : $pdf->getPageHeight() / 2 + 5; break; } $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 % $BadgePerPage == 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', 15); $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)) { 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); }
$PosX = array(6, 111, 6, 111); $PosY = array(6, 6, 155, 155); //echo $MyQuery; $Rs = safe_r_sql($MyQuery); if (safe_num_rows($Rs) > 0) { $pdf = new LabelPDF(); // 'P','mm','A4'); $pdf->AliasNbPages(); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetMargins(6, 6, 6); $pdf->SetAutoPageBreak(false, 15); $pdf->SetTextColor(0x0, 0x0, 0x0); $i = 0; while ($MyRow = safe_fetch($Rs)) { $pdf->SetFont($pdf->FontStd, 'B', 18); if ($i % 4 == 0) { $pdf->AddPage(); //Crop Mark $pdf->Line(2, 148.5, 5, 148.5); $pdf->Line(103, 148.5, 107, 148.5); $pdf->Line(205, 148.5, 208, 148.5); $pdf->Line(105, 2, 105, 5); $pdf->Line(105, 146.5, 105, 150.5); $pdf->Line(105, 292, 105, 295); } $myPosX = $PosX[$i % 4]; $myPosY = $PosY[$i % 4]; //$pdf->SetFillColor($ColorArray[$MyRow->Session-1][0],$ColorArray[$MyRow->Session-1][1],$ColorArray[$MyRow->Session-1][2]); // solo per batumi if (!is_null($MyRow->AcColor)) {
if ($MyRow->TargetNo and $NumTarget != intval($MyRow->TargetNo)) { $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);
case 'Access': if (!isset($Text)) { $txt = ''; for ($i = 0; $i < 8; $i++) { if ($MyRow->{'AcArea' . $i}) { $txt .= $i; if ($i < 2 and $MyRow->AcAreaStar) { $txt .= '*'; } $txt .= ' '; } } $Text = array(trim($txt)); } $Fill = false; $pdf->SetFont($Element->Options['FontFamily'], $Element->Options['FontStyle'], $Element->Options['Size']); 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); } foreach ($Text as $k => $txt) {
} //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);