// 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 "; } $Rs = safe_r_sql($Select);
$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 => ''); for ($archer = 1; $archer < 3; $archer++) { for ($row = 0; $row < $rows; $row++) { for ($col = 0; $col < $cols; $col++) { $idx = $row * $cols + $col; $ArValue = empty($myRow->{'arrowString' . $archer}[$idx]) ? '' : DecodeFromLetter($myRow->{'arrowString' . $archer}[$idx]); if ($ArValue == '') { continue; } $scores[$archer][$row][] = $ArValue; } } } // Get the last filled