$ImgDxSize = NULL; $ImgLowSize = NULL; if (!empty($pdf->ToPaths['ToLeft'])) { $ImgSxSize = getimagesize($pdf->ToPaths['ToLeft']); } if (!empty($pdf->ToPaths['ToRight'])) { $ImgDxSize = getimagesize($pdf->ToPaths['ToRight']); } if (!empty($pdf->ToPaths['ToBottom'])) { $ImgLowSize = getimagesize($pdf->ToPaths['ToBottom']); } if (is_file($file = $CFG->DOCUMENT_PATH . 'TV/Photos/TV-' . $_SESSION["TourCodeSafe"] . '-IdCardFooter.jpg')) { $pdf->ToPaths['ToBottom'] = $file; $ImgLowSize = getimagesize($pdf->ToPaths['ToBottom']); } $AccH = $pdf->getPageHeight() / 3 - 10; $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);
if (CheckTourSession()) { $pdf = new LabelPDF(); $ath4target = 0; $ses = GetSessions('Q'); foreach ($ses as $s) { $ath4target = max($ath4target, $s->SesAth4Target); } $MyQuery = "SELECT EnName AS Name, EnFirstName AS FirstName, SUBSTRING(ElTargetNo,1,1) AS Session, SUBSTRING(ElTargetNo,2,2) AS TargetNo, SUBSTRING(ElTargetNo,-1,1) AS BackNo " . " FROM Eliminations AS q " . " INNER JOIN Entries AS e ON q.ElId=e.EnId AND EnAthlete=1 " . " INNER JOIN Countries AS c ON e.EnCountry=c.CoId AND e.EnTournament=c.CoTournament " . " LEFT JOIN Session ON ElSession=SesOrder AND ElTournament=SesTournament AND SesType='E' " . " WHERE EnTournament = " . StrSafe_DB($_SESSION['TourId']) . ' ' . (!(empty($_REQUEST['x_From']) && empty($_REQUEST['x_To'])) ? " AND ElTargetNo>='" . str_pad($_REQUEST['x_From'], '3', '0', STR_PAD_LEFT) . "A' AND ElTargetNo<='" . str_pad($_REQUEST['x_To'], '3', '0', STR_PAD_LEFT) . "Z' AND ElElimPhase= " . $_REQUEST['x_Session'] . " " : "") . (!empty($_REQUEST['x_ElimSession']) ? " AND ElSession=" . $_REQUEST['x_ElimSession'] . " " : "") . ' ORDER BY ElSession, SesOrder, ElElimPhase, ElTargetNo ASC, EnFirstName, EnName, CoCode'; //echo $MyQuery;exit; $Rs = safe_r_sql($MyQuery); if ($Rs) { $Etichetta = -1; $CurrentTarget = 0; $NewTarget = true; $CurHeight = 0; $BlockHeight = ($pdf->getPageHeight() - 30) / 4; $CellHeight = $BlockHeight / ($ath4target + 1); while ($MyRow = safe_fetch($Rs)) { $NumEnd = $MyRow->Session == 0 ? 12 : 8; $TargetToPrint = $MyRow->TargetNo; $NumTarget = intval($MyRow->TargetNo); if ($NumTarget > $NumEnd) { $NumTarget = ($NumTarget - 1) % $NumEnd + 1; } 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; }
if (!empty($pdf->ToPaths['ToLeft'])) { $ImgSxSize = getimagesize($pdf->ToPaths['ToLeft']); } if (!empty($pdf->ToPaths['ToRight'])) { $ImgDxSize = getimagesize($pdf->ToPaths['ToRight']); } if (!empty($pdf->ToPaths['ToBottom'])) { $ImgLowSize = getimagesize($pdf->ToPaths['ToBottom']); } if (is_file($file = $CFG->DOCUMENT_PATH . 'TV/Photos/TV-' . $_SESSION["TourCodeSafe"] . '-IdCardFooter.jpg')) { $pdf->ToPaths['ToBottom'] = $file; $ImgLowSize = getimagesize($pdf->ToPaths['ToBottom']); } switch ($BadgePerPage) { case 1: $AccH = $pdf->getPageHeight() - 10; $AccW = $pdf->getPageWidth() - 10; break; case 2: $AccH = $pdf->getPageHeight() - 10; $AccW = $pdf->getPageWidth() / 2 - 10; break; default: $AccH = $pdf->getPageHeight() / 2 - 10; $AccW = $pdf->getPageWidth() / 2 - 10; break; } while ($MyRow = safe_fetch($Rs)) { $pdf->SetDefaultColor(); switch ($BadgePerPage) { case 1:
$Rs = safe_r_sql($MyQuery); if (!safe_num_rows($Rs)) { include 'Common/Templates/head-popup.php'; echo '<table height="' . ($_SESSION['WINHEIGHT'] - 50) . '" width="100%"><tr><td>'; echo '<div align="center">' . get_text('BadgeNoData', 'Tournament') . ''; echo '<br/><br/><input type="button" onclick="window.close();" value="' . get_text('Close') . '">'; echo '</td></tr></table>'; include 'Common/Templates/tail-popup.php'; die; } $pdf = new LabelPDF(); $pdf->SetAutoPageBreak(false); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $AccW = ($pdf->getPageWidth() - 13) / 2 - 10; $AccH = ($pdf->getPageHeight() - 50) / 3 - 10; $XOffset = array(0, $AccW + 10); $YOffset = array(0, 0, $AccH + 10, $AccH + 10, $AccH * 2 + 20, $AccH * 2 + 20); $CardsPerWidth = 2; $CardsPerPage = 6; $FlagHeight = 12; $cntPass = 0; $ImgSxSize = NULL; $ImgDxSize = NULL; $ImgLowSize = NULL; $ImgLWidth = 0; $ImgLWidth = 0; $ImgRHeight = 0; $ImgRWidth = 0; if ($pdf->ToPaths['ToLeft']) { $tmp = getimagesize($pdf->ToPaths['ToLeft']);