$TopPos = 35 - RowH; // select already assigned number of sessions with min and max target $SesSql = safe_r_sql("select QuSession, min(cast( substr(QuTargetNo,2) as unsigned)) TargetMin, max(cast( substr(QuTargetNo,2) as unsigned)) TargetMax, ToNumDist from Qualifications inner join Entries on EnId=QuId inner join Tournament on EnTournament=ToId where EnTournament={$_SESSION['TourId']} and cast( substr(QuTargetNo,2) as unsigned)>0 group by QuSession"); while ($SesRow = safe_fetch($SesSql)) { // set the target dimention $DimTarget = min(10, ($pdf->GetPageWidth() - 20 - ColName) / ($SesRow->TargetMax - $SesRow->TargetMin + 1)); // checks if there is enough space for at least 1 distance if (!$pdf->SamePage(RowH + 25)) { $pdf->AddPage(); //Al cambio di data aggiungo una pagina $TopPos = 35; } else { $TopPos += RowH; } // prints the session $pdf->SetFillColor(0); $pdf->SetTextColor(255); $pdf->SetXY(10, $TopPos); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell($pdf->GetPageWidth() - 20, 8, get_text('Session') . ": " . $SesRow->QuSession, 0, 0, "C", 1); $TopPos += 8; $pdf->SetFillColor(240); $pdf->SetTextColor(0); for ($n = 1; $n <= $SesRow->ToNumDist; $n++) { // gets the different distances for each Event and target type $Sql = "select distinct cast(substr(QuTargetNo,2) as unsigned) TargetNo, IFNULL(Td{$n},'.{$n}.') as Distance, TarDescr, TarDim from\r\nEntries\r\ninner join Qualifications on EnId=QuId\r\nleft join TournamentDistances on concat(trim(EnDivision),trim(EnClass)) like TdClasses and EnTournament=TdTournament\r\nleft join (select TfId, TarDescr, TfW{$n} as TarDim, TfTournament from TargetFaces inner join Targets on TfT{$n}=TarId) tf on TfTournament=EnTournament and TfId=EnTargetFace\r\nwhere EnTournament={$_SESSION['TourId']} and QuSession={$SesRow->QuSession}\r\norder by Distance desc, TargetNo, TarDescr, TarDim"; $Rows = array(); $OldDist = 0; $OldTarg = 0; $OldDim = 0; $q = safe_r_sql($Sql);
} else { $pdf->SetDefaultColor(); } if ($OldTeam != $MyRow->NationCode) { $pdf->SetFont($pdf->FontStd, '', 1); $pdf->Cell(190, 1, '', 0, 1, 'C', 0); $pdf->SetFont($pdf->FontStd, 'B', 7); $pdf->Cell(8, 4, $MyRow->NationCode, 'LTB', 0, 'C', $MyRow->TeamComplete); $pdf->Cell(46, 4, $MyRow->Nation, 'RTB', 0, 'L', $MyRow->TeamComplete); $OldTeam = $MyRow->NationCode; } else { $pdf->Cell(54, 4, '', 0, 0, 'C', 0); } //Disegno il quadrato pieno per gli accreditati if ($MyRow->OpDone != 0) { $pdf->SetFillColor(0xcc, 0xcc, 0xcc); } else { $pdf->SetDefaultColor(); } $pdf->Cell(3, 4, '', 'LTB', 0, 'R', $MyRow->OpDone); // Inizio dei dati degli atleti $pdf->SetFont($pdf->FontStd, '', 7); if ($MyRow->OpDone != 0) { $pdf->SetAccreditedColor(); } else { $pdf->SetDefaultColor(); } $pdf->Cell(4, 4, $MyRow->Session, 'RTB', 0, 'R', $MyRow->OpDone); $pdf->Cell(11, 4, $MyRow->TargetNo, 1, 0, 'R', $MyRow->OpDone); $pdf->Cell(10, 4, $MyRow->Bib, 1, 0, 'R', $MyRow->OpDone); $pdf->Cell(41, 4, $MyRow->FirstName . ' ' . $MyRow->Name, 1, 0, 'L', $MyRow->OpDone);
// Numero di frecce if ($MyRow->EvMaxTeamPerson > 1) { $nARR = "(" . $MyRow->EvMaxTeamPerson . 'x' . $MyRow->arrows / $MyRow->EvMaxTeamPerson . ")x" . $MyRow->ends; } $pdf->SetXY(10, $TopPos + 7); $pdf->SetFont($pdf->FontStd, 'I', 7); $pdf->Cell(ColName, 5, get_text('Arrows4End', 'Tournament', $nARR), 0, 0, "C"); } // arcieri per paglione $pdf->SetXY(10, $TopPos + 10.5); $pdf->SetTextColor(127); $pdf->Cell(ColName, 4, get_text('Ath4Target', 'Tournament'), 0, 0, "C", 0); $pdf->SetTextColor(0); $pdf->SetXY(10 + ColName, $TopPos); $pdf->SetFont($pdf->FontFix, 'B', 6); $pdf->SetFillColor(240); for ($i = $FirstTarget; $i <= $LastTarget; $i++) { $pdf->Cell($DimTarget, 3, $i, 'LRB', 0, "C", 1); } $OldSched = $MyRow->SchDate . $MyRow->SchTime; $OldDate = $MyRow->SchDate; $OldEvent = ''; $OldTarget = ''; $PrintEvent = true; $TimeEvents = array(); } $TgTop = $TopPos + 3; if ($MyRow->Warmup) { // set textcolor to black $pdf->SetTextColor(0); // scrive evento e fase