Esempio n. 1
0
function findOutOfRange()
{
    global $flags;
    /*
     * Per ogni sessione eliminatoria con i parametri settati calcolo il range corretto dei suoi bersagli.
     * Poi tra le righe che agganciano una sessione controllo la bontà del target impostato
     */
    $sessions = GetSessions('E');
    $ranges = array();
    foreach ($sessions as $s) {
        // se ogni parametro è >0
        if ($s->SesTar4Session * $s->SesAth4Target * $s->SesFirstTarget > 0) {
            $range = array();
            for ($tt = $s->SesFirstTarget; $tt < $s->SesTar4Session + $s->SesFirstTarget; ++$tt) {
                for ($aa = 1; $aa <= $s->SesAth4Target; ++$aa) {
                    $range[] = str_pad($tt, TargetNoPadding, '0', STR_PAD_LEFT) . chr($aa + 64);
                }
            }
            $ranges[$s->SesOrder] = $range;
        }
    }
    // adesso controllo i bersagli
    $q = "\r\n\t\t\tSELECT CONCAT(ElElimPhase,'_',ElEventCode,'_',ElQualRank,'_',ElTournament) AS `Id`,ElSession,ElTargetNo\r\n\t\t\tFROM\r\n\t\t\t\tEliminations\r\n\t\t\tWHERE\r\n\t\t\t\tElTournament={$_SESSION['TourId']}\r\n\t\t";
    $r = safe_r_sql($q);
    while ($MyRow = safe_fetch($r)) {
        if ($MyRow->ElSession != 0 && trim($MyRow->ElTargetNo) != '') {
            $flags[$MyRow->Id]['out'] = !in_array($MyRow->ElTargetNo, $ranges[$MyRow->ElSession]) ? 0 : 1;
        }
    }
}
Esempio n. 2
0
/**
 * Ritorna un array associativo con la lista delle sessioni
 * per la gara aperta.
 *
 * l'underscore serve perchè ora c'è la funzione GetSessions() in Fun_Sessions.inc.php
 *
 * @return mixed: elenco delle sessioni in caso di successo, false altrimenti
 */
