if ($CatOC) { $Filter[] = " ItOC<>0 "; } if (count($Filter) > 0) { $Filter = "AND (" . implode(" OR ", $Filter) . ") "; } else { $Filter = ""; } $Select = "\r\n\tSELECT ti.*, it.*,IF(ItJudge!=0,'CatJudge',IF(ItDoS!=0,'CatDos',IF(ItJury!=0,'CatJury','CatOC'))) AS `Category` \r\n\tFROM TournamentInvolved AS ti LEFT JOIN InvolvedType AS it ON ti.TiType=it.ItId \r\n\tWHERE ti.TiTournament={$Ses} AND it.ItId IS NOT NULL {$Filter}\r\n\tORDER BY IF(ItJudge!=0,1,IF(ItDoS!=0,2,IF(ItJury!=0,3,4))) ASC, IF(ItJudge!=0,ItJudge,IF(ItDoS!=0,ItDoS,IF(ItJury!=0,ItJury,ItOC))) ASC,ti.TiName ASC\r\n"; //print $Select;Exit; $Rs = safe_r_sql($Select); $CurCategory = ''; if ($Rs && safe_num_rows($Rs) > 0) { while ($MyRow = safe_fetch($Rs)) { if ($CurCategory != $MyRow->Category) { $pdf->Ln(10); $pdf->SetFont($pdf->FontStd, 'B', 14); $pdf->Cell(190, 8, get_text($MyRow->Category, 'Tournament'), 0, 1, 'L'); } $pdf->SetFont($pdf->FontStd, '', 10); $pdf->Cell(10, 8, '', 0, 0); $pdf->Cell(180, 6, $MyRow->TiName . ' - ' . get_text($MyRow->ItDescription, 'Tournament'), 0, 1); $CurCategory = $MyRow->Category; } } if (!isset($isCompleteResultBook)) { if (isset($_REQUEST['ToFitarco'])) { $Dest = 'D'; if (isset($_REQUEST['Dest'])) { $Dest = $_REQUEST['Dest']; }