Ritorna i matchno di una fase di un evento.
*/
define('debug', false);
require_once dirname(dirname(__FILE__)) . '/config.php';
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Fun_Final.local.inc.php';
$Ev = isset($_REQUEST['Ev']) ? $_REQUEST['Ev'] : null;
$Ph = isset($_REQUEST['Ph']) ? $_REQUEST['Ph'] : null;
$Team = isset($_REQUEST['TeamEvent']) ? $_REQUEST['TeamEvent'] : 0;
if (is_null($Ev) || is_null($Ph) || !CheckTourSession()) {
    print get_text('CrackError');
    exit;
}
$Errore = 0;
// tiro fuori i match
$rs = GetFinMatches($Ev, $Ph, null, $Team, true);
//$rs=safe_r_sql($query);
if (!$rs) {
    $Errore = 1;
}
if (!debug) {
    header('Content-Type: text/xml');
}
$xml = '<response>' . "\n";
$xml .= '<error>' . $Errore . '</error>' . "\n";
if ($Errore == 0) {
    while ($row = safe_fetch($rs)) {
        $Target = ltrim($row->target1, '0');
        if ($row->target1 != $row->target2) {
            $Target .= '/' . ltrim($row->target2, '0');
        }
 }
 // 		if($arrow==='0') $arrow='M';
 // 		elseif($arrow==='0*') $arrow='M*';
 //Se ho i valori di freccia, indice della textbox e tipo textbox (std o so) procedo con il salvataggio dei punti
 if (!(is_null($what) || is_null($arrow) || is_null($index) || !preg_match('/^[st]{1}$/i', $what))) {
     // Verifico la arrow se il valore è valido per il target selezionato
     if (array_key_exists(strtoupper(GetLetterFromPrint($arrow, $CurrentTarget)), $validData["Arrows"])) {
         $arrow = GetLetterFromPrint($arrow, $CurrentTarget);
     } else {
         $arrow = ' ';
     }
     // conti
     $ArrowStart = $index + 1;
     // se però ho mandato il tie devo rifare i conti
     if ($what == 't') {
         $rs = GetFinMatches($event, null, $queryMatch, $TeamEvent, false);
         $myRow = safe_fetch($rs);
         list($rows, $cols, $so) = CalcScoreRowsColsSO($myRow);
         $ArrowStart = $rows * $cols + 1 + $index;
     }
     UpdateArrowString($match2edit, $event, $TeamEvent, $arrow, $ArrowStart, $ArrowStart);
     if ($arrow == ' ') {
         UpdateArrowPosition($match2edit, $event, $TeamEvent, '', '', ($what == 's' ? '0' : '1') . "|" . $index);
     }
     $spotLimit[0] = $what == 's' ? 0 : 1;
 }
 $Select = '';
 if ($TeamEvent == 0) {
     $Select = "SELECT " . "f.FinEvent as EvCode, f.FinMatchNo as MatchNo, f2.FinMatchNo as OppMatchNo, EvMatchMode, EvMatchArrowsNo, " . "IF(f.FinDateTime>=f2.FinDateTime, f.FinDateTime, f2.FinDateTime) AS DateTime," . "f.FinScore AS Score, f.FinSetScore AS SetScore, f.FinTie as Tie, f.FinArrowString as ArString, f.FinTieBreak as TbString, " . "f2.FinScore AS OppScore, f2.FinSetScore AS OppSetScore, f2.FinTie as OppTie, f2.FinArrowString as OppArString, f2.FinTieBreak as OppTbString, " . "GrPhase, EvMaxTeamPerson " . "FROM Finals AS f " . "INNER JOIN Finals AS f2 ON f.FinEvent=f2.FinEvent AND f.FinMatchNo=IF((f.FinMatchNo % 2)=0,f2.FinMatchNo-1,f2.FinMatchNo+1) AND f.FinTournament=f2.FinTournament " . "INNER JOIN Events ON f.FinEvent=EvCode AND f.FinTournament=EvTournament AND EvTeamEvent=0 " . "INNER JOIN Grids ON f.FinMatchNo=GrMatchNo " . "WHERE f.FinTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND (f.FinMatchNo % 2)=0 AND GrMatchNo=" . StrSafe_DB($queryMatch) . " AND f.FinEvent=" . StrSafe_DB($event) . " " . "ORDER BY f.FinEvent, f.FinMatchNo ";
 } else {
     $Select = "SELECT " . "f.TfEvent as EvCode, f.TfMatchNo as MatchNo, f2.TfMatchNo as OppMatchNo, EvMatchMode, EvMatchArrowsNo, " . "IF(f.TfDateTime>=f2.TfDateTime, f.TfDateTime, f2.TfDateTime) AS DateTime," . "f.TfScore AS Score, f.TfSetScore AS SetScore, f.TfTie as Tie, f.TfArrowString as ArString, f.TfTieBreak as TbString, " . "f2.TfScore AS OppScore, f2.TfSetScore AS OppSetScore, f2.TfTie as OppTie, f2.TfArrowString as OppArString, f2.TfTieBreak as OppTbString, " . "GrPhase, EvMaxTeamPerson " . "FROM TeamFinals AS f " . "INNER JOIN TeamFinals AS f2 ON f.TfEvent=f2.TfEvent AND f.TfMatchNo=IF((f.TfMatchNo % 2)=0,f2.TfMatchNo-1,f2.TfMatchNo+1) AND f.TfTournament=f2.TfTournament " . "INNER JOIN Events ON f.TfEvent=EvCode AND f.TfTournament=EvTournament AND EvTeamEvent=1 " . "INNER JOIN Grids ON f.TfMatchNo=GrMatchNo " . "WHERE f.TfTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND (f.TfMatchNo % 2)=0 AND GrMatchNo=" . StrSafe_DB($queryMatch) . " AND f.TfEvent=" . StrSafe_DB($event) . " " . "ORDER BY f.TfEvent, f.TfMatchNo ";
Exemple #3
0
}
$q = safe_r_sql("(select '0' as Team, FinEvent as Event, FinMatchNo as MatchNo, UNIX_TIMESTAMP(FinDateTime) DateTime, UNIX_TIMESTAMP(FinDateTime)>{$LastUpdated} Updated from Finals where FinTournament={$TourId} and FinLive='1')\n\t\tUNION\n\t\t(select '1' as Team, TfEvent as Event, TfMatchNo as MatchNo, UNIX_TIMESTAMP(TfDateTime) DateTime, UNIX_TIMESTAMP(TfDateTime)>{$LastUpdated} Updated from TeamFinals where TfTournament={$TourId} and TfLive='1') order by MatchNo");
if (!($r = safe_fetch($q))) {
    $Error = 'no match now';
}
$XML = '<r>' . '<e>' . intval(!empty($Error)) . '</e>' . '<t>' . ($Error ? 0 : $r->DateTime) . '</t>' . '<c><![CDATA[' . $Error . ']]></c>' . '</r>';
// No changes so exits immediately
if ($Error or !$r->Updated) {
    header('Content-Type: text/xml');
    die($XML);
}
$d_Event = $r->Event;
$d_Match = $r->MatchNo;
$team = $r->Team;
// tiro fuori le info x lo scontro
$rs = GetFinMatches($d_Event, null, $d_Match, $team, false, $TourId);
//Carico il vettore dei dati validi
$validData = GetMaxScores($d_Event, $d_Match, $team, $TourId);
if (safe_num_rows($rs) != 1) {
    exit;
}
$EnCours = false;
$myRow = safe_fetch($rs);
//	debug_svela($myRow, true);
// righe e colonne e so nel caso di individuali cumulativi
$rows = 4;
$cols = 3;
$so = 1;
list($rows, $cols, $so) = CalcScoreRowsColsSO($myRow, $TourId);
// i due score da stampare a video
$scores = array(1 => '', 2 => '');
require_once 'HHT/serial.php';
require_once 'HHT/Fun_HHT.local.inc.php';
require_once 'Common/Lib/ArrTargets.inc.php';
require_once 'Common/Fun_Phases.inc.php';
$event = isset($_REQUEST['event']) ? $_REQUEST['event'] : null;
$team = isset($_REQUEST['team']) ? $_REQUEST['team'] : null;
$match = isset($_REQUEST['match']) ? $_REQUEST['match'] : null;
$line = isset($_REQUEST['line']) ? $_REQUEST['line'] : null;
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$contrast = isset($_REQUEST['contrast']) ? $_REQUEST['contrast'] : 9;
$Errore = 0;
if (is_null($event) || is_null($team) || is_null($match) || is_null($line) || is_null($type)) {
    $Errore = 1;
}
if ($Errore == 0) {
    $rs = GetFinMatches($event, null, $match, $team, false);
    $myRow = safe_fetch($rs);
    $obj = getEventArrowsParams($myRow->event, $myRow->phase, $myRow->teamEvent);
    /*
    echo "<pre>";
    print_r($myRow);
    print_r($obj);
    echo "</pre>";
    */
    $lArr = "";
    $rArr = "";
    $lSum = "";
    $rSum = "";
    $lTot = "";
    $rTot = "";
    $dLeft = "";
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Common/Lib/ArrTargets.inc.php';
require_once 'Fun_Final.local.inc.php';
CheckTourSession(true);
$d_Event = isset($_REQUEST['d_Event']) ? $_REQUEST['d_Event'] : null;
$d_Match = isset($_REQUEST['d_Match']) ? $_REQUEST['d_Match'] : null;
$team = isset($_REQUEST['d_Team']) ? $_REQUEST['d_Team'] : 0;
$chunkMode = isset($_REQUEST['d_Mode']) ? $_REQUEST['d_Mode'] : 0;
if (is_null($d_Event) || is_null($d_Match) || !CheckTourSession()) {
    exit;
}
if ($d_Match == '' || $d_Event == '') {
    exit;
}
// tiro fuori le info x lo scontro
$rs = GetFinMatches($d_Event, null, $d_Match, $team, false);
//Carico il vettore dei dati validi
$validData = GetMaxScores($d_Event, $d_Match, $team);
if (safe_num_rows($rs) != 1) {
    exit;
}
$myRow = safe_fetch($rs);
// righe e colonne e so nel caso di individuali cumulativi
$rows = 4;
$cols = 3;
$so = 1;
list($rows, $cols, $so) = CalcScoreRowsColsSO($myRow);
// i due score da stampare a video
$scores = array(1 => '', '');
/*
 * $setPoints contiene contiene i progressivi dei set.