} else { $pdf->AddPage('L'); //Al cambio di data aggiungo una pagina } $TopPos = 35; $DimTarget = min(10, ($pdf->getpagewidth() - 20 - ColName) / ($LastTarget - $FirstTarget + 1)); } else { if ($OldDate) { $pdf->SetLineStyle(array('width' => 0.5, 'color' => array(128))); $pdf->Line(10, $TopPos + RowH + $DistGap - 1, $pdf->getPageWidth() - 10, $TopPos + RowH + $DistGap - 1); $pdf->SetLineStyle(array('width' => 0.1, 'color' => array(0))); } $TopPos += RowH + $DistGap + 2; } $DistGap = 3; $pdf->SetTextColor(0); $pdf->SetXY(10, $TopPos - 1); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell(ColName, 3, isset($_REQUEST["HideTime"]) ? '' : $MyRow->SchTime, 0, 0, "C"); // data e ora $pdf->SetXY(10, $TopPos + ($MyRow->EvMatchArrowsNo == '--' ? 7 : 4)); $pdf->SetFont($pdf->FontStd, 'I', 8); //$pdf->Cell(ColName,5,date( get_text('DateFmt'), $MyRow->SchDate),0,0,"C"); $pdf->Cell(ColName, 5, dateRenderer($MyRow->FSScheduledDate, get_text('DateFmt')), 0, 0, "C"); if ($MyRow->EvMatchArrowsNo != '--') { // numero frecce $nARR = $MyRow->arrows . 'x' . $MyRow->ends; // Numero di frecce if ($MyRow->EvMaxTeamPerson > 1) { $nARR = "(" . $MyRow->EvMaxTeamPerson . 'x' . $MyRow->arrows / $MyRow->EvMaxTeamPerson . ")x" . $MyRow->ends; }
// 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); while ($r = safe_fetch($q)) {
} if ($OldSession != $MyRow->Session . $MyRow->Dist) { if (!$pdf->SamePage(RowH + 5) or $OldTrueSession != $MyRow->Session and !$pdf->SamePage(2 * RowH + 15)) { $pdf->AddPage(); //Al cambio di data aggiungo una pagina $TopPos = 35; } else { $TopPos += RowH; } $pdf->SetXY(10, $TopPos + 3); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell(ColName, 8, $MyRow->Dist, 0, 0, "C"); $pdf->SetXY(10, $TopPos + 9); $pdf->SetFont($pdf->FontStd, 'I', 8); $pdf->Cell(ColName, 5, get_text('Session') . ": " . $MyRow->Session, 0, 0, "C"); $pdf->SetTextColor(0); $pdf->SetXY(10 + ColName, $TopPos + 2); $pdf->SetFont($pdf->FontFix, 'B', 7); $pdf->SetFillColor(240); for ($i = $FirstTarget; $i <= $LastTarget; $i++) { $pdf->Cell($DimTarget, 4, $i, 'LRB', 0, "C", 1); } $OldSession = $MyRow->Session . $MyRow->Dist; $OldDist = ''; $OldTarget = ''; } $TgTop = $TopPos + 6; // devo calcolare fin dove si estende l'evento corrente $OldEvent = $MyRow->Session . $MyRow->Main; $TgNo = 0; $actTarget = $MyRow->Target;