function getSessions_()
{
    $sessions = array('0' => '--');
    $ses = GetSessions('Q');
    foreach ($ses as $s) {
        $sessions[$s->SesOrder] = $s->SesOrder;
    }
    return $sessions;
}
Esempio n. 3
0
     $Ath4Target = $ses[0]->SesAth4Target;
     $tab = array();
     for ($n = 0; $n < $Ath4Target; $n++) {
         $tab[0][sprintf('%c', $n + 65)] = '';
         // foto
         $tab[1][sprintf('%c', $n + 65)] = '';
         // bib num, divisione e classe
         $tab[2][sprintf('%c', $n + 65)] = '';
         // Nome
         $tab[3][sprintf('%c', $n + 65)] = '';
         // società
     }
 }
 if (!isset($ret[$MyRow->Session])) {
     // recupera il numero di atleti per paglione per quel turno
     $ses = GetSessions('Q', true, $MyRow->Session . '_Q');
     $Ath4Target = $ses[0]->SesAth4Target;
     $fotow = min(200, intval($_SESSION['WINWIDTH'] / $Ath4Target));
     // crea l'header della gara
     $tmp = '';
     $NumCol = $Ath4Target;
     $tmp .= '<tr><th class="Title" colspan="' . $NumCol . '">';
     $tmp .= $Arr_Pages[$TVsettings->TVPPage];
     $tmp .= '</th></tr>' . "\n";
     // Titolo della tabella
     $tmp .= '<tr><th class="Title" colspan="' . $NumCol . '">';
     $tmp .= $ses[0]->SesName ? $ses[0]->SesName : get_text('Session') . ' ' . $MyRow->Session;
     $tmp .= '</th></tr>' . "\n";
     // Header vero e proprio, incluse le larghezze delle colonne;
     $tmp .= '<tr>';
     $cols = '';
Esempio n. 4
0
$row = isset($_REQUEST['row']) ? $_REQUEST['row'] : null;
$col = isset($_REQUEST['col']) ? $_REQUEST['col'] : null;
if (!CheckTourSession() || is_null($session) || is_null($id) || is_null($row) || is_null($col)) {
    print get_text('CrackError');
    exit;
}
$tourId = StrSafe_DB($_SESSION['TourId']);
$error = 0;
$tooMany = 0;
$num4session = 999;
$msg = get_text('CmdOk');
$resetTarget = 0;
if (!IsBlocked(BIT_BLOCK_PARTICIPANT)) {
    // Calcolo il numero di bersagli disponibili per la sessione scelta
    if ($session > 0) {
        $ses = GetSessions('Q', false, array($session . '_Q'));
        $num4session = $ses[0]->SesTar4Session * $ses[0]->SesAth4Target;
    }
    // Mi serve la sessione attuale del tizio
    $query = "SELECT " . "QuSession " . "FROM " . "Qualifications " . "WHERE QuId=" . StrSafe_DB($id) . " ";
    $rs = safe_r_sql($query);
    $old = 0;
    if ($rs) {
        if (safe_num_rows($rs) == 1) {
            $myRow = safe_fetch($rs);
            $old = $myRow->QuSession;
            if ($session != 0 && $session != $old) {
                // conto gli arcieri di $session sessione
                $query = "SELECT " . "COUNT(QuId) AS HowMany " . "FROM " . "Qualifications INNER JOIN Entries ON QuId=EnId AND EnTournament=" . $tourId . " " . "WHERE QuSession=" . StrSafe_DB($session) . " ";
                $rs = safe_r_sql($query);
                if ($rs) {
Esempio n. 5
0
CheckTourSession(true);
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Common/Fun_Various.inc.php';
require_once 'Common/Fun_Sessions.inc.php';
$startSession = isset($_REQUEST['startSession']) ? $_REQUEST['startSession'] : null;
$endSession = isset($_REQUEST['endSession']) ? $_REQUEST['endSession'] : null;
$filter = isset($_REQUEST['filter']) ? $_REQUEST['filter'] : null;
$isEvent = isset($_REQUEST['isEvent']) && $_REQUEST['isEvent'] == 1 ? $_REQUEST['isEvent'] : 0;
$sourceRankFrom = isset($_REQUEST['sourceRankFrom']) ? $_REQUEST['sourceRankFrom'] : 1;
$sourceRankTo = isset($_REQUEST['sourceRankTo']) ? $_REQUEST['sourceRankTo'] : 9999;
$destFrom = isset($_REQUEST['destFrom']) ? $_REQUEST['destFrom'] : null;
$destTo = isset($_REQUEST['destTo']) ? $_REQUEST['destTo'] : null;
$NumSession = 0;
$Row = null;
// sessioni
$sessions = GetSessions('Q');
$comboStartSession = '<select name="startSession" id="startSession">' . "\n" . '<option value="0">' . get_text('AllSessions', 'Tournament') . '</option>' . "\n";
$comboEndSession = '<select name="endSession" id="endSession">' . "\n" . '<option value="0">--</option>' . "\n";
foreach ($sessions as $s) {
    $comboStartSession .= '<option value="' . $s->SesOrder . '"' . (!is_null($startSession) && $s->SesOrder == $startSession ? ' selected' : '') . '>' . $s->SesOrder . ': ' . $s->SesName . '</option>' . "\n";
    $comboEndSession .= '<option value="' . $s->SesOrder . '"' . (!is_null($endSession) && $s->SesOrder == $endSession ? ' selected' : '') . '>' . $s->SesOrder . ': ' . $s->SesName . '</option>' . "\n";
}
$comboStartSession .= '</select>' . "\n";
$comboEndSession .= '</select>' . "\n";
$msg = '';
if (isset($_REQUEST['command']) && $_REQUEST['command'] == 'OK') {
    if (!IsBlocked(BIT_BLOCK_PARTICIPANT)) {
        /* verifico i campi passati */
        // sessione . bersagli di destinazione
        $start = str_pad($destFrom, TargetNoPadding, '0', STR_PAD_LEFT);
        $end = str_pad($destTo, TargetNoPadding, '0', STR_PAD_LEFT);
Esempio n. 6
0
}
/* fine salvo */
$record = null;
if ($id != 0) {
    $record = GetRows($id);
    $record = $record[0];
    $record['dob'] = dateRenderer($record['dob'], get_text('DateFmt'));
} else {
    $record = array('id' => 0, 'ioccode' => '', 'code' => '', 'status' => 0, 'session' => $ses !== null ? $ses : '', 'targetno' => $tar !== null ? $tar : '', 'firstname' => '', 'name' => '', 'sex_id' => 0, 'sex' => get_text('ShortMale', 'Tournament'), 'ctrl_code' => '', 'dob' => '', 'country_id' => 0, 'country_code' => '', 'country_name' => '', 'sub_team' => 0, 'country_id2' => 0, 'country_code2' => '', 'country_name2' => '', 'country_id3' => 0, 'country_code3' => '', 'country_name3' => '', 'division' => '--', 'class' => '--', 'ageclass' => '--', 'subclass' => '--', 'targetface' => 0, 'indcl' => 0, 'teamcl' => 0, 'indfin' => 0, 'teamfin' => 0, 'mixteamfin' => 0, 'wc' => 0, 'double' => 0);
}
$arrStatus = array();
foreach (array(1, 5, 6, 7, 8, 9) as $s) {
    $arrStatus[] = array('id' => $s, 'descr' => get_text('Status_' . $s));
}
$comboStatus = ComboFromRs($arrStatus, 'id', 'descr', 1, null, array('0', ''), 'd_e_EnStatus_', 'd_e_EnStatus_');
$tmp = GetSessions('Q');
$sessions = array();
foreach ($tmp as $s) {
    $sessions[] = array('id' => $s->SesOrder, 'descr' => $s->Descr);
}
$comboSes = ComboFromRs($sessions, 'id', 'descr', 1, null, array('0', '--'), 'd_q_QuSession_', 'd_q_QuSession_', array('onblur' => 'SelectSession();'));
$comboSex = ComboFromRs(array(array('id' => 0, 'descr' => get_text('ShortMale', 'Tournament')), array('id' => 1, 'descr' => get_text('ShortFemale', 'Tournament'))), 'id', 'descr', 1, 0, null, 'd_e_EnSex_', 'd_e_EnSex_', array('onchange' => 'CheckCtrlCode();'));
// Division Selects
$rsDiv = safe_r_sql("SELECT DivId FROM Divisions WHERE DivTournament=" . StrSafe_DB($_SESSION['TourId']) . " ORDER BY DivViewOrder ASC");
$comboDiv = ComboFromRs($rsDiv, 'DivId', 'DivId', 0, null, array('', '--'), 'd_e_EnDivision_', 'd_e_EnDivision_', array('onchange' => 'CheckCtrlCode();'));
safe_data_seek($rsDiv, 0);
$comboFindDiv = ComboFromRs($rsDiv, 'DivId', 'DivId', 0, !empty($_REQUEST['findDiv']) ? $_REQUEST['findDiv'] : '', array('', '--'), 'findDiv', 'findDiv');
// Class Selection
$rsCl = safe_r_sql("SELECT ClId FROM Classes WHERE ClTournament=" . StrSafe_DB($_SESSION['TourId']) . " ORDER BY ClViewOrder ASC");
$comboCl = ComboFromRs($rsCl, 'ClId', 'ClId', 0, null, array('', '--'), 'd_e_EnClass_', 'd_e_EnClass_', array('onchange' => 'CheckCtrlCode();'));
safe_data_seek($rsCl, 0);
Esempio n. 7
0
    print '<tr><td  style="width:25%;" class="Right">' . get_text('Eliminations_2') . '</td><td>' . $CheckEvent2 . '</td></tr>';
}
?>
</table>
</td>
<td><input type="submit" value="<?php 
echo get_text('CmdOk');
?>
"/></td>
</table></form>
</td>
</tr>
</table>
<br>
<?php 
$sessions = GetSessions('E');
$EventsFilter = "";
$in = array();
if (count($Events) > 0) {
    foreach ($Events as $e) {
        list($ev, $phase) = explode('#', $e);
        $in[] = StrSafe_DB(str_replace('#', '', $e));
    }
    $EventsFilter .= " AND CONCAT(ElEventCode,ElElimPhase) IN(" . implode(',', $in) . ") ";
}
$Select = "SELECT " . "ElElimPhase,ElEventCode,EvEventName,ElQualRank,ElTournament,ElTargetNo AS TargetNo,ElSession,CoCode, CoName," . "EnCode,EnName,EnFirstName,EnDivision,EnClass,EnCountry " . "FROM " . "Eliminations " . "INNER JOIN Events ON ElEventCode=EvCode AND ElTournament=EvTournament AND EvTeamEvent=0 " . "LEFT JOIN " . "Entries " . "ON ElId=EnId AND ElTournament=EnTournament " . "LEFT JOIN " . "Countries " . "ON EnCountry=CoId AND EnTournament=CoTournament " . "WHERE " . "ElTournament=" . StrSafe_DB($_SESSION['TourId']) . "  " . $EventsFilter . " ";
$Select .= "ORDER BY ElElimPhase ASC, ElEventCode ASC,ElQualRank ASC ";
//debug_svela($Select, true);
$Rs = safe_r_sql($Select);
//print $Select;
$curEvent = '';
Esempio n. 8
0
        $pdf->HideFlags();
    }
    if (!empty($_REQUEST["ScoreBarcode"])) {
        $pdf->PrintBarcode = true;
    }
    if (isset($_REQUEST["ScoreDraw"]) && $_REQUEST["ScoreDraw"] == "Data") {
        $pdf->NoDrawing();
    }
    if (isset($_REQUEST["ScoreDraw"]) && $_REQUEST["ScoreDraw"] == "CompleteTotals") {
        $pdf->PrintTotalColumns();
    }
    $Ath4Target = 4;
    $session = intval($_REQUEST['x_Session']);
}
if ($session > 0) {
    $ses = GetSessions(null, false, array($session . '_Q'));
    $Ath4Target = $ses[0]->SesAth4Target;
}
$defScoreX = $pdf->getSideMargin();
$defScoreX2 = ($pdf->GetPageWidth() + $pdf->getSideMargin()) / 2;
$defScoreY = $pdf->getSideMargin();
$defScoreY2 = ($pdf->GetPageHeight() + $pdf->getSideMargin()) / 2;
$defScoreW = ($pdf->GetPageWidth() - $pdf->getSideMargin() * 3) / 2;
$defScoreH = ($pdf->GetPageHeight() - $pdf->getSideMargin() * 3) / 2;
if ($Ath4Target == 2) {
    $defScoreX = $pdf->getSideMargin() * 3;
    $defScoreH = $pdf->GetPageWidth() - $pdf->getSideMargin() * 2;
    $defScoreW = ($pdf->GetPageHeight() - $defScoreX * 3) / 2;
} elseif ($Ath4Target == 3) {
    $defScoreH = $pdf->GetPageWidth() - $pdf->getSideMargin() * 2;
    $defScoreW = ($pdf->GetPageHeight() - $pdf->getSideMargin() * 4) / 3;
Esempio n. 9
0
$RsTour = safe_r_sql($Select);
$RowTour = NULL;
$ComboSes = '';
$TxtFrom = '';
$TxtTo = '';
$ComboDist = '';
$ChkG = '';
$ChkX = '';
if (safe_num_rows($RsTour) == 1) {
    $RowTour = safe_fetch($RsTour);
    $ComboSes = '<select name="x_Session" id="x_Session" onChange="javascript:SelectSession();">' . "\n";
    $ComboSes .= '<option value="-1">---</option>' . "\n";
    $ComboDist = '<select name="x_Dist" id="x_Dist">' . "\n";
    $ComboDist .= '<option value="-1">---</option>' . "\n";
    //debug_svela(GetSessions('Q'), true);
    foreach (GetSessions('Q') as $ses) {
        $ComboSes .= '<option value="' . $ses->SesOrder . '"' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $ses->SesOrder ? ' selected' : '') . '>' . $ses->Descr . '</option>' . "\n";
    }
    $ComboSes .= '</select>' . "\n";
    for ($i = 1; $i <= $RowTour->TtNumDist; ++$i) {
        $ComboDist .= '<option value="' . $i . '"' . (isset($_REQUEST['x_Dist']) && $_REQUEST['x_Dist'] == $i ? ' selected' : '') . '>' . $i . '</option>' . "\n";
    }
    $ComboDist .= '</select>' . "\n";
    $TxtFrom = '<input type="text" name="x_From" id="x_From" size="5" maxlength="' . (TargetNoPadding + 1) . '" value="' . (isset($_REQUEST['x_From']) ? $_REQUEST['x_From'] : '') . '">';
    $TxtTo = '<input type="text" name="x_To" id="x_To" size="5" maxlength="' . (TargetNoPadding + 1) . '" value="' . (isset($_REQUEST['x_To']) ? $_REQUEST['x_To'] : '') . '">';
    $ChkG = '<input type="checkbox" name="x_Gold" id="x_Gold" value="1"' . (isset($_REQUEST['x_Gold']) && $_REQUEST['x_Gold'] == 1 ? ' checked' : '') . '>';
    //$ChkA = '<input type="checkbox" name="x_Arrows" id="x_Arrows" value="1"' . (isset($_REQUEST['x_Arrows']) && $_REQUEST['x_Arrows']==1 ? ' checked' : '') . '>';
    if (empty($_REQUEST['x_To']) && !empty($_REQUEST['x_From'])) {
        $_REQUEST['x_To'] = $_REQUEST['x_From'];
    }
    if (isset($_REQUEST['x_Arrows']) && $_REQUEST['x_Arrows'] == 2 && isset($_REQUEST['Command']) && $_REQUEST['Command'] == 'OK' && $_REQUEST['x_Session'] > 0 && $_REQUEST['x_Dist'] > 0 && !IsBlocked(BIT_BLOCK_QUAL)) {
Esempio n. 10
0
                }
            }
        } else {
            foreach ($sesOrders as $o) {
                if ($o == 0) {
                    continue;
                }
                $Arr_Values2Check_ManSessions['d_ToTar_' . $o] = array('Func' => 'GoodNumTarget', 'Error' => true);
                $Arr_Values2Check_ManSessions['d_ToAth_' . $o] = array('Func' => 'GoodNumAth', 'Error' => true);
            }
        }
    }
}
/* fine qui scrivo */
$numSessions = GetNumQualSessions();
$allQSessions = GetSessions('Q');
$sessions = array();
foreach ($allQSessions as $s) {
    if (in_array($s->SesOrder, $sesOrders)) {
        $sessions[$s->SesOrder] = $s;
    }
}
/*	print '<pre>';
	print_r($sessions);
	print '</pre>';exit;
*/
$JS_SCRIPT = array('<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Common/ajax/ObjXMLHttpRequest.js"></script>', '<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Tournament/Fun_JS.js"></script>', '<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Tournament/Fun_AJAX_ManDistances.js"></script>');
$PAGE_TITLE = get_text('ManSession', 'Tournament');
include 'Common/Templates/head.php';
?>
	<form name="Frm" method="post" action="">
Esempio n. 11
0
    print get_text('CrackError');
    exit;
}
/*$Select
		= "SELECT ToId,ToNumSession,TtNumDist, "
		. "ToTar4Session1, ToTar4Session2, ToTar4Session3, ToTar4Session4, ToTar4Session5, ToTar4Session6, ToTar4Session7, ToTar4Session8, ToTar4Session9 "
		. "FROM Tournament INNER JOIN Tournament*Type ON ToType=TtId "
		. "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']) . " ";*/
