} //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); } $pdf->SetFont('', 'B', 16); //Cognome e Nome $pdf->SetXY($tmpX, $PosY + $AccH * 0.08); $pdf->Cell($AccW + 2 - $tmpX - $PosX, $AccH * 0.07000000000000001, $MyRow->FirstName, 0, 0, 'C', 0); $pdf->SetXY($tmpX, $PosY + $AccH * 0.15); $pdf->Cell($AccW + 2 - $tmpX - $PosX, $AccH * 0.07000000000000001, $MyRow->Name, 0, 0, 'C', 0); $pdf->SetDefaultColor();
// $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 { $pdf->SetXY($myPosX + 5, $myPosY + 43); } //+$height); $pdf->SetFont($pdf->FontStd, 'I', 12); $pdf->Cell(30, 3, get_text('Code', 'Tournament'), 0, 1, 'L', 0); //$pdf->SetX($pdf->GetX()+5); //$pdf->Cell(30 , 3, 'Padiglione Fiera', 0, 1, 'L', 0); $pdf->SetX($myPosX + 5); $pdf->SetFont($pdf->FontStd, 'B', 12);
} while ($MyRow = safe_fetch($Rs)) { $pdf->SetDefaultColor(); $PosX = $XOffset[$cntPass % $CardsPerWidth] + 5; $PosY = $YOffset[$cntPass % $CardsPerPage] + 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 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);
} $Elements[] = $r; } while ($MyRow = safe_fetch($Rs)) { $pdf->SetDefaultColor(); if ($cntPass == 0) { $tmp = $pdf->addPage(); } $StartX = $Badges[$cntPass][0]; $StartY = $Badges[$cntPass][1]; if ($BackGround->IcBackground and file_exists($Back = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-Accreditation.jpg')) { // unset($BackGround->IcBackground); // debug_svela($BackGround); $ElX = $StartX + $BackGround->Options['IdBgX']; $ElY = $StartY + $BackGround->Options['IdBgY']; $pdf->Image($Back, $ElX, $ElY, $BackGround->Options['IdBgW'], $BackGround->Options['IdBgH']); } foreach ($Elements as $Element) { unset($Text); $ElX = $StartX + $Element->Options['X']; $ElY = $StartY + $Element->Options['Y']; switch ($Element->IceType) { case 'ToLeft': case 'ToRight': case 'ToBottom': $pdf->Image($pdf->ToPaths[$Element->IceType], $ElX, $ElY, $Element->Options['W'], $Element->Options['H']); break; case 'Picture': if (file_exists($im = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-En-' . $MyRow->EnId . '.jpg')) { $pdf->Image($im, $ElX, $ElY, $Element->Options['W'], $Element->Options['H']); }
$MySQL = "select" . " PhEnId, concat(CoCode, ' (', EnCode, '-', EnFirstName, ')') code " . "from" . " Photos" . " inner join Entries on EnId=PhEnId " . " inner join Countries on EnCountry=CoId " . " left join Qualifications on EnId=QuId " . "where" . " EnTournament={$_SESSION['TourId']} " . (isset($_REQUEST["Session"]) && is_numeric($_REQUEST["Session"]) ? " AND SUBSTRING(QuTargetNo,1,1) = " . StrSafe_DB($_REQUEST["Session"]) . " " : '') . " and PhPhoto>'' order by code"; $q = safe_r_sql($MySQL); $pdf->addpage(); $NumCols = floor(($PaperWidth - 2 * $MarLeftRight) / max(1, $StickCols)); $HGap = ($PaperWidth - 2 * $MarLeftRight - $NumCols * $StickCols) / ($NumCols - 1); $NumRows = floor(($PaperHeight - $MarTop - $MarTop) / max(1, $StickRows + 3)); $VGap = ($PaperHeight - $MarTop - $MarTop - $NumRows * ($StickRows + 3)) / ($NumRows - 1); $X = $MarLeftRight; $Y = $MarTop; $pdf->SetFontSize(7); error_reporting(E_ALL); while ($r = safe_fetch($q)) { if (!is_file($file = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-En-' . $r->PhEnId . '.jpg')) { continue; } $pdf->Image($file, $X, $Y, $StickCols, $StickRows, 'JPG', '', '', true, 300, '', false, false, 1, true); $pdf->setXY($X, $Y + $StickRows); $pdf->cell($StickCols, 3, $r->code, '', '', 'C', '', '', 1); $X += $StickCols + $HGap; if ($X + $StickCols > $PaperWidth) { $X = $MarLeftRight; $Y += $StickRows + $VGap + 3; if ($Y + $StickRows > $PaperHeight) { $Y = $MarTop; $pdf->addpage(); } } } } else { $lblW = $pdf->GetPageWidth() / 3; $lblH = $pdf->GetPageHeight() / 8;