Example #1
0
require_once 'Common/Fun_FormatText.inc.php';
$BisTarget = 0;
$NumEnd = 0;
/*$Select
	= "SELECT (TtElabTeam!=0) as BisTarget, TtNumEnds "
	. "FROM Tournament INNER JOIN Tournament*Type ON ToType=TtId "
	. "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']) . " ";*/
$Select = "SELECT (ToElabTeam!=0) as BisTarget, ToNumEnds AS TtNumEnds " . "FROM Tournament " . "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']) . " ";
$RsTour = safe_r_sql($Select);
if (safe_num_rows($RsTour) == 1) {
    $r = safe_fetch($RsTour);
    $BisTarget = $r->BisTarget;
    $NumEnd = $r->TtNumEnds;
    safe_free_result($RsTour);
}
$pdf = new BackNoPDF(0);
$max4Page = $pdf->AthletesPerPage();
if (isset($_REQUEST["BackNoDraw"]) && $_REQUEST['BackNoDraw'] == "Test") {
    $tmp = new stdClass();
    $tmp->EnFirstName = get_text('Athlete');
    $tmp->EnFirstNameUpper = mb_convert_case(get_text('Athlete'), MB_CASE_UPPER, "UTF-8");
    $tmp->EnName = get_text('Athlete');
    $tmp->CoCode = 'ABC';
    $tmp->CoName = get_text('Country');
    $pdf->DrawElements("1a", $tmp, 0);
    $pdf->DrawElements("99z", $tmp, 1);
} else {
    $From = str_pad(intval($_REQUEST['x_From']), 3, '0', STR_PAD_LEFT);
    $To = str_pad(intval($_REQUEST['x_To']), 3, '0', STR_PAD_LEFT);
    $MyQuery = 'SELECT SUBSTRING(at.AtTargetNo,2) as tNo, SUBSTRING(at.AtTargetNo,1,1) as Session, SesName, QuBacknoPrinted, EnFirstName, upper(EnFirstName) EnFirstNameUpper, EnName, CoCode, CoName ' . ' FROM AvailableTarget as at ' . ' LEFT JOIN Session ON at.AtTournament=SesTournament AND SUBSTRING(at.AtTargetNo,1,1)=SesOrder AND SesType="Q" ' . ' ' . (isset($_REQUEST["PrintEmpty"]) && $_REQUEST['PrintEmpty'] == 1 ? 'LEFT' : 'INNER') . ' JOIN ' . ' (SELECT QuTargetNo, QuBacknoPrinted, EnTournament, EnFirstName, EnName, CoCode, CoName ' . ' FROM Qualifications as q ' . ' INNER JOIN Entries AS e ON q.QuId=e.EnId AND e.EnAthlete=1 ' . ' INNER JOIN Countries as c ON e.EnCountry=c.CoId AND e.EnTournament=c.CoTournament) as Sqy on at.AtTargetNo=Sqy.QuTargetNo AND at.AtTournament=Sqy.EnTournament ' . " WHERE AtTournament =  " . StrSafe_DB($_SESSION['TourId']) . ' ' . (!empty($_REQUEST['SkipPrinted']) ? ' AND QuBacknoPrinted=0' : '') . " AND at.AtTargetNo>='" . $_REQUEST['x_Session'] . $From . "A' AND at.AtTargetNo<='" . $_REQUEST['x_Session'] . $To . "Z' " . ' ORDER BY at.AtTargetNo ASC, EnFirstName, EnName, CoCode';
    //print $MyQuery;
Example #2
0
<?php

require_once dirname(dirname(__FILE__)) . '/config.php';
require_once 'Common/pdf/BackNoPDF.php';
require_once 'Common/Fun_FormatText.inc.php';
$pdf = new BackNoPDF($_REQUEST['BackNo']);
$MyQuery = "SELECT " . "ElEventCode, " . "ElTargetNo,EnName,EnFirstName, upper(EnFirstName) EnFirstNameUpper, " . " CoCode, CoName " . "FROM " . "Eliminations INNER JOIN Entries ON ElId=EnId " . "INNER JOIN Countries ON EnCountry=CoId AND EnTournament=CoTournament " . "WHERE " . "EnTournament=" . StrSafe_DB($_SESSION['TourId']) . " ";
if (isset($_REQUEST['Elim'])) {
    $MyQuery .= " AND ElElimPhase=" . StrSafe_DB($_REQUEST['Elim']) . " ";
}
if (isset($_REQUEST['Event'])) {
    $MyQuery .= " AND ElEventCode = " . StrSafe_DB($_REQUEST['Event']) . " ";
}
$MyQuery .= "ORDER BY " . "ElElimPhase ASC, ElEventCode ASC ,ElTargetNo ASC ";
//print $MyQuery;exit;
//*DEBUG*/echo $MyQuery;exit();
$Rs = safe_r_sql($MyQuery);
// Se il Recordset � valido e contiene almeno una riga
if (safe_num_rows($Rs) > 0) {
    $CntBackNo = 0;
    $NumEnd = !empty($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == 1 ? 8 : 12;
    while ($MyRow = safe_fetch($Rs)) {
        $Targetno = intval(substr($MyRow->ElTargetNo, 0, -1));
        $BisValue = '';
        if ($Targetno > $NumEnd) {
            $Targetno -= $NumEnd;
            $BisValue = 'bis';
            if ($Targetno > $NumEnd) {
                $Targetno -= $NumEnd;
                $BisValue = 'ter';
            }
Example #3
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Common/pdf/BackNoPDF.php';
$pdf = new BackNoPDF(1);
$MyQuery = 'SELECT ' . ' EvCode, EvEventName, EvFinalFirstPhase, ' . ' IF(EvFinalFirstPhase=48 || EvFinalFirstPhase=24,GrPosition2, GrPosition) as GridPosition, EnName, EnFirstName, upper(EnFirstName) EnFirstNameUpper,' . ' CoCode, CoName' . ' FROM Events' . ' INNER JOIN Finals ON EvCode=FinEvent AND EvTournament=FinTournament' . ' INNER JOIN Grids ON FinMatchNo=GrMAtchNo AND GrPhase=IF( EvFinalFirstPhase =48, 64, IF( EvFinalFirstPhase =24, 32, EvFinalFirstPhase ) ) ' . ' LEFT JOIN Entries ON FinAthlete=EnId AND FinTournament=EnTournament' . ' LEFT JOIN Countries on EnCountry=CoId AND EnTournament=CoTournament' . ' WHERE EvTournament=' . StrSafe_DB($_SESSION['TourId']) . ' AND EvTeamEvent=0 AND IF(EvFinalFirstPhase=48 || EvFinalFirstPhase=24,GrPosition2, GrPosition)>0 ';
if (isset($_REQUEST['Event']) && preg_match("/^[0-9A-Z]{1,4}\$/i", $_REQUEST["Event"])) {
    $MyQuery .= "AND EvCode LIKE '" . $_REQUEST['Event'] . "' ";
}
if (isset($_REQUEST['noByes'])) {
    $MyQuery .= "AND FinAthlete != 0 ";
}
$MyQuery .= ' ORDER BY EvCode, FinMatchNo';
//	debug_svela($MyQuery, true);
//*DEBUG*/echo $MyQuery;exit();
$Rs = safe_r_sql($MyQuery);
// Se il Recordset � valido e contiene almeno una riga
if (safe_num_rows($Rs) > 0) {
    $CntBackNo = 0;
    while ($MyRow = safe_fetch($Rs)) {
        $pdf->DrawElements(empty($MyRow->GridPosition) ? '' : $MyRow->GridPosition, empty($MyRow) ? '' : $MyRow, $CntBackNo);
        $CntBackNo = ++$CntBackNo % 2;
    }
    safe_free_result($Rs);
}
if ($pdf->BackGroundFile) {
    unlink($pdf->BackGroundFile);
}
$pdf->Output();
Example #4
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Common/pdf/BackNoPDF.php';
$pdf = new BackNoPDF(2);
$MyQuery = 'SELECT ' . ' EvCode, EvEventName, EvFinalFirstPhase, GrPosition, ' . " CoCode, CONCAT(CoName, IF(TfSubTeam>'1',CONCAT(' (',TfSubTeam,')'),'')) AS CoName, EnFirstName, upper(EnFirstName) EnFirstNameUpper, EnName " . ' FROM Events ' . ' INNER JOIN TeamFinals ON EvCode=TfEvent AND EvTournament=TfTournament ' . ' INNER JOIN Grids ON TfMatchNo=GrMatchNo AND GrPhase=EvFinalFirstPhase ' . ' INNER JOIN Countries on TfTeam=CoId AND TfTournament=CoTournament ' . ' INNER JOIN TeamFinComponent ON CoId=TfcCoId AND TfSubTeam=TfcSubTeam AND CoTournament=TfcTournament AND EvCode=TfcEvent ' . ' INNER JOIN Entries ON TfcId=EnId AND TfcTournament=EnTournament ' . ' WHERE EvTournament=' . StrSafe_DB($_SESSION['TourId']) . ' AND EvTeamEvent=1 ';
if (isset($_REQUEST['Event']) && preg_match("/^[0-9A-Z]{1,4}\$/i", $_REQUEST["Event"])) {
    $MyQuery .= "AND EvCode LIKE '" . $_REQUEST['Event'] . "' ";
}
$MyQuery .= ' ORDER BY EvCode, TfMatchNo';
//*DEBUG*/echo $MyQuery;exit();
$Rs = safe_r_sql($MyQuery);
// Se il Recordset � valido e contiene almeno una riga
if (safe_num_rows($Rs) > 0) {
    $CntBackNo = 0;
    while ($MyRow = safe_fetch($Rs)) {
        $pdf->DrawElements(!is_null($MyRow->GrPosition) ? mb_strtolower($MyRow->GrPosition) : ' ', empty($MyRow) ? '' : $MyRow, $CntBackNo);
        $CntBackNo = ++$CntBackNo % 2;
    }
    safe_free_result($Rs);
}
if ($pdf->BackGroundFile) {
    unlink($pdf->BackGroundFile);
}
$pdf->Output();