$Select = "SELECT ToId,ToNumSession,ToNumDist AS TtNumDist " . "FROM Tournament  " . "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']) . " ";
$RsTour = safe_r_sql($Select);
$RowTour = null;
if (safe_num_rows($RsTour) == 1) {
    $RowTour = safe_fetch($RsTour);
}
//Tutte le fasi di qualifica
$sessions = GetSessions('Q', true);
$ComboSes = '<select name="x_Session" id="x_Session">' . "\n";
$ComboSes .= '<option value="-1">---</option>' . "\n";
foreach ($sessions as $s) {
    $ComboSes .= '<option value="' . $s->SesOrder . '"' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $s->SesOrder ? ' selected' : '') . '>' . $s->Descr . '</option>' . "\n";
}
//Tutte le finali
$Select = "SELECT DISTINCT CONCAT(FSScheduledDate,' ',FSScheduledTime) AS MyDate,FSTeamEvent " . "FROM Tournament INNER JOIN FinSchedule ON ToId=FSTournament " . "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']) . " " . "ORDER BY FSTeamEvent ASC,CONCAT(FSScheduledDate,FSScheduledTime) ASC ";
$Rs = safe_r_sql($Select);
if (safe_num_rows($Rs) > 0) {
    while ($MyRow = safe_fetch($Rs)) {
        $val = $MyRow->FSTeamEvent . $MyRow->MyDate;
        $text = $MyRow->FSTeamEvent == 0 ? get_text('FinInd', 'HTT') . ': ' . $MyRow->MyDate : get_text('FinTeam', 'HTT') . ': ' . $MyRow->MyDate;
        $ComboSes .= '<option value="' . $val . '" ' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $val ? ' selected' : '') . '>' . $text . '</option>' . "\n";
    }
}
Esempio n. 12
0
*/
define('debug', false);
require_once dirname(dirname(__FILE__)) . '/config.php';
require_once 'Common/Fun_Sessions.inc.php';
if (!CheckTourSession() || !isset($_REQUEST['Session'])) {
    print get_text('CrackError');
    exit;
}
$Errore = 0;
$Troppi = 0;
$Msg = get_text('CmdOk');
$SESSION = intval($_REQUEST['Session']);
$Rs = null;
// Bersagli e arcieri per bersaglio della sessione per ottenere il num max di arcieri per la sessione
if ($SESSION != 0) {
    $ses = GetSessions('Q', array($SESSION . '_Q'));
    $Num4Session = $ses[0]->SesTar4Session * $ses[0]->SesAth4Target;
    if ($SESSION != 0) {
        // se non ho una riga nuova e la sessione nuova è diversa dalla vecchia
        $Select = "SELECT QuSession FROM Qualifications " . "WHERE QuId=" . StrSafe_DB($_REQUEST['Id']) . " && QuSession<>" . StrSafe_DB($SESSION) . " ";
        $RsOld = safe_r_sql($Select);
        // se ho una riga conto altrimenti la sessione è quella vecchia e non faccio nulla
        if ($RsOld) {
            if (safe_num_rows($RsOld) == 1) {
                // conto il numero di arcieri inseriti per quella quella sessione
                $Select = "SELECT COUNT(QuId) AS Quanti " . "FROM Qualifications INNER JOIN Entries ON QuId=EnId AND EnTournament=" . StrSafe_DB($_SESSION['TourId']) . " " . "WHERE QuSession=" . StrSafe_DB($SESSION) . " ";
                if (debug) {
                    print $Select . '<br>';
                }
                $Rs = safe_r_sql($Select);
                if ($Rs) {
Esempio n. 13
0
         $tmp_stage[] = "E1";
     }
     if ($StageRow->EvElim2 > 0 && !in_array("E2", $tmp_stage)) {
         $tmp_stage[] = "E2";
     }
     if ($StageRow->EvTeamEvent == 0 && !in_array("MI", $tmp_stage)) {
         $tmp_stage[] = "MI";
     }
     if ($StageRow->EvTeamEvent == 1 && !in_array("MT", $tmp_stage)) {
         $tmp_stage[] = "MT";
     }
 }
 $json_array["stages"] = $tmp_stage;
 // Retrieve all the sessions that have been defined for the tournament
 // and create a sessions array in the json data
 $sessions = GetSessions('Q', false, null, $TourRow->ToId);
 $session_array = array();
 foreach ($sessions as $s) {
     $row_array = array();
     $row_array["sessdesc"] = $s->Descr;
     $row_array["sesstype"] = $s->SesType;
     $row_array["sessnumtargets"] = (int) $s->SesTar4Session;
     $row_array["sessfirsttarget"] = (int) $s->SesFirstTarget;
     $json_array["sessions"][] = $row_array;
 }
 // 		$json_array["sessions"] = $session_array;
 // Retrieve all the distances for the tournament and create
 // an array to be appended to the json data
 $Select = "SELECT Td1, Td2, Td3, Td4, Td5, Td6, Td7, Td8 " . "  FROM TournamentDistances " . " WHERE TdTournament=" . $TourRow->ToId;
 $Rs = safe_r_sql($Select);
 if (safe_num_rows($Rs) == 1) {
Esempio n. 14
0
function ComboSes($RowTour, $AllHHT = false, &$ComboSesArray = null)
{
    $ComboArr = array();
    $ComboSes = '';
    $numOptions = 0;
    if (isset($_REQUEST["x_Hht"]) && $_REQUEST["x_Hht"] != -1 or $AllHHT) {
        if (!$AllHHT) {
            $Select = 'SELECT HeEventCode FROM HhtEvents WHERE HeTournament=' . StrSafe_DB($_SESSION['TourId']) . ' AND HeHhtId=' . StrSafe_DB($_REQUEST["x_Hht"]);
            $Rs = safe_r_sql($Select);
        }
        if ($AllHHT or numHHT() == 1 && safe_num_rows($Rs) == 0) {
            if (!$AllHHT) {
                $sessions = GetSessions('Q');
                //Tutte le fasi di qualifica
                /*for ($i=1;$i<=$RowTour->ToNumSession;++$i)
                		{
                			$ComboSes.= '<option value="' . $i . '"' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session']==$i ? ' selected' : '') . '>' . get_text('QualSession','HTT') . ' ' . $i . '</option>' . "\n";
                			$numOptions++;
                		}*/
                foreach ($sessions as $s) {
                    if ($ComboSesArray !== null) {
                        $ComboArr[] = $s->SesOrder;
                    }
                    $ComboSes .= '<option value="' . $s->SesOrder . '"' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $s->SesOrder ? ' selected' : '') . '>' . get_text('QualSession', 'HTT') . ' ' . $s->Descr . '</option>' . "\n";
                    $numOptions++;
                }
            }
            //Tutte le finali individuali
            if ($AllHHT != 'Teams') {
                //					$Select
                //						= "SELECT DISTINCT CONCAT(FSScheduledDate,' ',FSScheduledTime) AS MyDate,FSTeamEvent "
                //						. "FROM Tournament INNER JOIN FinSchedule ON ToId=FSTournament "
                //						. "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']) . " and FSScheduledDate>0 and FSTeamEvent=0 "
                //						. "ORDER BY CONCAT(FSScheduledDate,FSScheduledTime) ASC ";
                $Select = 'SELECT' . ' @Phase:=ifnull(2*pow(2,truncate(log2(fsmatchno/2),0)),1) Phase' . ' , @RealPhase:=truncate(@Phase/2, 0) RealPhase' . ' , CONCAT(FSScheduledDate,\' \',FSScheduledTime) AS MyDate' . ' , DATE_FORMAT(FSScheduledDate,"' . get_text('DateFmtDBshort') . '") AS Dt ' . ' , DATE_FORMAT(FSScheduledDate,"' . get_text('DateFmtDB') . '") AS Dat ' . ' , FSTeamEvent ' . ' , FSEvent ' . ' , FSScheduledTime ' . ' , EvFinalFirstPhase ' . 'FROM' . ' `FinSchedule` fs ' . " inner join Events on FSEvent=EvCode and FSTeamEvent=EvTeamEvent and FsTournament=EvTournament " . 'where' . ' FsTournament=' . $_SESSION['TourId'] . ' and FsTeamEvent=0' . ' and fsscheduleddate >0 ' . 'group by ' . ' FsScheduledDate, ' . ' FsScheduledTime, ' . ' FsEvent, ' . ' Phase';
                //					$Rs=safe_r_sql($Select);
                //					if (safe_num_rows($Rs)>0)
                //					{
                //						while ($MyRow=safe_fetch($Rs))
                //						{
                //							$val=$MyRow->FSTeamEvent . $MyRow->MyDate;
                //							$text= get_text('FinInd','HTT') . ': ' . $MyRow->MyDate ;
                //							$ComboSes.='<option value="' . $val . '" ' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session']==$val ? ' selected' : '') . '>' . $text . '</option>' . "\n";
                //							$numOptions++;
                //						}
                //					}
                $tmp = array();
                $Rs = safe_r_sql($Select);
                while ($MyRow = safe_fetch($Rs)) {
                    $val = $MyRow->FSTeamEvent . $MyRow->MyDate;
                    $text = get_text('FinInd', 'HTT') . ': ' . $MyRow->MyDate;
                    //$ComboSes.='<option value="' . $val . '" ' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session']==$val ? ' selected' : '') . '>' . $text . '</option>' . "\n";
                    $tmp[$val]['events'][get_text(namePhase($MyRow->EvFinalFirstPhase, $MyRow->RealPhase) . '_Phase')][] = $MyRow->FSEvent;
                    $tmp[$val]['date'] = $MyRow->Dt . ' ' . substr($MyRow->FSScheduledTime, 0, 5) . ' ' . get_text('FinInd', 'HTT');
                    $tmp[$val]['selected'] = isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $val ? ' selected' : '';
                    $numOptions++;
                }
                foreach ($tmp as $k => $v) {
                    $val = array();
                    foreach ($v['events'] as $ph => $ev) {
                        $val[] = $ph . ' (' . implode('+', $ev) . ')';
                    }
                    $ComboSes .= '<option value="' . $k . '"' . $v['selected'] . '>' . $v['date'] . ' ' . implode('; ', $val) . '</option>';
                    if ($ComboSesArray !== null) {
                        $ComboArr[] = $k;
                    }
                }
            }
            //Tutte le finali a squadre
            if ($AllHHT != 'Individuals') {
                $Select = "SELECT DISTINCT CONCAT(FSScheduledDate,' ',FSScheduledTime) AS MyDate,FSTeamEvent " . "FROM Tournament INNER JOIN FinSchedule ON ToId=FSTournament " . "WHERE ToId=" . StrSafe_DB($_SESSION['TourId']) . " and FSScheduledDate>0 and FSTeamEvent!=0 " . "ORDER BY CONCAT(FSScheduledDate,FSScheduledTime) ASC ";
                $Select = 'SELECT' . ' @Phase:=ifnull(2*pow(2,truncate(log2(fsmatchno/2),0)),1) Phase' . ' , @RealPhase:=truncate(@Phase/2, 0) RealPhase' . ' , CONCAT(FSScheduledDate,\' \',FSScheduledTime) AS MyDate' . ' , DATE_FORMAT(FSScheduledDate,"' . get_text('DateFmtDBshort') . '") AS Dt ' . ' , DATE_FORMAT(FSScheduledDate,"' . get_text('DateFmtDB') . '") AS Dat ' . ' , FSTeamEvent ' . ' , FSEvent ' . ' , FSScheduledTime ' . 'FROM' . ' `FinSchedule` fs ' . 'where' . ' FsTournament=' . $_SESSION['TourId'] . ' and fsscheduleddate >0 ' . ' AND FSTeamEvent!=0 ' . 'group by ' . ' FsScheduledDate, ' . ' FsScheduledTime, ' . ' FsEvent, ' . ' Phase';
                $tmp = array();
                $Rs = safe_r_sql($Select);
                if (safe_num_rows($Rs) > 0) {
                    while ($MyRow = safe_fetch($Rs)) {
                        $val = $MyRow->FSTeamEvent . $MyRow->MyDate;
                        $text = get_text('FinTeam', 'HTT') . ': ' . $MyRow->MyDate;
                        //$ComboSes.='<option value="' . $val . '" ' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session']==$val ? ' selected' : '') . '>' . $text . '</option>' . "\n";
                        $tmp[$val]['events'][get_text($MyRow->RealPhase . '_Phase')][] = $MyRow->FSEvent;
                        $tmp[$val]['date'] = get_text('FinTeam', 'HTT') . ': ' . $MyRow->Dt . ' ' . substr($MyRow->FSScheduledTime, 0, 5);
                        $tmp[$val]['selected'] = isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $val ? ' selected' : '';
                        $numOptions++;
                    }
                    foreach ($tmp as $k => $v) {
                        $val = array();
                        foreach ($v['events'] as $ph => $ev) {
                            $val[] = $ph . ' (' . implode('+', $ev) . ')';
                        }
                        $ComboSes .= '<option value="' . $k . '"' . $v['selected'] . '>' . $v['date'] . ': ' . implode('; ', $val) . '</option>';
                        if ($ComboSesArray !== null) {
                            $ComboArr[] = $k;
                        }
                    }
                }
            }
        } else {
            //Solo le fasi di qualifica associate alla catena HHT
            $Select = 'SELECT HeSession FROM HhtEvents WHERE HeTournament=' . StrSafe_DB($_SESSION['TourId']) . ' AND HeHhtId=' . StrSafe_DB($_REQUEST["x_Hht"]) . " AND HeSession!=0 ORDER BY HeSession";
            $Rs = safe_r_sql($Select);
            while ($MyRow = safe_fetch($Rs)) {
                if ($ComboSesArray !== null) {
                    $ComboArr[] = $MyRow->HeSession;
                }
                $ComboSes .= '<option value="' . $MyRow->HeSession . '"' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $MyRow->HeSession ? ' selected' : '') . '>' . get_text('QualSession', 'HTT') . ' ' . $MyRow->HeSession . '</option>' . "\n";
                $numOptions++;
            }
            //Solo le finali associate alla catena HHT
            $Select = 'SELECT' . ' @Phase:=ifnull(2*pow(2,truncate(log2(fsmatchno/2),0)),1) Phase' . ' , @RealPhase:=truncate(@Phase/2, 0) RealPhase' . ' , CONCAT(FSScheduledDate,\' \',FSScheduledTime) AS MyDate' . ' , DATE_FORMAT(FSScheduledDate,"' . get_text('DateFmtDBshort') . '") AS Dt ' . ' , DATE_FORMAT(FSScheduledDate,"' . get_text('DateFmtDB') . '") AS Dat ' . ' , FSTeamEvent ' . ' , FSEvent ' . ' , FSScheduledTime ' . ' , EvFinalFirstPhase ' . 'FROM' . ' `FinSchedule` fs ' . "\tINNER JOIN HhtEvents ON HeTournament=FSTournament AND HeSession=0 AND HeTeamEvent=FSTeamEvent AND HeFinSchedule = CONCAT(FSScheduledDate,' ',FSScheduledTime) " . " inner join Events on FSEvent=EvCode and FSTeamEvent=EvTeamEvent and FsTournament=EvTournament " . 'where' . ' FsTournament=' . $_SESSION['TourId'] . ' and fsscheduleddate >0 ' . ' AND HeHhtId=' . StrSafe_DB($_REQUEST["x_Hht"]) . ' ' . 'group by ' . ' FsScheduledDate, ' . ' FsScheduledTime, ' . ' FsEvent, ' . ' Phase';
            $tmp = array();
            $Rs = safe_r_sql($Select);
            if (safe_num_rows($Rs) > 0) {
                while ($MyRow = safe_fetch($Rs)) {
                    $val = $MyRow->FSTeamEvent . $MyRow->MyDate;
                    $text = $MyRow->FSTeamEvent == 0 ? get_text('FinInd', 'HTT') . ': ' . $MyRow->MyDate : get_text('FinTeam', 'HTT') . ': ' . $MyRow->MyDate;
                    //$ComboSes.='<option value="' . $val . '" ' . (isset($_REQUEST['x_Session']) && $_REQUEST['x_Session']==$val ? ' selected' : '') . '>' . $text . '</option>' . "\n";
                    $tmp[$val]['events'][get_text(namePhase($MyRow->EvFinalFirstPhase, $MyRow->RealPhase) . '_Phase')][] = $MyRow->FSEvent;
                    $tmp[$val]['date'] = $MyRow->Dt . ' ' . substr($MyRow->FSScheduledTime, 0, 5) . ' ' . ($MyRow->FSTeamEvent == 0 ? get_text('FinInd', 'HTT') : get_text('FinTeam', 'HTT'));
                    $tmp[$val]['selected'] = isset($_REQUEST['x_Session']) && $_REQUEST['x_Session'] == $val ? ' selected' : '';
                    $numOptions++;
                }
                foreach ($tmp as $k => $v) {
                    $val = array();
                    foreach ($v['events'] as $ph => $ev) {
                        $val[] = $ph . ' (' . implode('+', $ev) . ')';
                    }
                    $ComboSes .= '<option value="' . $k . '"' . $v['selected'] . '>' . $v['date'] . ' ' . implode('; ', $val) . '</option>';
                    if ($ComboSesArray !== null) {
                        $ComboArr[] = $k;
                    }
                }
            }
        }
        $ComboSes = '<select name="x_Session" id="x_Session">' . "\n" . ($numOptions > 1 ? '<option value="-1">---</option>' . "\n" : '') . $ComboSes . '</select>' . "\n";
    }
    if ($ComboSesArray !== null) {
        $ComboSesArray = $ComboArr;
    }
    return $ComboSes;
}
Esempio n. 15
0
//	echo '<td></td>';
//	echo '<td></td>';
//	echo '<td></td>';
//	echo '<td></td>';
//	echo '<td></td>';
//	echo '<td></td>';
//	echo '<td></td>';
//	echo '<td></td>';
//	echo '<td></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="Center" colspan="8"><input type="submit" value="' . get_text('CmdOk') . '">&nbsp;&nbsp;&nbsp;';
echo '<input type="submit" name="Erase" value="' . get_text('TargetAssErase', 'Tournament') . '"></td>';
echo '</tr>';
if (isset($_REQUEST["Session"]) && $_REQUEST["Session"] >= 1 && $_REQUEST['Session'] <= $MaxSession) {
    $MySes = GetSessions(null, false, array($_REQUEST['Session'] . '_' . 'Q'));
    if ($MySes[0]->SesAth4Target >= 4) {
        $TgtArray = array('A', 'C', 'B', 'D');
        $StartLetter = 'E';
        if ($MySes[0]->SesAth4Target > 4) {
            for ($i = 4; $i < $MySes[0]->SesAth4Target; $i++) {
                $TgtArray[] = $StartLetter++;
            }
        }
    } else {
        $StartLetter = 'A';
        for ($i = 0; $i < $MySes[0]->SesAth4Target; $i++) {
            $TgtArray[] = $StartLetter++;
        }
    }
}