Re: [BETA] phpBB3 Football MOD Version 0.9.3
Verfasst: 25.06.2014 00:18
Damit bei der aktuellen WM die Achtelfinalteilnehmer automatisch eingetragen werden, kann man in football\includes\functions.php
durch folgendes ersetzen:
Dann werden zumindest die eindeutig platzierten Mannschaften automatisch eingetragen, Bei Punkt und Torgleichheit wird der direkte Vergleich nicht herangezogen und keine davon betroffene Mannschaft ins Achtelfinale übertragen.
Code: Alles auswählen
case 'G':
// GROUP
return '#0#'. substr($para_in_array[0], 1, 1) . '. ' . sprintf($user->lang['GROUP']). ' ' . substr($para_in_array[0], 0, 1) . '#'. substr($para_in_array[0], 1, 1) . '. ' . sprintf($user->lang['GROUP']) . ' ' . substr($para_in_array[0], 0, 1);
break;
Code: Alles auswählen
case 'G':
// GROUP
$group = substr($para_ary[0], 0, 1);
$place = substr($para_ary[0], 1, 1);
$sql = '
SELECT
SUM(1) AS matches,
SUM(IF(m.status = 3, 1, 0)) AS played
FROM ' . FOOTB_MATCHES . " AS m
WHERE m.season = $season AND m.league = $league AND m.group_id = '$group'
GROUP BY m.group_id
";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result))
{
if ($row['matches'] == $row['played'])
{
$sql = '
SELECT
t.*,
SUM(1) AS matches,
SUM(IF((m.team_id_home = t.team_id), IF(goals_home + 0 > goals_guest, 1, 0), IF(goals_home + 0 < goals_guest, 1, 0))) AS win,
SUM(IF(goals_home = goals_guest, 1, 0)) AS draw,
SUM(IF((m.team_id_home = t.team_id), IF(goals_home + 0 < goals_guest, 1, 0), IF(goals_home + 0 > goals_guest, 1, 0))) AS lose,
SUM(IF(m.team_id_home = t.team_id,
IF(goals_home + 0 > goals_guest,
3,
IF(goals_home = goals_guest,
1,
0
)
),
IF(goals_home + 0 < goals_guest,
3,
IF(goals_home = goals_guest,
1,
0
)
)
)
) AS points,
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest, goals_guest - goals_home)) AS goal_diff,
SUM(IF(m.team_id_home = t.team_id, goals_home, goals_guest)) AS goals,
SUM(IF(m.team_id_home = t.team_id, goals_guest, goals_home)) AS goals_get
FROM ' . FOOTB_TEAMS . ' AS t
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league AND
(m.team_id_home = t.team_id OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
WHERE t.season = $season AND t.league = $league AND m.group_id = '$group'
GROUP BY t.team_id
ORDER BY points DESC, goal_diff DESC, goals DESC
";
$result = $db->sql_query($sql);
$rowset = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
if (1 == $place)
{
if ($rowset[0]['points'] == $rowset[1]['points'] AND $rowset[0]['goal_diff'] == $rowset[1]['goal_diff'] AND $rowset[0]['goals'] == $rowset[1]['goals'])
{
return '#0#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $place . '#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $group;
}
else
{
$new_id = $rowset[0]['team_id'];
$sqlup = 'UPDATE ' . FOOTB_MATCHES . " SET $field = $new_id WHERE season = $season AND league = $league AND match_no = $matchnumber";
$resultup = $db->sql_query($sqlup);
$sqlup = 'UPDATE ' . FOOTB_TEAMS . ' SET matchday = (SELECT max(matchday) FROM ' . FOOTB_MATCHES . "
WHERE season = $season AND league = $league AND (team_id_home= $new_id OR team_id_guest = $new_id))
WHERE season = $season AND league = $league AND team_id = $new_id";
$resultup = $db->sql_query($sqlup);
return $rowset[0]['team_symbol'] . '#' . $new_id . '#' . $rowset[0]['team_name'] . '#' . $rowset[0]['team_name_short'];
}
}
else
{
// second
if (($rowset[0]['points'] == $rowset[1]['points'] AND $rowset[0]['goal_diff'] == $rowset[1]['goal_diff'] AND $rowset[0]['goals'] == $rowset[1]['goals'] ) OR
($rowset[2]['points'] == $rowset[1]['points'] AND $rowset[2]['goal_diff'] == $rowset[1]['goal_diff'] AND $rowset[2]['goals'] == $rowset[1]['goals'] ))
{
return '#0#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $group . '#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $group;
}
else
{
$new_id = $rowset[1]['team_id'];
$sqlup = 'UPDATE ' . FOOTB_MATCHES . " SET $field = $new_id WHERE season = $season AND league = $league AND match_no = $matchnumber";
$resultup = $db->sql_query($sqlup);
$sqlup = 'UPDATE ' . FOOTB_TEAMS . ' SET matchday = (SELECT max(matchday) FROM ' . FOOTB_MATCHES . "
WHERE season = $season AND league = $league AND (team_id_home= $new_id OR team_id_guest = $new_id))
WHERE season = $season AND league = $league AND team_id = $new_id";
$resultup = $db->sql_query($sqlup);
return $rowset[1]['team_symbol'] . '#' . $new_id . '#' . $rowset[1]['team_name'] . '#' . $rowset[1]['team_name_short'];
}
}
}
else
{
return '#0#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $group . '#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $group;
}
}
else
{
return '#0#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $group . '#' . $place . '. ' . sprintf($user->lang['GROUP']) . ' ' . $group;
}
break;