Compare commits
25 Commits
v0.9.8
...
dev_julian
| Author | SHA1 | Date | |
|---|---|---|---|
| 66dceff9f2 | |||
| 8b679b1286 | |||
| e1db71c99d | |||
| 3ade0f043f | |||
| f56cf04e74 | |||
| 66b2a1a8d0 | |||
| 889ff05ca6 | |||
| 0b9f099381 | |||
| 148c16c87a | |||
| 511fab50b7 | |||
| 6c06de3772 | |||
| 37204150dc | |||
| 85d3c835d2 | |||
| ac536658fa | |||
| 92267523b9 | |||
| 4a64eb71a3 | |||
| 268ca763f7 | |||
| 66b35b0155 | |||
| 4b627586f8 | |||
| 3b47093a3a | |||
| 511a23d609 | |||
| 6b9ebb0d1a | |||
|
|
7d8b92f1df | ||
|
|
c075143bfc | ||
|
|
a502b5d082 |
24
.gitignore
vendored
@@ -39,3 +39,27 @@ Icon
|
|||||||
# Files that might appear on external disk
|
# Files that might appear on external disk
|
||||||
.Spotlight-V100
|
.Spotlight-V100
|
||||||
.Trashes
|
.Trashes
|
||||||
|
/styles/prosilver/theme/images/right_arrow.png
|
||||||
|
/styles/prosilver/theme/images/icon_allbets.gif
|
||||||
|
/styles/prosilver/theme/images/icon_ball.gif
|
||||||
|
/styles/prosilver/theme/images/icon_ball2.gif
|
||||||
|
/styles/prosilver/theme/images/icon_bet.gif
|
||||||
|
/styles/prosilver/theme/images/icon_bookmark.gif
|
||||||
|
/styles/prosilver/theme/images/icon_download.gif
|
||||||
|
/styles/prosilver/theme/images/icon_info.gif
|
||||||
|
/styles/prosilver/theme/images/icon_list.gif
|
||||||
|
/styles/prosilver/theme/images/icon_mark.gif
|
||||||
|
/styles/prosilver/theme/images/icon_odds.gif
|
||||||
|
/styles/prosilver/theme/images/icon_points.gif
|
||||||
|
/styles/prosilver/theme/images/icon_print.gif
|
||||||
|
/styles/prosilver/theme/images/icon_rank.gif
|
||||||
|
/styles/prosilver/theme/images/icon_results.gif
|
||||||
|
/styles/prosilver/theme/images/icon_rules.gif
|
||||||
|
/styles/prosilver/theme/images/icon_statistic.gif
|
||||||
|
/styles/prosilver/theme/images/icon_statistics.gif
|
||||||
|
/styles/prosilver/theme/images/icon_xml.gif
|
||||||
|
/styles/prosilver/theme/images/left_arrow.png
|
||||||
|
/images/no_change.gif
|
||||||
|
/images/arrow_down.gif
|
||||||
|
/images/arrow_up.gif
|
||||||
|
/migrations/v099_beta1.php
|
||||||
|
|||||||
@@ -219,7 +219,6 @@ class all_bets_module
|
|||||||
$split_after = $count_matches;
|
$split_after = $count_matches;
|
||||||
$splits = 1;
|
$splits = 1;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Make sure $start is set to the last page if it exceeds the amount
|
// Make sure $start is set to the last page if it exceeds the amount
|
||||||
if ($start < 0 || $start >= $total_users)
|
if ($start < 0 || $start >= $total_users)
|
||||||
@@ -311,7 +310,7 @@ class all_bets_module
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
$bet_index++;
|
$bet_index++;
|
||||||
$total += $user_bet['points'];
|
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
|
||||||
if ($user_bet['status'] < 3)
|
if ($user_bet['status'] < 3)
|
||||||
{
|
{
|
||||||
$colorstyle_total = ' color_provisionally';
|
$colorstyle_total = ' color_provisionally';
|
||||||
@@ -419,7 +418,7 @@ class all_bets_module
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
$bet_index++;
|
$bet_index++;
|
||||||
$total += $user_bet['points'];
|
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
|
||||||
if ($user_bet['status'] < 3)
|
if ($user_bet['status'] < 3)
|
||||||
{
|
{
|
||||||
$colorstyle_total = ' color_provisionally';
|
$colorstyle_total = ' color_provisionally';
|
||||||
@@ -573,7 +572,9 @@ class all_bets_module
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result_bet);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$legend = delivery($season, $league, $matchday);
|
$legend = delivery($season, $league, $matchday);
|
||||||
|
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ class bank_module
|
|||||||
AND points_type IN (" . POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY . ')';
|
AND points_type IN (" . POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$count_updates += $db->sql_affectedrows();
|
$count_updates += $db->sql_affectedrows();
|
||||||
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -199,6 +200,7 @@ class bank_module
|
|||||||
HAVING win > 0";
|
HAVING win > 0";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$points_ary = $db->sql_fetchrowset($result);
|
$points_ary = $db->sql_fetchrowset($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
if (!$default_matchday)
|
if (!$default_matchday)
|
||||||
{
|
{
|
||||||
$matchday = (curr_matchday($season, $league) > 0) ? curr_matchday($season, $league) : 1;
|
$matchday = (curr_matchday($season, $league) > 0) ? curr_matchday($season, $league) : 1;
|
||||||
@@ -351,6 +353,7 @@ class bank_module
|
|||||||
AND points_type = $type";
|
AND points_type = $type";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$count_updates += $db->sql_affectedrows();
|
$count_updates += $db->sql_affectedrows();
|
||||||
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
$back_link = $this->u_action . '&action=list&s=' . $season . '&l=' . $league . '&t=' . $type . '&start=' . $start;
|
$back_link = $this->u_action . '&action=list&s=' . $season . '&l=' . $league . '&t=' . $type . '&start=' . $start;
|
||||||
trigger_error(sprintf($user->lang['LEAGUE_' . $points_var . ($count_updates == 1 ? '' : 'S')], $count_updates) . adm_back_link($back_link));
|
trigger_error(sprintf($user->lang['LEAGUE_' . $points_var . ($count_updates == 1 ? '' : 'S')], $count_updates) . adm_back_link($back_link));
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ class bets_module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($resultopen);
|
||||||
if ($count_updates > 0)
|
if ($count_updates > 0)
|
||||||
{
|
{
|
||||||
if ($same AND ($count_matches > 6) AND $this->config['football_same_allowed'] == 0)
|
if ($same AND ($count_matches > 6) AND $this->config['football_same_allowed'] == 0)
|
||||||
@@ -358,7 +359,6 @@ class bets_module
|
|||||||
{
|
{
|
||||||
$success[] = sprintf($user->lang['NO_BETS_SAVED']);
|
$success[] = sprintf($user->lang['NO_BETS_SAVED']);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($resultopen);
|
|
||||||
|
|
||||||
// extra bets
|
// extra bets
|
||||||
$sql = 'SELECT * FROM ' . FOOTB_EXTRA . " WHERE season = $season AND league = $league AND matchday = $matchday";
|
$sql = 'SELECT * FROM ' . FOOTB_EXTRA . " WHERE season = $season AND league = $league AND matchday = $matchday";
|
||||||
@@ -418,6 +418,7 @@ class bets_module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($resultextra);
|
||||||
if ($count_extra_updates)
|
if ($count_extra_updates)
|
||||||
{
|
{
|
||||||
$success[] = sprintf($user->lang['EXTRA_BET' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
$success[] = sprintf($user->lang['EXTRA_BET' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
||||||
@@ -425,6 +426,9 @@ class bets_module
|
|||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
$cash = $this->request->variable('cash', false);
|
$cash = $this->request->variable('cash', false);
|
||||||
save_ranking_matchday($season, $league, $matchday, $cash);
|
save_ranking_matchday($season, $league, $matchday, $cash);
|
||||||
|
bonuspoints($season, $league, $matchday);
|
||||||
|
corr($season, $league, $matchday);
|
||||||
|
chart($season, $league, $matchday);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -582,7 +586,8 @@ class bets_module
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($resultopen);
|
||||||
|
|
||||||
// Calculate extra bets of matchday
|
// Calculate extra bets of matchday
|
||||||
// Start select team
|
// Start select team
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
|
|||||||
@@ -151,8 +151,6 @@ class extra_module
|
|||||||
$existing_extra = sizeof($extra_row);
|
$existing_extra = sizeof($extra_row);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Which page?
|
// Which page?
|
||||||
switch ($action)
|
switch ($action)
|
||||||
@@ -265,7 +263,7 @@ class extra_module
|
|||||||
$matchday_eval_options .= '<option value="' . $row['matchday'] . '"' . $selected_eval . '>' . $day_name . '</option>';
|
$matchday_eval_options .= '<option value="' . $row['matchday'] . '"' . $selected_eval . '>' . $day_name . '</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
$question_type_options = '';
|
$question_type_options = '';
|
||||||
for($i = 1; $i<= 5; $i++)
|
for($i = 1; $i<= 5; $i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class football_module
|
|||||||
));
|
));
|
||||||
|
|
||||||
// Pull the array data from the lang pack
|
// Pull the array data from the lang pack
|
||||||
foreach ($user->help as $help_ary)
|
foreach ($user->lang['FOOTBALL_HELP_FAQ'] as $help_ary)
|
||||||
{
|
{
|
||||||
if ($help_ary[0] == '--')
|
if ($help_ary[0] == '--')
|
||||||
{
|
{
|
||||||
@@ -107,7 +107,7 @@ class football_module
|
|||||||
'football_header_enable' => array('lang' => 'FOOTBALL_HEADER_ENABLE','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'football_header_enable' => array('lang' => 'FOOTBALL_HEADER_ENABLE','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'football_guest_view' => array('lang' => 'GUEST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'football_guest_view' => array('lang' => 'GUEST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'football_user_view' => array('lang' => 'USER_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'football_user_view' => array('lang' => 'USER_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'football_host_timezone' => array('lang' => 'HOST_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'phpbb_timezone_select', 'params' => array($template, $user, '{CONFIG_VALUE}', true), 'explain' => true),
|
'football_time_shift' => array('lang' => 'TIME_SHIFT', 'validate' => 'int', 'type' => 'select', 'method' => 'time_shift_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true),
|
||||||
'football_info_display' => array('lang' => 'FOOTBALL_INFO', 'validate' => 'bool', 'type' => 'custom', 'method' => 'football_info', 'explain' => true),
|
'football_info_display' => array('lang' => 'FOOTBALL_INFO', 'validate' => 'bool', 'type' => 'custom', 'method' => 'football_info', 'explain' => true),
|
||||||
'football_info' => false,
|
'football_info' => false,
|
||||||
'football_win_name' => array('lang' => 'WIN_NAME', 'validate' => 'string', 'type' => 'text:6:6', 'explain' => true),
|
'football_win_name' => array('lang' => 'WIN_NAME', 'validate' => 'string', 'type' => 'text:6:6', 'explain' => true),
|
||||||
@@ -120,6 +120,8 @@ class football_module
|
|||||||
'legend2' => 'GENERAL_SETTINGS',
|
'legend2' => 'GENERAL_SETTINGS',
|
||||||
'football_left_column_width' => array('lang' => 'LEFT_COLUMN', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'football_left_column_width' => array('lang' => 'LEFT_COLUMN', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'football_right_column_width' => array('lang' => 'RIGHT_COLUMN', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'football_right_column_width' => array('lang' => 'RIGHT_COLUMN', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
|
'football_display_last_users' => array('lang' => 'DISPLAY_LAST_USERS', 'validate' => 'int','type' => 'text:3:3', 'explain' => true),
|
||||||
|
'football_display_last_results' => array('lang' => 'DISPLAY_LAST_RESULTS', 'validate' => 'int','type' => 'text:3:3', 'explain' => true),
|
||||||
'football_display_ranks' => array('lang' => 'DISPLAY_RANKS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'football_display_ranks' => array('lang' => 'DISPLAY_RANKS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'football_users_per_page' => array('lang' => 'USERS_PAGE', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'football_users_per_page' => array('lang' => 'USERS_PAGE', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
|
|
||||||
@@ -362,7 +364,7 @@ class football_module
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust Cronjob EMail remember next un
|
* Adjust Cronjob EMail remember next run
|
||||||
*/
|
*/
|
||||||
function next_run($value, $key = '')
|
function next_run($value, $key = '')
|
||||||
{
|
{
|
||||||
@@ -419,6 +421,18 @@ class football_module
|
|||||||
$year_options . ' ' . $user->lang['HOURS'] . ': ' . $hour_options . ' ' . $user->lang['MINUTES'] . ': ' . $minute_options;
|
$year_options . ' ' . $user->lang['HOURS'] . ': ' . $hour_options . ' ' . $user->lang['MINUTES'] . ': ' . $minute_options;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function time_shift_select($default = 0)
|
||||||
|
{
|
||||||
|
$time_shift_options = "";
|
||||||
|
for ($i = -23; $i < 24; $i++)
|
||||||
|
{
|
||||||
|
$selected = ($i == $default) ? ' selected="selected"' : '';
|
||||||
|
$time_shift_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||||
|
}
|
||||||
|
return $time_shift_options;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -153,7 +153,6 @@ class leagues_module
|
|||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if (!($row = $db->sql_fetchrow($result)))
|
if (!($row = $db->sql_fetchrow($result)))
|
||||||
{
|
{
|
||||||
$db->sql_freeresult($result);
|
|
||||||
trigger_error($user->lang['NO_MEMBERS_SELECTED'] . adm_back_link($this->u_action . "&action=list&s=$season&l=$league"), E_USER_WARNING);
|
trigger_error($user->lang['NO_MEMBERS_SELECTED'] . adm_back_link($this->u_action . "&action=list&s=$season&l=$league"), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ class matchdays_module
|
|||||||
ORDER BY matchday ASC, number ASC";
|
ORDER BY matchday ASC, number ASC";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$rows_matchdays = $db->sql_fetchrowset($result);
|
$rows_matchdays = $db->sql_fetchrowset($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
$row_number = 0;
|
$row_number = 0;
|
||||||
foreach ($rows_matchdays as $row_matchday)
|
foreach ($rows_matchdays as $row_matchday)
|
||||||
{
|
{
|
||||||
@@ -710,7 +711,7 @@ class matchdays_module
|
|||||||
if ($data['dday1_day'] <> '--' and $data['dday1_month'] <> '--' and $data['dday1_year'] <> '--')
|
if ($data['dday1_day'] <> '--' and $data['dday1_month'] <> '--' and $data['dday1_year'] <> '--')
|
||||||
{
|
{
|
||||||
$delivery_timestamp = mktime($data['dday1_hour'], $data['dday1_min'], 0, $data['dday1_month'], $data['dday1_day'], $data['dday1_year']);
|
$delivery_timestamp = mktime($data['dday1_hour'], $data['dday1_min'], 0, $data['dday1_month'], $data['dday1_day'], $data['dday1_year']);
|
||||||
$local_board_time = time() + (($this->config['board_timezone'] - $this->config['football_host_timezone']) * 3600);
|
$local_board_time = time() + ($this->config['football_time_shift'] * 3600);
|
||||||
if ($delivery_timestamp > $local_board_time AND $matchday_row['status'] == 0)
|
if ($delivery_timestamp > $local_board_time AND $matchday_row['status'] == 0)
|
||||||
{
|
{
|
||||||
// check if delivery is before all open matches
|
// check if delivery is before all open matches
|
||||||
@@ -764,6 +765,7 @@ class matchdays_module
|
|||||||
// reopen matchday
|
// reopen matchday
|
||||||
$matchday_row['status'] = 0;
|
$matchday_row['status'] = 0;
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ class matches_module
|
|||||||
if ($data['mday_day'] <> '--' and $data['mday_month'] <> '--' and $data['mday_year'] <> '--')
|
if ($data['mday_day'] <> '--' and $data['mday_month'] <> '--' and $data['mday_year'] <> '--')
|
||||||
{
|
{
|
||||||
$match_timestamp = mktime($data['mday_hour'], $data['mday_min'], 0, $data['mday_month'], $data['mday_day'], $data['mday_year']);
|
$match_timestamp = mktime($data['mday_hour'], $data['mday_min'], 0, $data['mday_month'], $data['mday_day'], $data['mday_year']);
|
||||||
$local_board_time = time() + (($this->config['board_timezone'] - $this->config['football_host_timezone']) * 3600);
|
$local_board_time = time() + ($this->config['football_time_shift'] * 3600);
|
||||||
if ($match_timestamp > $local_board_time AND $match_row['status'] < 3 AND $league_info['bet_in_time'] == 1)
|
if ($match_timestamp > $local_board_time AND $match_row['status'] < 3 AND $league_info['bet_in_time'] == 1)
|
||||||
{
|
{
|
||||||
// Bet in time and match moved to future
|
// Bet in time and match moved to future
|
||||||
@@ -627,7 +627,7 @@ class matches_module
|
|||||||
$selected_home = ($home_id && $row['team_id'] == $home_id) ? ' selected="selected"' : '';
|
$selected_home = ($home_id && $row['team_id'] == $home_id) ? ' selected="selected"' : '';
|
||||||
$team_home_options .= '<option value="' . $row['group_id'] . ';' . $row['team_id'] .'"' . $selected_home . '>' . $row['team_name'] . '</option>';
|
$team_home_options .= '<option value="' . $row['group_id'] . ';' . $row['team_id'] .'"' . $selected_home . '>' . $row['team_name'] . '</option>';
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
$u_back = $this->u_action . "&s=$season&l=$league&m=$matchday";
|
$u_back = $this->u_action . "&s=$season&l=$league&m=$matchday";
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class results_module
|
|||||||
{
|
{
|
||||||
trigger_error(sprintf($user->lang['NO_MATCHDAY'], $league_info['league_name'], $season) . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
trigger_error(sprintf($user->lang['NO_MATCHDAY'], $league_info['league_name'], $season) . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
$local_board_time = time() + (($this->config['board_timezone'] - $this->config['football_host_timezone']) * 3600);
|
$local_board_time = time() + ($this->config['football_time_shift'] * 3600);
|
||||||
|
|
||||||
// Which page?
|
// Which page?
|
||||||
switch ($action)
|
switch ($action)
|
||||||
@@ -382,6 +382,7 @@ class results_module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($resultextra);
|
||||||
if ($count_extra_updates)
|
if ($count_extra_updates)
|
||||||
{
|
{
|
||||||
$success[] = sprintf($user->lang['EXTRA_RESULT' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
$success[] = sprintf($user->lang['EXTRA_RESULT' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
||||||
@@ -442,6 +443,9 @@ class results_module
|
|||||||
|
|
||||||
$cash = $this->request->variable('cash', false);
|
$cash = $this->request->variable('cash', false);
|
||||||
save_ranking_matchday($season, $league, $matchday, $cash);
|
save_ranking_matchday($season, $league, $matchday, $cash);
|
||||||
|
bonuspoints($season, $league, $matchday);
|
||||||
|
corr($season, $league, $matchday);
|
||||||
|
chart($season, $league, $matchday);
|
||||||
|
|
||||||
// Patch delevirey
|
// Patch delevirey
|
||||||
if ($league_info['bet_in_time'] == 1)
|
if ($league_info['bet_in_time'] == 1)
|
||||||
@@ -768,6 +772,7 @@ class results_module
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
switch ($league_info['bet_ko_type'])
|
switch ($league_info['bet_ko_type'])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -397,6 +397,7 @@ class update_module
|
|||||||
{
|
{
|
||||||
$error[] = sprintf($user->lang['MISMATCH_MATCHDAYS'], $row['matchdays']);
|
$error[] = sprintf($user->lang['MISMATCH_MATCHDAYS'], $row['matchdays']);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(match_no) as matches
|
$sql = 'SELECT COUNT(match_no) as matches
|
||||||
FROM ' . FOOTB_MATCHES . "
|
FROM ' . FOOTB_MATCHES . "
|
||||||
@@ -414,6 +415,7 @@ class update_module
|
|||||||
{
|
{
|
||||||
$error[] = sprintf($user->lang['MISMATCH_MATCHES'], $row['matches']);
|
$error[] = sprintf($user->lang['MISMATCH_MATCHES'], $row['matches']);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
@@ -547,6 +549,7 @@ class update_module
|
|||||||
$count_updates++;
|
$count_updates++;
|
||||||
$effected_matchdays = ($effected_matchdays == '') ? $row['matchday'] : $effected_matchdays . ', ' . $row['matchday'];
|
$effected_matchdays = ($effected_matchdays == '') ? $row['matchday'] : $effected_matchdays . ', ' . $row['matchday'];
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
if ($effected_matchdays <> '')
|
if ($effected_matchdays <> '')
|
||||||
{
|
{
|
||||||
$sql = 'REPLACE INTO ' . FOOTB_MATCHDAYS . ' (season, league, matchday, status, delivery_date, delivery_date_2, delivery_date_3, matchday_name, matches)
|
$sql = 'REPLACE INTO ' . FOOTB_MATCHDAYS . ' (season, league, matchday, status, delivery_date, delivery_date_2, delivery_date_3, matchday_name, matches)
|
||||||
@@ -591,6 +594,7 @@ class update_module
|
|||||||
$count_updates++;
|
$count_updates++;
|
||||||
$effected_matchdays = ($effected_matchdays == '') ? $row['matchday'] : $effected_matchdays . ', ' . $row['matchday'];
|
$effected_matchdays = ($effected_matchdays == '') ? $row['matchday'] : $effected_matchdays . ', ' . $row['matchday'];
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
if ($effected_matchdays <> '')
|
if ($effected_matchdays <> '')
|
||||||
{
|
{
|
||||||
$sql = 'REPLACE INTO ' . FOOTB_MATCHDAYS . ' (season, league, matchday, status, delivery_date, delivery_date_2, delivery_date_3, matchday_name, matches)
|
$sql = 'REPLACE INTO ' . FOOTB_MATCHDAYS . ' (season, league, matchday, status, delivery_date, delivery_date_2, delivery_date_3, matchday_name, matches)
|
||||||
@@ -635,6 +639,7 @@ class update_module
|
|||||||
$count_updates++;
|
$count_updates++;
|
||||||
$effected_matchdays = ($effected_matchdays == '') ? $row['matchday'] : $effected_matchdays . ', ' . $row['matchday'];
|
$effected_matchdays = ($effected_matchdays == '') ? $row['matchday'] : $effected_matchdays . ', ' . $row['matchday'];
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
if ($effected_matchdays <> '')
|
if ($effected_matchdays <> '')
|
||||||
{
|
{
|
||||||
$sql = 'REPLACE INTO ' . FOOTB_MATCHDAYS . ' (season, league, matchday, status, delivery_date, delivery_date_2, delivery_date_3, matchday_name, matches)
|
$sql = 'REPLACE INTO ' . FOOTB_MATCHDAYS . ' (season, league, matchday, status, delivery_date, delivery_date_2, delivery_date_3, matchday_name, matches)
|
||||||
@@ -662,7 +667,7 @@ class update_module
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check status of matchdays
|
// check status of matchdays
|
||||||
$local_board_time = time() + (($this->config['board_timezone'] - $this->config['football_host_timezone']) * 3600);
|
$local_board_time = time() + ($this->config['football_time_shift'] * 3600);
|
||||||
$sql = $sql = 'UPDATE ' . FOOTB_MATCHDAYS . " AS target
|
$sql = $sql = 'UPDATE ' . FOOTB_MATCHDAYS . " AS target
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
(
|
(
|
||||||
@@ -1382,6 +1387,7 @@ class update_module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
return $count_updates;
|
return $count_updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,23 @@ if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
|||||||
|
|
||||||
$start = $this->request->variable('start', 0);
|
$start = $this->request->variable('start', 0);
|
||||||
$matches_on_matchday = false;
|
$matches_on_matchday = false;
|
||||||
|
$league_info = league_info($season, $league);
|
||||||
$sql = 'SELECT COUNT(DISTINCT user_id) AS num_users
|
if($league_info['bet_type'])
|
||||||
FROM ' . FOOTB_BETS . "
|
{
|
||||||
WHERE season = $season AND league = $league";
|
$sql = 'SELECT COUNT(DISTINCT b.user_id) AS num_users
|
||||||
|
FROM ' . FOOTB_MATCHES . ' AS m
|
||||||
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
||||||
|
WHERE b.season = $season AND b.league = $league AND m.matchday = $matchday";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT COUNT(DISTINCT b.user_id) AS num_users
|
||||||
|
FROM ' . FOOTB_MATCHES . ' AS m
|
||||||
|
LEFT JOIN ' . FOOTB_BETS . ' AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
||||||
|
LEFT JOIN ' . FOOTB_MATCHES . ' AS m2 ON (m2.season = m.season AND m2.league = m.league + 50 AND m2.matchday = m.matchday AND m2.team_id_home = b.user_id + 2000)
|
||||||
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m3 ON (m3.season = m.season AND m3.league = m.league + 50 AND m3.matchday = m.matchday AND m3.team_id_guest = b.user_id + 2000)
|
||||||
|
WHERE b.season = $season AND b.league = $league AND m.matchday = $matchday AND (m2.match_no IS NOT NULL || m3.match_no IS NOT NULL) ";
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$total_users = (int) $db->sql_fetchfield('num_users');
|
$total_users = (int) $db->sql_fetchfield('num_users');
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
@@ -36,7 +48,19 @@ $sql = "SELECT
|
|||||||
m.goals_guest,
|
m.goals_guest,
|
||||||
SUM(IF(b.goals_home + 0 > b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS home,
|
SUM(IF(b.goals_home + 0 > b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS home,
|
||||||
SUM(IF(b.goals_home = b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS draw,
|
SUM(IF(b.goals_home = b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS draw,
|
||||||
SUM(IF(b.goals_home + 0 < b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS guest
|
SUM(IF(b.goals_home + 0 < b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS guest,
|
||||||
|
CONCAT(
|
||||||
|
CASE DATE_FORMAT(m.match_datetime,'%w')
|
||||||
|
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
||||||
|
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
||||||
|
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
||||||
|
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
||||||
|
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
||||||
|
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
||||||
|
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
||||||
|
ELSE 'Error' END,
|
||||||
|
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
||||||
|
) AS match_time
|
||||||
FROM " . FOOTB_MATCHES . ' AS m
|
FROM " . FOOTB_MATCHES . ' AS m
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . ' AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
LEFT JOIN ' . FOOTB_TEAMS . ' AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||||
@@ -67,7 +91,7 @@ if ($user->data['football_mobile'])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($count_matches > 11)
|
if ($count_matches > 12)
|
||||||
{
|
{
|
||||||
$split_after = 8;
|
$split_after = 8;
|
||||||
$splits = ceil($count_matches / 8);
|
$splits = ceil($count_matches / 8);
|
||||||
@@ -78,7 +102,6 @@ else
|
|||||||
$splits = 1;
|
$splits = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Make sure $start is set to the last page if it exceeds the amount
|
// Make sure $start is set to the last page if it exceeds the amount
|
||||||
if ($start < 0 || $start >= $total_users)
|
if ($start < 0 || $start >= $total_users)
|
||||||
@@ -114,21 +137,47 @@ if ($count_matches > 0)
|
|||||||
{
|
{
|
||||||
$matches_on_matchday = true;
|
$matches_on_matchday = true;
|
||||||
|
|
||||||
$sql = "SELECT
|
if($league_info['bet_type'])
|
||||||
u.user_id,
|
{
|
||||||
u.username,
|
$sql = "SELECT
|
||||||
m.status,
|
u.user_id,
|
||||||
b.goals_home AS bet_home,
|
u.username,
|
||||||
b.goals_guest AS bet_guest,
|
m.status,
|
||||||
" . select_points() . '
|
b.goals_home AS bet_home,
|
||||||
FROM ' . FOOTB_MATCHES . ' AS m
|
b.goals_guest AS bet_guest,
|
||||||
LEFT JOIN ' . FOOTB_BETS . ' AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
IFNULL(m2.match_no,m3.match_no),
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
" . select_points() . '
|
||||||
WHERE m.season = $season
|
FROM ' . FOOTB_MATCHES . ' AS m
|
||||||
AND m.league = $league
|
LEFT JOIN ' . FOOTB_BETS . ' AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
||||||
AND m.matchday = $matchday
|
LEFT JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
|
||||||
ORDER BY LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
|
LEFT JOIN ' . FOOTB_MATCHES . ' AS m2 ON (m2.season = m.season AND m2.league = m.league + 50 AND m2.matchday = m.matchday AND m2.team_id_home = b.user_id + 2000)
|
||||||
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m3 ON (m3.season = m.season AND m3.league = m.league + 50 AND m3.matchday = m.matchday AND m3.team_id_guest = b.user_id + 2000)
|
||||||
|
WHERE m.season = $season
|
||||||
|
AND m.league = $league
|
||||||
|
AND m.matchday = $matchday
|
||||||
|
ORDER BY IFNULL(m2.match_no,m3.match_no) ASC, m3.match_no ASC, LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SELECT
|
||||||
|
u.user_id,
|
||||||
|
u.username,
|
||||||
|
m.status,
|
||||||
|
b.goals_home AS bet_home,
|
||||||
|
b.goals_guest AS bet_guest,
|
||||||
|
IFNULL(m2.match_no,m3.match_no),
|
||||||
|
" . select_points() . '
|
||||||
|
FROM ' . FOOTB_MATCHES . ' AS m
|
||||||
|
LEFT JOIN ' . FOOTB_BETS . ' AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
||||||
|
LEFT JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
|
||||||
|
LEFT JOIN ' . FOOTB_MATCHES . ' AS m2 ON (m2.season = m.season AND m2.league = m.league + 50 AND m2.matchday = m.matchday AND m2.team_id_home = b.user_id + 2000)
|
||||||
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m3 ON (m3.season = m.season AND m3.league = m.league + 50 AND m3.matchday = m.matchday AND m3.team_id_guest = b.user_id + 2000)
|
||||||
|
WHERE m.season = $season
|
||||||
|
AND m.league = $league
|
||||||
|
AND m.matchday = $matchday
|
||||||
|
AND (m3.match_no IS NOT NULL OR m2.match_no IS NOT NULL)
|
||||||
|
ORDER BY IFNULL(m2.match_no,m3.match_no) ASC, m3.match_no ASC, LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
|
||||||
|
}
|
||||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||||
$user_bets = $db->sql_fetchrowset($result);
|
$user_bets = $db->sql_fetchrowset($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
@@ -170,7 +219,15 @@ foreach ($matches AS $match)
|
|||||||
if ($bet_index == 0)
|
if ($bet_index == 0)
|
||||||
{
|
{
|
||||||
$count_user++;
|
$count_user++;
|
||||||
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$league_info = league_info($season, $league);
|
||||||
|
if ($league_info['bet_type'])
|
||||||
|
{
|
||||||
|
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$row_class = (!(($count_user + ($count_user % 2)) % 4)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
|
}
|
||||||
if ($user_bet['user_id'] == $user->data['user_id'])
|
if ($user_bet['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$row_class = 'bg3 row_user';
|
||||||
@@ -183,7 +240,7 @@ foreach ($matches AS $match)
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
$bet_index++;
|
$bet_index++;
|
||||||
$total += $user_bet['points'];
|
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
|
||||||
if ($user_bet['status'] < 3)
|
if ($user_bet['status'] < 3)
|
||||||
{
|
{
|
||||||
$colorstyle_total = ' color_provisionally';
|
$colorstyle_total = ' color_provisionally';
|
||||||
@@ -265,10 +322,11 @@ foreach ($matches AS $match)
|
|||||||
}
|
}
|
||||||
$colorstyle_match = color_style($match['status']);
|
$colorstyle_match = color_style($match['status']);
|
||||||
$template->assign_block_vars('match_panel.match_entry', array(
|
$template->assign_block_vars('match_panel.match_entry', array(
|
||||||
'HOME_NAME' => $homename,
|
'HOME_NAME' => $homename,
|
||||||
'GUEST_NAME' => $guestname,
|
'GUEST_NAME' => $guestname,
|
||||||
'RESULT' => $match['goals_home']. ':'.$match['goals_guest'],
|
'RESULT' => $match['goals_home']. ':'.$match['goals_guest'],
|
||||||
'COLOR_STYLE' => $colorstyle_match,
|
'COLOR_STYLE' => $colorstyle_match,
|
||||||
|
'MATCH_TIME' => $match['match_time'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ($match['status'] < 1 && !$config['football_view_tendencies'])
|
if ($match['status'] < 1 && !$config['football_view_tendencies'])
|
||||||
@@ -288,59 +346,70 @@ if ($count_matches > 0)
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
$count_user = 0;
|
$count_user = 0;
|
||||||
$bet_index = 0;
|
$bet_index = 0;
|
||||||
foreach ($bet_line[$split_index] AS $user_bet)
|
if(!empty($bet_line))
|
||||||
{
|
{
|
||||||
if ($bet_index == 0)
|
foreach ($bet_line[$split_index] AS $user_bet)
|
||||||
{
|
{
|
||||||
$count_user++;
|
if ($bet_index == 0)
|
||||||
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
|
||||||
if ($user_bet['user_id'] == $user->data['user_id'])
|
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$count_user++;
|
||||||
|
$league_info = league_info($season, $league);
|
||||||
|
if ($league_info['bet_type'])
|
||||||
|
{
|
||||||
|
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$row_class = (!(($count_user + ($count_user % 2)) % 4)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
|
}
|
||||||
|
if ($user_bet['user_id'] == $user->data['user_id'])
|
||||||
|
{
|
||||||
|
$row_class = 'bg3 row_user';
|
||||||
|
}
|
||||||
|
$template->assign_block_vars('match_panel.user_row', array(
|
||||||
|
'ROW_CLASS' => $row_class,
|
||||||
|
'USER_NAME' => $user_bet['username'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$total = 0;
|
||||||
|
}
|
||||||
|
$bet_index++;
|
||||||
|
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
|
||||||
|
if ($user_bet['status'] < 3)
|
||||||
|
{
|
||||||
|
$colorstyle_total = ' color_provisionally';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('match_panel.user_row', array(
|
if ($user_bet['status'] < 1 && !$config['football_view_bets'])
|
||||||
'ROW_CLASS' => $row_class,
|
{
|
||||||
'USER_NAME' => $user_bet['username'],
|
// hide bets
|
||||||
|
$bet_home = ($user_bet['bet_home'] == '') ? '' : '?';
|
||||||
|
$bet_guest = ($user_bet['bet_guest'] == '') ? '' : '?';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$bet_home = $user_bet['bet_home'];
|
||||||
|
$bet_guest = $user_bet['bet_guest'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$colorstyle_bet = color_style($user_bet['status']);
|
||||||
|
$template->assign_block_vars('match_panel.user_row.bet', array(
|
||||||
|
'BET' => $bet_home. ':'. $bet_guest,
|
||||||
|
'COLOR_STYLE' => $colorstyle_bet,
|
||||||
|
'POINTS' => ($user_bet['points'] == '') ? ' ' : $user_bet['points'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$total = 0;
|
|
||||||
}
|
|
||||||
$bet_index++;
|
|
||||||
$total += $user_bet['points'];
|
|
||||||
if ($user_bet['status'] < 3)
|
|
||||||
{
|
|
||||||
$colorstyle_total = ' color_provisionally';
|
|
||||||
}
|
|
||||||
if ($user_bet['status'] < 1 && !$config['football_view_bets'])
|
|
||||||
{
|
|
||||||
// hide bets
|
|
||||||
$bet_home = ($user_bet['bet_home'] == '') ? '' : '?';
|
|
||||||
$bet_guest = ($user_bet['bet_guest'] == '') ? '' : '?';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$bet_home = $user_bet['bet_home'];
|
|
||||||
$bet_guest = $user_bet['bet_guest'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$colorstyle_bet = color_style($user_bet['status']);
|
|
||||||
$template->assign_block_vars('match_panel.user_row.bet', array(
|
|
||||||
'BET' => $bet_home. ':'. $bet_guest,
|
|
||||||
'COLOR_STYLE' => $colorstyle_bet,
|
|
||||||
'POINTS' => ($user_bet['points'] == '') ? ' ' : $user_bet['points'],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($bet_index == $last_match_index)
|
if ($bet_index == $last_match_index)
|
||||||
{
|
{
|
||||||
$sum_total[$user_bet['username']] += $total;
|
$sum_total[$user_bet['username']] += $total;
|
||||||
$matchday_sum_total += $total;
|
$matchday_sum_total += $total;
|
||||||
$template->assign_block_vars('match_panel.user_row.points', array(
|
$template->assign_block_vars('match_panel.user_row.points', array(
|
||||||
'COLOR_STYLE' => $colorstyle_total,
|
'COLOR_STYLE' => $colorstyle_total,
|
||||||
'POINTS_TOTAL' => $sum_total[$user_bet['username']],
|
'POINTS_TOTAL' => $sum_total[$user_bet['username']],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$bet_index = 0;
|
$bet_index = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +520,7 @@ while ($row = $db->sql_fetchrow($result))
|
|||||||
while ($user_row = $db->sql_fetchrow($result_bet))
|
while ($user_row = $db->sql_fetchrow($result_bet))
|
||||||
{
|
{
|
||||||
$bet_number++ ;
|
$bet_number++ ;
|
||||||
$row_class = (!($bet_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!(($count_user + ($count_user % 2)) % 4)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if ($user_row['user_id'] == $user->data['user_id'])
|
if ($user_row['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$row_class = 'bg3 row_user';
|
||||||
@@ -479,19 +548,14 @@ while ($row = $db->sql_fetchrow($result))
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result_bet);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['ALL_BETS']);
|
$sidename = sprintf($user->lang['ALL_BETS']);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_ALL_BETS' => true,
|
'S_DISPLAY_ALL_BETS' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['BET']),
|
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'RIGHT_LINK' => sprintf($user->lang['RESULTS']) . ' >',
|
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_BET']),
|
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_RESULTS']),
|
|
||||||
'S_MATCHES_ON_MATCHDAY' => $matches_on_matchday,
|
'S_MATCHES_ON_MATCHDAY' => $matches_on_matchday,
|
||||||
'S_SPALTEN' => ($count_matches * 2) + 2,
|
'S_SPALTEN' => ($count_matches * 2) + 2,
|
||||||
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
||||||
|
|||||||
462
block/bank.php
@@ -1,235 +1,229 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Check Prediction League authorisation
|
// Check Prediction League authorisation
|
||||||
if ( !$this->auth->acl_get('u_use_football') )
|
if ( !$this->auth->acl_get('u_use_football') )
|
||||||
{
|
{
|
||||||
trigger_error('NO_AUTH_VIEW');
|
trigger_error('NO_AUTH_VIEW');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
global $phpbb_extension_manager;
|
global $phpbb_extension_manager;
|
||||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints'))
|
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints'))
|
||||||
{
|
{
|
||||||
$this->user->add_lang_ext('dmzx/ultimatepoints', 'common');
|
$this->user->add_lang_ext('dmzx/ultimatepoints', 'common');
|
||||||
// Get an instance of the ultimatepoints functions_points
|
// Get an instance of the ultimatepoints functions_points
|
||||||
$functions_points = $phpbb_container->get('dmzx.ultimatepoints.core.functions.points');
|
$functions_points = $phpbb_container->get('dmzx.ultimatepoints.core.functions.points');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get an instance of the football functions_points
|
// Get an instance of the football functions_points
|
||||||
$functions_points = $phpbb_container->get('football.football.core.functions.points');
|
$functions_points = $phpbb_container->get('football.football.core.functions.points');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_sel)
|
if (!$user_sel)
|
||||||
{
|
{
|
||||||
if (user_is_member($user->data['user_id'], $season, $league) or $league == 0)
|
if (user_is_member($user->data['user_id'], $season, $league) or $league == 0)
|
||||||
{
|
{
|
||||||
$user_sel = $user->data['user_id'];
|
$user_sel = $user->data['user_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$username = '';
|
$username = '';
|
||||||
$member = true;
|
$member = true;
|
||||||
if ($this->auth->acl_get('a_football_points'))
|
if ($this->auth->acl_get('a_football_points'))
|
||||||
{
|
{
|
||||||
$where_user = '';
|
$where_user = '';
|
||||||
$multi_view = true;
|
$multi_view = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$multi_view = false;
|
$multi_view = false;
|
||||||
if (user_is_member($user->data['user_id'], $season, $league))
|
if (user_is_member($user->data['user_id'], $season, $league))
|
||||||
{
|
{
|
||||||
$where_user = ' AND b.user_id = ' . $user->data['user_id'] . ' ';
|
$where_user = ' AND b.user_id = ' . $user->data['user_id'] . ' ';
|
||||||
$user_sel = $user->data['user_id'];
|
$user_sel = $user->data['user_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($league)
|
if ($league)
|
||||||
{
|
{
|
||||||
$member = false;
|
$member = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$where_league = '';
|
$where_league = '';
|
||||||
if ($league)
|
if ($league)
|
||||||
{
|
{
|
||||||
$where_league = " AND b.league = $league";
|
$where_league = " AND b.league = $league";
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
// Select user
|
// Select user
|
||||||
$total_users = 0;
|
$total_users = 0;
|
||||||
$sql = 'SELECT DISTINCT
|
$sql = 'SELECT DISTINCT
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.username
|
u.username
|
||||||
FROM ' . FOOTB_BETS . ' AS b
|
FROM ' . FOOTB_BETS . ' AS b
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
$where_league
|
$where_league
|
||||||
$where_user
|
$where_user
|
||||||
ORDER BY LOWER(u.username) ASC";
|
ORDER BY LOWER(u.username) ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$total_users++;
|
$total_users++;
|
||||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||||
{
|
{
|
||||||
$selectid = ' selected="selected"';
|
$selectid = ' selected="selected"';
|
||||||
$username = $row['username'];
|
$username = $row['username'];
|
||||||
$user_sel = $row['user_id'];
|
$user_sel = $row['user_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selectid = '';
|
$selectid = '';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('form_user', array(
|
$template->assign_block_vars('form_user', array(
|
||||||
'S_USER' => $row['user_id'],
|
'S_USER' => $row['user_id'],
|
||||||
'S_USERNAME' => $row['username'],
|
'S_USERNAME' => $row['username'],
|
||||||
'S_SELECTEDID' => $selectid,
|
'S_SELECTEDID' => $selectid,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$where_season = '';
|
$where_season = '';
|
||||||
if ($season)
|
if ($season)
|
||||||
{
|
{
|
||||||
$where_season = " AND fp.season = $season";
|
$where_season = " AND fp.season = $season";
|
||||||
}
|
}
|
||||||
|
|
||||||
$where_league = '';
|
$where_league = '';
|
||||||
$order_by = 'ORDER BY fp.points_type ASC, fp.matchday ASC, fp.league ASC';
|
$order_by = 'ORDER BY fp.points_type ASC, fp.matchday ASC, fp.league ASC';
|
||||||
|
|
||||||
if ($league)
|
if ($league)
|
||||||
{
|
{
|
||||||
$where_league = " AND fp.league = $league";
|
$where_league = " AND fp.league = $league";
|
||||||
$order_by = 'ORDER BY fp.league ASC, fp.matchday ASC, fp.points_type ASC';
|
$order_by = 'ORDER BY fp.league ASC, fp.matchday ASC, fp.points_type ASC';
|
||||||
}
|
}
|
||||||
|
|
||||||
// The different book types
|
// The different book types
|
||||||
$types = array(
|
$types = array(
|
||||||
0 => '--',
|
0 => '--',
|
||||||
1 => sprintf($user->lang['FOOTBALL_BET_POINTS']),
|
1 => sprintf($user->lang['FOOTBALL_BET_POINTS']),
|
||||||
2 => $user->lang['FOOTBALL_DEPOSIT'],
|
2 => $user->lang['FOOTBALL_DEPOSIT'],
|
||||||
3 => sprintf($user->lang['FOOTBALL_WIN']),
|
3 => sprintf($user->lang['FOOTBALL_WIN']),
|
||||||
4 => $user->lang['FOOTBALL_WIN'],
|
4 => $user->lang['FOOTBALL_WIN'],
|
||||||
5 => $user->lang['FOOTBALL_WIN'],
|
5 => $user->lang['FOOTBALL_WIN'],
|
||||||
6 => $user->lang['FOOTBALL_WIN'],
|
6 => $user->lang['FOOTBALL_WIN'],
|
||||||
7 => $user->lang['FOOTBALL_PAYOUT'],
|
7 => $user->lang['FOOTBALL_PAYOUT'],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Grab the football points
|
// Grab the football points
|
||||||
$sql = 'SELECT fp.season,
|
$sql = 'SELECT fp.season,
|
||||||
s.season_name,
|
s.season_name,
|
||||||
s.season_name_short,
|
s.season_name_short,
|
||||||
fp.league,
|
fp.league,
|
||||||
l.league_name,
|
l.league_name,
|
||||||
l.league_name_short,
|
l.league_name_short,
|
||||||
fp.matchday,
|
fp.matchday,
|
||||||
md.matchday_name,
|
md.matchday_name,
|
||||||
fp.points_type,
|
fp.points_type,
|
||||||
fp.points,
|
fp.points,
|
||||||
fp.points_comment,
|
fp.points_comment,
|
||||||
fp.cash
|
fp.cash
|
||||||
FROM ' . FOOTB_POINTS . ' AS fp
|
FROM ' . FOOTB_POINTS . ' AS fp
|
||||||
INNER JOIN ' . FOOTB_SEASONS . ' AS s ON (s.season = fp.season)
|
INNER JOIN ' . FOOTB_SEASONS . ' AS s ON (s.season = fp.season)
|
||||||
INNER JOIN ' . FOOTB_LEAGUES . ' AS l ON (l.season = fp.season AND l.league = fp.league)
|
INNER JOIN ' . FOOTB_LEAGUES . ' AS l ON (l.season = fp.season AND l.league = fp.league)
|
||||||
INNER JOIN ' . FOOTB_MATCHDAYS . ' AS md ON (md.season = fp.season AND md.league = fp.league AND md.matchday = fp.matchday)
|
INNER JOIN ' . FOOTB_MATCHDAYS . ' AS md ON (md.season = fp.season AND md.league = fp.league AND md.matchday = fp.matchday)
|
||||||
WHERE user_id = ' . (int) $user_sel . "
|
WHERE user_id = ' . (int) $user_sel . "
|
||||||
$where_season
|
$where_season
|
||||||
$where_league
|
$where_league
|
||||||
$order_by";
|
$order_by";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$current_balance = 0.00;
|
$current_balance = 0.00;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
// Start looping all the football points
|
// Start looping all the football points
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$count = $count + 1;
|
$count = $count + 1;
|
||||||
if ($row['points_type'] == POINTS_BET OR $row['points_type'] == POINTS_PAID)
|
if ($row['points_type'] == POINTS_BET OR $row['points_type'] == POINTS_PAID)
|
||||||
{
|
{
|
||||||
$points_sign = '-';
|
$points_sign = '-';
|
||||||
$points_style = " color: red;";
|
$points_style = " color: red;";
|
||||||
$current_balance -= $row['points'];
|
$current_balance -= $row['points'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$points_sign = '+';
|
$points_sign = '+';
|
||||||
$points_style = " color: green;";
|
$points_style = " color: green;";
|
||||||
$current_balance += $row['points'];
|
$current_balance += $row['points'];
|
||||||
}
|
}
|
||||||
// Add the items to the template
|
// Add the items to the template
|
||||||
$template->assign_block_vars('football', array(
|
$template->assign_block_vars('football', array(
|
||||||
'SEASON' => $season,
|
'SEASON' => $season,
|
||||||
'SEASON_NAME' => $season_name,
|
'SEASON_NAME' => $season_name,
|
||||||
'LEAGUE' => $row['league'],
|
'LEAGUE' => $row['league'],
|
||||||
'LEAGUE_NAME' => $row['league_name'],
|
'LEAGUE_NAME' => $row['league_name'],
|
||||||
'LEAGUE_SHORT' => $row['league_name_short'],
|
'LEAGUE_SHORT' => $row['league_name_short'],
|
||||||
'MATCHDAY' => $row['matchday'],
|
'MATCHDAY' => $row['matchday'],
|
||||||
'MATCHDAY_NAME' => ($row['matchday_name'] == '') ? $row['matchday'] . '.' . sprintf($user->lang['FOOTBALL_MATCHDAY']) : $row['matchday_name'],
|
'MATCHDAY_NAME' => ($row['matchday_name'] == '') ? $row['matchday'] . '.' . sprintf($user->lang['FOOTBALL_MATCHDAY']) : $row['matchday_name'],
|
||||||
'MATCHDAY_SHORT'=> $row['matchday'] . '.' . sprintf($user->lang['MATCHDAY_SHORT']),
|
'MATCHDAY_SHORT'=> $row['matchday'] . '.' . sprintf($user->lang['MATCHDAY_SHORT']),
|
||||||
'POINTS_SIGN' => $points_sign,
|
'POINTS_SIGN' => $points_sign,
|
||||||
'POINTS_STYLE' => $points_style,
|
'POINTS_STYLE' => $points_style,
|
||||||
'POINTS_TYPE' => $types[$row['points_type']],
|
'POINTS_TYPE' => $types[$row['points_type']],
|
||||||
'S_CASH' => $row['cash'],
|
'S_CASH' => $row['cash'],
|
||||||
'POINTS' => $functions_points->number_format_points($row['points']),
|
'POINTS' => $functions_points->number_format_points($row['points']),
|
||||||
'COMMENT' => nl2br($row['points_comment']),
|
'COMMENT' => nl2br($row['points_comment']),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($current_balance < 0)
|
if ($current_balance < 0)
|
||||||
{
|
{
|
||||||
$points_style = " color: red;";
|
$points_style = " color: red;";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$points_style = " color: green;";
|
$points_style = " color: green;";
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('football', array(
|
$template->assign_block_vars('football', array(
|
||||||
'SEASON' => $season,
|
'SEASON' => $season,
|
||||||
'SEASON_NAME' => '',
|
'SEASON_NAME' => '',
|
||||||
'LEAGUE' => $league,
|
'LEAGUE' => $league,
|
||||||
'LEAGUE_NAME' => '',
|
'LEAGUE_NAME' => '',
|
||||||
'MATCHDAY' => '',
|
'MATCHDAY' => '',
|
||||||
'MATCHDAY_NAME' => '',
|
'MATCHDAY_NAME' => '',
|
||||||
'POINTS_SIGN' => '',
|
'POINTS_SIGN' => '',
|
||||||
'POINTS_STYLE' => $points_style,
|
'POINTS_STYLE' => $points_style,
|
||||||
'POINTS_TYPE' => '',
|
'POINTS_TYPE' => '',
|
||||||
'S_CASH' => 1,
|
'S_CASH' => 1,
|
||||||
'POINTS' => $functions_points->number_format_points($current_balance),
|
'POINTS' => $functions_points->number_format_points($current_balance),
|
||||||
'COMMENT' => ($league == 0) ? sprintf($user->lang['FOOTBALL_BALANCES']) : sprintf($user->lang['FOOTBALL_BALANCE']),
|
'COMMENT' => ($league == 0) ? sprintf($user->lang['FOOTBALL_BALANCES']) : sprintf($user->lang['FOOTBALL_BALANCE']),
|
||||||
));
|
));
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['FOOTBALL_BANK']);
|
$sidename = sprintf($user->lang['FOOTBALL_BANK']);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_BANK' => true,
|
'S_DISPLAY_BANK' => true,
|
||||||
'S_MATCHDAY_HIDE' => true,
|
'S_MATCHDAY_HIDE' => true,
|
||||||
'S_MEMBER' => $member,
|
'S_MEMBER' => $member,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'S_MULTI_VIEW' => $multi_view,
|
'S_MULTI_VIEW' => $multi_view,
|
||||||
'L_TOTAL_ENTRIES' => ($count == 1) ? $count . ' ' .sprintf($user->lang['FOOTBALL_RECORD']) : $count . ' ' .sprintf($user->lang['FOOTBALL_RECORDS']),
|
'L_TOTAL_ENTRIES' => ($count == 1) ? $count . ' ' .sprintf($user->lang['FOOTBALL_RECORD']) : $count . ' ' .sprintf($user->lang['FOOTBALL_RECORDS']),
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'USERNAME' => $username,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['RANK_TOTAL']),
|
'POINTS' => $config['football_win_name'],
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
)
|
||||||
'RIGHT_LINK' => sprintf($user->lang['MY_BETS']) . ' >',
|
);
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_RANK_TOTAL']),
|
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_BETS']),
|
|
||||||
'USERNAME' => $username,
|
|
||||||
'POINTS' => $config['football_win_name'],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
1062
block/bet.php
@@ -1,391 +1,392 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Can this user view Prediction Leagues pages?
|
// Can this user view Prediction Leagues pages?
|
||||||
if (!$config['football_guest_view'])
|
if (!$config['football_guest_view'])
|
||||||
{
|
{
|
||||||
if ($user->data['user_id'] == ANONYMOUS)
|
if ($user->data['user_id'] == ANONYMOUS)
|
||||||
{
|
{
|
||||||
trigger_error('NO_GUEST_VIEW');
|
trigger_error('NO_GUEST_VIEW');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$config['football_user_view'])
|
if (!$config['football_user_view'])
|
||||||
{
|
{
|
||||||
// Only Prediction League member should see this page
|
// Only Prediction League member should see this page
|
||||||
// Check Prediction League authorisation
|
// Check Prediction League authorisation
|
||||||
if ( !$this->auth->acl_get('u_use_football') )
|
if ( !$this->auth->acl_get('u_use_football') )
|
||||||
{
|
{
|
||||||
trigger_error('NO_AUTH_VIEW');
|
trigger_error('NO_AUTH_VIEW');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Football disabled?
|
// Football disabled?
|
||||||
if ($config['football_disable'])
|
if ($config['football_disable'])
|
||||||
{
|
{
|
||||||
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
$userid = $this->request->variable('u', 0);
|
$userid = $this->request->variable('u', 0);
|
||||||
$season = $this->request->variable('s', 0);
|
$season = $this->request->variable('s', 0);
|
||||||
$league = $this->request->variable('l', 0);
|
$league = $this->request->variable('l', 0);
|
||||||
$matchday = $this->request->variable('m', 0);
|
$matchday = $this->request->variable('m', 0);
|
||||||
|
|
||||||
$error_message = '';
|
$error_message = '';
|
||||||
$username = '?';
|
$username = '?';
|
||||||
if (!$userid OR !$season OR !$league OR !$matchday)
|
if (!$userid OR !$season OR !$league OR !$matchday)
|
||||||
{
|
{
|
||||||
$data_bet = false;
|
$data_bet = false;
|
||||||
if (!$userid)
|
if (!$userid)
|
||||||
{
|
{
|
||||||
$error_message .= sprintf($user->lang['NO_USERID']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_USERID']) . '<br />';
|
||||||
}
|
}
|
||||||
if (!$season)
|
if (!$season)
|
||||||
{
|
{
|
||||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||||
}
|
}
|
||||||
if (!$league)
|
if (!$league)
|
||||||
{
|
{
|
||||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||||
}
|
}
|
||||||
if (!$matchday)
|
if (!$matchday)
|
||||||
{
|
{
|
||||||
$error_message .= sprintf($user->lang['NO_MATCHDAY']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_MATCHDAY']) . '<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$season_info = season_info($season);
|
$season_info = season_info($season);
|
||||||
if (sizeof($season_info))
|
if (sizeof($season_info))
|
||||||
{
|
{
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
if (sizeof($league_info))
|
if (sizeof($league_info))
|
||||||
{
|
{
|
||||||
// Get username
|
// Get username
|
||||||
$sql = 'SELECT username
|
$sql = 'SELECT username
|
||||||
FROM ' . USERS_TABLE . "
|
FROM ' . USERS_TABLE . "
|
||||||
WHERE user_id = $userid ";
|
WHERE user_id = $userid ";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$username = $row['username'];
|
$username = $row['username'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$data_bet = false;
|
$data_bet = false;
|
||||||
$error_message .= sprintf($user->lang['NO_USERID']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_USERID']) . '<br />';
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$display_group = false;
|
$display_group = false;
|
||||||
$lang_dates = $user->lang['datetime'];
|
$lang_dates = $user->lang['datetime'];
|
||||||
// Required for select_points function:
|
// Required for select_points function:
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
|
|
||||||
// Calculate matches and bets of matchday
|
// Calculate matches and bets of matchday
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
m.league,
|
m.league,
|
||||||
m.match_no,
|
m.match_no,
|
||||||
m.matchday,
|
m.matchday,
|
||||||
m.status,
|
m.status,
|
||||||
m.group_id,
|
m.group_id,
|
||||||
m.formula_home,
|
m.formula_home,
|
||||||
m.formula_guest,
|
m.formula_guest,
|
||||||
t1.team_symbol AS home_symbol,
|
t1.team_symbol AS home_symbol,
|
||||||
t2.team_symbol AS guest_symbol,
|
t2.team_symbol AS guest_symbol,
|
||||||
t1.team_id AS home_id,
|
t1.team_id AS home_id,
|
||||||
t2.team_id AS guest_id,
|
t2.team_id AS guest_id,
|
||||||
t1.team_name AS home_name,
|
t1.team_name AS home_name,
|
||||||
t2.team_name AS guest_name,
|
t2.team_name AS guest_name,
|
||||||
b.goals_home AS bet_home,
|
b.goals_home AS bet_home,
|
||||||
b.goals_guest AS bet_guest,
|
b.goals_guest AS bet_guest,
|
||||||
m.goals_home,
|
m.goals_home,
|
||||||
m.goals_guest,
|
m.goals_guest,
|
||||||
CONCAT(
|
CONCAT(
|
||||||
CASE DATE_FORMAT(m.match_datetime,'%w')
|
CASE DATE_FORMAT(m.match_datetime,'%w')
|
||||||
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
||||||
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
||||||
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
||||||
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
||||||
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
||||||
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
||||||
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
||||||
ELSE 'Error' END,
|
ELSE 'Error' END,
|
||||||
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
||||||
) AS match_time,
|
) AS match_time,
|
||||||
" . select_points() . "
|
" . select_points() . "
|
||||||
FROM " . FOOTB_MATCHES . ' AS m
|
FROM " . FOOTB_MATCHES . ' AS m
|
||||||
INNER JOIN ' . FOOTB_BETS . " AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no AND b.user_id = $userid)
|
INNER JOIN ' . FOOTB_BETS . " AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no AND b.user_id = $userid)
|
||||||
LEFT JOIN " . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
LEFT JOIN " . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||||
WHERE m.season = $season
|
WHERE m.season = $season
|
||||||
AND m.league = $league
|
AND m.league = $league
|
||||||
AND m.matchday = $matchday
|
AND m.matchday = $matchday
|
||||||
GROUP BY m.match_no
|
GROUP BY m.match_no
|
||||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$data_bet = true;
|
$data_bet = true;
|
||||||
$matchnumber = 0;
|
$matchnumber = 0;
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
$matchnumber++ ;
|
$matchnumber++ ;
|
||||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$display_link = true;
|
$display_link = true;
|
||||||
if (0 == $row['home_id'])
|
if (0 == $row['home_id'])
|
||||||
{
|
{
|
||||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||||
$home_in_array = explode("#",$home_info);
|
$home_in_array = explode("#",$home_info);
|
||||||
$homelogo = $home_in_array[0];
|
$homelogo = $home_in_array[0];
|
||||||
$homeid = $home_in_array[1];
|
$homeid = $home_in_array[1];
|
||||||
$homename = $home_in_array[2];
|
$homename = $home_in_array[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$homelogo = $row['home_symbol'];
|
$homelogo = $row['home_symbol'];
|
||||||
$homeid = $row['home_id'];
|
$homeid = $row['home_id'];
|
||||||
$homename = $row['home_name'];
|
$homename = $row['home_name'];
|
||||||
}
|
}
|
||||||
if (0 == $row['guest_id'])
|
if (0 == $row['guest_id'])
|
||||||
{
|
{
|
||||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||||
$guest_in_array = explode("#",$guest_info);
|
$guest_in_array = explode("#",$guest_info);
|
||||||
$guestlogo = $guest_in_array[0];
|
$guestlogo = $guest_in_array[0];
|
||||||
$guestid = $guest_in_array[1];
|
$guestid = $guest_in_array[1];
|
||||||
$guestname = $guest_in_array[2];
|
$guestname = $guest_in_array[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$guestlogo = $row['guest_symbol'];
|
$guestlogo = $row['guest_symbol'];
|
||||||
$guestid = $row['guest_id'];
|
$guestid = $row['guest_id'];
|
||||||
$guestname = $row['guest_name'];
|
$guestname = $row['guest_name'];
|
||||||
}
|
}
|
||||||
if ($homelogo <> '')
|
if ($homelogo <> '')
|
||||||
{
|
{
|
||||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
if ($guestlogo <> '')
|
if ($guestlogo <> '')
|
||||||
{
|
{
|
||||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['group_id'] == '')
|
if ($row['group_id'] == '')
|
||||||
{
|
{
|
||||||
$group_id = ' ';
|
$group_id = ' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$display_group = true;
|
$display_group = true;
|
||||||
$group_id = $row['group_id'];
|
$group_id = $row['group_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($row['status'] < 1 && !$config['football_view_bets'])
|
if ($row['status'] < 1 && !$config['football_view_bets'])
|
||||||
{
|
{
|
||||||
// hide bets
|
// hide bets
|
||||||
$bet_home = ($row['bet_home'] == '') ? ' ' : '?';
|
$bet_home = ($row['bet_home'] == '') ? ' ' : '?';
|
||||||
$bet_guest = ($row['bet_guest'] == '') ? ' ' : '?';
|
$bet_guest = ($row['bet_guest'] == '') ? ' ' : '?';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$bet_home = ($row['bet_home'] == '') ? ' ' : $row['bet_home'];
|
$bet_home = ($row['bet_home'] == '') ? ' ' : $row['bet_home'];
|
||||||
$bet_guest = ($row['bet_guest'] == '') ? ' ' : $row['bet_guest'];
|
$bet_guest = ($row['bet_guest'] == '') ? ' ' : $row['bet_guest'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$colorstyle = color_style($row['status']);
|
$colorstyle = color_style($row['status']);
|
||||||
$template->assign_block_vars('bet_view', array(
|
$template->assign_block_vars('bet_view', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'LEAGUE_ID' => $row['league'],
|
'LEAGUE_ID' => $row['league'],
|
||||||
'MATCH_NUMBER' => $row['match_no'],
|
'MATCH_NUMBER' => $row['match_no'],
|
||||||
'MATCHDAY' => $row['matchday'],
|
'MATCHDAY' => $row['matchday'],
|
||||||
'STATUS' => $row['status'],
|
'STATUS' => $row['status'],
|
||||||
'MATCH_TIME' => $row['match_time'],
|
'MATCH_TIME' => $row['match_time'],
|
||||||
'GROUP' => $group_id,
|
'GROUP' => $group_id,
|
||||||
'HOME_ID' => $homeid,
|
'HOME_ID' => $homeid,
|
||||||
'GUEST_ID' => $guestid,
|
'GUEST_ID' => $guestid,
|
||||||
'LOGO_HOME' => $logoH,
|
'LOGO_HOME' => $logoH,
|
||||||
'LOGO_GUEST' => $logoG,
|
'LOGO_GUEST' => $logoG,
|
||||||
'HOME_NAME' => $homename,
|
'HOME_NAME' => $homename,
|
||||||
'GUEST_NAME' => $guestname,
|
'GUEST_NAME' => $guestname,
|
||||||
'BET_HOME' => $bet_home,
|
'BET_HOME' => $bet_home,
|
||||||
'BET_GUEST' => $bet_guest,
|
'BET_GUEST' => $bet_guest,
|
||||||
'GOALS_HOME' => ($row['goals_home'] == '') ? ' ' : $row['goals_home'],
|
'GOALS_HOME' => ($row['goals_home'] == '') ? ' ' : $row['goals_home'],
|
||||||
'GOALS_GUEST' => ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'],
|
'GOALS_GUEST' => ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'],
|
||||||
'POINTS' => ($row['points'] == '') ? ' ' : $row['points'],
|
'POINTS' => ($row['points'] == '') ? ' ' : $row['points'],
|
||||||
'COLOR_STYLE' => $colorstyle,
|
'COLOR_STYLE' => $colorstyle,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
while ($row = $db->sql_fetchrow($result));
|
while ($row = $db->sql_fetchrow($result));
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$data_bet = false;
|
$data_bet = false;
|
||||||
$error_message .= sprintf($user->lang['NO_BETS']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_BETS']) . '<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$data_bet = false;
|
$data_bet = false;
|
||||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$data_bet = false;
|
$data_bet = false;
|
||||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate extra bets of matchday
|
// Calculate extra bets of matchday
|
||||||
$sql = "SELECT e.*,
|
$sql = "SELECT e.*,
|
||||||
eb.bet,
|
eb.bet,
|
||||||
eb.bet_points,
|
eb.bet_points,
|
||||||
t1.team_name AS result_team,
|
t1.team_name AS result_team,
|
||||||
t2.team_name AS bet_team
|
t2.team_name AS bet_team
|
||||||
FROM " . FOOTB_EXTRA . ' AS e
|
FROM " . FOOTB_EXTRA . ' AS e
|
||||||
LEFT JOIN ' . FOOTB_EXTRA_BETS . " AS eb ON (eb.season = e.season AND eb.league = e.league AND eb.extra_no = e.extra_no AND eb.user_id = $userid)
|
LEFT JOIN ' . FOOTB_EXTRA_BETS . " AS eb ON (eb.season = e.season AND eb.league = e.league AND eb.extra_no = e.extra_no AND eb.user_id = $userid)
|
||||||
LEFT JOIN " . FOOTB_TEAMS . ' AS t1 ON (t1.season = e.season AND t1.league = e.league AND t1.team_id = e.result)
|
LEFT JOIN " . FOOTB_TEAMS . ' AS t1 ON (t1.season = e.season AND t1.league = e.league AND t1.team_id = e.result)
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = e.season AND t2.league = e.league AND t2.team_id = eb.bet)
|
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = e.season AND t2.league = e.league AND t2.team_id = eb.bet)
|
||||||
WHERE e.season = $season
|
WHERE e.season = $season
|
||||||
AND e.league = $league
|
AND e.league = $league
|
||||||
AND e.matchday = $matchday
|
AND e.matchday = $matchday
|
||||||
ORDER BY e.extra_no ASC";
|
ORDER BY e.extra_no ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$extra_bet = false;
|
$extra_bet = false;
|
||||||
$extranumber = 0;
|
$extranumber = 0;
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$extra_bet = true;
|
$extra_bet = true;
|
||||||
$extranumber++ ;
|
$extranumber++ ;
|
||||||
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
|
|
||||||
if ($row['extra_status'] < 1 && !$config['football_view_bets'])
|
if ($row['extra_status'] < 1 && !$config['football_view_bets'])
|
||||||
{
|
{
|
||||||
// hide bets
|
// hide bets
|
||||||
$bet = ($row['bet'] == '') ? ' ' : '?';
|
$bet = ($row['bet'] == '') ? ' ' : '?';
|
||||||
$bet_team = ($row['bet_team'] == NULL) ? ' ' : '?';
|
$bet_team = ($row['bet_team'] == NULL) ? ' ' : '?';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$bet = ($row['bet'] == '') ? ' ' : $row['bet'];
|
$bet = ($row['bet'] == '') ? ' ' : $row['bet'];
|
||||||
$bet_team = ($row['bet_team'] == NULL) ? ' ' : $row['bet_team'];
|
$bet_team = ($row['bet_team'] == NULL) ? ' ' : $row['bet_team'];
|
||||||
}
|
}
|
||||||
$extra_colorstyle = color_style($row['extra_status']);
|
$extra_colorstyle = color_style($row['extra_status']);
|
||||||
|
|
||||||
switch($row['question_type'])
|
switch($row['question_type'])
|
||||||
{
|
{
|
||||||
case '1':
|
case '1':
|
||||||
{
|
{
|
||||||
$display_type = 1;
|
$display_type = 1;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
{
|
{
|
||||||
$display_type = 1;
|
$display_type = 1;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
{
|
{
|
||||||
$display_type = 2;
|
$display_type = 2;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
{
|
{
|
||||||
$display_type = 2;
|
$display_type = 2;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '5':
|
case '5':
|
||||||
{
|
{
|
||||||
$display_type = 2;
|
$display_type = 2;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
$display_type = 2;
|
$display_type = 2;
|
||||||
$eval_title = '';
|
$eval_title = '';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('extra_view', array(
|
$template->assign_block_vars('extra_view', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'QUESTION' => $row['question'],
|
'QUESTION' => $row['question'],
|
||||||
'EXTRA_POINTS' => $row['extra_points'],
|
'EXTRA_POINTS' => $row['extra_points'],
|
||||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||||
'EVALUATION_TITLE' => $eval_title,
|
'EVALUATION_TITLE' => $eval_title,
|
||||||
'RESULT' => ($display_type == 1) ? $row['result_team'] : $row['result'],
|
'RESULT' => ($display_type == 1) ? $row['result_team'] : $row['result'],
|
||||||
'BET' => ($display_type == 1) ? $bet_team : $bet,
|
'BET' => ($display_type == 1) ? $bet_team : $bet,
|
||||||
'BET_POINTS' => $row['bet_points'],
|
'BET_POINTS' => $row['bet_points'],
|
||||||
'COLOR_STYLE' => $extra_colorstyle,
|
'COLOR_STYLE' => $extra_colorstyle,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
$sidename = sprintf($user->lang['BET']);
|
|
||||||
if ($data_bet)
|
$sidename = sprintf($user->lang['BET']);
|
||||||
{
|
if ($data_bet)
|
||||||
$template->assign_vars(array(
|
{
|
||||||
'S_SIDENAME' => $sidename,
|
$template->assign_vars(array(
|
||||||
'S_USER_NAME' => $username,
|
'S_SIDENAME' => $sidename,
|
||||||
'S_ERROR_MESSAGE' => $error_message,
|
'S_USER_NAME' => $username,
|
||||||
'S_FROM' => sprintf($user->lang['FROM_DAY_SEASON'], $matchday, $season),
|
'S_ERROR_MESSAGE' => $error_message,
|
||||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
'S_FROM' => sprintf($user->lang['FROM_DAY_SEASON'], $matchday, $season),
|
||||||
'S_DATA_BET' => $data_bet,
|
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||||
'S_DISPLAY_GROUP' => $display_group,
|
'S_DATA_BET' => $data_bet,
|
||||||
'S_EXTRA_BET' => $extra_bet,
|
'S_DISPLAY_GROUP' => $display_group,
|
||||||
)
|
'S_EXTRA_BET' => $extra_bet,
|
||||||
);
|
)
|
||||||
|
);
|
||||||
// output page
|
|
||||||
page_header(sprintf($user->lang['BETS_OF']) . ' ' . $username);
|
// output page
|
||||||
}
|
page_header(sprintf($user->lang['BETS_OF']) . ' ' . $username);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$template->assign_vars(array(
|
{
|
||||||
'S_SIDENAME' => $sidename,
|
$template->assign_vars(array(
|
||||||
'S_USER_NAME' => '',
|
'S_SIDENAME' => $sidename,
|
||||||
'S_ERROR_MESSAGE' => $error_message,
|
'S_USER_NAME' => '',
|
||||||
'S_FROM' => '',
|
'S_ERROR_MESSAGE' => $error_message,
|
||||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
'S_FROM' => '',
|
||||||
'S_DATA_BET' => $data_bet,
|
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||||
'S_DISPLAY_GROUP' => false,
|
'S_DATA_BET' => $data_bet,
|
||||||
)
|
'S_DISPLAY_GROUP' => false,
|
||||||
);
|
)
|
||||||
|
);
|
||||||
// output page
|
|
||||||
page_header(sprintf($user->lang['BETS_OF']));
|
// output page
|
||||||
}
|
page_header(sprintf($user->lang['BETS_OF']));
|
||||||
|
}
|
||||||
$template->set_filenames(array(
|
|
||||||
'body' => 'bet_popup.html')
|
$template->set_filenames(array(
|
||||||
);
|
'body' => 'bet_popup.html')
|
||||||
|
);
|
||||||
page_footer();
|
|
||||||
|
page_footer();
|
||||||
?>
|
?>
|
||||||
@@ -15,7 +15,7 @@ $data_delivery = false;
|
|||||||
$user_id = $user->data['user_id'];
|
$user_id = $user->data['user_id'];
|
||||||
$lang_dates = $user->lang['datetime'];
|
$lang_dates = $user->lang['datetime'];
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$local_board_time = time() + (($config['board_timezone'] - $config['football_host_timezone']) * 3600);
|
$local_board_time = time() + ($config['football_time_shift'] * 3600);
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
m.season,
|
m.season,
|
||||||
m.league,
|
m.league,
|
||||||
|
|||||||
@@ -1,134 +1,135 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$this->user->add_lang_ext('football/football', 'info_acp_bank');
|
$this->user->add_lang_ext('football/football', 'info_acp_bank');
|
||||||
|
|
||||||
// Check Prediction League authorisation
|
// Check Prediction League authorisation
|
||||||
if ( !$this->auth->acl_get('u_use_football') )
|
if ( !$this->auth->acl_get('u_use_football') )
|
||||||
{
|
{
|
||||||
trigger_error('NO_AUTH_VIEW');
|
trigger_error('NO_AUTH_VIEW');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
$phpbb_root_path = './../../';
|
$phpbb_root_path = './../../';
|
||||||
|
|
||||||
if (!$season OR !$league)
|
if (!$season OR !$league)
|
||||||
{
|
{
|
||||||
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league)));
|
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$season_info = season_info($season);
|
$season_info = season_info($season);
|
||||||
if (!sizeof($season_info))
|
if (!sizeof($season_info))
|
||||||
{
|
{
|
||||||
$error_message = sprintf($user->lang['NO_SEASON']);
|
$error_message = sprintf($user->lang['NO_SEASON']);
|
||||||
trigger_error($error_message);
|
trigger_error($error_message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
if (!sizeof($league_info))
|
if (!sizeof($league_info))
|
||||||
{
|
{
|
||||||
$error_message = sprintf($user->lang['NO_LEAGUE']);
|
$error_message = sprintf($user->lang['NO_LEAGUE']);
|
||||||
trigger_error($error_message);
|
trigger_error($error_message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$bet_points = $league_info['bet_points'];
|
$bet_points = $league_info['bet_points'];
|
||||||
$league_name =$league_info['league_name'];
|
$league_name =$league_info['league_name'];
|
||||||
$league_short =$league_info['league_name_short'];
|
$league_short =$league_info['league_name_short'];
|
||||||
|
|
||||||
$user_points = '';
|
$user_points = '';
|
||||||
global $phpbb_extension_manager;
|
global $phpbb_extension_manager;
|
||||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints') && $config['points_enable'])
|
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints') && $config['points_enable'])
|
||||||
{
|
{
|
||||||
$user_points = 'u.user_points,';
|
$user_points = 'u.user_points,';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$user_points = "0.00 AS user_points,";
|
$user_points = "0.00 AS user_points,";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the members points
|
// Grab the members points
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
b.user_id,
|
b.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
$user_points
|
$user_points
|
||||||
$bet_points AS bet_points,
|
$bet_points AS bet_points,
|
||||||
SUM(IF(p.points_type = " . POINTS_BET . ', IF(p.cash = 0, p.points, 0.00), 0.00)) AS no_cash_bet_points,
|
SUM(IF(p.points_type = " . POINTS_BET . ', IF(p.cash = 0, p.points, 0.00), 0.00)) AS no_cash_bet_points,
|
||||||
SUM(IF(p.points_type = ' . POINTS_DEPOSITED . ', IF(p.cash = 0, p.points, 0.00), 0.00)) AS no_cash_deposit,
|
SUM(IF(p.points_type = ' . POINTS_DEPOSITED . ', IF(p.cash = 0, p.points, 0.00), 0.00)) AS no_cash_deposit,
|
||||||
SUM(IF(p.points_type IN (' . POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY . '),
|
SUM(IF(p.points_type IN (' . POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY . '),
|
||||||
IF(p.cash = 0, p.points, 0.00),
|
IF(p.cash = 0, p.points, 0.00),
|
||||||
0.00)) AS no_cash_wins,
|
0.00)) AS no_cash_wins,
|
||||||
SUM(IF(p.points_type = ' . POINTS_PAID . ', IF(p.cash = 0, p.points, 0.00), 0.00)) AS no_cash_paid,
|
SUM(IF(p.points_type = ' . POINTS_PAID . ', IF(p.cash = 0, p.points, 0.00), 0.00)) AS no_cash_paid,
|
||||||
SUM(IF(p.points_type = ' . POINTS_DEPOSITED . ', p.points, 0.00)) AS deposit,
|
SUM(IF(p.points_type = ' . POINTS_DEPOSITED . ', p.points, 0.00)) AS deposit,
|
||||||
IF(SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points, p.points * -1.0)) > 0,
|
IF(SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points, p.points * -1.0)) > 0,
|
||||||
SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points, p.points * -1.0)), 0.00) AS new_deposit,
|
SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points, p.points * -1.0)), 0.00) AS new_deposit,
|
||||||
SUM(IF(p.points_type IN (' . POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY . '),
|
SUM(IF(p.points_type IN (' . POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY . '),
|
||||||
p.points, 0.00)) AS wins,
|
p.points, 0.00)) AS wins,
|
||||||
SUM(IF(p.points_type = ' . POINTS_PAID . ', p.points, 0.00)) AS paid,
|
SUM(IF(p.points_type = ' . POINTS_PAID . ', p.points, 0.00)) AS paid,
|
||||||
IF(SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points * -1.0, p.points)) > 0,
|
IF(SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points * -1.0, p.points)) > 0,
|
||||||
SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points * -1.0, p.points)), 0.00) AS new_pay
|
SUM(IF(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points * -1.0, p.points)), 0.00) AS new_pay
|
||||||
FROM ' . FOOTB_BETS . ' AS b
|
FROM ' . FOOTB_BETS . ' AS b
|
||||||
JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
|
JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
|
||||||
LEFT JOIN ' . FOOTB_POINTS . " AS p ON (p.season = $season AND p.league = $league AND p.user_id = b.user_id)
|
LEFT JOIN ' . FOOTB_POINTS . " AS p ON (p.season = $season AND p.league = $league AND p.user_id = b.user_id)
|
||||||
WHERE b.season = $season
|
WHERE b.season = $season
|
||||||
AND b.league = $league
|
AND b.league = $league
|
||||||
AND b.match_no = 1
|
AND b.match_no = 1
|
||||||
GROUP BY b.user_id
|
GROUP BY b.user_id
|
||||||
ORDER BY u.username ASC";
|
ORDER BY u.username ASC";
|
||||||
|
|
||||||
if(!$result = $db->sql_query($sql))
|
if(!$result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
trigger_error('NO_LEAGUE');
|
trigger_error('NO_LEAGUE');
|
||||||
}
|
}
|
||||||
$user_rows = $db->sql_fetchrowset($result);
|
$user_rows = $db->sql_fetchrowset($result);
|
||||||
$export_file = $league_short . '_' . $season . '_bank.csv';
|
$db->sql_freeresult($result);
|
||||||
$newline = "\r\n";
|
$export_file = $league_short . '_' . $season . '_bank.csv';
|
||||||
header('Pragma: no-cache');
|
$newline = "\r\n";
|
||||||
header("Content-Type: text/csv; name=\"$export_file\"");
|
header('Pragma: no-cache');
|
||||||
header("Content-disposition: attachment; filename=$export_file");
|
header("Content-Type: text/csv; name=\"$export_file\"");
|
||||||
$export= '';
|
header("Content-disposition: attachment; filename=$export_file");
|
||||||
$export .= $league_name . ' ' . sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
|
$export= '';
|
||||||
$export .= sprintf($user->lang['NAME']) . ';' . $config['football_win_name'] . ';' . sprintf($user->lang['BET_POINTS']) . ';' .
|
$export .= $league_name . ' ' . sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
|
||||||
sprintf($user->lang['DEPOSITED']) . ';' . sprintf($user->lang['DEPOSIT']) . ';' . sprintf($user->lang['WINS']) . ';' .
|
$export .= sprintf($user->lang['NAME']) . ';' . $config['football_win_name'] . ';' . sprintf($user->lang['BET_POINTS']) . ';' .
|
||||||
sprintf($user->lang['PAID']) . ';' . sprintf($user->lang['PAYOUT']) . ';' . $newline;
|
sprintf($user->lang['DEPOSITED']) . ';' . sprintf($user->lang['DEPOSIT']) . ';' . sprintf($user->lang['WINS']) . ';' .
|
||||||
|
sprintf($user->lang['PAID']) . ';' . sprintf($user->lang['PAYOUT']) . ';' . $newline;
|
||||||
$curr_season = curr_season();
|
|
||||||
foreach ($user_rows as $user_row)
|
$curr_season = curr_season();
|
||||||
{
|
foreach ($user_rows as $user_row)
|
||||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints') && $config['points_enable'] && $season == $curr_season)
|
{
|
||||||
{
|
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints') && $config['points_enable'] && $season == $curr_season)
|
||||||
$no_cash_bet_points = ($user_row['no_cash_bet_points'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_bet_points']) . ')';
|
{
|
||||||
$no_cash_deposit = ($user_row['no_cash_deposit'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_deposit']) . ')';
|
$no_cash_bet_points = ($user_row['no_cash_bet_points'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_bet_points']) . ')';
|
||||||
$no_cash_wins = ($user_row['no_cash_wins'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_wins']) . ')';
|
$no_cash_deposit = ($user_row['no_cash_deposit'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_deposit']) . ')';
|
||||||
$no_cash_paid = ($user_row['no_cash_paid'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_paid']) . ')';
|
$no_cash_wins = ($user_row['no_cash_wins'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_wins']) . ')';
|
||||||
}
|
$no_cash_paid = ($user_row['no_cash_paid'] == 0.00) ? '' : ' (' . str_replace('.', ',', $user_row['no_cash_paid']) . ')';
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$no_cash_bet_points = '';
|
{
|
||||||
$no_cash_deposit = '';
|
$no_cash_bet_points = '';
|
||||||
$no_cash_wins = '';
|
$no_cash_deposit = '';
|
||||||
$no_cash_paid = '';
|
$no_cash_wins = '';
|
||||||
}
|
$no_cash_paid = '';
|
||||||
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
|
}
|
||||||
str_replace('.', ',', $user_row['user_points']) . ';' .
|
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
|
||||||
str_replace('.', ',', $user_row['bet_points']) . $no_cash_bet_points . ';' .
|
str_replace('.', ',', $user_row['user_points']) . ';' .
|
||||||
str_replace('.', ',', $user_row['deposit']) . $no_cash_deposit . ';' .
|
str_replace('.', ',', $user_row['bet_points']) . $no_cash_bet_points . ';' .
|
||||||
str_replace('.', ',', $user_row['new_deposit']) . ';' .
|
str_replace('.', ',', $user_row['deposit']) . $no_cash_deposit . ';' .
|
||||||
str_replace('.', ',', $user_row['wins']) . $no_cash_wins . ';' .
|
str_replace('.', ',', $user_row['new_deposit']) . ';' .
|
||||||
str_replace('.', ',', $user_row['paid']) . $no_cash_paid . ';' .
|
str_replace('.', ',', $user_row['wins']) . $no_cash_wins . ';' .
|
||||||
str_replace('.', ',', $user_row['new_pay']) . ';' . $newline;
|
str_replace('.', ',', $user_row['paid']) . $no_cash_paid . ';' .
|
||||||
}
|
str_replace('.', ',', $user_row['new_pay']) . ';' . $newline;
|
||||||
echo utf8_decode($export);
|
}
|
||||||
exit;
|
echo utf8_decode($export);
|
||||||
}
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
@@ -1,87 +1,88 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$this->user->add_lang_ext('football/football', 'info_acp_bank');
|
$this->user->add_lang_ext('football/football', 'info_acp_bank');
|
||||||
|
|
||||||
// Check Prediction League authorisation
|
// Check Prediction League authorisation
|
||||||
if ( !$this->auth->acl_get('u_use_football') )
|
if ( !$this->auth->acl_get('u_use_football') )
|
||||||
{
|
{
|
||||||
trigger_error('NO_AUTH_VIEW');
|
trigger_error('NO_AUTH_VIEW');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
if (!$season)
|
if (!$season)
|
||||||
{
|
{
|
||||||
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season)));
|
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$season_info = season_info($season);
|
$season_info = season_info($season);
|
||||||
if (!sizeof($season_info))
|
if (!sizeof($season_info))
|
||||||
{
|
{
|
||||||
$error_message = sprintf($user->lang['NO_SEASON']);
|
$error_message = sprintf($user->lang['NO_SEASON']);
|
||||||
trigger_error($error_message);
|
trigger_error($error_message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Grab the members points
|
// Grab the members points
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
u.username,
|
u.username,
|
||||||
p.season,
|
p.season,
|
||||||
p.league,
|
p.league,
|
||||||
round(sum(if(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points * -1.0, p.points)),2) as saldo
|
round(sum(if(p.points_type IN (' . POINTS_BET . ',' . POINTS_PAID . '), p.points * -1.0, p.points)),2) as saldo
|
||||||
FROM ' . FOOTB_POINTS . ' AS p
|
FROM ' . FOOTB_POINTS . ' AS p
|
||||||
JOIN ' . USERS_TABLE . " AS u ON (u.user_id = p.user_id)
|
JOIN ' . USERS_TABLE . " AS u ON (u.user_id = p.user_id)
|
||||||
WHERE p.season <= $season
|
WHERE p.season <= $season
|
||||||
GROUP BY p.season, p.league, u.username
|
GROUP BY p.season, p.league, u.username
|
||||||
HAVING saldo <> 0.00
|
HAVING saldo <> 0.00
|
||||||
ORDER BY u.username, p.season, p.league";
|
ORDER BY u.username, p.season, p.league";
|
||||||
|
|
||||||
if(!$result = $db->sql_query($sql))
|
if(!$result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
trigger_error('NO_SEASON');
|
trigger_error('NO_SEASON');
|
||||||
}
|
}
|
||||||
$user_rows = $db->sql_fetchrowset($result);
|
$user_rows = $db->sql_fetchrowset($result);
|
||||||
$export_file = $season. '_bank.csv';
|
$db->sql_freeresult($result);
|
||||||
$newline = "\r\n";
|
$export_file = $season. '_bank.csv';
|
||||||
header('Pragma: no-cache');
|
$newline = "\r\n";
|
||||||
header("Content-Type: text/csv; name=\"$export_file\"");
|
header('Pragma: no-cache');
|
||||||
header("Content-disposition: attachment; filename=$export_file");
|
header("Content-Type: text/csv; name=\"$export_file\"");
|
||||||
$export= '';
|
header("Content-disposition: attachment; filename=$export_file");
|
||||||
$export .= sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
|
$export= '';
|
||||||
$export .= sprintf($user->lang['NAME']) . ';' . sprintf($user->lang['SEASON']) . ';' . sprintf($user->lang['LEAGUE']) . ';Saldo;' . $newline;
|
$export .= sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
|
||||||
|
$export .= sprintf($user->lang['NAME']) . ';' . sprintf($user->lang['SEASON']) . ';' . sprintf($user->lang['LEAGUE']) . ';Saldo;' . $newline;
|
||||||
$last_username = '';
|
|
||||||
$sum_saldo = 0.0;
|
$last_username = '';
|
||||||
foreach ($user_rows as $user_row)
|
$sum_saldo = 0.0;
|
||||||
{
|
foreach ($user_rows as $user_row)
|
||||||
if ($last_username != '' AND $last_username != $user_row['username'])
|
{
|
||||||
{
|
if ($last_username != '' AND $last_username != $user_row['username'])
|
||||||
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
|
{
|
||||||
str_replace('.', ',', $sum_saldo) . ';' . $newline;
|
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
|
||||||
$sum_saldo = 0.0;
|
str_replace('.', ',', $sum_saldo) . ';' . $newline;
|
||||||
}
|
$sum_saldo = 0.0;
|
||||||
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
|
}
|
||||||
$user_row['season'] . ';' .
|
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
|
||||||
$user_row['league'] . ';' .
|
$user_row['season'] . ';' .
|
||||||
str_replace('.', ',', $user_row['saldo']) . ';' . $newline;
|
$user_row['league'] . ';' .
|
||||||
$sum_saldo += $user_row['saldo'];
|
str_replace('.', ',', $user_row['saldo']) . ';' . $newline;
|
||||||
$last_username = $user_row['username'];
|
$sum_saldo += $user_row['saldo'];
|
||||||
}
|
$last_username = $user_row['username'];
|
||||||
if ($last_username != '')
|
}
|
||||||
{
|
if ($last_username != '')
|
||||||
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
|
{
|
||||||
str_replace('.', ',', $sum_saldo) . ';' . $newline;
|
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
|
||||||
}
|
str_replace('.', ',', $sum_saldo) . ';' . $newline;
|
||||||
echo utf8_decode($export);
|
}
|
||||||
exit;
|
echo utf8_decode($export);
|
||||||
}
|
exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
@@ -91,6 +91,10 @@ else
|
|||||||
$data_last_home = false;
|
$data_last_home = false;
|
||||||
$data_last_away = false;
|
$data_last_away = false;
|
||||||
$form_from = $matchday-5;
|
$form_from = $matchday-5;
|
||||||
|
$percent_home = 0;
|
||||||
|
$percent_draw = 0;
|
||||||
|
$percent_guest = 0;
|
||||||
|
$stat_hist = '';
|
||||||
$value_h = 0;
|
$value_h = 0;
|
||||||
$value_g = 0;
|
$value_g = 0;
|
||||||
$value_hg = 0;
|
$value_hg = 0;
|
||||||
@@ -115,7 +119,6 @@ else
|
|||||||
{
|
{
|
||||||
$logo[$home_id] = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logo[$home_id] = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -142,7 +145,6 @@ else
|
|||||||
{
|
{
|
||||||
$logo[$guest_id] = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logo[$guest_id] = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -245,7 +247,6 @@ else
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Statistic and forecast-points for historie
|
// Statistic and forecast-points for historie
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
@@ -322,10 +323,6 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$stat_hist = '';
|
|
||||||
$percent_home = 0;
|
|
||||||
$percent_draw = 0;
|
|
||||||
$percent_guest = 0;
|
|
||||||
if (sizeof($row))
|
if (sizeof($row))
|
||||||
{
|
{
|
||||||
if ($history_count <= 2)
|
if ($history_count <= 2)
|
||||||
@@ -1003,7 +1000,6 @@ else
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
//last matches home hometeam
|
//last matches home hometeam
|
||||||
$sql = '(SELECT
|
$sql = '(SELECT
|
||||||
@@ -1074,7 +1070,6 @@ else
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
//last game guestteam
|
//last game guestteam
|
||||||
$sql = "(SELECT
|
$sql = "(SELECT
|
||||||
@@ -1158,7 +1153,6 @@ else
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
//last matches away guestteam
|
//last matches away guestteam
|
||||||
$sql = '(SELECT
|
$sql = '(SELECT
|
||||||
@@ -1226,7 +1220,6 @@ else
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if ($history_count == 0 and !($data_home and $data_guest))
|
if ($history_count == 0 and !($data_home and $data_guest))
|
||||||
{
|
{
|
||||||
@@ -1266,7 +1259,7 @@ else
|
|||||||
$sql = 'UPDATE ' . FOOTB_MATCHES . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
$sql = 'UPDATE ' . FOOTB_MATCHES . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||||
WHERE season = $season AND league = $league AND match_no = $matchnumber";
|
WHERE season = $season AND league = $league AND match_no = $matchnumber";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
|
||||||
$forecast_value = 0;
|
$forecast_value = 0;
|
||||||
|
|||||||
150
block/last_results.php
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB Extension - Football Football
|
||||||
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_is_member = user_is_member($user->data['user_id'], $season, $league);
|
||||||
|
$edit_mode = false;
|
||||||
|
$display_group = false;
|
||||||
|
$display_ko = false;
|
||||||
|
$data_lastresults = false;
|
||||||
|
$curr_year = date("Y");
|
||||||
|
$matchnumber = 0;
|
||||||
|
$match_date = "";
|
||||||
|
|
||||||
|
$local_board_time = time() + ($config['football_time_shift'] * 3600);
|
||||||
|
$sql = 'SELECT * FROM ' . FOOTB_MATCHDAYS . " WHERE status = 0 AND delivery_date < FROM_UNIXTIME('$local_board_time')";
|
||||||
|
|
||||||
|
// Calculate matches AND results of matchday
|
||||||
|
$sql = "SELECT
|
||||||
|
m.season,
|
||||||
|
m.league,
|
||||||
|
m.matchday,
|
||||||
|
m.status,
|
||||||
|
m.match_datetime,
|
||||||
|
LEFT(m.match_datetime, 10) AS match_date,
|
||||||
|
l.league_name,
|
||||||
|
t1.team_symbol AS home_symbol,
|
||||||
|
t2.team_symbol AS guest_symbol,
|
||||||
|
t1.team_name AS home_name,
|
||||||
|
t2.team_name AS guest_name,
|
||||||
|
t1.team_name_short AS home_short,
|
||||||
|
t2.team_name_short AS guest_short,
|
||||||
|
m.goals_home,
|
||||||
|
m.goals_guest,
|
||||||
|
m.ko_match AS ko_match,
|
||||||
|
m.goals_overtime_home AS kogoals_home,
|
||||||
|
m.goals_overtime_guest AS kogoals_guest,
|
||||||
|
CONCAT(
|
||||||
|
CASE DATE_FORMAT(m.match_datetime,'%w')
|
||||||
|
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
||||||
|
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
||||||
|
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
||||||
|
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
||||||
|
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
||||||
|
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
||||||
|
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
||||||
|
ELSE 'Error' END,
|
||||||
|
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
||||||
|
) AS match_time
|
||||||
|
FROM " . FOOTB_MATCHES . ' AS m
|
||||||
|
LEFT JOIN ' . FOOTB_LEAGUES . ' AS l ON (l.season = m.season AND l.league = m.league)
|
||||||
|
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
||||||
|
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||||
|
WHERE m.match_datetime < FROM_UNIXTIME('$local_board_time')
|
||||||
|
ORDER BY m.match_datetime DESC, m.league ASC
|
||||||
|
LIMIT 100";
|
||||||
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
|
while($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$data_lastresults = true;
|
||||||
|
$matchnumber++ ;
|
||||||
|
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
|
|
||||||
|
if ($match_date <> $row['match_date'])
|
||||||
|
{
|
||||||
|
$match_date = ($match_date == "") ? $row['match_date'] : $match_date;
|
||||||
|
if ($matchnumber > $config['football_display_last_results'] )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$homelogo = $row['home_symbol'];
|
||||||
|
$homename = $row['home_name'];
|
||||||
|
$homeshort = $row['home_short'];
|
||||||
|
|
||||||
|
$guestlogo = $row['guest_symbol'];
|
||||||
|
$guestname = $row['guest_name'];
|
||||||
|
$guestshort = $row['guest_short'];
|
||||||
|
|
||||||
|
if ($homelogo <> '')
|
||||||
|
{
|
||||||
|
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"20\" height=\"20\"/>" ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"20\" height=\"20\"/>" ;
|
||||||
|
}
|
||||||
|
if ($guestlogo <> '')
|
||||||
|
{
|
||||||
|
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"20\" height=\"20\"/>" ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"20\" height=\"20\"/>" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$goals_home = ($row['goals_home'] == '') ? '- ' : $row['goals_home'];
|
||||||
|
$goals_guest = ($row['goals_guest'] == '') ? ' -' : $row['goals_guest'];
|
||||||
|
$kogoals_home = ($row['kogoals_home'] == '') ? '- ' : $row['kogoals_home'];
|
||||||
|
$kogoals_guest = ($row['kogoals_guest'] == '') ? ' -' : $row['kogoals_guest'];
|
||||||
|
$colorstyle = color_style($row['status']);
|
||||||
|
|
||||||
|
$template->assign_block_vars('last_results', array(
|
||||||
|
'ROW_CLASS' => $row_class,
|
||||||
|
'U_RESULTS_LINK'=> $this->helper->route('football_main_controller', array('side' => 'results', 's' => $row['season'], 'l' => $row['league'], 'm' => $row['matchday'])),
|
||||||
|
'MATCH_DATE' => $row['match_date'],
|
||||||
|
'MATCH_TIME' => $row['match_time'],
|
||||||
|
'LEAGUE_NAME' => $row['league_name'],
|
||||||
|
'LOGO_HOME' => $logoH,
|
||||||
|
'LOGO_GUEST' => $logoG,
|
||||||
|
'HOME_NAME' => $homename,
|
||||||
|
'GUEST_NAME' => $guestname,
|
||||||
|
'HOME_SHORT' => $homeshort,
|
||||||
|
'GUEST_SHORT' => $guestshort,
|
||||||
|
'GOALS_HOME' => $goals_home,
|
||||||
|
'GOALS_GUEST' => $goals_guest,
|
||||||
|
'COLOR_STYLE' => color_style($row['status']),
|
||||||
|
'KOGOALS_HOME' => $kogoals_home,
|
||||||
|
'KOGOALS_GUEST' => $kogoals_guest,
|
||||||
|
'COLOR_STYLE' => $colorstyle,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$sidename = sprintf($user->lang['LAST_RESULTS']);
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'S_DISPLAY_LAST_RESULTS' => true,
|
||||||
|
'S_SIDENAME' => $sidename,
|
||||||
|
'S_DATA_LAST_RESULTS' => $data_lastresults,
|
||||||
|
'S_USER_IS_MEMBER' => $user_is_member,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,66 +1,66 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB'))
|
if (!defined('IN_PHPBB'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$display_last_users = false;
|
$display_last_users = false;
|
||||||
// Last 5 users
|
// Last users
|
||||||
$sql = 'SELECT s.session_user_id
|
$sql = 'SELECT s.session_user_id
|
||||||
, u.username
|
, u.username
|
||||||
, u.user_colour
|
, u.user_colour
|
||||||
, u.user_lastvisit
|
, u.user_lastvisit
|
||||||
, MAX(s.session_time) AS session_time
|
, MAX(s.session_time) AS session_time
|
||||||
, IF(MAX(s.session_time) > u.user_lastvisit, MAX(s.session_time), u.user_lastvisit) AS lastvisit
|
, IF(MAX(s.session_time) > u.user_lastvisit, MAX(s.session_time), u.user_lastvisit) AS lastvisit
|
||||||
, IF(MAX(s.session_time) > u.user_lastvisit, MAX(CONCAT(s.session_time,s.session_browser)), "") AS session_browser
|
, IF(MAX(s.session_time) > u.user_lastvisit, MAX(CONCAT(s.session_time,s.session_browser)), "") AS session_browser
|
||||||
FROM ' . USERS_TABLE . ' AS u
|
FROM ' . USERS_TABLE . ' AS u
|
||||||
LEFT JOIN ' . SESSIONS_TABLE . ' AS s ON (u.user_id = s.session_user_id)
|
LEFT JOIN ' . SESSIONS_TABLE . ' AS s ON (u.user_id = s.session_user_id)
|
||||||
WHERE u.user_lastvisit > 0
|
WHERE u.user_lastvisit > 0
|
||||||
AND u.user_type IN (0,3)
|
AND u.user_type IN (0,3)
|
||||||
GROUP BY u.user_id
|
GROUP BY u.user_id
|
||||||
ORDER BY lastvisit DESC';
|
ORDER BY lastvisit DESC';
|
||||||
|
|
||||||
$result = $db->sql_query_limit($sql, 5);
|
$result = $db->sql_query_limit($sql, $config['football_display_last_users']);
|
||||||
$first = true;
|
$first = true;
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if (!$row['lastvisit'] && $first == true)
|
if (!$row['lastvisit'] && $first == true)
|
||||||
{
|
{
|
||||||
$display_last_users = false;
|
$display_last_users = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$display_last_users = true;
|
$display_last_users = true;
|
||||||
if($row['lastvisit'] > 0)
|
if($row['lastvisit'] > 0)
|
||||||
{
|
{
|
||||||
$browser = '';
|
$browser = '';
|
||||||
if (preg_match('/iPad|iPhone|iOS|Opera Mobi|BlackBerry|Android|IEMobile|Symbian/', $row['session_browser'], $match_browser))
|
if (preg_match('/iPad|iPhone|iOS|Opera Mobi|BlackBerry|Android|IEMobile|Symbian/', $row['session_browser'], $match_browser))
|
||||||
{
|
{
|
||||||
$browser = ' (' . $match_browser[0] . ')';
|
$browser = ' (' . $match_browser[0] . ')';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('last_users', array(
|
$template->assign_block_vars('last_users', array(
|
||||||
'USER_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']) . $browser,
|
'USER_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']) . $browser,
|
||||||
'LAST_VISIT_DATE' => $user->format_date($row['lastvisit']),
|
'LAST_VISIT_DATE' => $user->format_date($row['lastvisit']),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$first = false;
|
$first = false;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Assign specific vars
|
// Assign specific vars
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'LAST_USERS' => sprintf($user->lang['LAST_VISITORS'], 5),
|
'LAST_USERS' => sprintf($user->lang['LAST_VISITORS'], $config['football_display_last_users']),
|
||||||
'S_DISPLAY_LAST_USERS' => $display_last_users,
|
'S_DISPLAY_LAST_USERS' => $display_last_users,
|
||||||
'S_LAST_USERS' => true,
|
'S_LAST_USERS' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,332 +1,324 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_sel)
|
if (!$user_sel)
|
||||||
{
|
{
|
||||||
if (user_is_member($user->data['user_id'], $season, $league))
|
if (user_is_member($user->data['user_id'], $season, $league))
|
||||||
{
|
{
|
||||||
$user_sel = $user->data['user_id'];
|
$user_sel = $user->data['user_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$username = '';
|
$username = '';
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
// select user
|
// select user
|
||||||
$sql = 'SELECT DISTINCT
|
$sql = 'SELECT DISTINCT
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.username
|
u.username
|
||||||
FROM ' . FOOTB_BETS . ' AS b
|
FROM ' . FOOTB_BETS . ' AS b
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||||
WHERE season = $season AND league = $league
|
WHERE season = $season AND league = $league
|
||||||
ORDER BY LOWER(u.username) ASC";
|
ORDER BY LOWER(u.username) ASC";
|
||||||
|
|
||||||
$numb_users = 0;
|
$numb_users = 0;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$numb_users++;
|
$numb_users++;
|
||||||
$data = true;
|
$data = true;
|
||||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||||
{
|
{
|
||||||
$selectid = ' selected="selected"';
|
$selectid = ' selected="selected"';
|
||||||
$username = $row['username'];
|
$username = $row['username'];
|
||||||
$user_sel = $row['user_id'];
|
$user_sel = $row['user_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selectid = '';
|
$selectid = '';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('form_user', array(
|
$template->assign_block_vars('form_user', array(
|
||||||
'S_USER' => $row['user_id'],
|
'S_USER' => $row['user_id'],
|
||||||
'S_USERNAME' => $row['username'],
|
'S_USERNAME' => $row['username'],
|
||||||
'S_SELECTEDID' => $selectid,
|
'S_SELECTEDID' => $selectid,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// All bets of selected user group by bet
|
// All bets of selected user group by bet
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$bets_home_win = 0;
|
$bets_home_win = 0;
|
||||||
$bets_draw = 0;
|
$bets_draw = 0;
|
||||||
$bets_guest_win = 0;
|
$bets_guest_win = 0;
|
||||||
$win_home_win = 0;
|
$win_home_win = 0;
|
||||||
$win_draw = 0;
|
$win_draw = 0;
|
||||||
$win_guest_win = 0;
|
$win_guest_win = 0;
|
||||||
$points_home_win = 0;
|
$points_home_win = 0;
|
||||||
$points_draw = 0;
|
$points_draw = 0;
|
||||||
$points_guest_win = 0;
|
$points_guest_win = 0;
|
||||||
|
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
COUNT(b.match_no) AS bets,
|
COUNT(b.match_no) AS bets,
|
||||||
b.goals_home,
|
b.goals_home,
|
||||||
b.goals_guest,
|
b.goals_guest,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
||||||
)
|
)
|
||||||
) AS hits,
|
) AS hits,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||||
)
|
)
|
||||||
) AS tendencies,
|
) AS tendencies,
|
||||||
' . select_points('m',true) . '
|
' . select_points('m',true) . '
|
||||||
FROM ' . FOOTB_BETS . ' AS b
|
FROM ' . FOOTB_BETS . ' AS b
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
||||||
WHERE b.season = $season
|
WHERE b.season = $season
|
||||||
AND b.league = $league
|
AND b.league = $league
|
||||||
AND b.goals_home <> ''
|
AND b.goals_home <> ''
|
||||||
AND b.goals_guest <> ''
|
AND b.goals_guest <> ''
|
||||||
AND m.status = 3
|
AND m.status = 3
|
||||||
AND b.user_id = $user_sel
|
AND b.user_id = $user_sel
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
GROUP by b.goals_home, b.goals_guest
|
GROUP by b.goals_home, b.goals_guest
|
||||||
ORDER by bets DESC";
|
ORDER by bets DESC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['goals_home'] > $row['goals_guest'])
|
if ($row['goals_home'] > $row['goals_guest'])
|
||||||
{
|
{
|
||||||
$bets_home_win += $row['bets'];
|
$bets_home_win += $row['bets'];
|
||||||
$win_home_win += $row['hits'] + $row['tendencies'];
|
$win_home_win += $row['hits'] + $row['tendencies'];
|
||||||
$points_home_win += $row['points'];
|
$points_home_win += $row['points'];
|
||||||
}
|
}
|
||||||
if ($row['goals_home'] == $row['goals_guest'])
|
if ($row['goals_home'] == $row['goals_guest'])
|
||||||
{
|
{
|
||||||
$bets_draw += $row['bets'];
|
$bets_draw += $row['bets'];
|
||||||
$win_draw += $row['hits'] + $row['tendencies'];
|
$win_draw += $row['hits'] + $row['tendencies'];
|
||||||
$points_draw += $row['points'];
|
$points_draw += $row['points'];
|
||||||
}
|
}
|
||||||
if ($row['goals_home'] < $row['goals_guest'])
|
if ($row['goals_home'] < $row['goals_guest'])
|
||||||
{
|
{
|
||||||
$bets_guest_win += $row['bets'];
|
$bets_guest_win += $row['bets'];
|
||||||
$win_guest_win += $row['hits'] + $row['tendencies'];
|
$win_guest_win += $row['hits'] + $row['tendencies'];
|
||||||
$points_guest_win += $row['points'];
|
$points_guest_win += $row['points'];
|
||||||
}
|
}
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$template->assign_block_vars('bets', array(
|
$template->assign_block_vars('bets', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'GOALSHOME' => $row['goals_home'],
|
'GOALSHOME' => $row['goals_home'],
|
||||||
'GOALSGUEST' => $row['goals_guest'],
|
'GOALSGUEST' => $row['goals_guest'],
|
||||||
'COUNT' => $row['bets'],
|
'COUNT' => $row['bets'],
|
||||||
'DIRECTHITS' => $row['hits'],
|
'DIRECTHITS' => $row['hits'],
|
||||||
'TENDENCIES' => $row['tendencies'],
|
'TENDENCIES' => $row['tendencies'],
|
||||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'AVERAGE' => round($row['points'] / $row['bets'],1),
|
'AVERAGE' => round($row['points'] / $row['bets'],1),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Tendencies of all results
|
// Tendencies of all results
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
SUM(IF(goals_home + 0 > goals_guest,1,0)) AS SUM_HOME_WIN,
|
SUM(IF(goals_home + 0 > goals_guest,1,0)) AS SUM_HOME_WIN,
|
||||||
SUM(IF(goals_home = goals_guest,1,0)) AS SUM_DRAW,
|
SUM(IF(goals_home = goals_guest,1,0)) AS SUM_DRAW,
|
||||||
SUM(IF(goals_home + 0 < goals_guest,1,0)) AS SUM_GUEST_WIN
|
SUM(IF(goals_home + 0 < goals_guest,1,0)) AS SUM_GUEST_WIN
|
||||||
FROM " . FOOTB_MATCHES . "
|
FROM " . FOOTB_MATCHES . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
AND status = 3
|
AND status = 3
|
||||||
AND matchday <= $matchday";
|
AND matchday <= $matchday";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('bets_wdl', array(
|
$template->assign_block_vars('bets_wdl', array(
|
||||||
'ROW_CLASS' => 'bg2 row_dark',
|
'ROW_CLASS' => 'bg2 row_dark',
|
||||||
'SCORE' => sprintf($user->lang['PLAYED']),
|
'SCORE' => sprintf($user->lang['PLAYED']),
|
||||||
'HOMEWIN' => $row['SUM_HOME_WIN'],
|
'HOMEWIN' => $row['SUM_HOME_WIN'],
|
||||||
'DRAW' => $row['SUM_DRAW'],
|
'DRAW' => $row['SUM_DRAW'],
|
||||||
'GUESTWIN' => $row['SUM_GUEST_WIN'],
|
'GUESTWIN' => $row['SUM_GUEST_WIN'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Muliply with user of this league
|
// Muliply with user of this league
|
||||||
$template->assign_block_vars('bets_wdl_all', array(
|
$template->assign_block_vars('bets_wdl_all', array(
|
||||||
'ROW_CLASS' => 'bg2 row_dark',
|
'ROW_CLASS' => 'bg2 row_dark',
|
||||||
'SCORE' => sprintf($user->lang['PLAYED']),
|
'SCORE' => sprintf($user->lang['PLAYED']),
|
||||||
'HOMEWIN' => $row['SUM_HOME_WIN'] * $numb_users,
|
'HOMEWIN' => $row['SUM_HOME_WIN'] * $numb_users,
|
||||||
'DRAW' => $row['SUM_DRAW'] * $numb_users,
|
'DRAW' => $row['SUM_DRAW'] * $numb_users,
|
||||||
'GUESTWIN' => $row['SUM_GUEST_WIN'] * $numb_users,
|
'GUESTWIN' => $row['SUM_GUEST_WIN'] * $numb_users,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Count tendencies (bets of selected user)
|
// Count tendencies (bets of selected user)
|
||||||
$template->assign_block_vars('bets_wdl', array(
|
$template->assign_block_vars('bets_wdl', array(
|
||||||
'ROW_CLASS' => 'bg1 row_light',
|
'ROW_CLASS' => 'bg1 row_light',
|
||||||
'SCORE' => sprintf($user->lang['GUESSED']),
|
'SCORE' => sprintf($user->lang['GUESSED']),
|
||||||
'HOMEWIN' => $bets_home_win,
|
'HOMEWIN' => $bets_home_win,
|
||||||
'DRAW' => $bets_draw,
|
'DRAW' => $bets_draw,
|
||||||
'GUESTWIN' => $bets_guest_win,
|
'GUESTWIN' => $bets_guest_win,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Scored with tendency (bets of selected user)
|
// Scored with tendency (bets of selected user)
|
||||||
$template->assign_block_vars('bets_wdl', array(
|
$template->assign_block_vars('bets_wdl', array(
|
||||||
'ROW_CLASS' => 'bg2 row_dark',
|
'ROW_CLASS' => 'bg2 row_dark',
|
||||||
'SCORE' => sprintf($user->lang['SCORED']),
|
'SCORE' => sprintf($user->lang['SCORED']),
|
||||||
'HOMEWIN' => $win_home_win,
|
'HOMEWIN' => $win_home_win,
|
||||||
'DRAW' => $win_draw,
|
'DRAW' => $win_draw,
|
||||||
'GUESTWIN' => $win_guest_win,
|
'GUESTWIN' => $win_guest_win,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Points with tendency (bets of selected user)
|
// Points with tendency (bets of selected user)
|
||||||
$template->assign_block_vars('bets_wdl', array(
|
$template->assign_block_vars('bets_wdl', array(
|
||||||
'ROW_CLASS' => 'bg1 row_light',
|
'ROW_CLASS' => 'bg1 row_light',
|
||||||
'SCORE' => sprintf($user->lang['POINTS']),
|
'SCORE' => sprintf($user->lang['POINTS']),
|
||||||
'HOMEWIN' => $points_home_win,
|
'HOMEWIN' => $points_home_win,
|
||||||
'DRAW' => $points_draw,
|
'DRAW' => $points_draw,
|
||||||
'GUESTWIN' => $points_guest_win,
|
'GUESTWIN' => $points_guest_win,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// All bets of all users group by bet
|
// All bets of all users group by bet
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$bets_home_win = 0;
|
$bets_home_win = 0;
|
||||||
$bets_draw = 0;
|
$bets_draw = 0;
|
||||||
$bets_guest_win = 0;
|
$bets_guest_win = 0;
|
||||||
$win_home_win = 0;
|
$win_home_win = 0;
|
||||||
$win_draw = 0;
|
$win_draw = 0;
|
||||||
$win_guest_win = 0;
|
$win_guest_win = 0;
|
||||||
$points_home_win = 0;
|
$points_home_win = 0;
|
||||||
$points_draw = 0;
|
$points_draw = 0;
|
||||||
$points_guest_win = 0;
|
$points_guest_win = 0;
|
||||||
|
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
COUNT(b.match_no) AS bets,
|
COUNT(b.match_no) AS bets,
|
||||||
b.goals_home,
|
b.goals_home,
|
||||||
b.goals_guest,
|
b.goals_guest,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
||||||
)
|
)
|
||||||
) AS hits,
|
) AS hits,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||||
)
|
)
|
||||||
) AS tendencies,
|
) AS tendencies,
|
||||||
' . select_points('m',true) . '
|
' . select_points('m',true) . '
|
||||||
FROM ' . FOOTB_BETS . ' AS b
|
FROM ' . FOOTB_BETS . ' AS b
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
||||||
WHERE b.season = $season
|
WHERE b.season = $season
|
||||||
AND b.league = $league
|
AND b.league = $league
|
||||||
AND b.goals_home <> ''
|
AND b.goals_home <> ''
|
||||||
AND b.goals_guest <> ''
|
AND b.goals_guest <> ''
|
||||||
AND m.status = 3
|
AND m.status = 3
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
GROUP by b.goals_home, b.goals_guest
|
GROUP by b.goals_home, b.goals_guest
|
||||||
ORDER by bets DESC";
|
ORDER by bets DESC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['goals_home'] > $row['goals_guest'])
|
if ($row['goals_home'] > $row['goals_guest'])
|
||||||
{
|
{
|
||||||
$bets_home_win += $row['bets'];
|
$bets_home_win += $row['bets'];
|
||||||
$win_home_win += $row['hits'] + $row['tendencies'];
|
$win_home_win += $row['hits'] + $row['tendencies'];
|
||||||
$points_home_win += $row['points'];
|
$points_home_win += $row['points'];
|
||||||
}
|
}
|
||||||
if ($row['goals_home'] == $row['goals_guest'])
|
if ($row['goals_home'] == $row['goals_guest'])
|
||||||
{
|
{
|
||||||
$bets_draw += $row['bets'];
|
$bets_draw += $row['bets'];
|
||||||
$win_draw += $row['hits'] + $row['tendencies'];
|
$win_draw += $row['hits'] + $row['tendencies'];
|
||||||
$points_draw += $row['points'];
|
$points_draw += $row['points'];
|
||||||
}
|
}
|
||||||
if ($row['goals_home'] < $row['goals_guest'])
|
if ($row['goals_home'] < $row['goals_guest'])
|
||||||
{
|
{
|
||||||
$bets_guest_win += $row['bets'];
|
$bets_guest_win += $row['bets'];
|
||||||
$win_guest_win += $row['hits'] + $row['tendencies'];
|
$win_guest_win += $row['hits'] + $row['tendencies'];
|
||||||
$points_guest_win += $row['points'];
|
$points_guest_win += $row['points'];
|
||||||
}
|
}
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$template->assign_block_vars('allbets', array(
|
$template->assign_block_vars('allbets', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'GOALSHOME' => $row['goals_home'],
|
'GOALSHOME' => $row['goals_home'],
|
||||||
'GOALSGUEST' => $row['goals_guest'],
|
'GOALSGUEST' => $row['goals_guest'],
|
||||||
'COUNT' => $row['bets'],
|
'COUNT' => $row['bets'],
|
||||||
'DIRECTHITS' => $row['hits'],
|
'DIRECTHITS' => $row['hits'],
|
||||||
'TENDENCIES' => $row['tendencies'],
|
'TENDENCIES' => $row['tendencies'],
|
||||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'AVERAGE' => round($row['points'] / $row['bets'],1),
|
'AVERAGE' => round($row['points'] / $row['bets'],1),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Count tendencies (bets of all user)
|
// Count tendencies (bets of all user)
|
||||||
$template->assign_block_vars('bets_wdl_all', array(
|
$template->assign_block_vars('bets_wdl_all', array(
|
||||||
'ROW_CLASS' => 'bg2 row_dark',
|
'ROW_CLASS' => 'bg2 row_dark',
|
||||||
'SCORE' => sprintf($user->lang['GUESSED']),
|
'SCORE' => sprintf($user->lang['GUESSED']),
|
||||||
'HOMEWIN' => $bets_home_win,
|
'HOMEWIN' => $bets_home_win,
|
||||||
'DRAW' => $bets_draw,
|
'DRAW' => $bets_draw,
|
||||||
'GUESTWIN' => $bets_guest_win,
|
'GUESTWIN' => $bets_guest_win,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Scored with tendency (bets of all user)
|
// Scored with tendency (bets of all user)
|
||||||
$template->assign_block_vars('bets_wdl_all', array(
|
$template->assign_block_vars('bets_wdl_all', array(
|
||||||
'ROW_CLASS' => 'bg1 row_light',
|
'ROW_CLASS' => 'bg1 row_light',
|
||||||
'SCORE' => sprintf($user->lang['SCORED']),
|
'SCORE' => sprintf($user->lang['SCORED']),
|
||||||
'HOMEWIN' => $win_home_win,
|
'HOMEWIN' => $win_home_win,
|
||||||
'DRAW' => $win_draw,
|
'DRAW' => $win_draw,
|
||||||
'GUESTWIN' => $win_guest_win,
|
'GUESTWIN' => $win_guest_win,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Points with tendency (bets of all user)
|
// Points with tendency (bets of all user)
|
||||||
$template->assign_block_vars('bets_wdl_all', array(
|
$template->assign_block_vars('bets_wdl_all', array(
|
||||||
'ROW_CLASS' => 'bg2 row_dark',
|
'ROW_CLASS' => 'bg2 row_dark',
|
||||||
'SCORE' => sprintf($user->lang['POINTS']),
|
'SCORE' => sprintf($user->lang['POINTS']),
|
||||||
'HOMEWIN' => $points_home_win,
|
'HOMEWIN' => $points_home_win,
|
||||||
'DRAW' => $points_draw,
|
'DRAW' => $points_draw,
|
||||||
'GUESTWIN' => $points_guest_win,
|
'GUESTWIN' => $points_guest_win,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['MY_BETS']);
|
$sidename = sprintf($user->lang['MY_BETS']);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_MY_BETS' => true,
|
'S_DISPLAY_MY_BETS' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => ($config['football_bank']) ? $this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league, 'm' => $matchday)) :
|
'S_DATA_MY_BETS' => $data,
|
||||||
$this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'SEASON' => $season,
|
||||||
'LEFT_LINK' => ($config['football_bank']) ? '< ' . sprintf($user->lang['FOOTBALL_BANK']) :
|
'LEAGUE' => $league,
|
||||||
'< ' . sprintf($user->lang['RANK_TOTAL']),
|
'USERNAME' => $username,
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_points', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
)
|
||||||
'RIGHT_LINK' => sprintf($user->lang['MY_POINTS']) . ' >',
|
);
|
||||||
'LEFT_TITLE' => ($config['football_bank']) ? sprintf($user->lang['TITLE_FOOTBALL_BANK']) : sprintf($user->lang['TITLE_RANK_TOTAL']),
|
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_POINTS']),
|
|
||||||
'S_DATA_MY_BETS' => $data,
|
|
||||||
'SEASON' => $season,
|
|
||||||
'LEAGUE' => $league,
|
|
||||||
'USERNAME' => $username,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,339 +1,334 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
$user1 = '';
|
$user1 = '';
|
||||||
$user2 = '';
|
$user2 = '';
|
||||||
$user3 = '';
|
$user3 = '';
|
||||||
$user4 = '';
|
$user4 = '';
|
||||||
$username = '';
|
$username = '';
|
||||||
$username2 = '';
|
$username2 = '';
|
||||||
$username3 = '';
|
$username3 = '';
|
||||||
$username4 = '';
|
$username4 = '';
|
||||||
// Calculate rank total
|
// Calculate rank total
|
||||||
$sql = 'SELECT
|
$sql = "SELECT
|
||||||
r.user_id,
|
r.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
SUM(r.points) AS points_total
|
(SELECT SUM(c.rank_total) FROM " . FOOTB_MY_CHART . " AS c WHERE c.user_id = (r.user_id) AND c.season = r.season AND c.league = r.league AND c.matchday = $matchday) AS points_total
|
||||||
FROM ' . FOOTB_RANKS . ' AS r
|
FROM " . FOOTB_RANKS . ' AS r
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||||
WHERE r.season = $season
|
WHERE r.season = $season
|
||||||
AND r.league = $league
|
AND r.league = $league
|
||||||
AND r.matchday <= $matchday
|
AND r.matchday <= $matchday
|
||||||
GROUP BY r.user_id
|
GROUP BY r.user_id
|
||||||
ORDER BY points_total DESC, LOWER(u.username) ASC";
|
ORDER BY points_total ASC, LOWER(u.username) ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$current_ranks = $db->sql_fetchrowset($result);
|
$current_ranks = $db->sql_fetchrowset($result);
|
||||||
$total_users = sizeof($current_ranks);
|
$db->sql_freeresult($result);
|
||||||
if ($total_users > 3 AND $total_users <= 50)
|
$total_users = sizeof($current_ranks);
|
||||||
{
|
if ($total_users > 3 AND $total_users <= 50)
|
||||||
$data = true;
|
{
|
||||||
$middle = round($total_users / 2,0);
|
$data = true;
|
||||||
// If user = leader then first = seconde
|
$middle = round($total_users / 2,0);
|
||||||
$user_first = $current_ranks[0]['user_id'];
|
// If user = leader then first = seconde
|
||||||
if ($user_first == $user->data['user_id'])
|
$user_first = $current_ranks[0]['user_id'];
|
||||||
$user_first = $current_ranks[1]['user_id'];
|
if ($user_first == $user->data['user_id'])
|
||||||
// If user = middle then middle = middle - 1
|
$user_first = $current_ranks[1]['user_id'];
|
||||||
$user_middle = $current_ranks[$middle-1]['user_id'];
|
// If user = middle then middle = middle - 1
|
||||||
if ($user_middle == $user->data['user_id'])
|
$user_middle = $current_ranks[$middle-1]['user_id'];
|
||||||
$user_middle = $current_ranks[$middle]['user_id'];
|
if ($user_middle == $user->data['user_id'])
|
||||||
// If user = last then last = last but one
|
$user_middle = $current_ranks[$middle]['user_id'];
|
||||||
$user_last = $current_ranks[$total_users - 1]['user_id'];
|
// If user = last then last = last but one
|
||||||
if ($user_last == $user->data['user_id'])
|
$user_last = $current_ranks[$total_users - 1]['user_id'];
|
||||||
$user_last = $current_ranks[$total_users - 2]['user_id'];
|
if ($user_last == $user->data['user_id'])
|
||||||
|
$user_last = $current_ranks[$total_users - 2]['user_id'];
|
||||||
if (user_is_member($user->data['user_id'], $season, $league))
|
|
||||||
{
|
if (user_is_member($user->data['user_id'], $season, $league))
|
||||||
// Take user, leader, middle and last
|
{
|
||||||
$user1 = $this->request->variable('user1', $user->data['user_id']);
|
// Take user, leader, middle and last
|
||||||
$user2 = $this->request->variable('user2', $user_first);
|
$user1 = $this->request->variable('user1', $user->data['user_id']);
|
||||||
$user3 = $this->request->variable('user3', $user_middle);
|
$user2 = $this->request->variable('user2', $user_first);
|
||||||
$user4 = $this->request->variable('user4', $user_last);
|
$user3 = $this->request->variable('user3', $user_middle);
|
||||||
}
|
$user4 = $this->request->variable('user4', $user_last);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
// Only take leader, middle and last
|
{
|
||||||
$user1 = $this->request->variable('user1', $user_first);
|
// Only take leader, middle and last
|
||||||
$user2 = $this->request->variable('user2', $user_middle);
|
$user1 = $this->request->variable('user1', $user_first);
|
||||||
$user3 = $this->request->variable('user3', $user_last);
|
$user2 = $this->request->variable('user2', $user_middle);
|
||||||
$user4 = $this->request->variable('user4', 0);
|
$user3 = $this->request->variable('user3', $user_last);
|
||||||
}
|
$user4 = $this->request->variable('user4', 0);
|
||||||
|
}
|
||||||
// Add empty choice
|
|
||||||
$template->assign_block_vars('form_user2', array(
|
// Add empty choice
|
||||||
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
$template->assign_block_vars('form_user2', array(
|
||||||
'S_USERID' => 0,
|
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
||||||
'S_SELECTEDID2' => '',
|
'S_USERID' => 0,
|
||||||
)
|
'S_SELECTEDID2' => '',
|
||||||
);
|
)
|
||||||
$template->assign_block_vars('form_user3', array(
|
);
|
||||||
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
$template->assign_block_vars('form_user3', array(
|
||||||
'S_USERID' => 0,
|
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
||||||
'S_SELECTEDID3' => '',
|
'S_USERID' => 0,
|
||||||
)
|
'S_SELECTEDID3' => '',
|
||||||
);
|
)
|
||||||
$template->assign_block_vars('form_user4', array(
|
);
|
||||||
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
$template->assign_block_vars('form_user4', array(
|
||||||
'S_USERID' => 0,
|
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
||||||
'S_SELECTEDID4' => '',
|
'S_USERID' => 0,
|
||||||
)
|
'S_SELECTEDID4' => '',
|
||||||
);
|
)
|
||||||
|
);
|
||||||
// Start select user
|
|
||||||
foreach ($current_ranks as $rank_user)
|
// Start select user
|
||||||
{
|
foreach ($current_ranks as $rank_user)
|
||||||
$curr_userid =$rank_user['user_id'];
|
{
|
||||||
if ($user1 == $curr_userid)
|
$curr_userid =$rank_user['user_id'];
|
||||||
{
|
if ($user1 == $curr_userid)
|
||||||
$selectid1 = ' selected="selected"';
|
{
|
||||||
$username = $rank_user['username'];
|
$selectid1 = ' selected="selected"';
|
||||||
}
|
$username = $rank_user['username'];
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$selectid1 = '';
|
{
|
||||||
}
|
$selectid1 = '';
|
||||||
if ($user2 == $curr_userid)
|
}
|
||||||
{
|
if ($user2 == $curr_userid)
|
||||||
$selectid2 = ' selected="selected"';
|
{
|
||||||
$username2 = $rank_user['username'];
|
$selectid2 = ' selected="selected"';
|
||||||
}
|
$username2 = $rank_user['username'];
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$selectid2 = '';
|
{
|
||||||
}
|
$selectid2 = '';
|
||||||
if ($user3 == $curr_userid)
|
}
|
||||||
{
|
if ($user3 == $curr_userid)
|
||||||
$selectid3 = ' selected="selected"';
|
{
|
||||||
$username3 = $rank_user['username'];
|
$selectid3 = ' selected="selected"';
|
||||||
}
|
$username3 = $rank_user['username'];
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$selectid3 = '';
|
{
|
||||||
}
|
$selectid3 = '';
|
||||||
if ($user4 == $curr_userid)
|
}
|
||||||
{
|
if ($user4 == $curr_userid)
|
||||||
$selectid4 = ' selected="selected"';
|
{
|
||||||
$username4 = $rank_user['username'];
|
$selectid4 = ' selected="selected"';
|
||||||
}
|
$username4 = $rank_user['username'];
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$selectid4 = '';
|
{
|
||||||
}
|
$selectid4 = '';
|
||||||
if ($curr_userid != $user2 AND $curr_userid != $user3 AND $curr_userid != $user4)
|
}
|
||||||
$template->assign_block_vars('form_user1', array(
|
if ($curr_userid != $user2 AND $curr_userid != $user3 AND $curr_userid != $user4)
|
||||||
'S_USERNAME' => $rank_user['username'],
|
$template->assign_block_vars('form_user1', array(
|
||||||
'S_USERID' => $curr_userid,
|
'S_USERNAME' => $rank_user['username'],
|
||||||
'S_SELECTEDID' => $selectid1));
|
'S_USERID' => $curr_userid,
|
||||||
if ($curr_userid != $user1 AND $curr_userid != $user3 AND $curr_userid != $user4)
|
'S_SELECTEDID' => $selectid1));
|
||||||
$template->assign_block_vars('form_user2', array(
|
if ($curr_userid != $user1 AND $curr_userid != $user3 AND $curr_userid != $user4)
|
||||||
'S_USERNAME' => $rank_user['username'],
|
$template->assign_block_vars('form_user2', array(
|
||||||
'S_USERID' => $curr_userid,
|
'S_USERNAME' => $rank_user['username'],
|
||||||
'S_SELECTEDID' => $selectid2));
|
'S_USERID' => $curr_userid,
|
||||||
if ($curr_userid != $user1 AND $curr_userid != $user2 AND $curr_userid != $user4)
|
'S_SELECTEDID' => $selectid2));
|
||||||
$template->assign_block_vars('form_user3', array(
|
if ($curr_userid != $user1 AND $curr_userid != $user2 AND $curr_userid != $user4)
|
||||||
'S_USERNAME' => $rank_user['username'],
|
$template->assign_block_vars('form_user3', array(
|
||||||
'S_USERID' => $curr_userid,
|
'S_USERNAME' => $rank_user['username'],
|
||||||
'S_SELECTEDID' => $selectid3));
|
'S_USERID' => $curr_userid,
|
||||||
if ($curr_userid != $user1 AND $curr_userid != $user2 AND $curr_userid != $user3)
|
'S_SELECTEDID' => $selectid3));
|
||||||
$template->assign_block_vars('form_user4', array(
|
if ($curr_userid != $user1 AND $curr_userid != $user2 AND $curr_userid != $user3)
|
||||||
'S_USERNAME' => $rank_user['username'],
|
$template->assign_block_vars('form_user4', array(
|
||||||
'S_USERID' => $curr_userid,
|
'S_USERNAME' => $rank_user['username'],
|
||||||
'S_SELECTEDID' => $selectid4));
|
'S_USERID' => $curr_userid,
|
||||||
}
|
'S_SELECTEDID' => $selectid4));
|
||||||
|
}
|
||||||
$ranks_total_1 = '';
|
|
||||||
$ranks_dayl_1 = '';
|
$ranks_total_1 = '';
|
||||||
$points_1 = '';
|
$ranks_dayl_1 = '';
|
||||||
$sql = 'SELECT *
|
$points_1 = '';
|
||||||
FROM ' . FOOTB_RANKS . "
|
$sql = 'SELECT *
|
||||||
WHERE season = $season
|
FROM ' . FOOTB_MY_CHART . "
|
||||||
AND league = $league
|
WHERE season = $season
|
||||||
AND matchday <= $matchday
|
AND league = $league
|
||||||
AND user_id = $user1
|
AND matchday <= $matchday
|
||||||
ORDER BY matchday ASC";
|
AND user_id = $user1
|
||||||
|
ORDER BY matchday ASC";
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$points_1 = $points_1. $row['points']. ',';
|
{
|
||||||
$ranks_total_1 = $ranks_total_1. $row['rank_total']. ',';
|
$points_1 = $points_1. $row['points']. ',';
|
||||||
$ranks_dayl_1 = $ranks_dayl_1. $row['rank']. ',';
|
$ranks_total_1 = $ranks_total_1. $row['rank_total']. ',';
|
||||||
}
|
$ranks_dayl_1 = $ranks_dayl_1. $row['rank']. ',';
|
||||||
$points_1 = substr($points_1, 0, strlen($points_1) - 1);
|
}
|
||||||
$ranks_total_1 = substr($ranks_total_1, 0, strlen($ranks_total_1) - 1);
|
$points_1 = substr($points_1, 0, strlen($points_1) - 1);
|
||||||
$ranks_dayl_1 = substr($ranks_dayl_1, 0, strlen($ranks_dayl_1) - 1);
|
$ranks_total_1 = substr($ranks_total_1, 0, strlen($ranks_total_1) - 1);
|
||||||
$db->sql_freeresult($result);
|
$ranks_dayl_1 = substr($ranks_dayl_1, 0, strlen($ranks_dayl_1) - 1);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
$ranks_total_2 = '';
|
|
||||||
$ranks_dayl_2 = '';
|
$ranks_total_2 = '';
|
||||||
$points_2 = '';
|
$ranks_dayl_2 = '';
|
||||||
if ($user2 != 0)
|
$points_2 = '';
|
||||||
{
|
if ($user2 != 0)
|
||||||
$sql = 'SELECT *
|
{
|
||||||
FROM ' . FOOTB_RANKS . "
|
$sql = 'SELECT *
|
||||||
WHERE season = $season
|
FROM ' . FOOTB_RANKS . "
|
||||||
AND league = $league
|
WHERE season = $season
|
||||||
AND matchday <= $matchday
|
AND league = $league
|
||||||
AND user_id = $user2
|
AND matchday <= $matchday
|
||||||
ORDER BY matchday ASC";
|
AND user_id = $user2
|
||||||
|
ORDER BY matchday ASC";
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$points_2 = $points_2 . $row['points']. ',';
|
{
|
||||||
$ranks_total_2 = $ranks_total_2 . $row['rank_total']. ',';
|
$points_2 = $points_2 . $row['points']. ',';
|
||||||
$ranks_dayl_2 = $ranks_dayl_2 . $row['rank']. ',';
|
$ranks_total_2 = $ranks_total_2 . $row['rank_total']. ',';
|
||||||
}
|
$ranks_dayl_2 = $ranks_dayl_2 . $row['rank']. ',';
|
||||||
$points_2 = substr($points_2, 0, strlen($points_2) - 1);
|
}
|
||||||
$ranks_total_2 = substr($ranks_total_2, 0, strlen($ranks_total_2) - 1);
|
$points_2 = substr($points_2, 0, strlen($points_2) - 1);
|
||||||
$ranks_dayl_2 = substr($ranks_dayl_2, 0, strlen($ranks_dayl_2) - 1);
|
$ranks_total_2 = substr($ranks_total_2, 0, strlen($ranks_total_2) - 1);
|
||||||
$db->sql_freeresult($result);
|
$ranks_dayl_2 = substr($ranks_dayl_2, 0, strlen($ranks_dayl_2) - 1);
|
||||||
}
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
$ranks_total_3 = '';
|
|
||||||
$ranks_dayl_3 = '';
|
$ranks_total_3 = '';
|
||||||
$points_3 = '';
|
$ranks_dayl_3 = '';
|
||||||
if ($user3 != 0)
|
$points_3 = '';
|
||||||
{
|
if ($user3 != 0)
|
||||||
$sql = 'SELECT *
|
{
|
||||||
FROM ' . FOOTB_RANKS . "
|
$sql = 'SELECT *
|
||||||
WHERE season = $season
|
FROM ' . FOOTB_MY_CHART . "
|
||||||
AND league = $league
|
WHERE season = $season
|
||||||
AND matchday <= $matchday
|
AND league = $league
|
||||||
AND user_id = $user3
|
AND matchday <= $matchday
|
||||||
ORDER BY matchday ASC";
|
AND user_id = $user3
|
||||||
|
ORDER BY matchday ASC";
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$points_3 = $points_3. $row['points']. ',';
|
{
|
||||||
$ranks_total_3 = $ranks_total_3. $row['rank_total']. ',';
|
$points_3 = $points_3. $row['points']. ',';
|
||||||
$ranks_dayl_3 = $ranks_dayl_3. $row['rank']. ',';
|
$ranks_total_3 = $ranks_total_3. $row['rank_total']. ',';
|
||||||
}
|
$ranks_dayl_3 = $ranks_dayl_3. $row['rank']. ',';
|
||||||
$points_3 = substr($points_3,0,strlen($points_3)-1);
|
}
|
||||||
$ranks_total_3 = substr($ranks_total_3,0,strlen($ranks_total_3)-1);
|
$points_3 = substr($points_3,0,strlen($points_3)-1);
|
||||||
$ranks_dayl_3 = substr($ranks_dayl_3,0,strlen($ranks_dayl_3)-1);
|
$ranks_total_3 = substr($ranks_total_3,0,strlen($ranks_total_3)-1);
|
||||||
$db->sql_freeresult($result);
|
$ranks_dayl_3 = substr($ranks_dayl_3,0,strlen($ranks_dayl_3)-1);
|
||||||
}
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
$ranks_total_4 = '';
|
|
||||||
$ranks_dayl_4 = '';
|
$ranks_total_4 = '';
|
||||||
$points_4 = '';
|
$ranks_dayl_4 = '';
|
||||||
if ($user4 != 0)
|
$points_4 = '';
|
||||||
{
|
if ($user4 != 0)
|
||||||
$sql = 'SELECT *
|
{
|
||||||
FROM ' . FOOTB_RANKS . "
|
$sql = 'SELECT *
|
||||||
WHERE season = $season
|
FROM ' . FOOTB_MY_CHART . "
|
||||||
AND league = $league
|
WHERE season = $season
|
||||||
AND matchday <= $matchday
|
AND league = $league
|
||||||
AND user_id = $user4
|
AND matchday <= $matchday
|
||||||
ORDER BY matchday ASC";
|
AND user_id = $user4
|
||||||
|
ORDER BY matchday ASC";
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$points_4 = $points_4. $row['points']. ',';
|
{
|
||||||
$sptagplatz = $row['rank'];
|
$points_4 = $points_4. $row['points']. ',';
|
||||||
$ranks_total_4 = $ranks_total_4. $row['rank_total']. ',';
|
$sptagplatz = $row['rank'];
|
||||||
$ranks_dayl_4 = $ranks_dayl_4. $row['rank']. ',';
|
$ranks_total_4 = $ranks_total_4. $row['rank_total']. ',';
|
||||||
}
|
$ranks_dayl_4 = $ranks_dayl_4. $row['rank']. ',';
|
||||||
$points_4 = substr($points_4,0,strlen($points_4)-1);
|
}
|
||||||
$ranks_total_4 = substr($ranks_total_4,0,strlen($ranks_total_4)-1);
|
$points_4 = substr($points_4,0,strlen($points_4)-1);
|
||||||
$ranks_dayl_4 = substr($ranks_dayl_4,0,strlen($ranks_dayl_4)-1);
|
$ranks_total_4 = substr($ranks_total_4,0,strlen($ranks_total_4)-1);
|
||||||
$db->sql_freeresult($result);
|
$ranks_dayl_4 = substr($ranks_dayl_4,0,strlen($ranks_dayl_4)-1);
|
||||||
}
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
$min = '';
|
|
||||||
$max = '';
|
$min = '';
|
||||||
if ($user1 != 0)
|
$max = '';
|
||||||
{
|
if ($user1 != 0)
|
||||||
$sql = 'SELECT
|
{
|
||||||
MIN(points) As points_min,
|
$sql = 'SELECT
|
||||||
MAX(points) As points_max
|
MIN(points) As points_min,
|
||||||
FROM ' . FOOTB_RANKS . "
|
MAX(points) As points_max
|
||||||
WHERE season = $season
|
FROM ' . FOOTB_MY_CHART . "
|
||||||
AND league = $league
|
WHERE season = $season
|
||||||
AND matchday <= $matchday
|
AND league = $league
|
||||||
GROUP BY matchday
|
AND matchday <= $matchday
|
||||||
ORDER BY matchday ASC";
|
GROUP BY matchday
|
||||||
|
ORDER BY matchday ASC";
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$min = $min. $row['points_min']. ',';
|
{
|
||||||
$max = $max. $row['points_max']. ',';
|
$min = $min. $row['points_min']. ',';
|
||||||
}
|
$max = $max. $row['points_max']. ',';
|
||||||
$min = substr($min,0,strlen($min)-1);
|
}
|
||||||
$max = substr($max,0,strlen($max)-1);
|
$min = substr($min,0,strlen($min)-1);
|
||||||
$db->sql_freeresult($result);
|
$max = substr($max,0,strlen($max)-1);
|
||||||
}
|
$db->sql_freeresult($result);
|
||||||
// Create and display charts
|
}
|
||||||
$chart= "<img src='". generate_board_url() . '/' . $this->football_root_path
|
// Create and display charts
|
||||||
. "includes/chart_rank.php?t=$total_users&m=$matchday&v1=$ranks_total_1&v2=$ranks_total_2&v3=$ranks_total_3&v4=$ranks_total_4&c="
|
$chart= "<img src='". generate_board_url() . '/' . $this->football_root_path
|
||||||
. sprintf($user->lang['PLACE']) . "' alt='"
|
. "includes/chart_rank.php?t=$total_users&m=$matchday&v1=$ranks_total_1&v2=$ranks_total_2&v3=$ranks_total_3&v4=$ranks_total_4&c="
|
||||||
. sprintf($user->lang['CHART_TOTAL'])
|
. sprintf($user->lang['PLACE']) . "' alt='"
|
||||||
. "'/>";
|
. sprintf($user->lang['CHART_TOTAL'])
|
||||||
$template->assign_block_vars('chart_rank', array(
|
. "'/>";
|
||||||
'CHARTIMAGE' => $chart,
|
$template->assign_block_vars('chart_rank', array(
|
||||||
)
|
'CHARTIMAGE' => $chart,
|
||||||
);
|
)
|
||||||
$chart= "<img src='". generate_board_url() . '/' . $this->football_root_path
|
);
|
||||||
. "includes/chart_rank.php?t=$total_users&m=$matchday&v1=$ranks_dayl_1&v2=$ranks_dayl_2&v3=$ranks_dayl_3&v4=$ranks_dayl_4&c="
|
$chart= "<img src='". generate_board_url() . '/' . $this->football_root_path
|
||||||
. sprintf($user->lang['PLACE']) . "' alt='"
|
. "includes/chart_rank.php?t=$total_users&m=$matchday&v1=$ranks_dayl_1&v2=$ranks_dayl_2&v3=$ranks_dayl_3&v4=$ranks_dayl_4&c="
|
||||||
. sprintf($user->lang['CHART_MATCHDAY'])
|
. sprintf($user->lang['PLACE']) . "' alt='"
|
||||||
. "'/>";
|
. sprintf($user->lang['CHART_MATCHDAY'])
|
||||||
$template->assign_block_vars('chart_matchtdays', array(
|
. "'/>";
|
||||||
'CHARTIMAGE' => $chart,
|
$template->assign_block_vars('chart_matchtdays', array(
|
||||||
)
|
'CHARTIMAGE' => $chart,
|
||||||
);
|
)
|
||||||
$chart= "<img src='". generate_board_url() . '/' . $this->football_root_path
|
);
|
||||||
. "includes/chart_points.php?m=$matchday&v1=$points_1&v2=$points_2&v3=$points_3&v4=$points_4&min=$min&max=$max&c="
|
$chart= "<img src='". generate_board_url() . '/' . $this->football_root_path
|
||||||
. sprintf($user->lang['POINTS']) . ',' . sprintf($user->lang['BANDWIDTH']) . "' alt='"
|
. "includes/chart_points.php?m=$matchday&v1=$points_1&v2=$points_2&v3=$points_3&v4=$points_4&min=$min&max=$max&c="
|
||||||
. sprintf($user->lang['CHART_POINTS'])
|
. sprintf($user->lang['POINTS']) . ',' . sprintf($user->lang['BANDWIDTH']) . "' alt='"
|
||||||
. "'/>";
|
. sprintf($user->lang['CHART_POINTS'])
|
||||||
$template->assign_block_vars('chart_points', array(
|
. "'/>";
|
||||||
'CHARTIMAGE' => $chart,
|
$template->assign_block_vars('chart_points', array(
|
||||||
)
|
'CHARTIMAGE' => $chart,
|
||||||
);
|
)
|
||||||
}
|
);
|
||||||
$sidename = sprintf($user->lang['MY_CHART']);
|
}
|
||||||
$template->assign_vars(array(
|
$sidename = sprintf($user->lang['MY_CHART']);
|
||||||
'S_DISPLAY_MY_CHART' => true,
|
$template->assign_vars(array(
|
||||||
'S_SIDENAME' => $sidename,
|
'S_DISPLAY_MY_CHART' => true,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_rank', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'S_SIDENAME' => $sidename,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_RANK']),
|
'S_DATA_MY_CHART' => $data,
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_koeff', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'SEASON' => $season,
|
||||||
'RIGHT_LINK' => sprintf($user->lang['MY_KOEFF']) . ' >',
|
'LEAGUE' => $league,
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_RANKS']),
|
'S_USER1' => $user1,
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_KOEFF']),
|
'S_USER2' => $user2,
|
||||||
'S_DATA_MY_CHART' => $data,
|
'S_USER3' => $user3,
|
||||||
'SEASON' => $season,
|
'S_USER4' => $user4,
|
||||||
'LEAGUE' => $league,
|
'USERNAME1' => $username,
|
||||||
'S_USER1' => $user1,
|
'USERNAME2' => $username2,
|
||||||
'S_USER2' => $user2,
|
'USERNAME3' => $username3,
|
||||||
'S_USER3' => $user3,
|
'USERNAME4' => $username4,
|
||||||
'S_USER4' => $user4,
|
)
|
||||||
'USERNAME1' => $username,
|
);
|
||||||
'USERNAME2' => $username2,
|
|
||||||
'USERNAME3' => $username3,
|
|
||||||
'USERNAME4' => $username4,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
?>
|
?>
|
||||||
@@ -98,7 +98,6 @@ else
|
|||||||
$split_after = $count_matches;
|
$split_after = $count_matches;
|
||||||
$splits = 1;
|
$splits = 1;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Make sure $start is set to the last page if it exceeds the amount
|
// Make sure $start is set to the last page if it exceeds the amount
|
||||||
if ($start < 0 || $start >= $total_users)
|
if ($start < 0 || $start >= $total_users)
|
||||||
@@ -192,7 +191,7 @@ foreach ($matches AS $match)
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
$bet_index++;
|
$bet_index++;
|
||||||
$total += $user_bet['points'];
|
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
|
||||||
if ($user_bet['status'] < 1 && !$config['football_view_bets'])
|
if ($user_bet['status'] < 1 && !$config['football_view_bets'])
|
||||||
{
|
{
|
||||||
// hide bets
|
// hide bets
|
||||||
@@ -310,7 +309,7 @@ if ($count_matches > 0)
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
$bet_index++;
|
$bet_index++;
|
||||||
$total += $user_bet['points'];
|
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
|
||||||
if ($user_bet['status'] < 1)
|
if ($user_bet['status'] < 1)
|
||||||
{
|
{
|
||||||
if ($user_bet['bet_home'] == '')
|
if ($user_bet['bet_home'] == '')
|
||||||
@@ -376,12 +375,6 @@ $sidename = sprintf($user->lang['MY_KOEFF']);
|
|||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_MY_KOEFF' => true,
|
'S_DISPLAY_MY_KOEFF' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_chart', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_CHART']),
|
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'stat_points', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'RIGHT_LINK' => sprintf($user->lang['STAT_POINTS']) . ' >',
|
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_CHART']),
|
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_STAT_POINTS']),
|
|
||||||
'S_MATCHES_ON_MATCHDAY' => $matches_on_matchday,
|
'S_MATCHES_ON_MATCHDAY' => $matches_on_matchday,
|
||||||
'S_SPALTEN' => ($count_matches * 2) + 2,
|
'S_SPALTEN' => ($count_matches * 2) + 2,
|
||||||
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
||||||
|
|||||||
@@ -1,204 +1,198 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_sel)
|
if (!$user_sel)
|
||||||
{
|
{
|
||||||
if (user_is_member($user->data['user_id'], $season, $league))
|
if (user_is_member($user->data['user_id'], $season, $league))
|
||||||
{
|
{
|
||||||
$user_sel = $user->data['user_id'];
|
$user_sel = $user->data['user_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$username = '';
|
$username = '';
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
// Select user
|
// Select user
|
||||||
$sql = 'SELECT DISTINCT
|
$sql = 'SELECT DISTINCT
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.username
|
u.username
|
||||||
FROM ' . FOOTB_BETS . ' AS b
|
FROM ' . FOOTB_BETS . ' AS b
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
ORDER BY LOWER(u.username) ASC";
|
ORDER BY LOWER(u.username) ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$data = true;
|
$data = true;
|
||||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||||
{
|
{
|
||||||
$selectid = ' selected="selected"';
|
$selectid = ' selected="selected"';
|
||||||
$username = $row['username'];
|
$username = $row['username'];
|
||||||
$user_sel = $row['user_id'];
|
$user_sel = $row['user_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selectid = '';
|
$selectid = '';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('form_user', array(
|
$template->assign_block_vars('form_user', array(
|
||||||
'S_USER' => $row['user_id'],
|
'S_USER' => $row['user_id'],
|
||||||
'S_USERNAME' => $row['username'],
|
'S_USERNAME' => $row['username'],
|
||||||
'S_SELECTEDID' => $selectid,
|
'S_SELECTEDID' => $selectid,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Select sum of users points group by team
|
// Select sum of users points group by team
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
t.*,
|
t.*,
|
||||||
SUM(1) AS bets,
|
SUM(1) AS bets,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
||||||
)
|
)
|
||||||
) AS win,
|
) AS win,
|
||||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
||||||
)
|
)
|
||||||
) AS lost,
|
) AS lost,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest=m.goals_guest),
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest=m.goals_guest),
|
||||||
0,1
|
0,1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)AS tendencies,
|
)AS tendencies,
|
||||||
SUM(IF((b.goals_home = m.goals_home) AND (b.goals_guest=m.goals_guest),1,0))AS hits,
|
SUM(IF((b.goals_home = m.goals_home) AND (b.goals_guest=m.goals_guest),1,0))AS hits,
|
||||||
" . select_points('m',true) . "
|
" . select_points('m',true) . "
|
||||||
FROM " . FOOTB_TEAMS . ' AS t
|
FROM " . FOOTB_TEAMS . ' AS t
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
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.team_id_home = t.team_id OR m.team_id_guest = t.team_id))
|
||||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no=m.match_no)
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no=m.match_no)
|
||||||
WHERE t.season = $season
|
WHERE t.season = $season
|
||||||
AND t.league = $league
|
AND t.league = $league
|
||||||
AND m.status IN (3,6)
|
AND m.status IN (3,6)
|
||||||
AND b.user_id = $user_sel
|
AND b.user_id = $user_sel
|
||||||
AND b.goals_home <> ''
|
AND b.goals_home <> ''
|
||||||
AND b.goals_guest <> ''
|
AND b.goals_guest <> ''
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
GROUP BY t.team_id
|
GROUP BY t.team_id
|
||||||
ORDER BY points DESC";
|
ORDER BY points DESC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
$template->assign_block_vars('points', array(
|
$template->assign_block_vars('points', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'RANK' => $rank,
|
'RANK' => $rank,
|
||||||
'LOGO' => $logo,
|
'LOGO' => $logo,
|
||||||
'TEAM' => $row['team_name_short'],
|
'TEAM' => $row['team_name_short'],
|
||||||
'COUNT' => $row['bets'],
|
'COUNT' => $row['bets'],
|
||||||
'WIN' => $row['win'],
|
'WIN' => $row['win'],
|
||||||
'DRAW' => $row['draw'],
|
'DRAW' => $row['draw'],
|
||||||
'LOST' => $row['lost'],
|
'LOST' => $row['lost'],
|
||||||
'DIRECTHITS' => $row['hits'],
|
'DIRECTHITS' => $row['hits'],
|
||||||
'TENDENCIES' => $row['tendencies'],
|
'TENDENCIES' => $row['tendencies'],
|
||||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Select sum of all users points group by team
|
// Select sum of all users points group by team
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
t.*,
|
t.*,
|
||||||
SUM(1) AS bets,
|
SUM(1) AS bets,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
||||||
)
|
)
|
||||||
) AS win,
|
) AS win,
|
||||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
||||||
)
|
)
|
||||||
) AS lost,
|
) AS lost,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||||
)
|
)
|
||||||
)AS tendencies,
|
)AS tendencies,
|
||||||
SUM(IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)) AS hits,
|
SUM(IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)) AS hits,
|
||||||
" . select_points('m',true) . "
|
" . select_points('m',true) . "
|
||||||
FROM " . FOOTB_TEAMS . ' AS t
|
FROM " . FOOTB_TEAMS . ' AS t
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
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.team_id_home = t.team_id OR m.team_id_guest = t.team_id))
|
||||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no=m.match_no)
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no=m.match_no)
|
||||||
WHERE t.season = $season
|
WHERE t.season = $season
|
||||||
AND t.league = $league
|
AND t.league = $league
|
||||||
AND b.goals_home <> ''
|
AND b.goals_home <> ''
|
||||||
AND b.goals_guest <> ''
|
AND b.goals_guest <> ''
|
||||||
AND m.status IN (3,6)
|
AND m.status IN (3,6)
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
GROUP BY t.team_id
|
GROUP BY t.team_id
|
||||||
ORDER BY points DESC";
|
ORDER BY points DESC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
$template->assign_block_vars('allpoints', array(
|
$template->assign_block_vars('allpoints', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'RANK' => $rank,
|
'RANK' => $rank,
|
||||||
'LOGO' => $logo,
|
'LOGO' => $logo,
|
||||||
'TEAM' => $row['team_name_short'],
|
'TEAM' => $row['team_name_short'],
|
||||||
'COUNT' => $row['bets'],
|
'COUNT' => $row['bets'],
|
||||||
'WIN' => $row['win'],
|
'WIN' => $row['win'],
|
||||||
'DRAW' => $row['draw'],
|
'DRAW' => $row['draw'],
|
||||||
'LOST' => $row['lost'],
|
'LOST' => $row['lost'],
|
||||||
'DIRECTHITS' => $row['hits'],
|
'DIRECTHITS' => $row['hits'],
|
||||||
'TENDENCIES' => $row['tendencies'],
|
'TENDENCIES' => $row['tendencies'],
|
||||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['MY_POINTS']);
|
$sidename = sprintf($user->lang['MY_POINTS']);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_MY_POINTS' => true,
|
'S_DISPLAY_MY_POINTS' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'S_DATA_MY_POINTS' => $data,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_BETS']),
|
'SEASON' => $season,
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'LEAGUE' => $league,
|
||||||
'RIGHT_LINK' => sprintf($user->lang['MY_TABLE']) . ' >',
|
'USERNAME' => $username,
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_BETS']),
|
)
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_TABLE']),
|
);
|
||||||
'S_DATA_MY_POINTS' => $data,
|
|
||||||
'SEASON' => $season,
|
|
||||||
'LEAGUE' => $league,
|
|
||||||
'USERNAME' => $username,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
?>
|
?>
|
||||||
@@ -1,179 +1,173 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_sel)
|
if (!$user_sel)
|
||||||
{
|
{
|
||||||
if (user_is_member($user->data['user_id'], $season, $league))
|
if (user_is_member($user->data['user_id'], $season, $league))
|
||||||
{
|
{
|
||||||
$user_sel = $user->data['user_id'];
|
$user_sel = $user->data['user_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$username = '';
|
$username = '';
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
// select user
|
// select user
|
||||||
$sql = 'SELECT DISTINCT
|
$sql = 'SELECT DISTINCT
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.username
|
u.username
|
||||||
FROM ' . FOOTB_BETS . ' AS w
|
FROM ' . FOOTB_BETS . ' AS w
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = w.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = w.user_id)
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
ORDER BY LOWER(u.username) ASC ";
|
ORDER BY LOWER(u.username) ASC ";
|
||||||
|
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||||
{
|
{
|
||||||
$selectid = ' selected="selected"';
|
$selectid = ' selected="selected"';
|
||||||
$username = $row['username'];
|
$username = $row['username'];
|
||||||
$user_sel = $row['user_id'];
|
$user_sel = $row['user_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selectid = '';
|
$selectid = '';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('form_user', array(
|
$template->assign_block_vars('form_user', array(
|
||||||
'S_USER' => $row['user_id'],
|
'S_USER' => $row['user_id'],
|
||||||
'S_USERNAME' => $row['username'],
|
'S_USERNAME' => $row['username'],
|
||||||
'S_SELECTEDID' => $selectid,
|
'S_SELECTEDID' => $selectid,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Get ranks 1-3 of selected user
|
// Get ranks 1-3 of selected user
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
season,
|
season,
|
||||||
COUNT(matchday) AS matchdays,
|
COUNT(matchday) AS matchdays,
|
||||||
SUM(points) AS points,
|
SUM(points) AS points,
|
||||||
SUM(IF(rank = 1, 1, 0)) AS rank1,
|
SUM(IF(rank = 1, 1, 0)) AS rank1,
|
||||||
SUM(IF(rank = 2, 1, 0)) AS rank2,
|
SUM(IF(rank = 2, 1, 0)) AS rank2,
|
||||||
SUM(IF(rank = 3, 1, 0)) AS rank3
|
SUM(IF(rank = 3, 1, 0)) AS rank3
|
||||||
FROM ' . FOOTB_RANKS . "
|
FROM ' . FOOTB_RANKS . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
AND user_id = $user_sel
|
AND user_id = $user_sel
|
||||||
GROUP BY user_id, season
|
GROUP BY user_id, season
|
||||||
ORDER BY season ASC";
|
ORDER BY season ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$template->assign_block_vars('myrank', array(
|
$template->assign_block_vars('myrank', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'SEASON' => $row['season'],
|
'SEASON' => $row['season'],
|
||||||
'MATCHDAYS' => $row['matchdays'],
|
'MATCHDAYS' => $row['matchdays'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'RANK1' => $row['rank1'],
|
'RANK1' => $row['rank1'],
|
||||||
'RANK2' => $row['rank2'],
|
'RANK2' => $row['rank2'],
|
||||||
'RANK3' => $row['rank3'],
|
'RANK3' => $row['rank3'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Get all ranks 1-3 of selected user
|
// Get all ranks 1-3 of selected user
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
COUNT(matchday) AS matchdays,
|
COUNT(matchday) AS matchdays,
|
||||||
rank
|
rank
|
||||||
FROM ' . FOOTB_RANKS . "
|
FROM ' . FOOTB_RANKS . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
AND user_id = $user_sel
|
AND user_id = $user_sel
|
||||||
GROUP BY user_id, rank
|
GROUP BY user_id, rank
|
||||||
ORDER BY rank ASC";
|
ORDER BY rank ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$template->assign_block_vars('season_ranks', array(
|
$template->assign_block_vars('season_ranks', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'RANK' => $row['rank'],
|
'RANK' => $row['rank'],
|
||||||
'MATCHDAYS' => $row['matchdays'],
|
'MATCHDAYS' => $row['matchdays'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Get ranks 1-3 of all users
|
// Get ranks 1-3 of all users
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
r.user_id,
|
r.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
COUNT(r.matchday) AS matchdays,
|
COUNT(r.matchday) AS matchdays,
|
||||||
SUM(r.points) AS points,
|
SUM(r.points) AS points,
|
||||||
SUM(IF(r.rank =1, 1, 0)) AS rank1,
|
SUM(IF(r.rank =1, 1, 0)) AS rank1,
|
||||||
SUM(IF(r.rank =2, 1, 0)) AS rank2,
|
SUM(IF(r.rank =2, 1, 0)) AS rank2,
|
||||||
SUM(IF(r.rank =3, 1, 0)) AS rank3
|
SUM(IF(r.rank =3, 1, 0)) AS rank3
|
||||||
FROM ' . FOOTB_RANKS . " AS r
|
FROM ' . FOOTB_RANKS . " AS r
|
||||||
LEFT JOIN " . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
LEFT JOIN " . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||||
WHERE r.season = $season
|
WHERE r.season = $season
|
||||||
AND r.league = $league
|
AND r.league = $league
|
||||||
GROUP BY r.user_id
|
GROUP BY r.user_id
|
||||||
ORDER BY rank1 DESC, rank2 DESC, rank3 DESC";
|
ORDER BY rank1 DESC, rank2 DESC, rank3 DESC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$data = true;
|
$data = true;
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if ($row['user_id'] == $user->data['user_id'])
|
if ($row['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$row_class = 'bg3 row_user';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('allranks', array(
|
$template->assign_block_vars('allranks', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'NAME' => $row['username'],
|
'NAME' => $row['username'],
|
||||||
'MATCHDAYS' => $row['matchdays'],
|
'MATCHDAYS' => $row['matchdays'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'AVERAGE' => round($row['points'] / $row['matchdays'],1),
|
'AVERAGE' => round($row['points'] / $row['matchdays'],1),
|
||||||
'RANK1' => $row['rank1'],
|
'RANK1' => $row['rank1'],
|
||||||
'RANK2' => $row['rank2'],
|
'RANK2' => $row['rank2'],
|
||||||
'RANK3' => $row['rank3'],
|
'RANK3' => $row['rank3'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['MY_RANK']);
|
$sidename = sprintf($user->lang['MY_RANK']);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_MY_RANK' => true,
|
'S_DISPLAY_MY_RANK' => true,
|
||||||
'S_MATCHDAY_HIDE' => true,
|
'S_MATCHDAY_HIDE' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'S_DATA_MY_RANK' => $data,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_TABLE']),
|
'SEASON' => $season,
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_chart', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'LEAGUE' => $league,
|
||||||
'RIGHT_LINK' => sprintf($user->lang['MY_CHART']) . ' >',
|
'USERNAME' => $username,
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_TABLE']),
|
)
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_CHART']),
|
);
|
||||||
'S_DATA_MY_RANK' => $data,
|
|
||||||
'SEASON' => $season,
|
|
||||||
'LEAGUE' => $league,
|
|
||||||
'USERNAME' => $username,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,434 +1,430 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_sel)
|
if (!$user_sel)
|
||||||
{
|
{
|
||||||
if (user_is_member($user->data['user_id'], $season, $league))
|
if (user_is_member($user->data['user_id'], $season, $league))
|
||||||
{
|
{
|
||||||
$user_sel = $user->data['user_id'];
|
$user_sel = $user->data['user_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$username = '';
|
$username = '';
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
|
|
||||||
// select user
|
// select user
|
||||||
$sql = 'SELECT DISTINCT
|
$sql = 'SELECT DISTINCT
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.username
|
u.username
|
||||||
FROM ' . FOOTB_BETS . ' AS b
|
FROM ' . FOOTB_BETS . ' AS b
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
ORDER BY LOWER(u.username) ASC";
|
ORDER BY LOWER(u.username) ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
if ($user_sel == 900)
|
if ($user_sel == 900)
|
||||||
{
|
{
|
||||||
$selectid = ' selected="selected"';
|
$selectid = ' selected="selected"';
|
||||||
$username = 'Alle';
|
$username = 'Alle';
|
||||||
$user_sel = 900;
|
$user_sel = 900;
|
||||||
$where_user = "";
|
$where_user = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selectid = '';
|
$selectid = '';
|
||||||
$where_user = "b.user_id = $user_sel AND ";
|
$where_user = "b.user_id = $user_sel AND ";
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('form_user', array(
|
$template->assign_block_vars('form_user', array(
|
||||||
'S_USER' => 900,
|
'S_USER' => 900,
|
||||||
'S_USERNAME' => 'Alle',
|
'S_USERNAME' => 'Alle',
|
||||||
'S_SELECTEDID' => $selectid,
|
'S_SELECTEDID' => $selectid,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||||
{
|
{
|
||||||
$selectid = ' selected="selected"';
|
$selectid = ' selected="selected"';
|
||||||
$username = $row['username'];
|
$username = $row['username'];
|
||||||
$user_sel = $row['user_id'];
|
$user_sel = $row['user_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selectid = '';
|
$selectid = '';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('form_user', array(
|
$template->assign_block_vars('form_user', array(
|
||||||
'S_USER' => $row['user_id'],
|
'S_USER' => $row['user_id'],
|
||||||
'S_USERNAME' => $row['username'],
|
'S_USERNAME' => $row['username'],
|
||||||
'S_SELECTEDID' => $selectid,
|
'S_SELECTEDID' => $selectid,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$data_table = false;
|
$data_table = false;
|
||||||
$data_form = false;
|
$data_form = false;
|
||||||
if ($matchday > 5)
|
if ($matchday > 5)
|
||||||
{
|
{
|
||||||
$form_from = $matchday - 5;
|
$form_from = $matchday - 5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$form_from = 1;
|
$form_from = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = '
|
$sql = '
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM ' . FOOTB_LEAGUES . "
|
FROM ' . FOOTB_LEAGUES . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league";
|
AND league = $league";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$league_type = $row['league_type'];
|
$league_type = $row['league_type'];
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$text_form = sprintf($user->lang['TABLE_FORM_FROM'], $form_from);
|
$text_form = sprintf($user->lang['TABLE_FORM_FROM'], $form_from);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Select table on selected user bets
|
// Select table on selected user bets
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
t.*,
|
t.*,
|
||||||
SUM(1) AS matches,
|
SUM(1) AS matches,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
||||||
)
|
)
|
||||||
) AS win,
|
) AS win,
|
||||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
||||||
)
|
)
|
||||||
) AS lost,
|
) AS lost,
|
||||||
SUM(IF(m.team_id_home = t.team_id,
|
SUM(IF(m.team_id_home = t.team_id,
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0)),
|
IF(b.goals_home + 0 > b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0)),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))
|
IF(b.goals_home + 0 < b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))
|
||||||
)
|
)
|
||||||
) AS points,
|
) AS points,
|
||||||
SUM(IF(m.team_id_home = t.team_id,
|
SUM(IF(m.team_id_home = t.team_id,
|
||||||
IF(m.goals_home + 0 > m.goals_guest, 3, IF(m.goals_home = m.goals_guest, 1, 0)),
|
IF(m.goals_home + 0 > m.goals_guest, 3, IF(m.goals_home = m.goals_guest, 1, 0)),
|
||||||
IF(m.goals_home + 0 < m.goals_guest, 3, IF(m.goals_home = m.goals_guest, 1, 0))
|
IF(m.goals_home + 0 < m.goals_guest, 3, IF(m.goals_home = m.goals_guest, 1, 0))
|
||||||
)
|
)
|
||||||
) AS realpoints,
|
) AS realpoints,
|
||||||
SUM(IF(m.team_id_home = t.team_id, b.goals_home - b.goals_guest, b.goals_guest - b.goals_home)) AS goals_diff,
|
SUM(IF(m.team_id_home = t.team_id, b.goals_home - b.goals_guest, b.goals_guest - b.goals_home)) AS goals_diff,
|
||||||
SUM(IF(m.team_id_home = t.team_id, b.goals_home, b.goals_guest)) AS goals,
|
SUM(IF(m.team_id_home = t.team_id, b.goals_home, b.goals_guest)) AS goals,
|
||||||
SUM(IF(m.team_id_home = t.team_id, b.goals_guest, b.goals_home)) AS goals_against
|
SUM(IF(m.team_id_home = t.team_id, b.goals_guest, b.goals_home)) AS goals_against
|
||||||
FROM ' . FOOTB_TEAMS . ' AS t
|
FROM ' . FOOTB_TEAMS . ' AS t
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
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)
|
AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
||||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
||||||
WHERE $where_user
|
WHERE $where_user
|
||||||
t.season = $season
|
t.season = $season
|
||||||
AND t.league = $league
|
AND t.league = $league
|
||||||
AND b.goals_home <> ''
|
AND b.goals_home <> ''
|
||||||
AND b.goals_guest <> ''
|
AND b.goals_guest <> ''
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
GROUP BY t.team_id
|
AND m.show_table = 0
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
GROUP BY t.team_id
|
||||||
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$lastGroup = '';
|
$result = $db->sql_query($sql);
|
||||||
$sumdiff = 0;
|
$lastGroup = '';
|
||||||
while($row = $db->sql_fetchrow($result))
|
$sumdiff = 0;
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
if ($lastGroup != $row['group_id'])
|
{
|
||||||
{
|
if ($lastGroup != $row['group_id'])
|
||||||
$lastGroup = $row['group_id'];
|
{
|
||||||
$rank = 0;
|
$lastGroup = $row['group_id'];
|
||||||
$template->assign_block_vars('total', array(
|
$rank = 0;
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
$template->assign_block_vars('total', array(
|
||||||
)
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||||
);
|
)
|
||||||
}
|
);
|
||||||
if ($league_type != 2 OR $row['group_id'] != '')
|
}
|
||||||
{
|
if ($league_type != 2 OR $row['group_id'] != '')
|
||||||
$data_table = true;
|
{
|
||||||
$rank++;
|
$data_table = true;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$rank++;
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$pdiff = $row['points'] - $row['realpoints'];
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
if ($pdiff >= 0)
|
$pdiff = $row['points'] - $row['realpoints'];
|
||||||
{
|
if ($pdiff >= 0)
|
||||||
$sumdiff += $pdiff;
|
{
|
||||||
$pdiff = ' (+' . $pdiff . ')';
|
$sumdiff += $pdiff;
|
||||||
|
$pdiff = ' (+' . $pdiff . ')';
|
||||||
}
|
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$sumdiff -= $pdiff;
|
{
|
||||||
$pdiff = ' (' . $pdiff . ')';
|
$sumdiff -= $pdiff;
|
||||||
}
|
$pdiff = ' (' . $pdiff . ')';
|
||||||
if ($user_sel == 900)
|
}
|
||||||
{
|
if ($user_sel == 900)
|
||||||
$pdiff = '';
|
{
|
||||||
}
|
$pdiff = '';
|
||||||
|
}
|
||||||
$template->assign_block_vars('total', array(
|
|
||||||
'RANK' => $rank . '.',
|
$template->assign_block_vars('total', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'RANK' => $rank . '.',
|
||||||
'LOGO' => $logo,
|
'ROW_CLASS' => $row_class,
|
||||||
'TEAM_ID' => $row['team_id'],
|
'LOGO' => $logo,
|
||||||
'TEAM' => $row['team_name_short'],
|
'TEAM_ID' => $row['team_id'],
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'TEAM' => $row['team_name_short'],
|
||||||
'tid' => $row['team_id'], 'mode' => 'played')),
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'GAMES' => $row['matches'],
|
'tid' => $row['team_id'], 'mode' => 'played')),
|
||||||
'WIN' => $row['win'],
|
'GAMES' => $row['matches'],
|
||||||
'DRAW' => $row['draw'],
|
'WIN' => $row['win'],
|
||||||
'LOST' => $row['lost'],
|
'DRAW' => $row['draw'],
|
||||||
'GOALS' => $row['goals'],
|
'LOST' => $row['lost'],
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
'GOALS' => $row['goals'],
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
'POINTS' => $row['points'] . $pdiff,
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
)
|
'POINTS' => $row['points'] . $pdiff,
|
||||||
);
|
)
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
$rank = 0;
|
|
||||||
// Select formtable on selected user bets
|
$rank = 0;
|
||||||
$sql = 'SELECT
|
// Select formtable on selected user bets
|
||||||
t.*,
|
$sql = 'SELECT
|
||||||
SUM(1) AS matches,
|
t.*,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(1) AS matches,
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0),
|
||||||
)
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0)
|
||||||
) AS win,
|
)
|
||||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
) AS win,
|
||||||
SUM(IF((m.team_id_home = t.team_id),
|
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
SUM(IF((m.team_id_home = t.team_id),
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
IF(b.goals_home + 0 < b.goals_guest, 1, 0),
|
||||||
)
|
IF(b.goals_home + 0 > b.goals_guest, 1, 0)
|
||||||
) AS lost,
|
)
|
||||||
SUM(IF(m.team_id_home = t.team_id,
|
) AS lost,
|
||||||
IF(b.goals_home + 0 > b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0)),
|
SUM(IF(m.team_id_home = t.team_id,
|
||||||
IF(b.goals_home + 0 < b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))
|
IF(b.goals_home + 0 > b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0)),
|
||||||
)
|
IF(b.goals_home + 0 < b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))
|
||||||
) AS points,
|
)
|
||||||
SUM(IF(m.team_id_home = t.team_id, b.goals_home - b.goals_guest, b.goals_guest - b.goals_home)) AS goals_diff,
|
) AS points,
|
||||||
SUM(IF(m.team_id_home = t.team_id, b.goals_home, b.goals_guest)) AS goals,
|
SUM(IF(m.team_id_home = t.team_id, b.goals_home - b.goals_guest, b.goals_guest - b.goals_home)) AS goals_diff,
|
||||||
SUM(IF(m.team_id_home = t.team_id, b.goals_guest, b.goals_home)) AS goals_against
|
SUM(IF(m.team_id_home = t.team_id, b.goals_home, b.goals_guest)) AS goals,
|
||||||
FROM ' . FOOTB_TEAMS . ' AS t
|
SUM(IF(m.team_id_home = t.team_id, b.goals_guest, b.goals_home)) AS goals_against
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
FROM ' . FOOTB_TEAMS . ' AS t
|
||||||
AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
||||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
||||||
WHERE $where_user
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
||||||
t.season = $season
|
WHERE $where_user
|
||||||
AND t.league = $league
|
t.season = $season
|
||||||
AND b.goals_home <> ''
|
AND t.league = $league
|
||||||
AND b.goals_guest <> ''
|
AND b.goals_home <> ''
|
||||||
AND m.matchday >= $form_from
|
AND b.goals_guest <> ''
|
||||||
GROUP BY t.team_id
|
AND m.matchday >= $form_from
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
AND m.show_table = 0
|
||||||
|
GROUP BY t.team_id
|
||||||
$result = $db->sql_query($sql);
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
||||||
$lastGroup = '';
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
$result = $db->sql_query($sql);
|
||||||
{
|
$lastGroup = '';
|
||||||
$data_form = true;
|
while($row = $db->sql_fetchrow($result))
|
||||||
if ($lastGroup != $row['group_id'])
|
{
|
||||||
{
|
$data_form = true;
|
||||||
$lastGroup = $row['group_id'];
|
if ($lastGroup != $row['group_id'])
|
||||||
$rank = 0;
|
{
|
||||||
$template->assign_block_vars('form', array(
|
$lastGroup = $row['group_id'];
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
$rank = 0;
|
||||||
)
|
$template->assign_block_vars('form', array(
|
||||||
);
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||||
}
|
)
|
||||||
if ($league_type != 2 OR $row['group_id'] != '')
|
);
|
||||||
{
|
}
|
||||||
$rank++;
|
if ($league_type != 2 OR $row['group_id'] != '')
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
{
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$rank++;
|
||||||
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$template->assign_block_vars('form', array(
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
'RANK' => $rank . '.',
|
|
||||||
'ROW_CLASS' => $row_class,
|
$template->assign_block_vars('form', array(
|
||||||
'LOGO' => $logo,
|
'RANK' => $rank . '.',
|
||||||
'TEAM_ID' => $row['team_id'],
|
'ROW_CLASS' => $row_class,
|
||||||
'TEAM' => $row['team_name_short'],
|
'LOGO' => $logo,
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'TEAM_ID' => $row['team_id'],
|
||||||
'tid' => $row['team_id'], 'mode' => 'rest')),
|
'TEAM' => $row['team_name_short'],
|
||||||
'GAMES' => $row['matches'],
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'WIN' => $row['win'],
|
'tid' => $row['team_id'], 'mode' => 'rest')),
|
||||||
'DRAW' => $row['draw'],
|
'GAMES' => $row['matches'],
|
||||||
'LOST' => $row['lost'],
|
'WIN' => $row['win'],
|
||||||
'GOALS' => $row['goals'],
|
'DRAW' => $row['draw'],
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
'LOST' => $row['lost'],
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
'GOALS' => $row['goals'],
|
||||||
'POINTS' => $row['points'],
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
)
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
);
|
'POINTS' => $row['points'],
|
||||||
}
|
)
|
||||||
}
|
);
|
||||||
$db->sql_freeresult($result);
|
}
|
||||||
|
}
|
||||||
$rank = 0;
|
$db->sql_freeresult($result);
|
||||||
// Select home-table on selected user bets
|
|
||||||
$sql = 'SELECT
|
$rank = 0;
|
||||||
t.*,
|
// Select home-table on selected user bets
|
||||||
SUM(1) AS matches,
|
$sql = 'SELECT
|
||||||
SUM(IF(b.goals_home + 0 > b.goals_guest, 1, 0)) AS win,
|
t.*,
|
||||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
SUM(1) AS matches,
|
||||||
SUM(IF(b.goals_home + 0 < b.goals_guest, 1, 0)) AS lost,
|
SUM(IF(b.goals_home + 0 > b.goals_guest, 1, 0)) AS win,
|
||||||
SUM(IF(b.goals_home + 0 > b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))) AS points,
|
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||||
SUM(b.goals_home - b.goals_guest) AS goals_diff,
|
SUM(IF(b.goals_home + 0 < b.goals_guest, 1, 0)) AS lost,
|
||||||
SUM(b.goals_home) AS goals,
|
SUM(IF(b.goals_home + 0 > b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))) AS points,
|
||||||
SUM(b.goals_guest) AS goals_against
|
SUM(b.goals_home - b.goals_guest) AS goals_diff,
|
||||||
FROM ' . FOOTB_TEAMS . ' AS t
|
SUM(b.goals_home) AS goals,
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
SUM(b.goals_guest) AS goals_against
|
||||||
AND m.team_id_home = t.team_id AND m.group_id = t.group_id)
|
FROM ' . FOOTB_TEAMS . ' AS t
|
||||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
||||||
WHERE $where_user
|
AND m.team_id_home = t.team_id AND m.group_id = t.group_id)
|
||||||
t.season = $season
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
||||||
AND t.league = $league
|
WHERE $where_user
|
||||||
AND b.goals_home <> ''
|
t.season = $season
|
||||||
AND b.goals_guest <> ''
|
AND t.league = $league
|
||||||
AND m.matchday <= $matchday
|
AND b.goals_home <> ''
|
||||||
GROUP BY t.team_id
|
AND b.goals_guest <> ''
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
AND m.matchday <= $matchday
|
||||||
|
AND m.show_table = 0
|
||||||
$result = $db->sql_query($sql);
|
GROUP BY t.team_id
|
||||||
$lastGroup = '';
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
$result = $db->sql_query($sql);
|
||||||
if ($lastGroup != $row['group_id'])
|
$lastGroup = '';
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$lastGroup = $row['group_id'];
|
{
|
||||||
$rank = 0;
|
if ($lastGroup != $row['group_id'])
|
||||||
$template->assign_block_vars('home', array(
|
{
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
$lastGroup = $row['group_id'];
|
||||||
)
|
$rank = 0;
|
||||||
);
|
$template->assign_block_vars('home', array(
|
||||||
}
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||||
if ($league_type != 2 OR $row['group_id'] != '')
|
)
|
||||||
{
|
);
|
||||||
$rank++;
|
}
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
if ($league_type != 2 OR $row['group_id'] != '')
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
{
|
||||||
|
$rank++;
|
||||||
$template->assign_block_vars('home', array(
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
'RANK' => $rank . '.',
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
'ROW_CLASS' => $row_class,
|
|
||||||
'LOGO' => $logo,
|
$template->assign_block_vars('home', array(
|
||||||
'TEAM_ID' => $row['team_id'],
|
'RANK' => $rank . '.',
|
||||||
'TEAM' => $row['team_name_short'],
|
'ROW_CLASS' => $row_class,
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'LOGO' => $logo,
|
||||||
'tid' => $row['team_id'], 'mode' => 'home')),
|
'TEAM_ID' => $row['team_id'],
|
||||||
'GAMES' => $row['matches'],
|
'TEAM' => $row['team_name_short'],
|
||||||
'WIN' => $row['win'],
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'DRAW' => $row['draw'],
|
'tid' => $row['team_id'], 'mode' => 'home')),
|
||||||
'LOST' => $row['lost'],
|
'GAMES' => $row['matches'],
|
||||||
'GOALS' => $row['goals'],
|
'WIN' => $row['win'],
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
'DRAW' => $row['draw'],
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
'LOST' => $row['lost'],
|
||||||
'POINTS' => $row['points'],
|
'GOALS' => $row['goals'],
|
||||||
)
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
);
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
}
|
'POINTS' => $row['points'],
|
||||||
}
|
)
|
||||||
$db->sql_freeresult($result);
|
);
|
||||||
|
}
|
||||||
$rank = 0;
|
}
|
||||||
// Select away-table on selected user bets
|
$db->sql_freeresult($result);
|
||||||
$sql = 'SELECT
|
|
||||||
t.*,
|
$rank = 0;
|
||||||
SUM(1) AS matches,
|
// Select away-table on selected user bets
|
||||||
SUM(IF(b.goals_home + 0 < b.goals_guest, 1, 0)) AS win,
|
$sql = 'SELECT
|
||||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
t.*,
|
||||||
SUM(IF(b.goals_home + 0 > b.goals_guest, 1, 0)) AS lost,
|
SUM(1) AS matches,
|
||||||
SUM(IF(b.goals_home + 0 < b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))) AS points,
|
SUM(IF(b.goals_home + 0 < b.goals_guest, 1, 0)) AS win,
|
||||||
SUM(b.goals_guest - b.goals_home) AS goals_diff,
|
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||||
SUM(b.goals_guest) AS goals,
|
SUM(IF(b.goals_home + 0 > b.goals_guest, 1, 0)) AS lost,
|
||||||
SUM(b.goals_home) AS goals_against
|
SUM(IF(b.goals_home + 0 < b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))) AS points,
|
||||||
FROM ' . FOOTB_TEAMS . ' AS t
|
SUM(b.goals_guest - b.goals_home) AS goals_diff,
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league AND m.team_id_guest = t.team_id AND m.group_id = t.group_id)
|
SUM(b.goals_guest) AS goals,
|
||||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
SUM(b.goals_home) AS goals_against
|
||||||
WHERE $where_user
|
FROM ' . FOOTB_TEAMS . ' AS t
|
||||||
t.season = $season
|
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league AND m.team_id_guest = t.team_id AND m.group_id = t.group_id)
|
||||||
AND t.league = $league
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no = m.match_no)
|
||||||
AND b.goals_home <> ''
|
WHERE $where_user
|
||||||
AND b.goals_guest <> ''
|
t.season = $season
|
||||||
AND m.matchday <= $matchday
|
AND t.league = $league
|
||||||
GROUP BY t.team_id
|
AND b.goals_home <> ''
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
AND b.goals_guest <> ''
|
||||||
|
AND m.matchday <= $matchday
|
||||||
$result = $db->sql_query($sql);
|
AND m.show_table = 0
|
||||||
$lastGroup = '';
|
GROUP BY t.team_id
|
||||||
while($row = $db->sql_fetchrow($result))
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC";
|
||||||
{
|
|
||||||
if ($lastGroup != $row['group_id'])
|
$result = $db->sql_query($sql);
|
||||||
{
|
$lastGroup = '';
|
||||||
$lastGroup = $row['group_id'];
|
while($row = $db->sql_fetchrow($result))
|
||||||
$rank = 0;
|
{
|
||||||
$template->assign_block_vars('away', array(
|
if ($lastGroup != $row['group_id'])
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
{
|
||||||
)
|
$lastGroup = $row['group_id'];
|
||||||
);
|
$rank = 0;
|
||||||
}
|
$template->assign_block_vars('away', array(
|
||||||
if ($league_type != 2 OR $row['group_id'] != '')
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||||
{
|
)
|
||||||
$rank++;
|
);
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
}
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
if ($league_type != 2 OR $row['group_id'] != '')
|
||||||
|
{
|
||||||
$template->assign_block_vars('away', array(
|
$rank++;
|
||||||
'RANK' => $rank . '.',
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
'ROW_CLASS' => $row_class,
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
'LOGO' => $logo,
|
|
||||||
'TEAM_ID' => $row['team_id'],
|
$template->assign_block_vars('away', array(
|
||||||
'TEAM' => $row['team_name_short'],
|
'RANK' => $rank . '.',
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'ROW_CLASS' => $row_class,
|
||||||
'tid' => $row['team_id'], 'mode' => 'away')),
|
'LOGO' => $logo,
|
||||||
'GAMES' => $row['matches'],
|
'TEAM_ID' => $row['team_id'],
|
||||||
'WIN' => $row['win'],
|
'TEAM' => $row['team_name_short'],
|
||||||
'DRAW' => $row['draw'],
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'LOST' => $row['lost'],
|
'tid' => $row['team_id'], 'mode' => 'away')),
|
||||||
'GOALS' => $row['goals'],
|
'GAMES' => $row['matches'],
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
'WIN' => $row['win'],
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
'DRAW' => $row['draw'],
|
||||||
'POINTS' => $row['points'],
|
'LOST' => $row['lost'],
|
||||||
)
|
'GOALS' => $row['goals'],
|
||||||
);
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
}
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
}
|
'POINTS' => $row['points'],
|
||||||
$db->sql_freeresult($result);
|
)
|
||||||
|
);
|
||||||
$sidename = sprintf($user->lang['MY_TABLE']);
|
}
|
||||||
$template->assign_vars(array(
|
}
|
||||||
'S_DISPLAY_MY_TABLE' => true,
|
$db->sql_freeresult($result);
|
||||||
'S_SIDENAME' => $sidename,
|
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_points', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
$sidename = sprintf($user->lang['MY_TABLE']);
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_TABLE']),
|
$template->assign_vars(array(
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_POINTS']),
|
'S_DISPLAY_MY_TABLE' => true,
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_rank', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'S_SIDENAME' => $sidename,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_TABLE']),
|
'S_DATA_MY_TABLE' => $data_table,
|
||||||
'RIGHT_LINK' => sprintf($user->lang['MY_RANK']) . ' >',
|
'S_DATA_FORM' => $data_form,
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_POINTS']),
|
'SEASON' => $season,
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_RANKS']),
|
'LEAGUE' => $league,
|
||||||
'S_DATA_MY_TABLE' => $data_table,
|
'TEXT_FORM' => $text_form,
|
||||||
'S_DATA_FORM' => $data_form,
|
'S_PDIFF' => $sumdiff,
|
||||||
'SEASON' => $season,
|
'USERNAME' => $username,
|
||||||
'LEAGUE' => $league,
|
)
|
||||||
'TEXT_FORM' => $text_form,
|
);
|
||||||
'S_PDIFF' => $sumdiff,
|
|
||||||
'USERNAME' => $username,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
414
block/odds.php
@@ -1,211 +1,205 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data_odds = false;
|
$data_odds = false;
|
||||||
$matchnumber = 0;
|
$matchnumber = 0;
|
||||||
$lang_dates = $user->lang['datetime'];
|
$lang_dates = $user->lang['datetime'];
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
m.league,
|
m.league,
|
||||||
m.match_no,
|
m.match_no,
|
||||||
CONCAT(
|
CONCAT(
|
||||||
CASE DATE_FORMAT(m.match_datetime,'%w')
|
CASE DATE_FORMAT(m.match_datetime,'%w')
|
||||||
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
||||||
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
||||||
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
||||||
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
||||||
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
||||||
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
||||||
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
||||||
ELSE 'Error' END,
|
ELSE 'Error' END,
|
||||||
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
||||||
) AS match_time,
|
) AS match_time,
|
||||||
t1.team_symbol AS home_symbol,
|
t1.team_symbol AS home_symbol,
|
||||||
t2.team_symbol AS guest_symbol,
|
t2.team_symbol AS guest_symbol,
|
||||||
t1.team_name_short AS home_name,
|
t1.team_name_short AS home_name,
|
||||||
t2.team_name_short AS guest_name,
|
t2.team_name_short AS guest_name,
|
||||||
t1.team_id AS home_id,
|
t1.team_id AS home_id,
|
||||||
t2.team_id AS guest_id,
|
t2.team_id AS guest_id,
|
||||||
m.goals_home,
|
m.goals_home,
|
||||||
m.goals_guest,
|
m.goals_guest,
|
||||||
m.goals_overtime_home AS kogoals_home,
|
m.goals_overtime_home AS kogoals_home,
|
||||||
m.goals_overtime_guest AS kogoals_guest,
|
m.goals_overtime_guest AS kogoals_guest,
|
||||||
m.ko_match,
|
m.ko_match,
|
||||||
m.group_id,
|
m.group_id,
|
||||||
m.formula_home,
|
m.formula_home,
|
||||||
m.formula_guest,
|
m.formula_guest,
|
||||||
m.odd_1,
|
m.odd_1,
|
||||||
m.odd_x,
|
m.odd_x,
|
||||||
m.odd_2,
|
m.odd_2,
|
||||||
m.trend FROM " . FOOTB_MATCHES . ' AS m
|
m.trend FROM " . FOOTB_MATCHES . ' AS m
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||||
WHERE m.season = $season
|
WHERE m.season = $season
|
||||||
AND m.league = $league
|
AND m.league = $league
|
||||||
AND m.matchday = $matchday
|
AND m.matchday = $matchday
|
||||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$rows = $db->sql_fetchrowset($result);
|
$rows = $db->sql_fetchrowset($result);
|
||||||
|
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
//while($row = $db->sql_fetchrow($result))
|
//while($row = $db->sql_fetchrow($result))
|
||||||
foreach ($rows as $row)
|
foreach ($rows as $row)
|
||||||
{
|
{
|
||||||
$data_odds = true;
|
$data_odds = true;
|
||||||
$matchnumber++ ;
|
$matchnumber++ ;
|
||||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if (0 == $row['home_id'])
|
if (0 == $row['home_id'])
|
||||||
{
|
{
|
||||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||||
$home_in_array = explode("#",$home_info);
|
$home_in_array = explode("#",$home_info);
|
||||||
$homelogo = $home_in_array[0];
|
$homelogo = $home_in_array[0];
|
||||||
$homeid = $home_in_array[1];
|
$homeid = $home_in_array[1];
|
||||||
$homename = $home_in_array[2];
|
$homename = $home_in_array[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$homelogo = $row['home_symbol'];
|
$homelogo = $row['home_symbol'];
|
||||||
$homeid = $row['home_id'];
|
$homeid = $row['home_id'];
|
||||||
$homename = $row['home_name'];
|
$homename = $row['home_name'];
|
||||||
}
|
}
|
||||||
if (0 == $row['guest_id'])
|
if (0 == $row['guest_id'])
|
||||||
{
|
{
|
||||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||||
$guest_in_array = explode("#",$guest_info);
|
$guest_in_array = explode("#",$guest_info);
|
||||||
$guestlogo = $guest_in_array[0];
|
$guestlogo = $guest_in_array[0];
|
||||||
$guestid = $guest_in_array[1];
|
$guestid = $guest_in_array[1];
|
||||||
$guestname = $guest_in_array[2];
|
$guestname = $guest_in_array[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$guestlogo = $row['guest_symbol'];
|
$guestlogo = $row['guest_symbol'];
|
||||||
$guestid = $row['guest_id'];
|
$guestid = $row['guest_id'];
|
||||||
$guestname = $row['guest_name'];
|
$guestname = $row['guest_name'];
|
||||||
}
|
}
|
||||||
if ($homelogo <> '')
|
if ($homelogo <> '')
|
||||||
{
|
{
|
||||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
if ($guestlogo <> '')
|
if ($guestlogo <> '')
|
||||||
{
|
{
|
||||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['ko_match'])
|
if ($row['ko_match'])
|
||||||
{
|
{
|
||||||
$display_ko = true;
|
$display_ko = true;
|
||||||
$ko_match = true;
|
$ko_match = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ko_match = false;
|
$ko_match = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['group_id'] == '')
|
if ($row['group_id'] == '')
|
||||||
{
|
{
|
||||||
$group_id = ' ';
|
$group_id = ' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$display_group = true;
|
$display_group = true;
|
||||||
$group_id = $row['group_id'];
|
$group_id = $row['group_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$edit_match = false;
|
$edit_match = false;
|
||||||
$goals_home = ($row['goals_home'] == '') ? ' ' : $row['goals_home'];
|
$goals_home = ($row['goals_home'] == '') ? ' ' : $row['goals_home'];
|
||||||
$goals_guest = ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'];
|
$goals_guest = ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'];
|
||||||
$kogoals_home = ($row['kogoals_home'] == '') ? ' ' : $row['kogoals_home'];
|
$kogoals_home = ($row['kogoals_home'] == '') ? ' ' : $row['kogoals_home'];
|
||||||
$kogoals_guest = ($row['kogoals_guest'] == '') ? ' ' : $row['kogoals_guest'];
|
$kogoals_guest = ($row['kogoals_guest'] == '') ? ' ' : $row['kogoals_guest'];
|
||||||
|
|
||||||
$template->assign_block_vars('odds', array(
|
$template->assign_block_vars('odds', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'MATCH_NUMBER' => $row['match_no'],
|
'MATCH_NUMBER' => $row['match_no'],
|
||||||
'MATCHDAY' => $matchday,
|
'MATCHDAY' => $matchday,
|
||||||
'MATCH_TIME' => $row['match_time'],
|
'MATCH_TIME' => $row['match_time'],
|
||||||
'GROUP' => $group_id,
|
'GROUP' => $group_id,
|
||||||
'HOME_ID' => $homeid,
|
'HOME_ID' => $homeid,
|
||||||
'GUEST_ID' => $guestid,
|
'GUEST_ID' => $guestid,
|
||||||
'LOGO_HOME' => $logoH,
|
'LOGO_HOME' => $logoH,
|
||||||
'LOGO_GUEST' => $logoG,
|
'LOGO_GUEST' => $logoG,
|
||||||
'HOME_NAME' => $homename,
|
'HOME_NAME' => $homename,
|
||||||
'GUEST_NAME' => $guestname,
|
'GUEST_NAME' => $guestname,
|
||||||
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'tid' => $homeid, 'mode' => 'all')),
|
'tid' => $homeid, 'mode' => 'all')),
|
||||||
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'tid' => $guestid, 'mode' => 'all')),
|
'tid' => $guestid, 'mode' => 'all')),
|
||||||
'GOALS_HOME' => $goals_home,
|
'GOALS_HOME' => $goals_home,
|
||||||
'GOALS_GUEST' => $goals_guest,
|
'GOALS_GUEST' => $goals_guest,
|
||||||
'COLOR_STYLE' => '',
|
'COLOR_STYLE' => '',
|
||||||
'KOGOALS_HOME' => $kogoals_home,
|
'KOGOALS_HOME' => $kogoals_home,
|
||||||
'KOGOALS_GUEST' => $kogoals_guest,
|
'KOGOALS_GUEST' => $kogoals_guest,
|
||||||
'S_KO_MATCH' => $ko_match,
|
'S_KO_MATCH' => $ko_match,
|
||||||
'TREND' => $row['trend'],
|
'TREND' => $row['trend'],
|
||||||
'U_MATCH_STATS' => $this->helper->route('football_football_popup', array('popside' => 'hist_popup', 's' => $season, 'l' => $league,
|
'U_MATCH_STATS' => $this->helper->route('football_football_popup', array('popside' => 'hist_popup', 's' => $season, 'l' => $league,
|
||||||
'hid' => $homeid, 'gid' => $guestid, 'm' => $matchday,
|
'hid' => $homeid, 'gid' => $guestid, 'm' => $matchday,
|
||||||
'mn' => $row['match_no'], 'gr' => $row['group_id'])),
|
'mn' => $row['match_no'], 'gr' => $row['group_id'])),
|
||||||
'ODD_1' => $row['odd_1'],
|
'ODD_1' => $row['odd_1'],
|
||||||
'ODD_X' => $row['odd_x'],
|
'ODD_X' => $row['odd_x'],
|
||||||
'ODD_2' => $row['odd_2'],
|
'ODD_2' => $row['odd_2'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sidename = 'Chancen';
|
$sidename = 'Chancen';
|
||||||
switch ($league_info['bet_ko_type'])
|
switch ($league_info['bet_ko_type'])
|
||||||
{
|
{
|
||||||
case BET_KO_90:
|
case BET_KO_90:
|
||||||
$result_explain = sprintf($user->lang['MIN90']);
|
$result_explain = sprintf($user->lang['MIN90']);
|
||||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||||
break;
|
break;
|
||||||
case BET_KO_EXTRATIME:
|
case BET_KO_EXTRATIME:
|
||||||
$result_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
$result_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
||||||
$label_finalresult = sprintf($user->lang['PENALTY']);
|
$label_finalresult = sprintf($user->lang['PENALTY']);
|
||||||
break;
|
break;
|
||||||
case BET_KO_PENALTY:
|
case BET_KO_PENALTY:
|
||||||
$result_explain = sprintf($user->lang['PENALTY']);
|
$result_explain = sprintf($user->lang['PENALTY']);
|
||||||
$display_ko = false;
|
$display_ko = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$result_explain = sprintf($user->lang['MIN90']);
|
$result_explain = sprintf($user->lang['MIN90']);
|
||||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_ODDS' => true,
|
'S_DISPLAY_ODDS' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'RESULT_EXPLAIN' => $result_explain,
|
'RESULT_EXPLAIN' => $result_explain,
|
||||||
'LABEL_FINALRESULT' => $label_finalresult,
|
'LABEL_FINALRESULT' => $label_finalresult,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'S_DATA_ODDS' => $data_odds,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['BET']),
|
)
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
);
|
||||||
'RIGHT_LINK' => sprintf($user->lang['TABLE']) . ' >',
|
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_BET']),
|
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_TABLE']),
|
|
||||||
'S_DATA_ODDS' => $data_odds,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -12,6 +12,15 @@ if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($league > 50)
|
||||||
|
{
|
||||||
|
$league_corr = $league - 50;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$league_corr = $league;
|
||||||
|
}
|
||||||
|
|
||||||
if ($league <> 0)
|
if ($league <> 0)
|
||||||
{
|
{
|
||||||
$data_rank_matchday = false;
|
$data_rank_matchday = false;
|
||||||
@@ -26,7 +35,7 @@ if ($league <> 0)
|
|||||||
FROM " . FOOTB_RANKS . ' AS r
|
FROM " . FOOTB_RANKS . ' AS r
|
||||||
LEFT Join ' . USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
LEFT Join ' . USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
||||||
WHERE r.season = $season
|
WHERE r.season = $season
|
||||||
AND r.league = $league
|
AND r.league = $league_corr
|
||||||
AND r.matchday = $matchday
|
AND r.matchday = $matchday
|
||||||
AND r.status IN (2,3)
|
AND r.status IN (2,3)
|
||||||
ORDER BY rank ASC, LOWER(u.username) ASC";
|
ORDER BY rank ASC, LOWER(u.username) ASC";
|
||||||
@@ -50,7 +59,7 @@ if ($league <> 0)
|
|||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'USERID' => $row['user_id'],
|
'USERID' => $row['user_id'],
|
||||||
'USERNAME' => $row['username'],
|
'USERNAME' => $row['username'],
|
||||||
'U_BET_USER' => $this->helper->route('football_football_popup', array('popside' => 'bet_popup', 's' => $season, 'l' => $league,
|
'U_BET_USER' => $this->helper->route('football_football_popup', array('popside' => 'bet_popup', 's' => $season, 'l' => $league_corr,
|
||||||
'm' => $matchday, 'u' => $row['user_id'])),
|
'm' => $matchday, 'u' => $row['user_id'])),
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'COLOR_STYLE' => $colorstyle,
|
'COLOR_STYLE' => $colorstyle,
|
||||||
@@ -60,7 +69,7 @@ if ($league <> 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league_corr);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_RANK_MATCHDAY' => true,
|
'S_DISPLAY_RANK_MATCHDAY' => true,
|
||||||
|
|||||||
@@ -1,270 +1,261 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$start = $this->request->variable('start', 0);
|
$start = $this->request->variable('start', 0);
|
||||||
$win_user_most_hits = array();
|
$win_user_most_hits = array();
|
||||||
$win_user_most_hits_away = array();
|
$win_user_most_hits_away = array();
|
||||||
$season_wins = array();
|
$season_wins = array();
|
||||||
$win_user_most_hits = win_user_most_hits($season, $league, $matchday);
|
$win_user_most_hits = win_user_most_hits($season, $league, $matchday);
|
||||||
$win_user_most_hits_away = win_user_most_hits_away($season, $league, $matchday);
|
$win_user_most_hits_away = win_user_most_hits_away($season, $league, $matchday);
|
||||||
|
|
||||||
// Statistics of matchday
|
// Statistics of matchday
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
b.user_id,
|
b.user_id,
|
||||||
COUNT(b.match_no) AS matches,
|
COUNT(b.match_no) AS matches,
|
||||||
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS bets,
|
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS bets,
|
||||||
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '',
|
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '',
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0),
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0),
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
) AS hits,
|
) AS hits,
|
||||||
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '',
|
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '',
|
||||||
IF((m.goals_home <= m.goals_guest),
|
IF((m.goals_home <= m.goals_guest),
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0),
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0),
|
||||||
0
|
0
|
||||||
),
|
),
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
) AS hits02,
|
) AS hits02,
|
||||||
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '',
|
SUM(IF(b.goals_home <> '' AND b.goals_guest <> '',
|
||||||
IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest) OR
|
IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest) OR
|
||||||
(b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest) OR
|
(b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest) OR
|
||||||
(b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
(b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||||
),
|
),
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
) AS tendency
|
) AS tendency
|
||||||
FROM " . FOOTB_BETS . ' AS b
|
FROM " . FOOTB_BETS . ' AS b
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
||||||
WHERE b.season = $season
|
WHERE b.season = $season
|
||||||
AND b.league = $league
|
AND b.league = $league
|
||||||
AND m.status IN (2,3)
|
AND m.status IN (2,3)
|
||||||
AND m.matchday = $matchday
|
AND m.matchday = $matchday
|
||||||
GROUP BY user_id";
|
GROUP BY user_id";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$usersstats = $db->sql_fetchrowset($result);
|
$usersstats = $db->sql_fetchrowset($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
foreach ($usersstats AS $userstats)
|
foreach ($usersstats AS $userstats)
|
||||||
{
|
{
|
||||||
$betsof[$userstats['user_id']] = $userstats['bets'];
|
$betsof[$userstats['user_id']] = $userstats['bets'];
|
||||||
$nobetsof[$userstats['user_id']] = $userstats['matches'] - $userstats['bets'];
|
$nobetsof[$userstats['user_id']] = $userstats['matches'] - $userstats['bets'];
|
||||||
$tendenciesof[$userstats['user_id']] = $userstats['tendency'];
|
$tendenciesof[$userstats['user_id']] = $userstats['tendency'];
|
||||||
$hitsof[$userstats['user_id']] = $userstats['hits'];
|
$hitsof[$userstats['user_id']] = $userstats['hits'];
|
||||||
$hits02of[$userstats['user_id']] = $userstats['hits02'];
|
$hits02of[$userstats['user_id']] = $userstats['hits02'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ranks of matchday
|
// ranks of matchday
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
rank,
|
rank,
|
||||||
user_id
|
user_id
|
||||||
FROM '. FOOTB_RANKS . "
|
FROM '. FOOTB_RANKS . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
AND matchday = $matchday
|
AND matchday = $matchday
|
||||||
AND status IN (2,3)
|
AND status IN (2,3)
|
||||||
ORDER BY rank ASC, user_id ASC";
|
ORDER BY rank ASC, user_id ASC";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$ranks = $db->sql_fetchrowset($result);
|
$ranks = $db->sql_fetchrowset($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
$total_users = sizeof($ranks);
|
$total_users = sizeof($ranks);
|
||||||
foreach ($ranks AS $rank)
|
foreach ($ranks AS $rank)
|
||||||
{
|
{
|
||||||
$rankof[$rank['user_id']] = $rank['rank'];
|
$rankof[$rank['user_id']] = $rank['rank'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($matchday > 1)
|
if ($matchday > 1)
|
||||||
{
|
{
|
||||||
// rank previous matchday
|
// rank previous matchday
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
rank AS last_rang,
|
rank AS last_rang,
|
||||||
user_id
|
user_id
|
||||||
FROM '. FOOTB_RANKS . "
|
FROM '. FOOTB_RANKS . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
AND matchday = ($matchday-1)
|
AND matchday = ($matchday-1)
|
||||||
AND status IN (2,3)
|
AND status IN (2,3)
|
||||||
ORDER BY last_rang ASC, user_id ASC";
|
ORDER BY last_rang ASC, user_id ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$ranks = $db->sql_fetchrowset($result);
|
$ranks = $db->sql_fetchrowset($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
foreach ($ranks AS $rank)
|
foreach ($ranks AS $rank)
|
||||||
{
|
{
|
||||||
$prevrankof[$rank['user_id']] = $rank['last_rang'];
|
$prevrankof[$rank['user_id']] = $rank['last_rang'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($matchday == $maxmatchday)
|
if ($matchday == $maxmatchday)
|
||||||
{
|
{
|
||||||
$season_wins = season_wins($season, $league, $matchday);
|
$season_wins = season_wins($season, $league, $matchday);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure $start is set to the last page if it exceeds the amount
|
// Make sure $start is set to the last page if it exceeds the amount
|
||||||
if ($start < 0 || $start >= $total_users)
|
if ($start < 0 || $start >= $total_users)
|
||||||
{
|
{
|
||||||
$sql_start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
|
$sql_start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql_start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
$sql_start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||||
}
|
}
|
||||||
$sql_limit = $config['football_users_per_page'];
|
$sql_limit = $config['football_users_per_page'];
|
||||||
|
|
||||||
// handle pagination.
|
// handle pagination.
|
||||||
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday));
|
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday));
|
||||||
$pagination = $phpbb_container->get('pagination');
|
$pagination = $phpbb_container->get('pagination');
|
||||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||||
$data_ranks = false;
|
$data_ranks = false;
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
|
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
r.rank,
|
r.rank,
|
||||||
r.status,
|
r.status,
|
||||||
r.user_id,
|
r.user_id,
|
||||||
r.points,
|
r.points,
|
||||||
r.win AS wins,
|
r.win AS wins,
|
||||||
u.user_colour,
|
u.user_colour,
|
||||||
u.username
|
u.username
|
||||||
FROM '. FOOTB_RANKS . ' AS r
|
FROM '. FOOTB_RANKS . ' AS r
|
||||||
LEFT Join '. USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
LEFT Join '. USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
||||||
WHERE r.season = $season
|
WHERE r.season = $season
|
||||||
AND r.league = $league
|
AND r.league = $league
|
||||||
AND r.matchday = $matchday
|
AND r.matchday = $matchday
|
||||||
AND r.status IN (2,3)
|
AND r.status IN (2,3)
|
||||||
ORDER BY r.rank ASC, r.points DESC, LOWER(u.username) ASC";
|
ORDER BY r.rank ASC, r.points DESC, LOWER(u.username) ASC";
|
||||||
|
|
||||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$index++;
|
$index++;
|
||||||
$data_ranks = true;
|
$data_ranks = true;
|
||||||
if (isset($prevrankof[$row['user_id']]))
|
if (isset($prevrankof[$row['user_id']]))
|
||||||
{
|
{
|
||||||
if ($rankof[$row['user_id']] == '')
|
if ($rankof[$row['user_id']] == '')
|
||||||
{
|
{
|
||||||
$change_sign = '';
|
$change_sign = '';
|
||||||
$change_img = '';
|
$change_differ = ' ';
|
||||||
$change_differ = ' ';
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
if ($rankof[$row['user_id']] == $prevrankof[$row['user_id']])
|
||||||
if ($rankof[$row['user_id']] == $prevrankof[$row['user_id']])
|
{
|
||||||
{
|
$change_sign = '=';
|
||||||
$change_sign = '=';
|
$change_differ = ' ';
|
||||||
$change_img = "<img src=\"" . $ext_path . "images/no_change.gif\" alt=\"" . $user->lang['NO_CHANGES'] . "\"/>";
|
}
|
||||||
$change_differ = ' ';
|
else
|
||||||
}
|
{
|
||||||
else
|
if ($rankof[$row['user_id']] > $prevrankof[$row['user_id']])
|
||||||
{
|
{
|
||||||
if ($rankof[$row['user_id']] > $prevrankof[$row['user_id']])
|
$change_sign = '+';
|
||||||
{
|
$differ = $rankof[$row['user_id']] - $prevrankof[$row['user_id']];
|
||||||
$change_sign = '+';
|
$change_differ = ' (' . $differ . ')';
|
||||||
$change_img = "<img src=\"" . $ext_path . "images/arrow_down.gif\" alt=\"" . $user->lang['WORSENED'] . "\"/>";
|
}
|
||||||
$differ = $rankof[$row['user_id']] - $prevrankof[$row['user_id']];
|
else
|
||||||
$change_differ = ' (' . $differ . ')';
|
{
|
||||||
}
|
$change_sign = '-';
|
||||||
else
|
$differ = $prevrankof[$row['user_id']] - $rankof[$row['user_id']];
|
||||||
{
|
$change_differ = ' (' . $differ . ')';
|
||||||
$change_sign = '-';
|
}
|
||||||
$change_img = "<img src=\"" . $ext_path . "images/arrow_up.gif\" alt=\"" . $user->lang['IMPROVED'] . "\"/>";
|
}
|
||||||
$differ = $prevrankof[$row['user_id']] - $rankof[$row['user_id']];
|
}
|
||||||
$change_differ = ' (' . $differ . ')';
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
$change_sign = '';
|
||||||
}
|
$change_differ = ' ';
|
||||||
else
|
}
|
||||||
{
|
|
||||||
$change_sign = '';
|
if ($matchday == $maxmatchday)
|
||||||
$change_img = '';
|
{
|
||||||
$change_differ = ' ';
|
// if someone didn't bet the hole Season
|
||||||
}
|
if(!isset($win_user_most_hits[$row['user_id']]['win']))
|
||||||
|
{
|
||||||
if ($matchday == $maxmatchday)
|
$win_user_most_hits[$row['user_id']]['win'] = 0;
|
||||||
{
|
}
|
||||||
// if someone didn't bet the hole Season
|
if(!isset($win_user_most_hits_away[$row['user_id']]['win']))
|
||||||
if(!isset($win_user_most_hits[$row['user_id']]['win']))
|
{
|
||||||
{
|
$win_user_most_hits_away[$row['user_id']]['win'] = 0;
|
||||||
$win_user_most_hits[$row['user_id']]['win'] = 0;
|
}
|
||||||
}
|
if(!isset($season_wins[$row['user_id']]['win']))
|
||||||
if(!isset($win_user_most_hits_away[$row['user_id']]['win']))
|
{
|
||||||
{
|
$season_wins[$row['user_id']]['win'] = 0;
|
||||||
$win_user_most_hits_away[$row['user_id']]['win'] = 0;
|
}
|
||||||
}
|
$win_total = sprintf('%01.2f',$row['wins'] + $win_user_most_hits[$row['user_id']]['win'] + $win_user_most_hits_away[$row['user_id']]['win']
|
||||||
if(!isset($season_wins[$row['user_id']]['win']))
|
+ $season_wins[$row['user_id']]['win']);
|
||||||
{
|
}
|
||||||
$season_wins[$row['user_id']]['win'] = 0;
|
else
|
||||||
}
|
{
|
||||||
$win_total = sprintf('%01.2f',$row['wins'] + $win_user_most_hits[$row['user_id']]['win'] + $win_user_most_hits_away[$row['user_id']]['win']
|
$win_total = sprintf('%01.2f',$row['wins']);
|
||||||
+ $season_wins[$row['user_id']]['win']);
|
}
|
||||||
}
|
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
else
|
if ($row['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$win_total = sprintf('%01.2f',$row['wins']);
|
$row_class = 'bg3 row_user';
|
||||||
}
|
}
|
||||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$colorstyle = color_style($row['status']);
|
||||||
if ($row['user_id'] == $user->data['user_id'])
|
|
||||||
{
|
$template->assign_block_vars('rankstotal', array(
|
||||||
$row_class = 'bg3 row_user';
|
'ROW_CLASS' => $row_class,
|
||||||
}
|
'RANK' => $rankof[$row['user_id']],
|
||||||
$colorstyle = color_style($row['status']);
|
'NO_CHANGES' => ($change_sign == '=') ? true : false,
|
||||||
|
'WORSENED' => ($change_sign == '-') ? true : false,
|
||||||
$template->assign_block_vars('rankstotal', array(
|
'IMPROVED' => ($change_sign == '+') ? true : false,
|
||||||
'ROW_CLASS' => $row_class,
|
'CHANGE_SIGN' => $change_sign,
|
||||||
'RANK' => $rankof[$row['user_id']],
|
'CHANGE_DIFFER' => $change_differ,
|
||||||
'CHANGE_SIGN' => $change_sign,
|
'USERID' => $row['user_id'],
|
||||||
'CHANGE_IMG' => $change_img,
|
'USERNAME' => $row['username'],
|
||||||
'CHANGE_DIFFER' => $change_differ,
|
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
||||||
'USERID' => $row['user_id'],
|
'BETS' => $betsof[$row['user_id']],
|
||||||
'USERNAME' => $row['username'],
|
'NOBETS' => ($nobetsof[$row['user_id']] == 0) ? ' ' : $nobetsof[$row['user_id']],
|
||||||
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
'TENDENCIES' => ($tendenciesof[$row['user_id']] == 0) ? ' ' : $tendenciesof[$row['user_id']],
|
||||||
'BETS' => $betsof[$row['user_id']],
|
'DIRECTHITS' => ($hitsof[$row['user_id']] == 0) ? ' ' : $hitsof[$row['user_id']],
|
||||||
'NOBETS' => ($nobetsof[$row['user_id']] == 0) ? ' ' : $nobetsof[$row['user_id']],
|
'DIRECTHITS02' => ($hits02of[$row['user_id']] == 0) ? ' ' : $hits02of[$row['user_id']],
|
||||||
'TENDENCIES' => ($tendenciesof[$row['user_id']] == 0) ? ' ' : $tendenciesof[$row['user_id']],
|
'POINTS' => $row['points'],
|
||||||
'DIRECTHITS' => ($hitsof[$row['user_id']] == 0) ? ' ' : $hitsof[$row['user_id']],
|
'COLOR_STYLE' => $colorstyle,
|
||||||
'DIRECTHITS02' => ($hits02of[$row['user_id']] == 0) ? ' ' : $hits02of[$row['user_id']],
|
'WIN' => $win_total,
|
||||||
'POINTS' => $row['points'],
|
)
|
||||||
'COLOR_STYLE' => $colorstyle,
|
);
|
||||||
'WIN' => $win_total,
|
}
|
||||||
)
|
$db->sql_freeresult($result);
|
||||||
);
|
$league_info = league_info($season, $league);
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
$sidename = sprintf($user->lang['RANK_MATCHDAY']);
|
||||||
$league_info = league_info($season, $league);
|
$template->assign_vars(array(
|
||||||
|
'S_DISPLAY_RANKS_MATCHDAY' => true,
|
||||||
$sidename = sprintf($user->lang['RANK_MATCHDAY']);
|
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||||
$template->assign_vars(array(
|
'S_SIDENAME' => $sidename,
|
||||||
'S_DISPLAY_RANKS_MATCHDAY' => true,
|
'S_WIN' => ($league_info['win_matchday'] == '0') ? false : true,
|
||||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
'S_DATA_RANKS' => $data_ranks,
|
||||||
'S_SIDENAME' => $sidename,
|
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
||||||
'S_WIN' => ($league_info['win_matchday'] == '0') ? false : true,
|
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'WIN_NAME' => $config['football_win_name'],
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['TABLE']),
|
)
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
);
|
||||||
'RIGHT_LINK' => sprintf($user->lang['RANK_TOTAL']) . ' >',
|
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_TABLE']),
|
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_RANK_TOTAL']),
|
|
||||||
'S_DATA_RANKS' => $data_ranks,
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
|
||||||
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
|
||||||
'WIN_NAME' => $config['football_win_name'],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -157,7 +157,6 @@ switch ($mode)
|
|||||||
}
|
}
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
@@ -166,13 +165,6 @@ switch ($mode)
|
|||||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||||
'S_DATA_RANKS' => $data_ranks,
|
'S_DATA_RANKS' => $data_ranks,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['RANK_MATCHDAY']),
|
|
||||||
'U_RIGHT' => ($config['football_bank']) ? $this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league, 'm' => $matchday)) :
|
|
||||||
$this->helper->route('football_main_controller', array('side' => 'my_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'RIGHT_LINK' => ($config['football_bank']) ? sprintf($user->lang['FOOTBALL_BANK']) . ' >' : sprintf($user->lang['MY_BETS']) . ' >',
|
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_RANK_MATCHDAY']),
|
|
||||||
'RIGHT_TITLE' => ($config['football_bank']) ? sprintf($user->lang['TITLE_FOOTBALL_BANK']) : sprintf($user->lang['TITLE_MY_BETS']),
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
||||||
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
||||||
'S_WIN' => false,
|
'S_WIN' => false,
|
||||||
@@ -328,7 +320,6 @@ switch ($mode)
|
|||||||
}
|
}
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
@@ -337,13 +328,6 @@ switch ($mode)
|
|||||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||||
'S_DATA_RANKS' => $data_ranks,
|
'S_DATA_RANKS' => $data_ranks,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['RANK_MATCHDAY']),
|
|
||||||
'U_RIGHT' => ($config['football_bank']) ? $this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league, 'm' => $matchday)) :
|
|
||||||
$this->helper->route('football_main_controller', array('side' => 'my_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'RIGHT_LINK' => ($config['football_bank']) ? sprintf($user->lang['FOOTBALL_BANK']) . ' >' : sprintf($user->lang['MY_BETS']) . ' >',
|
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_RANK_MATCHDAY']),
|
|
||||||
'RIGHT_TITLE' => ($config['football_bank']) ? sprintf($user->lang['TITLE_FOOTBALL_BANK']) : sprintf($user->lang['TITLE_MY_BETS']),
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
||||||
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
||||||
'S_WIN' => ($league_info['win_matchday'] == '0' and $league_info['win_season'] == '0') ? false : ($this->auth->acl_gets('a_')) ? true : false,
|
'S_WIN' => ($league_info['win_matchday'] == '0' and $league_info['win_season'] == '0') ? false : ($this->auth->acl_gets('a_')) ? true : false,
|
||||||
@@ -492,7 +476,6 @@ switch ($mode)
|
|||||||
if ($rank == $prev_rank_of[$curr_rank['user_id']])
|
if ($rank == $prev_rank_of[$curr_rank['user_id']])
|
||||||
{
|
{
|
||||||
$change_sign = '=';
|
$change_sign = '=';
|
||||||
$change_img = "<img src=\"" . $ext_path . "images/no_change.gif\" alt=\"" . $user->lang['NO_CHANGES'] . "\"/>";
|
|
||||||
$change_differ = '';
|
$change_differ = '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -500,14 +483,12 @@ switch ($mode)
|
|||||||
if ($rank > $prev_rank_of[$curr_rank['user_id']])
|
if ($rank > $prev_rank_of[$curr_rank['user_id']])
|
||||||
{
|
{
|
||||||
$change_sign = '+';
|
$change_sign = '+';
|
||||||
$change_img = "<img src=\"" . $ext_path . "images/arrow_down.gif\" alt=\"" . $user->lang['WORSENED'] . "\"/>";
|
|
||||||
$differ = $rank - $prev_rank_of[$curr_rank['user_id']];
|
$differ = $rank - $prev_rank_of[$curr_rank['user_id']];
|
||||||
$change_differ = ' (' . $differ . ')';
|
$change_differ = ' (' . $differ . ')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$change_sign = '-';
|
$change_sign = '-';
|
||||||
$change_img = "<img src=\"" . $ext_path . "images/arrow_up.gif\" alt=\"" . $user->lang['IMPROVED'] . "\"/>";
|
|
||||||
$differ = $prev_rank_of[$curr_rank['user_id']] - $rank;
|
$differ = $prev_rank_of[$curr_rank['user_id']] - $rank;
|
||||||
$change_differ = ' (' . $differ . ')';
|
$change_differ = ' (' . $differ . ')';
|
||||||
}
|
}
|
||||||
@@ -516,7 +497,6 @@ switch ($mode)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$change_sign = '';
|
$change_sign = '';
|
||||||
$change_img = '';
|
|
||||||
$change_differ = '';
|
$change_differ = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,8 +519,10 @@ switch ($mode)
|
|||||||
$template->assign_block_vars('rankstotal', array(
|
$template->assign_block_vars('rankstotal', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'RANK' => $rank,
|
'RANK' => $rank,
|
||||||
|
'NO_CHANGES' => ($change_sign == '=') ? true : false,
|
||||||
|
'WORSENED' => ($change_sign == '-') ? true : false,
|
||||||
|
'IMPROVED' => ($change_sign == '+') ? true : false,
|
||||||
'CHANGE_SIGN' => $change_sign,
|
'CHANGE_SIGN' => $change_sign,
|
||||||
'CHANGE_IMG' => $change_img,
|
|
||||||
'CHANGE_DIFFER' => $change_differ,
|
'CHANGE_DIFFER' => $change_differ,
|
||||||
'USERID' => $curr_rank['user_id'],
|
'USERID' => $curr_rank['user_id'],
|
||||||
'USERNAME' => $curr_rank['username'],
|
'USERNAME' => $curr_rank['username'],
|
||||||
@@ -558,7 +540,6 @@ switch ($mode)
|
|||||||
}
|
}
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
@@ -567,13 +548,6 @@ switch ($mode)
|
|||||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||||
'S_DATA_RANKS' => $data_ranks,
|
'S_DATA_RANKS' => $data_ranks,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['RANK_MATCHDAY']),
|
|
||||||
'U_RIGHT' => ($config['football_bank']) ? $this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league, 'm' => $matchday)) :
|
|
||||||
$this->helper->route('football_main_controller', array('side' => 'my_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
|
||||||
'RIGHT_LINK' => ($config['football_bank']) ? sprintf($user->lang['FOOTBALL_BANK']) . ' >' : sprintf($user->lang['MY_BETS']) . ' >',
|
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_RANK_MATCHDAY']),
|
|
||||||
'RIGHT_TITLE' => ($config['football_bank']) ? sprintf($user->lang['TITLE_FOOTBALL_BANK']) : sprintf($user->lang['TITLE_MY_BETS']),
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
||||||
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
||||||
'S_WIN' => ($league_info['win_matchday'] == '0' and $league_info['win_season'] == '0') ? false : true,
|
'S_WIN' => ($league_info['win_matchday'] == '0' and $league_info['win_season'] == '0') ? false : true,
|
||||||
|
|||||||
@@ -1,433 +1,440 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_is_member = user_is_member($user->data['user_id'], $season, $league);
|
$user_is_member = user_is_member($user->data['user_id'], $season, $league);
|
||||||
$edit_mode = false;
|
$edit_mode = false;
|
||||||
$display_group = false;
|
$display_group = false;
|
||||||
$display_ko = false;
|
$display_ko = false;
|
||||||
$data_results = false;
|
$data_results = false;
|
||||||
$lang_dates = $user->lang['datetime'];
|
$lang_dates = $user->lang['datetime'];
|
||||||
$matchnumber = 0;
|
$matchnumber = 0;
|
||||||
$editstatus = array(1, 2, 4, 5);
|
$editstatus = array(1, 2, 4, 5);
|
||||||
|
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
// Calculate matches AND results of matchday
|
// Calculate matches AND results of matchday
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
m.match_no,
|
m.match_no,
|
||||||
m.matchday,
|
m.matchday,
|
||||||
m.status,
|
m.status,
|
||||||
m.group_id,
|
m.group_id,
|
||||||
m.formula_home,
|
m.formula_home,
|
||||||
m.formula_guest,
|
m.formula_guest,
|
||||||
t1.team_symbol AS home_symbol,
|
t1.team_symbol AS home_symbol,
|
||||||
t2.team_symbol AS guest_symbol,
|
t2.team_symbol AS guest_symbol,
|
||||||
t1.team_id AS home_id,
|
t1.team_id AS home_id,
|
||||||
t2.team_id AS guest_id,
|
t2.team_id AS guest_id,
|
||||||
t1.team_name AS home_name,
|
t1.team_name AS home_name,
|
||||||
t2.team_name AS guest_name,
|
t2.team_name AS guest_name,
|
||||||
t1.team_name_short AS home_short,
|
t1.team_name_short AS home_short,
|
||||||
t2.team_name_short AS guest_short,
|
t2.team_name_short AS guest_short,
|
||||||
m.goals_home,
|
m.goals_home,
|
||||||
m.goals_guest,
|
m.goals_guest,
|
||||||
m.ko_match AS ko_match,
|
m.ko_match AS ko_match,
|
||||||
m.goals_overtime_home AS kogoals_home,
|
m.goals_overtime_home AS kogoals_home,
|
||||||
m.goals_overtime_guest AS kogoals_guest,
|
m.goals_overtime_guest AS kogoals_guest,
|
||||||
CONCAT(
|
CONCAT(
|
||||||
CASE DATE_FORMAT(m.match_datetime,'%w')
|
CASE DATE_FORMAT(m.match_datetime,'%w')
|
||||||
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
|
||||||
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
|
||||||
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
|
||||||
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
|
||||||
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
|
||||||
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
|
||||||
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
|
||||||
ELSE 'Error' END,
|
ELSE 'Error' END,
|
||||||
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
|
||||||
) AS match_time
|
) AS match_time
|
||||||
FROM " . FOOTB_MATCHES . ' AS m
|
FROM " . FOOTB_MATCHES . ' AS m
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||||
WHERE m.season = $season
|
WHERE m.season = $season
|
||||||
AND m.league = $league
|
AND m.league = $league
|
||||||
AND m.matchday = $matchday
|
AND m.matchday = $matchday
|
||||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$data_results = true;
|
$data_results = true;
|
||||||
$matchnumber++ ;
|
$matchnumber++ ;
|
||||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if (0 == $row['home_id'])
|
if (0 == $row['home_id'])
|
||||||
{
|
{
|
||||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||||
$home_in_array = explode("#",$home_info);
|
$home_in_array = explode("#",$home_info);
|
||||||
$homelogo = $home_in_array[0];
|
$homelogo = $home_in_array[0];
|
||||||
$homeid = $home_in_array[1];
|
$homeid = $home_in_array[1];
|
||||||
$homename = $home_in_array[2];
|
$homename = $home_in_array[2];
|
||||||
$homeshort = $home_in_array[2];
|
$homeshort = $home_in_array[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$homelogo = $row['home_symbol'];
|
$homelogo = $row['home_symbol'];
|
||||||
$homeid = $row['home_id'];
|
$homeid = $row['home_id'];
|
||||||
$homename = $row['home_name'];
|
$homename = $row['home_name'];
|
||||||
$homeshort = $row['home_short'];
|
$homeshort = $row['home_short'];
|
||||||
}
|
}
|
||||||
if (0 == $row['guest_id'])
|
if (0 == $row['guest_id'])
|
||||||
{
|
{
|
||||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||||
$guest_in_array = explode("#",$guest_info);
|
$guest_in_array = explode("#",$guest_info);
|
||||||
$guestlogo = $guest_in_array[0];
|
$guestlogo = $guest_in_array[0];
|
||||||
$guestid = $guest_in_array[1];
|
$guestid = $guest_in_array[1];
|
||||||
$guestname = $guest_in_array[2];
|
$guestname = $guest_in_array[2];
|
||||||
$guestshort = $guest_in_array[2];
|
$guestshort = $guest_in_array[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$guestlogo = $row['guest_symbol'];
|
$guestlogo = $row['guest_symbol'];
|
||||||
$guestid = $row['guest_id'];
|
$guestid = $row['guest_id'];
|
||||||
$guestname = $row['guest_name'];
|
$guestname = $row['guest_name'];
|
||||||
$guestshort = $row['guest_short'];
|
$guestshort = $row['guest_short'];
|
||||||
}
|
}
|
||||||
if ($homelogo <> '')
|
if ($homelogo <> '')
|
||||||
{
|
{
|
||||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
if ($guestlogo <> '')
|
if ($guestlogo <> '')
|
||||||
{
|
{
|
||||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['ko_match'])
|
if ($row['ko_match'])
|
||||||
{
|
{
|
||||||
$display_ko = true;
|
$display_ko = true;
|
||||||
$ko_match = true;
|
$ko_match = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ko_match = false;
|
$ko_match = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['group_id'] == '')
|
if ($row['group_id'] == '')
|
||||||
{
|
{
|
||||||
$group_id = ' ';
|
$group_id = ' ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$display_group = true;
|
$display_group = true;
|
||||||
$group_id = $row['group_id'];
|
$group_id = $row['group_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (in_array($row['status'], $editstatus) AND $user_is_member)
|
if (in_array($row['status'], $editstatus) AND $user_is_member)
|
||||||
{
|
{
|
||||||
$edit_mode = true;
|
$edit_mode = true;
|
||||||
$edit_match = true;
|
$edit_match = true;
|
||||||
$goals_home = $row['goals_home'];
|
$goals_home = $row['goals_home'];
|
||||||
$goals_guest = $row['goals_guest'];
|
$goals_guest = $row['goals_guest'];
|
||||||
$kogoals_home = $row['kogoals_home'];
|
$kogoals_home = $row['kogoals_home'];
|
||||||
$kogoals_guest = $row['kogoals_guest'];
|
$kogoals_guest = $row['kogoals_guest'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$edit_match = false;
|
$edit_match = false;
|
||||||
$goals_home = ($row['goals_home'] == '') ? ' ' : $row['goals_home'];
|
$goals_home = ($row['goals_home'] == '') ? ' ' : $row['goals_home'];
|
||||||
$goals_guest = ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'];
|
$goals_guest = ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'];
|
||||||
$kogoals_home = ($row['kogoals_home'] == '') ? ' ' : $row['kogoals_home'];
|
$kogoals_home = ($row['kogoals_home'] == '') ? ' ' : $row['kogoals_home'];
|
||||||
$kogoals_guest = ($row['kogoals_guest'] == '') ? ' ' : $row['kogoals_guest'];
|
$kogoals_guest = ($row['kogoals_guest'] == '') ? ' ' : $row['kogoals_guest'];
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('result', array(
|
$template->assign_block_vars('result', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'MATCH_NUMBER' => $row['match_no'],
|
'MATCH_NUMBER' => $row['match_no'],
|
||||||
'MATCHDAY' => $row['matchday'],
|
'MATCHDAY' => $row['matchday'],
|
||||||
'STATUS' => $row['status'],
|
'STATUS' => $row['status'],
|
||||||
'MATCH_TIME' => $row['match_time'],
|
'MATCH_TIME' => $row['match_time'],
|
||||||
'GROUP' => $group_id,
|
'GROUP' => $group_id,
|
||||||
'HOME_ID' => $homeid,
|
'HOME_ID' => $homeid,
|
||||||
'GUEST_ID' => $guestid,
|
'GUEST_ID' => $guestid,
|
||||||
'LOGO_HOME' => $logoH,
|
'LOGO_HOME' => $logoH,
|
||||||
'LOGO_GUEST' => $logoG,
|
'LOGO_GUEST' => $logoG,
|
||||||
'HOME_NAME' => $homename,
|
'HOME_NAME' => $homename,
|
||||||
'GUEST_NAME' => $guestname,
|
'GUEST_NAME' => $guestname,
|
||||||
'HOME_SHORT' => $homeshort,
|
'HOME_SHORT' => $homeshort,
|
||||||
'GUEST_SHORT' => $guestshort,
|
'GUEST_SHORT' => $guestshort,
|
||||||
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'tid' => $homeid, 'mode' => 'all')),
|
'tid' => $homeid, 'mode' => 'all')),
|
||||||
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||||
'tid' => $guestid, 'mode' => 'all')),
|
'tid' => $guestid, 'mode' => 'all')),
|
||||||
'GOALS_HOME' => $goals_home,
|
'GOALS_HOME' => $goals_home,
|
||||||
'GOALS_GUEST' => $goals_guest,
|
'GOALS_GUEST' => $goals_guest,
|
||||||
'COLOR_STYLE' => color_style($row['status']),
|
'COLOR_STYLE' => color_style($row['status']),
|
||||||
'KOGOALS_HOME' => $kogoals_home,
|
'KOGOALS_HOME' => $kogoals_home,
|
||||||
'KOGOALS_GUEST' => $kogoals_guest,
|
'KOGOALS_GUEST' => $kogoals_guest,
|
||||||
'S_KO_MATCH' => $ko_match,
|
'S_KO_MATCH' => $ko_match,
|
||||||
'S_EDIT_MATCH' => $edit_match,
|
'S_EDIT_MATCH' => $edit_match,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Calculate extra bets of matchday
|
// Calculate extra bets of matchday
|
||||||
// Start select team
|
// Start select team
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
team_id AS option_value,
|
team_id AS option_value,
|
||||||
team_name AS option_name
|
team_name AS option_name
|
||||||
FROM ' . FOOTB_TEAMS . "
|
FROM ' . FOOTB_TEAMS . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
ORDER BY team_name ASC";
|
ORDER BY team_name ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$option_rows = $db->sql_fetchrowset($result);
|
$option_rows = $db->sql_fetchrowset($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($edit_mode)
|
if ($edit_mode)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('worldfootball', array('LEAGUE' => $league-1,));
|
$template->assign_block_vars('worldfootball', array('LEAGUE' => $league-1,));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT e.*,
|
$sql = "SELECT e.*,
|
||||||
t1.team_name AS result_team
|
t1.team_name AS result_team
|
||||||
FROM " . FOOTB_EXTRA . ' AS e
|
FROM " . FOOTB_EXTRA . ' AS e
|
||||||
LEFT JOIN ' . FOOTB_TEAMS . " AS t1 ON (t1.season = e.season AND t1.league = e.league AND t1.team_id = e.result)
|
LEFT JOIN ' . FOOTB_TEAMS . " AS t1 ON (t1.season = e.season AND t1.league = e.league AND t1.team_id = e.result)
|
||||||
WHERE e.season = $season
|
WHERE e.season = $season
|
||||||
AND e.league = $league
|
AND e.league = $league
|
||||||
AND e.matchday_eval = $matchday
|
AND e.matchday_eval = $matchday
|
||||||
ORDER BY e.extra_no ASC";
|
ORDER BY e.extra_no ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$extra_results = false;
|
$extra_results = false;
|
||||||
$extranumber = 0;
|
$extranumber = 0;
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$extra_results = true;
|
$extra_results = true;
|
||||||
$extranumber++ ;
|
$extranumber++ ;
|
||||||
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
|
|
||||||
switch($row['question_type'])
|
switch($row['question_type'])
|
||||||
{
|
{
|
||||||
case '1':
|
case '1':
|
||||||
{
|
{
|
||||||
$display_type = 1;
|
$display_type = 1;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
{
|
{
|
||||||
$display_type = 1;
|
$display_type = 1;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
{
|
{
|
||||||
$display_type = 2;
|
$display_type = 2;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
case '5':
|
case '5':
|
||||||
{
|
{
|
||||||
$display_type = 2;
|
$display_type = 2;
|
||||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
$display_type = 2;
|
$display_type = 2;
|
||||||
$eval_title = '';
|
$eval_title = '';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['extra_status'] > 0 && $row['extra_status'] < 3 && $user_is_member)
|
if ($row['extra_status'] > 0 && $row['extra_status'] < 3 && $user_is_member)
|
||||||
{
|
{
|
||||||
$edit_mode = true;
|
$edit_mode = true;
|
||||||
$result_extra = ($row['result_team'] == NULL) ? '' : $row['result_team'];
|
$result_extra = ($row['result_team'] == NULL) ? '' : $row['result_team'];
|
||||||
|
|
||||||
$multiple = '';
|
$multiple = '';
|
||||||
switch($row['question_type'])
|
switch($row['question_type'])
|
||||||
{
|
{
|
||||||
case '2':
|
case '2':
|
||||||
{
|
{
|
||||||
$multiple = ' multiple="multiple" size="3" ';
|
$multiple = ' multiple="multiple" size="3" ';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
{
|
{
|
||||||
$option_arr = array();
|
$option_arr = array();
|
||||||
for ($i = 65; $i <= 72; $i++)
|
for ($i = 65; $i <= 72; $i++)
|
||||||
{
|
{
|
||||||
if (strstr($row['question'], chr($i) . ':'))
|
if (strstr($row['question'], chr($i) . ':'))
|
||||||
{
|
{
|
||||||
$option_arr[] = array(
|
$option_arr[] = array(
|
||||||
'option_value' => chr($i),
|
'option_value' => chr($i),
|
||||||
'option_name' => chr($i),
|
'option_name' => chr($i),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sizeof($option_arr) > 1)
|
if (sizeof($option_arr) > 1)
|
||||||
{
|
{
|
||||||
$display_type = 1;
|
$display_type = 1;
|
||||||
$option_rows = $option_arr;
|
$option_rows = $option_arr;
|
||||||
$result_extra = $row['result'];
|
$result_extra = $row['result'];
|
||||||
$multiple = ' multiple="multiple" size="3" ';
|
$multiple = ' multiple="multiple" size="3" ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
{
|
{
|
||||||
$option_arr = array();
|
$option_arr = array();
|
||||||
for ($i = 65; $i <= 72; $i++)
|
for ($i = 65; $i <= 72; $i++)
|
||||||
{
|
{
|
||||||
if (strstr($row['question'], chr($i) . ':'))
|
if (strstr($row['question'], chr($i) . ':'))
|
||||||
{
|
{
|
||||||
$option_arr[] = array(
|
$option_arr[] = array(
|
||||||
'option_value' => chr($i),
|
'option_value' => chr($i),
|
||||||
'option_name' => chr($i),
|
'option_name' => chr($i),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sizeof($option_arr) > 1)
|
if (sizeof($option_arr) > 1)
|
||||||
{
|
{
|
||||||
$display_type = 1;
|
$display_type = 1;
|
||||||
$option_rows = $option_arr;
|
$option_rows = $option_arr;
|
||||||
$result_extra = $row['result'];
|
$result_extra = $row['result'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('extra_result', array(
|
$template->assign_block_vars('extra_result', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'EXTRA_NO' => $row['extra_no'],
|
'EXTRA_NO' => $row['extra_no'],
|
||||||
'S_EDIT_EXTRA' => true,
|
'S_EDIT_EXTRA' => true,
|
||||||
'QUESTION' => $row['question'],
|
'QUESTION' => $row['question'],
|
||||||
'EXTRA_POINTS' => $row['extra_points'],
|
'EXTRA_POINTS' => $row['extra_points'],
|
||||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||||
'EVALUATION_TITLE' => $eval_title,
|
'EVALUATION_TITLE' => $eval_title,
|
||||||
'RESULT' => ($display_type == 1) ? $result_extra : $row['result'],
|
'RESULT' => ($display_type == 1) ? $result_extra : $row['result'],
|
||||||
'S_DISPLAY_TYPE' => $display_type,
|
'S_DISPLAY_TYPE' => $display_type,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($display_type == 1)
|
if ($display_type == 1)
|
||||||
{
|
{
|
||||||
$selected = ($row['result'] == '') ? ' selected="selected"' : '';
|
$selected = ($row['result'] == '') ? ' selected="selected"' : '';
|
||||||
|
|
||||||
$template->assign_block_vars('extra_result.extra_option', array(
|
$template->assign_block_vars('extra_result.extra_option', array(
|
||||||
'OPTION_VALUE' => '',
|
'OPTION_VALUE' => '',
|
||||||
'OPTION_NAME' => sprintf($user->lang['SELECT']),
|
'OPTION_NAME' => sprintf($user->lang['SELECT']),
|
||||||
'S_SELECTED' => $selected));
|
'S_SELECTED' => $selected));
|
||||||
|
|
||||||
foreach ($option_rows as $option_row)
|
foreach ($option_rows as $option_row)
|
||||||
{
|
{
|
||||||
if (strstr($row['result'], ';'))
|
if (strstr($row['result'], ';'))
|
||||||
{
|
{
|
||||||
$selected = '';
|
$selected = '';
|
||||||
$result_arr = explode(';', $row['result']);
|
$result_arr = explode(';', $row['result']);
|
||||||
foreach($result_arr AS $result_value)
|
foreach($result_arr AS $result_value)
|
||||||
{
|
{
|
||||||
if ($result_value <> '')
|
if ($result_value <> '')
|
||||||
{
|
{
|
||||||
if ($option_row['option_value'] == $result_value)
|
if ($option_row['option_value'] == $result_value)
|
||||||
{
|
{
|
||||||
$selected = ' selected="selected"';
|
$selected = ' selected="selected"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$selected = ($option_row['option_value'] == $row['result']) ? ' selected="selected"' : '';
|
$selected = ($option_row['option_value'] == $row['result']) ? ' selected="selected"' : '';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('extra_result.extra_option', array(
|
$template->assign_block_vars('extra_result.extra_option', array(
|
||||||
'OPTION_VALUE' => $option_row['option_value'],
|
'OPTION_VALUE' => $option_row['option_value'],
|
||||||
'OPTION_NAME' => $option_row['option_name'],
|
'OPTION_NAME' => $option_row['option_name'],
|
||||||
'S_SELECTED' => $selected));
|
'S_SELECTED' => $selected));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$extra_colorstyle = color_style($row['extra_status']);
|
$extra_colorstyle = color_style($row['extra_status']);
|
||||||
$extra_result = ($row['result'] == '') ? ' ' : $row['result'];
|
$extra_result = ($row['result'] == '') ? ' ' : $row['result'];
|
||||||
$result_extra = ($row['result_team'] == NULL) ? ' ' : $row['result_team'];
|
$result_extra = ($row['result_team'] == NULL) ? ' ' : $row['result_team'];
|
||||||
|
|
||||||
$template->assign_block_vars('extra_result', array(
|
$template->assign_block_vars('extra_result', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'S_EDIT_EXTRA' => false,
|
'S_EDIT_EXTRA' => false,
|
||||||
'QUESTION' => $row['question'],
|
'QUESTION' => $row['question'],
|
||||||
'EXTRA_POINTS' => $row['extra_points'],
|
'EXTRA_POINTS' => $row['extra_points'],
|
||||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||||
'RESULT' => ($display_type == 1) ? $result_extra : $extra_result,
|
'RESULT' => ($display_type == 1) ? $result_extra : $extra_result,
|
||||||
'COLOR_STYLE' => $extra_colorstyle,
|
'COLOR_STYLE' => $extra_colorstyle,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
$sidename = sprintf($user->lang['RESULTS']);
|
|
||||||
switch ($league_info['bet_ko_type'])
|
switch ($league_info['bet_ko_type'])
|
||||||
{
|
{
|
||||||
case BET_KO_90:
|
case BET_KO_90:
|
||||||
$result_explain = sprintf($user->lang['MIN90']);
|
$result_explain = sprintf($user->lang['MIN90']);
|
||||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||||
break;
|
break;
|
||||||
case BET_KO_EXTRATIME:
|
case BET_KO_EXTRATIME:
|
||||||
$result_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
$result_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
||||||
$label_finalresult = sprintf($user->lang['PENALTY']);
|
$label_finalresult = sprintf($user->lang['PENALTY']);
|
||||||
break;
|
break;
|
||||||
case BET_KO_PENALTY:
|
case BET_KO_PENALTY:
|
||||||
$result_explain = sprintf($user->lang['PENALTY']);
|
$result_explain = sprintf($user->lang['PENALTY']);
|
||||||
$display_ko = false;
|
$display_ko = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$result_explain = sprintf($user->lang['MIN90']);
|
$result_explain = sprintf($user->lang['MIN90']);
|
||||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
// set correct display for usage in menu template
|
||||||
'S_DISPLAY_RESULTS' => true,
|
if($side == 'results')
|
||||||
'S_EXTRA_RESULTS' => $extra_results,
|
{
|
||||||
'S_SIDENAME' => $sidename,
|
$display_results = true;
|
||||||
'RESULT_EXPLAIN' => $result_explain,
|
$sidename = sprintf($user->lang['RESULTS']);
|
||||||
'LABEL_FINALRESULT' => $label_finalresult,
|
}
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
if($side == 'results_tl')
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['ALL_BETS']),
|
{
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
$display_results_tl = true;
|
||||||
'RIGHT_LINK' => sprintf($user->lang['TABLE']) . ' >',
|
$sidename = sprintf($user->lang['RESULTS']);
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_ALL_BETS']),
|
}
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_TABLE']),
|
|
||||||
'S_FORM_ACTION_RESULT' => $this->helper->route('football_main_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'result')),
|
$template->assign_vars(array(
|
||||||
'S_DATA_RESULTS' => $data_results,
|
'S_DISPLAY_RESULTS' => $display_results,
|
||||||
'S_USER_IS_MEMBER' => $user_is_member,
|
'S_DISPLAY_RESULTS_TL' => $display_results_tl,
|
||||||
'S_DISPLAY_GROUP' => $display_group,
|
'S_EXTRA_RESULTS' => $extra_results,
|
||||||
'S_DISPLAY_KO' => $display_ko,
|
'S_SIDENAME' => $sidename,
|
||||||
'S_EDIT_MODE' => $edit_mode,
|
'RESULT_EXPLAIN' => $result_explain,
|
||||||
)
|
'LABEL_FINALRESULT' => $label_finalresult,
|
||||||
);
|
'S_FORM_ACTION_RESULT' => $this->helper->route('football_main_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'result')),
|
||||||
|
'S_DATA_RESULTS' => $data_results,
|
||||||
|
'S_USER_IS_MEMBER' => $user_is_member,
|
||||||
|
'S_DISPLAY_GROUP' => $display_group,
|
||||||
|
'S_DISPLAY_KO' => $display_ko,
|
||||||
|
'S_EDIT_MODE' => $edit_mode,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,145 +1,145 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data_table = false;
|
$data_table = false;
|
||||||
|
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . FOOTB_RANKS . "
|
FROM ' . FOOTB_RANKS . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
AND matchday = $matchday";
|
AND matchday = $matchday";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
include($this->football_root_path . 'block/rank_matchday.' . $this->php_ext);
|
include($this->football_root_path . 'block/rank_matchday.' . $this->php_ext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Get table-information
|
// Get table-information
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
t.*,
|
t.*,
|
||||||
SUM(1) AS matches,
|
SUM(1) AS matches,
|
||||||
SUM(IF(m.team_id_home = t.team_id,
|
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)),
|
||||||
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))
|
||||||
)
|
)
|
||||||
) - IF(t.team_id = 20 AND t.season = 2011 AND $matchday > 7, 2, 0) AS points,
|
) - IF(t.team_id = 20 AND t.season = 2011 AND $matchday > 7, 2, 0) AS points,
|
||||||
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS goals_diff,
|
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS goals_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_home , goals_guest)) AS goals,
|
||||||
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) AS goals_against
|
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) AS goals_against
|
||||||
FROM " . FOOTB_TEAMS . ' AS t
|
FROM " . FOOTB_TEAMS . ' AS t
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
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)
|
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
|
WHERE t.season = $season
|
||||||
AND t.league = $league
|
AND t.league = $league
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
AND m.status IN (2,3,5,6)
|
AND m.status IN (2,3,5,6)
|
||||||
GROUP BY t.team_id
|
GROUP BY t.team_id
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$table_ary = array();
|
$table_ary = array();
|
||||||
$points_ary = array();
|
$points_ary = array();
|
||||||
$ranks_ary = array();
|
$ranks_ary = array();
|
||||||
while( $row = $db->sql_fetchrow($result))
|
while( $row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$table_ary[$row['team_id']] = $row;
|
$table_ary[$row['team_id']] = $row;
|
||||||
$points_ary[$row['group_id']][$row['points']][]=$row['team_id'];
|
$points_ary[$row['group_id']][$row['points']][]=$row['team_id'];
|
||||||
$ranks_ary[] = $row['team_id'];
|
$ranks_ary[] = $row['team_id'];
|
||||||
}
|
}
|
||||||
$last_group = '';
|
$last_group = '';
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$current_rank = 0;
|
$current_rank = 0;
|
||||||
$last_goals = 0;
|
$last_goals = 0;
|
||||||
$last_goals_againts = 0;
|
$last_goals_againts = 0;
|
||||||
$last_points = 0;
|
$last_points = 0;
|
||||||
foreach($points_ary as $group_id => $points)
|
foreach($points_ary as $group_id => $points)
|
||||||
{
|
{
|
||||||
$data_table = true;
|
$data_table = true;
|
||||||
if ($last_group != $group_id)
|
if ($last_group != $group_id)
|
||||||
{
|
{
|
||||||
$last_group =$group_id;
|
$last_group =$group_id;
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$last_goals = 0;
|
$last_goals = 0;
|
||||||
$last_goals_againts = 0;
|
$last_goals_againts = 0;
|
||||||
$last_points = 0;
|
$last_points = 0;
|
||||||
$template->assign_block_vars('side_total', array(
|
$template->assign_block_vars('side_total', array(
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' .$group_id,
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' .$group_id,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($points as $point => $teams)
|
foreach($points as $point => $teams)
|
||||||
{
|
{
|
||||||
if(count($teams) > 1 AND $group_id != '')
|
if(count($teams) > 1 AND $group_id != '')
|
||||||
{
|
{
|
||||||
// Compare teams with equal points and sort
|
// Compare teams with equal points and sort
|
||||||
$teams = get_order_team_compare($teams, $season, $league, $group_id, $ranks_ary, $matchday);
|
$teams = get_order_team_compare($teams, $season, $league, $group_id, $ranks_ary, $matchday);
|
||||||
}
|
}
|
||||||
foreach($teams as $key => $team)
|
foreach($teams as $key => $team)
|
||||||
{
|
{
|
||||||
$row = $table_ary[$team];
|
$row = $table_ary[$team];
|
||||||
$rank++;
|
$rank++;
|
||||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||||
{
|
{
|
||||||
$current_rank = $rank . '.';
|
$current_rank = $rank . '.';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$current_rank = '';
|
$current_rank = '';
|
||||||
}
|
}
|
||||||
$last_points = $row['points'];
|
$last_points = $row['points'];
|
||||||
$last_goals = $row['goals'];
|
$last_goals = $row['goals'];
|
||||||
$last_goals_againts = $row['goals_against'];
|
$last_goals_againts = $row['goals_against'];
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if ($row['team_symbol'] <> '')
|
if ($row['team_symbol'] <> '')
|
||||||
{
|
{
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"20\" height=\"20\"/>" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"20\" height=\"20\"/>" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('side_total', array(
|
$template->assign_block_vars('side_total', array(
|
||||||
'RANK' => $current_rank,
|
'RANK' => $current_rank,
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'LOGO' => $logo,
|
'LOGO' => $logo,
|
||||||
'TEAM_ID' => $row['team_id'],
|
'TEAM_ID' => $row['team_id'],
|
||||||
'TEAM_SHORT' => $row['team_name_short'],
|
'TEAM_SHORT' => $row['team_name_short'],
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||||
'tid' => $row['team_id'], 'mode' => 'played')),
|
'tid' => $row['team_id'], 'mode' => 'played')),
|
||||||
'GAMES' => $row['matches'],
|
'GAMES' => $row['matches'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_SIDE_TABLE' => true,
|
'S_DISPLAY_SIDE_TABLE' => true,
|
||||||
'S_DATA_SIDE_TABLE' => $data_table,
|
'S_DATA_SIDE_TABLE' => $data_table,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -1,170 +1,164 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
$data_all = false;
|
$data_all = false;
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
r.user_id,
|
r.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
r.*
|
r.*
|
||||||
FROM ' . FOOTB_RANKS . ' AS r
|
FROM ' . FOOTB_RANKS . ' AS r
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league
|
AND league = $league
|
||||||
ORDER BY r.points DESC";
|
ORDER BY r.points DESC";
|
||||||
|
|
||||||
$result = $db->sql_query_limit($sql, 20);
|
$result = $db->sql_query_limit($sql, 20);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$data = true;
|
$data = true;
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if ($row['user_id'] == $user->data['user_id'])
|
if ($row['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$row_class = 'bg3 row_user';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('top20', array(
|
$template->assign_block_vars('top20', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'NAME' => $row['username'],
|
'NAME' => $row['username'],
|
||||||
'MATCHDAY' => $row['matchday'],
|
'MATCHDAY' => $row['matchday'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'WIN' => $row['win'],
|
'WIN' => $row['win'],
|
||||||
'DIRECTHITS' => $row['correct_result'],
|
'DIRECTHITS' => $row['correct_result'],
|
||||||
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
||||||
'TOTAL' => $row['tendencies'],
|
'TOTAL' => $row['tendencies'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
r.user_id,
|
r.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
r.*
|
r.*
|
||||||
FROM ' . FOOTB_RANKS . ' AS r
|
FROM ' . FOOTB_RANKS . ' AS r
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||||
WHERE r.season = $season
|
WHERE r.season = $season
|
||||||
AND r.league = $league
|
AND r.league = $league
|
||||||
ORDER BY r.points ASC";
|
ORDER BY r.points ASC";
|
||||||
|
|
||||||
$result = $db->sql_query_limit($sql, 20);
|
$result = $db->sql_query_limit($sql, 20);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if ($row['user_id'] == $user->data['user_id'])
|
if ($row['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$row_class = 'bg3 row_user';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('flop20', array(
|
$template->assign_block_vars('flop20', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'NAME' => $row['username'],
|
'NAME' => $row['username'],
|
||||||
'MATCHDAY' => $row['matchday'],
|
'MATCHDAY' => $row['matchday'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'DIRECTHITS' => $row['correct_result'],
|
'DIRECTHITS' => $row['correct_result'],
|
||||||
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
||||||
'TOTAL' => $row['tendencies'],
|
'TOTAL' => $row['tendencies'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
r.user_id,
|
r.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
r.*
|
r.*
|
||||||
FROM ' . FOOTB_RANKS . ' AS r
|
FROM ' . FOOTB_RANKS . ' AS r
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||||
WHERE league = $league
|
WHERE league = $league
|
||||||
ORDER BY r.points DESC";
|
ORDER BY r.points DESC";
|
||||||
|
|
||||||
$result = $db->sql_query_limit($sql, 20);
|
$result = $db->sql_query_limit($sql, 20);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$data_all = true;
|
$data_all = true;
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if ($row['user_id'] == $user->data['user_id'])
|
if ($row['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$row_class = 'bg3 row_user';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('alltop20', array(
|
$template->assign_block_vars('alltop20', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'NAME' => $row['username'],
|
'NAME' => $row['username'],
|
||||||
'SEASON' => $row['season'],
|
'SEASON' => $row['season'],
|
||||||
'MATCHDAY' => $row['matchday'],
|
'MATCHDAY' => $row['matchday'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'WIN' => $row['win'],
|
'WIN' => $row['win'],
|
||||||
'DIRECTHITS' => $row['correct_result'],
|
'DIRECTHITS' => $row['correct_result'],
|
||||||
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
||||||
'TOTAL' => $row['tendencies'],
|
'TOTAL' => $row['tendencies'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
r.user_id,
|
r.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
COUNT(points) AS count_zero
|
COUNT(points) AS count_zero
|
||||||
FROM ' . FOOTB_RANKS . ' AS r
|
FROM ' . FOOTB_RANKS . ' AS r
|
||||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||||
WHERE r.league = $league
|
WHERE r.league = $league
|
||||||
AND r.points = 0
|
AND r.points = 0
|
||||||
GROUP BY r.user_id
|
GROUP BY r.user_id
|
||||||
ORDER BY count_zero DESC";
|
ORDER BY count_zero DESC";
|
||||||
|
|
||||||
$result = $db->sql_query_limit($sql, 20);
|
$result = $db->sql_query_limit($sql, 20);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
if ($row['user_id'] == $user->data['user_id'])
|
if ($row['user_id'] == $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$row_class = 'bg3 row_user';
|
$row_class = 'bg3 row_user';
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('allflop20', array(
|
$template->assign_block_vars('allflop20', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'NAME' => $row['username'],
|
'NAME' => $row['username'],
|
||||||
'COUNTZERO' => $row['count_zero'],
|
'COUNTZERO' => $row['count_zero'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$league_info = league_info($season, $league);
|
$league_info = league_info($season, $league);
|
||||||
$sidename = sprintf($user->lang['STAT_POINTS']);
|
$sidename = sprintf($user->lang['STAT_POINTS']);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_STAT_POINTS' => true,
|
'S_DISPLAY_STAT_POINTS' => true,
|
||||||
'S_MATCHDAY_HIDE' => true,
|
'S_MATCHDAY_HIDE' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'S_WIN' => ($league_info['win_matchday'] == '0') ? false : true,
|
'S_WIN' => ($league_info['win_matchday'] == '0') ? false : true,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_koeff', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'S_DATA_STAT_POINTS' => $data,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_KOEFF']),
|
'S_DATA_ALL_POINTS' => $data_all,
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'stat_results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'SEASON' => $season,
|
||||||
'RIGHT_LINK' => sprintf($user->lang['STAT_RESULTS']) . ' >',
|
'LEAGUE' => $league,
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_KOEFF']),
|
)
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_STAT_RESULTS']),
|
);
|
||||||
'S_DATA_STAT_POINTS' => $data,
|
|
||||||
'S_DATA_ALL_POINTS' => $data_all,
|
|
||||||
'SEASON' => $season,
|
|
||||||
'LEAGUE' => $league,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,146 +1,140 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Select results and count
|
// Select results and count
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
COUNT(DISTINCT(m.match_no)) AS count_result,
|
COUNT(DISTINCT(m.match_no)) AS count_result,
|
||||||
COUNT(m.match_no) AS count_bets,
|
COUNT(m.match_no) AS count_bets,
|
||||||
m.goals_home,
|
m.goals_home,
|
||||||
m.goals_guest,
|
m.goals_guest,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
||||||
)
|
)
|
||||||
) AS hits,
|
) AS hits,
|
||||||
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
SUM(IF((b.goals_home + 0 < b.goals_guest) <> (m.goals_home + 0 < m.goals_guest)
|
||||||
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
OR (b.goals_home = b.goals_guest) <> (m.goals_home = m.goals_guest)
|
||||||
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
OR (b.goals_home + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||||
0,
|
0,
|
||||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||||
)
|
)
|
||||||
) AS tendencies,
|
) AS tendencies,
|
||||||
' . select_points('m',true) . '
|
' . select_points('m',true) . '
|
||||||
FROM ' . FOOTB_MATCHES . ' AS m
|
FROM ' . FOOTB_MATCHES . ' AS m
|
||||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
LEFT JOIN ' . FOOTB_BETS . " AS b ON (m.season = b.season AND m.league = b.league AND m.match_no = b.match_no)
|
||||||
WHERE m.season = $season
|
WHERE m.season = $season
|
||||||
AND m.league = $league
|
AND m.league = $league
|
||||||
AND b.goals_home <> ''
|
AND b.goals_home <> ''
|
||||||
AND b.goals_guest <> ''
|
AND b.goals_guest <> ''
|
||||||
AND (m.status IN (3,6))
|
AND (m.status IN (3,6))
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
GROUP BY m.goals_home, m.goals_guest
|
GROUP BY m.goals_home, m.goals_guest
|
||||||
ORDER BY count_bets DESC";
|
ORDER BY count_bets DESC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$data = true;
|
$data = true;
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$template->assign_block_vars('result', array(
|
$template->assign_block_vars('result', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'GOALS_HOME' => $row['goals_home'],
|
'GOALS_HOME' => $row['goals_home'],
|
||||||
'GOALS_GUEST' => $row['goals_guest'],
|
'GOALS_GUEST' => $row['goals_guest'],
|
||||||
'RESULTS' => $row['count_result'],
|
'RESULTS' => $row['count_result'],
|
||||||
'BETS' => $row['count_bets'],
|
'BETS' => $row['count_bets'],
|
||||||
'HITS' => $row['hits'],
|
'HITS' => $row['hits'],
|
||||||
'TENDENCIES' => $row['tendencies'],
|
'TENDENCIES' => $row['tendencies'],
|
||||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
'AVERAGE' => round($row['points'] / $row['count_bets'],1),
|
'AVERAGE' => round($row['points'] / $row['count_bets'],1),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
// Get goaldifferences by team
|
// Get goaldifferences by team
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
t.*,
|
t.*,
|
||||||
SUM(1) AS matches,
|
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 wins,
|
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 wins,
|
||||||
SUM(IF(goals_home = goals_guest, 1, 0)) AS draw,
|
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+2), 1, 0), IF((goals_home + 2) < goals_guest, 1, 0))) AS plus3,
|
SUM(IF((m.team_id_home = t.team_id), IF(goals_home + 0 > (goals_guest+2), 1, 0), IF((goals_home + 2) < goals_guest, 1, 0))) AS plus3,
|
||||||
SUM(IF((m.team_id_home = t.team_id), IF(goals_home = (goals_guest+2), 1, 0), IF((goals_home + 2) = goals_guest, 1, 0))) AS plus2,
|
SUM(IF((m.team_id_home = t.team_id), IF(goals_home = (goals_guest+2), 1, 0), IF((goals_home + 2) = goals_guest, 1, 0))) AS plus2,
|
||||||
SUM(IF((m.team_id_home = t.team_id), IF(goals_home = (goals_guest+1), 1, 0), IF((goals_home + 1) = goals_guest, 1, 0))) AS plus1,
|
SUM(IF((m.team_id_home = t.team_id), IF(goals_home = (goals_guest+1), 1, 0), IF((goals_home + 1) = goals_guest, 1, 0))) AS plus1,
|
||||||
SUM(IF((m.team_id_home = t.team_id), IF((goals_home + 1) = goals_guest, 1, 0), IF(goals_home = (goals_guest + 1), 1, 0))) AS minus1,
|
SUM(IF((m.team_id_home = t.team_id), IF((goals_home + 1) = goals_guest, 1, 0), IF(goals_home = (goals_guest + 1), 1, 0))) AS minus1,
|
||||||
SUM(IF((m.team_id_home = t.team_id), IF((goals_home + 2) = goals_guest, 1, 0), IF(goals_home = (goals_guest + 2), 1, 0))) AS minus2,
|
SUM(IF((m.team_id_home = t.team_id), IF((goals_home + 2) = goals_guest, 1, 0), IF(goals_home = (goals_guest + 2), 1, 0))) AS minus2,
|
||||||
SUM(IF((m.team_id_home = t.team_id), IF((goals_home + 2) < goals_guest, 1, 0), IF(goals_home + 0 > (goals_guest + 2), 1, 0))) AS minus3,
|
SUM(IF((m.team_id_home = t.team_id), IF((goals_home + 2) < goals_guest, 1, 0), IF(goals_home + 0 > (goals_guest + 2), 1, 0))) AS minus3,
|
||||||
SUM(IF(m.team_id_home = t.team_id,
|
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)),
|
||||||
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,
|
) 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 , 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_home , goals_guest)) AS goals,
|
||||||
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) AS goals_get
|
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) AS goals_get
|
||||||
FROM " . FOOTB_TEAMS . ' AS t
|
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))
|
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))
|
||||||
WHERE t.season = $season
|
WHERE t.season = $season
|
||||||
AND t.league = $league
|
AND t.league = $league
|
||||||
AND m.season = $season
|
AND m.season = $season
|
||||||
AND m.league = $league
|
AND m.league = $league
|
||||||
AND m.status IN (3,6)
|
AND m.status IN (3,6)
|
||||||
AND m.matchday <= $matchday
|
AND m.matchday <= $matchday
|
||||||
GROUP BY t.team_id
|
GROUP BY t.team_id
|
||||||
ORDER BY points DESC, goal_diff DESC, goals DESC";
|
ORDER BY points DESC, goal_diff DESC, goals DESC";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$rank++;
|
$rank++;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
$template->assign_block_vars('points', array(
|
$template->assign_block_vars('points', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'RANK' => $rank,
|
'RANK' => $rank,
|
||||||
'LOGO' => $logo,
|
'LOGO' => $logo,
|
||||||
'TEAM' => $row['team_name_short'],
|
'TEAM' => $row['team_name_short'],
|
||||||
'MATCHES' => $row['matches'],
|
'MATCHES' => $row['matches'],
|
||||||
'PLUS3' => $row['plus3'],
|
'PLUS3' => $row['plus3'],
|
||||||
'PLUS2' => $row['plus2'],
|
'PLUS2' => $row['plus2'],
|
||||||
'PLUS1' => $row['plus1'],
|
'PLUS1' => $row['plus1'],
|
||||||
'DRAW' => $row['draw'],
|
'DRAW' => $row['draw'],
|
||||||
'MINUS1' => $row['minus1'],
|
'MINUS1' => $row['minus1'],
|
||||||
'MINUS2' => $row['minus2'],
|
'MINUS2' => $row['minus2'],
|
||||||
'MINUS3' => $row['minus3'],
|
'MINUS3' => $row['minus3'],
|
||||||
'GOALS_DIFF' => $row['goal_diff'],
|
'GOALS_DIFF' => $row['goal_diff'],
|
||||||
'POINTS' => $row['points'],
|
'POINTS' => $row['points'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sidename = sprintf($user->lang['STAT_RESULTS']);
|
$sidename = sprintf($user->lang['STAT_RESULTS']);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_STAT_RESULTS' => true,
|
'S_DISPLAY_STAT_RESULTS' => true,
|
||||||
'S_SIDENAME' => $sidename,
|
'S_SIDENAME' => $sidename,
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'stat_points', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'S_DATA_STAT_RESULTS' => $data,
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['STAT_POINTS']),
|
'SEASON' => $season,
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'LEAGUE' => $league,
|
||||||
'RIGHT_LINK' => sprintf($user->lang['BET']) . ' >',
|
)
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_STAT_POINTS']),
|
);
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_BET']),
|
|
||||||
'S_DATA_STAT_RESULTS' => $data,
|
|
||||||
'SEASON' => $season,
|
|
||||||
'LEAGUE' => $league,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
924
block/table.php
@@ -1,446 +1,480 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB Extension - Football Football
|
* @package phpBB Extension - Football Football
|
||||||
* @copyright (c) 2016 football (http://football.bplaced.net)
|
* @copyright (c) 2016 football (http://football.bplaced.net)
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
|
||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$data_table = false;
|
$data_table = false;
|
||||||
$data_form = false;
|
$data_form = false;
|
||||||
|
|
||||||
if ($matchday > 5)
|
if ($matchday > 5)
|
||||||
{
|
{
|
||||||
$form_from = $matchday - 5;
|
$form_from = $matchday - 5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$form_from = 1;
|
$form_from = 1;
|
||||||
}
|
}
|
||||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . FOOTB_LEAGUES . "
|
FROM ' . FOOTB_LEAGUES . "
|
||||||
WHERE season = $season
|
WHERE season = $season
|
||||||
AND league = $league";
|
AND league = $league";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$league_type = $row['league_type'];
|
$league_type = $row['league_type'];
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$text_form = sprintf($user->lang['TABLE_FORM_FROM'], $form_from);
|
$text_form = sprintf($user->lang['TABLE_FORM_FROM'], $form_from);
|
||||||
|
|
||||||
$rank = 0;
|
$rank = 0;
|
||||||
// Get table-information
|
// Get table-information
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
t.*,
|
t.*,
|
||||||
SUM(1) AS matches,
|
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((m.team_id_home = t.team_id), IF(goals_home + 0 > goals_guest, 1, 0), IF(goals_home + 0 < goals_guest, 1, 0)))
|
||||||
SUM(IF(goals_home = goals_guest, 1, 0)) AS draw,
|
+ IFNULL((SELECT SUM(c.win) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)AS win,
|
||||||
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 lost,
|
SUM(IF(goals_home = goals_guest, 1, 0))
|
||||||
SUM(IF(m.team_id_home = t.team_id,
|
+ IFNULL((SELECT SUM(c.draw) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)AS draw,
|
||||||
IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0)),
|
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)))
|
||||||
IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))
|
+ IFNULL((SELECT SUM(c.lost) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)AS lost,
|
||||||
)
|
SUM(IF(m.team_id_home = t.team_id,
|
||||||
) - IF(t.team_id = 20 AND t.season = 2011 AND $matchday > 7, 2, 0) AS points,
|
IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0)),
|
||||||
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS goals_diff,
|
IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))
|
||||||
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_against
|
) + IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND b.matchday <= $matchday), 0)
|
||||||
FROM " . FOOTB_TEAMS . ' AS t
|
+ IFNULL((SELECT SUM(c.points) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
- IF(t.team_id = 20 AND t.season = 2011 AND $matchday > 7, 2, 0) AS points,
|
||||||
AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS goals_diff,
|
||||||
WHERE t.season = $season
|
SUM(IF(m.team_id_home = t.team_id, goals_home , goals_guest)) AS goals,
|
||||||
AND t.league = $league
|
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) AS goals_against,
|
||||||
AND m.matchday <= $matchday
|
IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND b.matchday <= $matchday), 0) AS bonus
|
||||||
AND m.status IN (2,3,5,6)
|
FROM " . FOOTB_TEAMS . ' AS t
|
||||||
GROUP BY t.team_id
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
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
|
||||||
$result = $db->sql_query($sql);
|
AND t.league = $league
|
||||||
|
AND m.matchday <= $matchday
|
||||||
$table_ary = array();
|
AND m.status IN (2,3,5,6)
|
||||||
$points_ary = array();
|
AND m.show_table = 0
|
||||||
$ranks_ary = array();
|
GROUP BY t.team_id
|
||||||
$rank = 0;
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
||||||
while( $row = $db->sql_fetchrow($result))
|
|
||||||
{
|
$result = $db->sql_query($sql);
|
||||||
$rank++;
|
|
||||||
$table_ary[$row['team_id']] = $row;
|
$table_ary = array();
|
||||||
$points_ary[$row['group_id']][$row['points']][]=$row['team_id'];
|
$points_ary = array();
|
||||||
$ranks_ary[] = $row['team_id'];
|
$ranks_ary = array();
|
||||||
}
|
$rank = 0;
|
||||||
|
while( $row = $db->sql_fetchrow($result))
|
||||||
$last_group = '';
|
{
|
||||||
$rank = 0;
|
$rank++;
|
||||||
$current_rank = 0;
|
$table_ary[$row['team_id']] = $row;
|
||||||
$last_goals = 0;
|
$points_ary[$row['group_id']][$row['points']][]=$row['team_id'];
|
||||||
$last_goals_againts = 0;
|
$ranks_ary[] = $row['team_id'];
|
||||||
$last_points = 0;
|
}
|
||||||
foreach($points_ary as $group_id => $points)
|
|
||||||
{
|
$last_group = '';
|
||||||
$data_table = true;
|
$rank = 0;
|
||||||
if ($last_group != $group_id)
|
$current_rank = 0;
|
||||||
{
|
$last_goals = 0;
|
||||||
$last_group =$group_id;
|
$last_goals_againts = 0;
|
||||||
$rank = 0;
|
$last_points = 0;
|
||||||
$last_goals = 0;
|
foreach($points_ary as $group_id => $points)
|
||||||
$last_goals_againts = 0;
|
{
|
||||||
$last_points = 0;
|
$data_table = true;
|
||||||
$template->assign_block_vars('total', array(
|
if ($last_group != $group_id)
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' .$group_id,
|
{
|
||||||
)
|
$last_group =$group_id;
|
||||||
);
|
$rank = 0;
|
||||||
}
|
$last_goals = 0;
|
||||||
|
$last_goals_againts = 0;
|
||||||
foreach($points as $point => $teams)
|
$last_points = 0;
|
||||||
{
|
$template->assign_block_vars('total', array(
|
||||||
if(count($teams) > 1 AND $group_id != '')
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' .$group_id,
|
||||||
{
|
)
|
||||||
// Compare teams with equal points and sort
|
);
|
||||||
$teams = get_order_team_compare($teams, $season, $league, $group_id, $ranks_ary, $matchday);
|
}
|
||||||
}
|
|
||||||
foreach($teams as $key => $team)
|
foreach($points as $point => $teams)
|
||||||
{
|
{
|
||||||
$row = $table_ary[$team];
|
if(count($teams) > 1 AND $group_id != '')
|
||||||
$rank++;
|
{
|
||||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
// Compare teams with equal points and sort
|
||||||
{
|
$teams = get_order_team_compare($teams, $season, $league, $group_id, $ranks_ary, $matchday);
|
||||||
$current_rank = $rank . '.';
|
}
|
||||||
}
|
foreach($teams as $key => $team)
|
||||||
else
|
{
|
||||||
{
|
$row = $table_ary[$team];
|
||||||
$current_rank = '';
|
$rank++;
|
||||||
}
|
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||||
$last_points = $row['points'];
|
{
|
||||||
$last_goals = $row['goals'];
|
$current_rank = $rank . '.';
|
||||||
$last_goals_againts = $row['goals_against'];
|
}
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
else
|
||||||
if ($row['team_symbol'] <> '')
|
{
|
||||||
{
|
$current_rank = '';
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
}
|
||||||
}
|
$last_points = $row['points'];
|
||||||
else
|
$last_goals = $row['goals'];
|
||||||
{
|
$last_goals_againts = $row['goals_against'];
|
||||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
}
|
if ($row['team_symbol'] <> '')
|
||||||
|
{
|
||||||
$template->assign_block_vars('total', array(
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
'RANK' => $current_rank,
|
}
|
||||||
'ROW_CLASS' => $row_class,
|
else
|
||||||
'LOGO' => $logo,
|
{
|
||||||
'TEAM_ID' => $row['team_id'],
|
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
'TEAM' => $row['team_name'],
|
}
|
||||||
'TEAM_SHORT' => $row['team_name_short'],
|
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
$template->assign_block_vars('total', array(
|
||||||
'tid' => $row['team_id'], 'mode' => 'played')),
|
'RANK' => $current_rank,
|
||||||
'GAMES' => $row['matches'],
|
'ROW_CLASS' => $row_class,
|
||||||
'WIN' => $row['win'],
|
'LOGO' => $logo,
|
||||||
'DRAW' => $row['draw'],
|
'TEAM_ID' => $row['team_id'],
|
||||||
'LOST' => $row['lost'],
|
'TEAM' => $row['team_name'],
|
||||||
'GOALS' => $row['goals'],
|
'TEAM_SHORT' => $row['team_name_short'],
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
'tid' => $row['team_id'], 'mode' => 'played')),
|
||||||
'POINTS' => $row['points'],
|
'GAMES' => $row['matches'],
|
||||||
)
|
'WIN' => $row['win'],
|
||||||
);
|
'DRAW' => $row['draw'],
|
||||||
}
|
'LOST' => $row['lost'],
|
||||||
}
|
'GOALS' => $row['goals'],
|
||||||
}
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
$db->sql_freeresult($result);
|
'BONUS' => round($row['bonus'],2),
|
||||||
$rank = 0;
|
'POINTS' => round($row['points'],2),
|
||||||
// Get form-table-information
|
)
|
||||||
$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 lost,
|
$db->sql_freeresult($result);
|
||||||
SUM(IF(m.team_id_home = t.team_id,
|
$rank = 0;
|
||||||
IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0)),
|
// Get form-table-information
|
||||||
IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))
|
$sql = "SELECT
|
||||||
)
|
t.*,
|
||||||
) AS points,
|
SUM(1) AS matches,
|
||||||
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS goals_diff,
|
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)))
|
||||||
SUM(IF(m.team_id_home = t.team_id, goals_home, goals_guest)) AS goals,
|
+ IFNULL((SELECT SUM(c.win) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)AS win,
|
||||||
SUM(IF(m.team_id_home = t.team_id, goals_guest, goals_home)) AS goals_against
|
SUM(IF(goals_home = goals_guest, 1, 0))
|
||||||
FROM ' . FOOTB_TEAMS . ' AS t
|
+ IFNULL((SELECT SUM(c.draw) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)AS draw,
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
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)))
|
||||||
AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
+ IFNULL((SELECT SUM(c.lost) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)AS lost,
|
||||||
WHERE t.season = $season
|
SUM(IF(m.team_id_home = t.team_id,
|
||||||
AND t.league = $league
|
IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0)),
|
||||||
AND m.matchday >= $form_from
|
IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))
|
||||||
AND m.status IN (2, 3,5,6)
|
)
|
||||||
GROUP BY t.team_id
|
) + IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND b.matchday <= $matchday),0)
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
+ IFNULL((SELECT SUM(c.points) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday),0)
|
||||||
|
- IF(t.team_id = 20 AND t.season = 2011 AND $matchday > 7, 2, 0) AS points,
|
||||||
$result = $db->sql_query($sql);
|
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS goals_diff,
|
||||||
$last_group = '';
|
SUM(IF(m.team_id_home = t.team_id, goals_home , goals_guest)) AS goals,
|
||||||
$current_rank = 0;
|
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) AS goals_against,
|
||||||
$last_goals = 0;
|
IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND b.matchday <= $matchday),0) AS bonus
|
||||||
$last_goals_againts = 0;
|
FROM " . FOOTB_TEAMS . ' AS t
|
||||||
$last_points = 0;
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
||||||
while($row = $db->sql_fetchrow($result))
|
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
|
||||||
if ($last_group != $row['group_id'])
|
AND t.league = $league
|
||||||
{
|
AND m.matchday >= $form_from
|
||||||
$last_group = $row['group_id'];
|
AND m.status IN (2, 3,5,6)
|
||||||
$rank = 0;
|
AND m.show_table = 0
|
||||||
$last_goals = 0;
|
GROUP BY t.team_id
|
||||||
$last_goals_againts = 0;
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
||||||
$last_points = 0;
|
|
||||||
$template->assign_block_vars('form', array(
|
$result = $db->sql_query($sql);
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
$last_group = '';
|
||||||
)
|
$current_rank = 0;
|
||||||
);
|
$last_goals = 0;
|
||||||
}
|
$last_goals_againts = 0;
|
||||||
if ($league_type != 2 OR $row['group_id'] != '')
|
$last_points = 0;
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$data_form = true;
|
{
|
||||||
$rank++;
|
if ($last_group != $row['group_id'])
|
||||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
{
|
||||||
{
|
$last_group = $row['group_id'];
|
||||||
$current_rank = $rank . '.';
|
$rank = 0;
|
||||||
}
|
$last_goals = 0;
|
||||||
else
|
$last_goals_againts = 0;
|
||||||
{
|
$last_points = 0;
|
||||||
$current_rank = '';
|
$template->assign_block_vars('form', array(
|
||||||
}
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||||
$last_points = $row['points'];
|
)
|
||||||
$last_goals = $row['goals'];
|
);
|
||||||
$last_goals_againts = $row['goals_against'];
|
}
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
if ($league_type != 2 OR $row['group_id'] != '')
|
||||||
if ($row['team_symbol'] <> '')
|
{
|
||||||
{
|
$data_form = true;
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$rank++;
|
||||||
}
|
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||||
else
|
{
|
||||||
{
|
$current_rank = $rank . '.';
|
||||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
$template->assign_block_vars('form', array(
|
$current_rank = '';
|
||||||
'RANK' => $current_rank,
|
}
|
||||||
'ROW_CLASS' => $row_class,
|
$last_points = $row['points'];
|
||||||
'LOGO' => $logo,
|
$last_goals = $row['goals'];
|
||||||
'TEAM_ID' => $row['team_id'],
|
$last_goals_againts = $row['goals_against'];
|
||||||
'TEAM' => $row['team_name'],
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
'TEAM_SHORT' => $row['team_name_short'],
|
if ($row['team_symbol'] <> '')
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
{
|
||||||
'tid' => $row['team_id'], 'mode' => 'rest')),
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
'GAMES' => $row['matches'],
|
}
|
||||||
'WIN' => $row['win'],
|
else
|
||||||
'DRAW' => $row['draw'],
|
{
|
||||||
'LOST' => $row['lost'],
|
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
'GOALS' => $row['goals'],
|
}
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
$template->assign_block_vars('form', array(
|
||||||
'POINTS' => $row['points'],
|
'RANK' => $current_rank,
|
||||||
)
|
'ROW_CLASS' => $row_class,
|
||||||
);
|
'LOGO' => $logo,
|
||||||
}
|
'TEAM_ID' => $row['team_id'],
|
||||||
}
|
'TEAM' => $row['team_name'],
|
||||||
$db->sql_freeresult($result);
|
'TEAM_SHORT' => $row['team_name_short'],
|
||||||
$rank = 0;
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||||
// Get home-table-information
|
'tid' => $row['team_id'], 'mode' => 'rest')),
|
||||||
$sql = 'SELECT
|
'GAMES' => $row['matches'],
|
||||||
t.*,
|
'WIN' => $row['win'],
|
||||||
SUM(1) AS matches,
|
'DRAW' => $row['draw'],
|
||||||
SUM(IF(goals_home + 0 > goals_guest, 1, 0)) AS win,
|
'LOST' => $row['lost'],
|
||||||
SUM(IF(goals_home = goals_guest, 1, 0)) AS draw,
|
'GOALS' => $row['goals'],
|
||||||
SUM(IF(goals_home + 0 < goals_guest, 1, 0)) AS lost,
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
SUM(IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0))) AS points,
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
SUM(goals_home - goals_guest) AS goals_diff,
|
'BONUS' => round($row['bonus'],2),
|
||||||
SUM(goals_home) AS goals,
|
'POINTS' => round($row['points'],2),
|
||||||
SUM(goals_guest) AS goals_against
|
)
|
||||||
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 AND m.group_id = t.group_id)
|
}
|
||||||
WHERE t.season = $season
|
$db->sql_freeresult($result);
|
||||||
AND t.league = $league
|
$rank = 0;
|
||||||
AND m.matchday <= $matchday
|
// Get home-table-information
|
||||||
AND m.status IN (2, 3,5,6)
|
$sql = "SELECT
|
||||||
GROUP BY t.team_id
|
t.*,
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
SUM(1) AS matches,
|
||||||
|
SUM(IF(goals_home + 0 > goals_guest, 1, 0))
|
||||||
$result = $db->sql_query($sql);
|
+ IFNULL((SELECT SUM(c.win) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 1 ),0)AS win,
|
||||||
$last_group = '';
|
SUM(IF(goals_home = goals_guest, 1, 0))
|
||||||
$current_rank = 0;
|
+ IFNULL((SELECT SUM(c.draw) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 1 ),0)AS draw,
|
||||||
$last_goals = 0;
|
SUM(IF(goals_home + 0 < goals_guest, 1, 0))
|
||||||
$last_goals_againts = 0;
|
+ IFNULL((SELECT SUM(c.lost) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 1 ),0)AS lost,
|
||||||
$last_points = 0;
|
SUM(IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0)))+ IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND b.matchday <= $matchday AND home = '1'),0)
|
||||||
while($row = $db->sql_fetchrow($result))
|
+ IFNULL((SELECT SUM(c.points) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 1 ),0)AS points,
|
||||||
{
|
SUM(goals_home - goals_guest) AS goals_diff,
|
||||||
if ($last_group != $row['group_id'])
|
SUM(goals_home) AS goals,
|
||||||
{
|
SUM(goals_guest) AS goals_against,
|
||||||
$last_group = $row['group_id'];
|
IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND home = '1'),0) AS bonus
|
||||||
$rank = 0;
|
FROM " . FOOTB_TEAMS . ' AS t
|
||||||
$last_goals = 0;
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
||||||
$last_goals_againts = 0;
|
AND m.team_id_home = t.team_id AND m.group_id = t.group_id)
|
||||||
$last_points = 0;
|
WHERE t.season = $season
|
||||||
$template->assign_block_vars('home', array(
|
AND t.league = $league
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
AND m.matchday <= $matchday
|
||||||
)
|
AND m.status IN (2, 3,5,6)
|
||||||
);
|
AND m.show_table = 0
|
||||||
}
|
GROUP BY t.team_id
|
||||||
if ($league_type != 2 OR $row['group_id'] != '')
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
||||||
{
|
|
||||||
$rank++;
|
$result = $db->sql_query($sql);
|
||||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
$last_group = '';
|
||||||
{
|
$current_rank = 0;
|
||||||
$current_rank = $rank . '.';
|
$last_goals = 0;
|
||||||
}
|
$last_goals_againts = 0;
|
||||||
else
|
$last_points = 0;
|
||||||
{
|
while($row = $db->sql_fetchrow($result))
|
||||||
$current_rank = '';
|
{
|
||||||
}
|
if ($last_group != $row['group_id'])
|
||||||
$last_points = $row['points'];
|
{
|
||||||
$last_goals = $row['goals'];
|
$last_group = $row['group_id'];
|
||||||
$last_goals_againts = $row['goals_against'];
|
$rank = 0;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$last_goals = 0;
|
||||||
if ($row['team_symbol'] <> '')
|
$last_goals_againts = 0;
|
||||||
{
|
$last_points = 0;
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
$template->assign_block_vars('home', array(
|
||||||
}
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||||
else
|
)
|
||||||
{
|
);
|
||||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
}
|
||||||
}
|
if ($league_type != 2 OR $row['group_id'] != '')
|
||||||
|
{
|
||||||
$template->assign_block_vars('home', array(
|
$rank++;
|
||||||
'RANK' => $current_rank,
|
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||||
'ROW_CLASS' => $row_class,
|
{
|
||||||
'LOGO' => $logo,
|
$current_rank = $rank . '.';
|
||||||
'TEAM_ID' => $row['team_id'],
|
}
|
||||||
'TEAM' => $row['team_name'],
|
else
|
||||||
'TEAM_SHORT' => $row['team_name_short'],
|
{
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
$current_rank = '';
|
||||||
'tid' => $row['team_id'], 'mode' => 'home')),
|
}
|
||||||
'GAMES' => $row['matches'],
|
$last_points = $row['points'];
|
||||||
'WIN' => $row['win'],
|
$last_goals = $row['goals'];
|
||||||
'DRAW' => $row['draw'],
|
$last_goals_againts = $row['goals_against'];
|
||||||
'LOST' => $row['lost'],
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
'GOALS' => $row['goals'],
|
if ($row['team_symbol'] <> '')
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
{
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
'POINTS' => $row['points'],
|
}
|
||||||
)
|
else
|
||||||
);
|
{
|
||||||
}
|
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
|
||||||
$rank = 0;
|
$template->assign_block_vars('home', array(
|
||||||
// Get away-table-information
|
'RANK' => $current_rank,
|
||||||
$sql = 'SELECT
|
'ROW_CLASS' => $row_class,
|
||||||
t.*,
|
'LOGO' => $logo,
|
||||||
SUM(1) AS matches,
|
'TEAM_ID' => $row['team_id'],
|
||||||
SUM(IF(goals_home + 0 < goals_guest, 1, 0)) AS win,
|
'TEAM' => $row['team_name'],
|
||||||
SUM(IF(goals_home = goals_guest, 1, 0)) AS draw,
|
'TEAM_SHORT' => $row['team_name_short'],
|
||||||
SUM(IF(goals_home + 0 > goals_guest, 1, 0)) AS lost,
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||||
SUM(IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))) AS points,
|
'tid' => $row['team_id'], 'mode' => 'home')),
|
||||||
SUM(goals_guest - goals_home) AS goals_diff,
|
'GAMES' => $row['matches'],
|
||||||
SUM(goals_guest) AS goals,
|
'WIN' => $row['win'],
|
||||||
SUM(goals_home) AS goals_against
|
'DRAW' => $row['draw'],
|
||||||
FROM ' . FOOTB_TEAMS . ' AS t
|
'LOST' => $row['lost'],
|
||||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
'GOALS' => $row['goals'],
|
||||||
AND m.team_id_guest = t.team_id AND m.group_id = t.group_id)
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
WHERE t.season = $season
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
AND t.league = $league
|
'BONUS' => round($row['bonus'],2),
|
||||||
AND m.matchday <= $matchday
|
'POINTS' => round($row['points'],2),
|
||||||
AND m.status IN (2, 3,5,6)
|
)
|
||||||
GROUP BY t.team_id
|
);
|
||||||
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
}
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$db->sql_freeresult($result);
|
||||||
$last_group = '';
|
$rank = 0;
|
||||||
$current_rank = 0;
|
// Get away-table-information
|
||||||
$last_goals = 0;
|
$sql = "SELECT
|
||||||
$last_goals_againts = 0;
|
t.*,
|
||||||
$last_points = 0;
|
SUM(1) AS matches,
|
||||||
while($row = $db->sql_fetchrow($result))
|
SUM(IF(goals_home + 0 < goals_guest, 1, 0))
|
||||||
{
|
+ IFNULL((SELECT SUM(c.win) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 0 ),0)AS win,
|
||||||
if ($last_group != $row['group_id'])
|
SUM(IF(goals_home = goals_guest, 1, 0))
|
||||||
{
|
+ IFNULL((SELECT SUM(c.draw) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 0 ),0)AS draw,
|
||||||
$last_group = $row['group_id'];
|
SUM(IF(goals_home + 0 > goals_guest, 1, 0))
|
||||||
$rank = 0;
|
+ IFNULL((SELECT SUM(c.lost) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 0 ),0)AS lost,
|
||||||
$last_goals = 0;
|
SUM(IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))) + IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND b.matchday <= $matchday AND home = '0'),0)
|
||||||
$last_goals_againts = 0;
|
+ IFNULL((SELECT SUM(c.points) FROM " . FOOTB_CORR . " AS c WHERE c.team_id = t.team_id AND c.season = t.season AND c.league = t.league AND c.matchday <= $matchday AND c.home = 0 ),0)AS points,
|
||||||
$last_points = 0;
|
SUM(goals_guest - goals_home) AS goals_diff,
|
||||||
$template->assign_block_vars('away', array(
|
SUM(goals_guest) AS goals,
|
||||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
SUM(goals_home) AS goals_against,
|
||||||
)
|
IFNULL((SELECT SUM(b.bonuspoints) FROM " . FOOTB_BONUS_DAY . " AS b WHERE b.team_id = t.team_id AND b.season = t.season AND b.league = t.league AND home = '0'),0) AS bonus
|
||||||
);
|
FROM " . FOOTB_TEAMS . ' AS t
|
||||||
}
|
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league
|
||||||
if ($league_type != 2 OR $row['group_id'] != '')
|
AND m.team_id_guest = t.team_id AND m.group_id = t.group_id)
|
||||||
{
|
WHERE t.season = $season
|
||||||
$rank++;
|
AND t.league = $league
|
||||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
AND m.matchday <= $matchday
|
||||||
{
|
AND m.status IN (2, 3,5,6)
|
||||||
$current_rank = $rank . '.';
|
AND m.show_table = 0
|
||||||
}
|
GROUP BY t.team_id
|
||||||
else
|
ORDER BY t.group_id ASC, points DESC, goals_diff DESC, goals DESC, t.team_name ASC";
|
||||||
{
|
|
||||||
$current_rank = '';
|
$result = $db->sql_query($sql);
|
||||||
}
|
$last_group = '';
|
||||||
$last_points = $row['points'];
|
$current_rank = 0;
|
||||||
$last_goals = $row['goals'];
|
$last_goals = 0;
|
||||||
$last_goals_againts = $row['goals_against'];
|
$last_goals_againts = 0;
|
||||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
$last_points = 0;
|
||||||
if ($row['team_symbol'] <> '')
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
if ($last_group != $row['group_id'])
|
||||||
}
|
{
|
||||||
else
|
$last_group = $row['group_id'];
|
||||||
{
|
$rank = 0;
|
||||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
$last_goals = 0;
|
||||||
}
|
$last_goals_againts = 0;
|
||||||
|
$last_points = 0;
|
||||||
$template->assign_block_vars('away', array(
|
$template->assign_block_vars('away', array(
|
||||||
'RANK' => $current_rank,
|
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||||
'ROW_CLASS' => $row_class,
|
)
|
||||||
'LOGO' => $logo,
|
);
|
||||||
'TEAM_ID' => $row['team_id'],
|
}
|
||||||
'TEAM' => $row['team_name'],
|
if ($league_type != 2 OR $row['group_id'] != '')
|
||||||
'TEAM_SHORT' => $row['team_name_short'],
|
{
|
||||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
$rank++;
|
||||||
'tid' => $row['team_id'], 'mode' => 'away')),
|
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||||
'GAMES' => $row['matches'],
|
{
|
||||||
'WIN' => $row['win'],
|
$current_rank = $rank . '.';
|
||||||
'DRAW' => $row['draw'],
|
}
|
||||||
'LOST' => $row['lost'],
|
else
|
||||||
'GOALS' => $row['goals'],
|
{
|
||||||
'GOALS_AGAINST' => $row['goals_against'],
|
$current_rank = '';
|
||||||
'GOALS_DIFF' => $row['goals_diff'],
|
}
|
||||||
'POINTS' => $row['points'],
|
$last_points = $row['points'];
|
||||||
)
|
$last_goals = $row['goals'];
|
||||||
);
|
$last_goals_againts = $row['goals_against'];
|
||||||
}
|
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||||
}
|
if ($row['team_symbol'] <> '')
|
||||||
|
{
|
||||||
$db->sql_freeresult($result);
|
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||||
$sidename = sprintf($user->lang['TABLE']);
|
}
|
||||||
$template->assign_vars(array(
|
else
|
||||||
'S_DISPLAY_TABLE' => true,
|
{
|
||||||
'S_SIDENAME' => $sidename,
|
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
}
|
||||||
'LEFT_LINK' => '< ' . sprintf($user->lang['RESULTS']),
|
|
||||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
$template->assign_block_vars('away', array(
|
||||||
'RIGHT_LINK' => sprintf($user->lang['RANK_MATCHDAY']) . ' >',
|
'RANK' => $current_rank,
|
||||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_RESULTS']),
|
'ROW_CLASS' => $row_class,
|
||||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_RANK_MATCHDAY']),
|
'LOGO' => $logo,
|
||||||
'S_DATA_TABLE' => $data_table,
|
'TEAM_ID' => $row['team_id'],
|
||||||
'S_DATA_FORM' => $data_form,
|
'TEAM' => $row['team_name'],
|
||||||
'SEASON' => $season,
|
'TEAM_SHORT' => $row['team_name_short'],
|
||||||
'LEAGUE' => $league,
|
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||||
'TEXT_FORM' => $text_form,
|
'tid' => $row['team_id'], 'mode' => 'away')),
|
||||||
)
|
'GAMES' => $row['matches'],
|
||||||
);
|
'WIN' => $row['win'],
|
||||||
|
'DRAW' => $row['draw'],
|
||||||
|
'LOST' => $row['lost'],
|
||||||
|
'GOALS' => $row['goals'],
|
||||||
|
'GOALS_AGAINST' => $row['goals_against'],
|
||||||
|
'GOALS_DIFF' => $row['goals_diff'],
|
||||||
|
'BONUS' => round($row['bonus'],2),
|
||||||
|
'POINTS' => round($row['points'],2),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($league > 50)
|
||||||
|
{
|
||||||
|
// Activate bonus coloumn only for tippers.
|
||||||
|
$data_bns = true;
|
||||||
|
}
|
||||||
|
if($side == 'table') {
|
||||||
|
$display_table_menu = true;
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
$sidename = sprintf($user->lang['TABLE']);
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'S_DISPLAY_TABLE' => true,
|
||||||
|
'S_DISPLAY_TABLE_MENU' => $display_table_menu,
|
||||||
|
'S_SIDENAME' => $sidename,
|
||||||
|
'S_DATA_TABLE' => $data_table,
|
||||||
|
'S_DATA_FORM' => $data_form,
|
||||||
|
'SEASON' => $season,
|
||||||
|
'LEAGUE' => $league,
|
||||||
|
'TEXT_FORM' => $text_form,
|
||||||
|
'S_DATA_BNS' => $data_bns,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
"type": "phpbb-extension",
|
"type": "phpbb-extension",
|
||||||
"description": "Football Prediction League",
|
"description": "Football Prediction League",
|
||||||
"homepage": "http://football.bplaced.net",
|
"homepage": "http://football.bplaced.net",
|
||||||
"version": "0.9.8",
|
"version": "0.9.9",
|
||||||
"time": "2017-02-19",
|
"time": "2017-09-09",
|
||||||
"license": "GPL-2.0",
|
"license": "GPL-2.0",
|
||||||
"authors": [{
|
"authors": [{
|
||||||
"name": "J. Helmke",
|
"name": "J. Helmke",
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"extra": {
|
"extra": {
|
||||||
"display-name": "Football Prediction League",
|
"display-name": "Football Prediction League",
|
||||||
"soft-require": {
|
"soft-require": {
|
||||||
"phpbb/phpbb": "3.1.*"
|
"phpbb/phpbb": ">3.1.*"
|
||||||
},
|
},
|
||||||
"version-check": {
|
"version-check": {
|
||||||
"host": "football.bplaced.net",
|
"host": "football.bplaced.net",
|
||||||
|
|||||||
@@ -308,8 +308,8 @@ class main
|
|||||||
$user_id = $user->data['user_id'];
|
$user_id = $user->data['user_id'];
|
||||||
$sql = 'SELECT * FROM ' . FOOTB_MATCHES . " WHERE season = $season AND league = $league AND matchday = $matchday AND status <= 0";
|
$sql = 'SELECT * FROM ' . FOOTB_MATCHES . " WHERE season = $season AND league = $league AND matchday = $matchday AND status <= 0";
|
||||||
$resultopen = $db->sql_query($sql);
|
$resultopen = $db->sql_query($sql);
|
||||||
|
|
||||||
$rows = $db->sql_fetchrowset($resultopen);
|
$rows = $db->sql_fetchrowset($resultopen);
|
||||||
|
$db->sql_freeresult($resultopen);
|
||||||
|
|
||||||
$count_matches = 0;
|
$count_matches = 0;
|
||||||
$count_updates = 0;
|
$count_updates = 0;
|
||||||
@@ -419,7 +419,6 @@ class main
|
|||||||
{
|
{
|
||||||
$dbmsg = sprintf($user->lang['NO_BETS_SAVED']);
|
$dbmsg = sprintf($user->lang['NO_BETS_SAVED']);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($resultopen);
|
|
||||||
|
|
||||||
// extra bets
|
// extra bets
|
||||||
$sql = 'SELECT * FROM ' . FOOTB_EXTRA . " WHERE season = $season AND league = $league AND matchday = $matchday AND extra_status <= 0";
|
$sql = 'SELECT * FROM ' . FOOTB_EXTRA . " WHERE season = $season AND league = $league AND matchday = $matchday AND extra_status <= 0";
|
||||||
@@ -479,6 +478,7 @@ class main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($resultextra);
|
||||||
if ($count_extra_updates)
|
if ($count_extra_updates)
|
||||||
{
|
{
|
||||||
$dbmsg = $dbmsg . ' ' . sprintf($user->lang['EXTRA_BET' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
$dbmsg = $dbmsg . ' ' . sprintf($user->lang['EXTRA_BET' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
||||||
@@ -725,12 +725,16 @@ class main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($resultextra);
|
||||||
if ($count_extra_updates)
|
if ($count_extra_updates)
|
||||||
{
|
{
|
||||||
$dbmsg = $dbmsg . ' ' . sprintf($user->lang['EXTRA_RESULT' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
$dbmsg = $dbmsg . ' ' . sprintf($user->lang['EXTRA_RESULT' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
||||||
}
|
}
|
||||||
calculate_extra_points($season, $league, $matchday);
|
calculate_extra_points($season, $league, $matchday);
|
||||||
save_ranking_matchday($season, $league, $matchday);
|
save_ranking_matchday($season, $league, $matchday);
|
||||||
|
bonuspoints($season, $league, $matchday);
|
||||||
|
corr($season, $league, $matchday);
|
||||||
|
chart($season, $league, $matchday);
|
||||||
break;
|
break;
|
||||||
case 'join':
|
case 'join':
|
||||||
join_league($season, $league, $user->data['user_id']);
|
join_league($season, $league, $user->data['user_id']);
|
||||||
@@ -781,11 +785,36 @@ class main
|
|||||||
}
|
}
|
||||||
|
|
||||||
$league_name = '';
|
$league_name = '';
|
||||||
$sql = 'SELECT * FROM ' . FOOTB_LEAGUES . " WHERE season = $season AND league_type >= 1";
|
if ($side == 'table' OR $side == 'results_tl')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT * FROM ' . FOOTB_LEAGUES . " WHERE season = $season AND league_type >= 1 AND (league >= 50 OR bet_type = 1) ORDER BY sort ASC";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT * FROM ' . FOOTB_LEAGUES . " WHERE season = $season AND league_type >= 1 AND league < 50";
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while( $row = $db->sql_fetchrow($result))
|
while( $row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||||
|
if ($side == 'table' && $league_info['bet_type'])
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif ($side == 'table' OR $side == 'results_tl')
|
||||||
|
{
|
||||||
|
if ($league < 51)
|
||||||
|
{
|
||||||
|
$league = $league + 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($league > 50)
|
||||||
|
{
|
||||||
|
$league = $league - 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($selected)
|
if ($selected)
|
||||||
{
|
{
|
||||||
$league_name = $row['league_name'];
|
$league_name = $row['league_name'];
|
||||||
@@ -823,7 +852,7 @@ class main
|
|||||||
$league_type = $row['league_type'];
|
$league_type = $row['league_type'];
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
$lang_dates = $user->lang['datetime'];
|
$lang_dates = $user->lang['datetime'];
|
||||||
$local_board_time = time() + (($config['board_timezone'] - $config['football_host_timezone']) * 3600);
|
$local_board_time = time() + ($config['football_time_shift'] * 3600);
|
||||||
$sql = "SELECT *,
|
$sql = "SELECT *,
|
||||||
CONCAT(
|
CONCAT(
|
||||||
CASE DATE_FORMAT(delivery_date,'%w')
|
CASE DATE_FORMAT(delivery_date,'%w')
|
||||||
@@ -904,7 +933,7 @@ class main
|
|||||||
// Start matchday list
|
// Start matchday list
|
||||||
if ($side == 'bet')
|
if ($side == 'bet')
|
||||||
{
|
{
|
||||||
include($this->football_root_path . 'block/side_table.' . $this->php_ext);
|
include($this->football_root_path . 'block/table.' . $this->php_ext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -914,12 +943,6 @@ class main
|
|||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
// Start total list
|
|
||||||
include($this->football_root_path . 'block/rank_total.' . $this->php_ext);
|
|
||||||
// End total list
|
|
||||||
|
|
||||||
//*****************************************************************************
|
|
||||||
|
|
||||||
// Start delivery list
|
// Start delivery list
|
||||||
include($this->football_root_path . 'block/delivery.' . $this->php_ext);
|
include($this->football_root_path . 'block/delivery.' . $this->php_ext);
|
||||||
// End delivery list
|
// End delivery list
|
||||||
@@ -988,6 +1011,10 @@ class main
|
|||||||
{
|
{
|
||||||
include($this->football_root_path . 'block/under_construction.' . $this->php_ext);
|
include($this->football_root_path . 'block/under_construction.' . $this->php_ext);
|
||||||
}
|
}
|
||||||
|
elseif ($side == 'results_tl')
|
||||||
|
{
|
||||||
|
include($this->football_root_path . 'block/results.' . $this->php_ext);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
include($this->football_root_path . 'block/' . $side . '.' . $this->php_ext);
|
include($this->football_root_path . 'block/' . $side . '.' . $this->php_ext);
|
||||||
@@ -1000,7 +1027,14 @@ class main
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mobile = '';
|
$mobile = '';
|
||||||
include($this->football_root_path . 'block/last_users.' . $this->php_ext);
|
if ($config['football_display_last_users'] > 0)
|
||||||
|
{
|
||||||
|
include($this->football_root_path . 'block/last_users.' . $this->php_ext);
|
||||||
|
}
|
||||||
|
if ($config['football_display_last_results'] > 0)
|
||||||
|
{
|
||||||
|
include($this->football_root_path . 'block/last_results.' . $this->php_ext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Send data to the template file
|
// Send data to the template file
|
||||||
if ($view == 'print')
|
if ($view == 'print')
|
||||||
|
|||||||
@@ -219,8 +219,9 @@ class main_listener implements EventSubscriberInterface
|
|||||||
'S_FOOTBALL_HEADER_ENABLED' => $this->config['football_header_enable'] ? $in_football_ext : false,
|
'S_FOOTBALL_HEADER_ENABLED' => $this->config['football_header_enable'] ? $in_football_ext : false,
|
||||||
'U_FOOTBALL' => $this->controller_helper->route('football_main_controller', array('side' => 'bet')),
|
'U_FOOTBALL' => $this->controller_helper->route('football_main_controller', array('side' => 'bet')),
|
||||||
'U_BET' => $this->controller_helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'U_BET' => $this->controller_helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||||
'U_ALL_BETS' => $this->controller_helper->route('football_main_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'U_ALL_BETS' => $this->controller_helper->route('football_main_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||||
'U_RESULTS' => $this->controller_helper->route('football_main_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'U_RESULTS' => $this->controller_helper->route('football_main_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||||
|
'U_RESULTS_TL' => $this->controller_helper->route('football_main_controller', array('side' => 'results_tl', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||||
'U_TABLE' => $this->controller_helper->route('football_main_controller', array('side' => 'table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'U_TABLE' => $this->controller_helper->route('football_main_controller', array('side' => 'table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||||
'U_RANKS_TOTAL' => $this->controller_helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'U_RANKS_TOTAL' => $this->controller_helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||||
'U_RANKS_MATCHDAY' => $this->controller_helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
'U_RANKS_MATCHDAY' => $this->controller_helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 187 B |
|
Before Width: | Height: | Size: 188 B |
BIN
images/flags/1. FC Gera.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
images/flags/1. FC Heidenheim 1846.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
images/flags/1. FC Kaiserslautern.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
images/flags/1. FC Koeln.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
images/flags/1. FC Magdeburg.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
images/flags/1. FC Neubrandenburg 04.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
images/flags/1. FC Normannia Schwaebisch Gmuend.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/flags/1. FC Nuernberg.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
images/flags/1. FC Saarbruecken.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/flags/1. FC Schweinfurt 05.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
images/flags/1. FC Union Berlin.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
images/flags/1. FSV Mainz 05.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
images/flags/AC Florenz.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
images/flags/AC Mailand.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
images/flags/AEK Athen.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
images/flags/AEK Larnaka.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
images/flags/AEL Limassol.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
images/flags/AFC Sunderland.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
images/flags/AIK Solna.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
images/flags/APOEL Nikosia.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
images/flags/AS Monaco.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
images/flags/AS Rom.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/flags/AS St. Etienne.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
images/flags/ASV Bergedorf 85.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
images/flags/ASV Durlach.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/flags/AZ Alkmaar.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
images/flags/Aalborg BK.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
images/flags/Aalesunds FK.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
images/flags/Academica Coimbra.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
images/flags/Afghanistan.png
Normal file
|
After Width: | Height: | Size: 417 B |
BIN
images/flags/Ajax Amsterdam.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
images/flags/Alania Wladikawkas.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
images/flags/Albania.png
Normal file
|
After Width: | Height: | Size: 594 B |
BIN
images/flags/Alemannia Aachen.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
images/flags/Algeria.png
Normal file
|
After Width: | Height: | Size: 345 B |
BIN
images/flags/American-Samoa.png
Normal file
|
After Width: | Height: | Size: 589 B |
BIN
images/flags/Andorra.png
Normal file
|
After Width: | Height: | Size: 478 B |
BIN
images/flags/Angola.png
Normal file
|
After Width: | Height: | Size: 464 B |
BIN
images/flags/Anguilla.png
Normal file
|
After Width: | Height: | Size: 696 B |
BIN
images/flags/Anker Wismar.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
images/flags/Anorthosis Famagusta.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
images/flags/Anschi Machatschkala.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
images/flags/Antigua-Barbuda.png
Normal file
|
After Width: | Height: | Size: 416 B |
BIN
images/flags/Apollon Limassol.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
images/flags/Argentina.png
Normal file
|
After Width: | Height: | Size: 275 B |
BIN
images/flags/Armenia.png
Normal file
|
After Width: | Height: | Size: 124 B |
BIN
images/flags/Arminia Bielefeld.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/flags/Aruba.png
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
images/flags/Asteras Tripolis.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
images/flags/Aston Villa.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/flags/Astra Giurgiu.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
images/flags/Athletic Bilbao.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/flags/Atletico Madrid.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
images/flags/Atromitos Athen.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
images/flags/Australia.png
Normal file
|
After Width: | Height: | Size: 475 B |
BIN
images/flags/Austria Wien.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/flags/Austria.png
Normal file
|
After Width: | Height: | Size: 120 B |
BIN
images/flags/Azerbaijan.png
Normal file
|
After Width: | Height: | Size: 365 B |
BIN
images/flags/BATE Borisov.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |