Change order of tippers in all_bets site according to the tipper vs tipper matches and change background color.
This commit is contained in:
@@ -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);
|
||||||
@@ -79,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);
|
||||||
@@ -125,21 +137,47 @@ if ($count_matches > 0)
|
|||||||
{
|
{
|
||||||
$matches_on_matchday = true;
|
$matches_on_matchday = true;
|
||||||
|
|
||||||
|
if($league_info['bet_type'])
|
||||||
|
{
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.username,
|
u.username,
|
||||||
m.status,
|
m.status,
|
||||||
b.goals_home AS bet_home,
|
b.goals_home AS bet_home,
|
||||||
b.goals_guest AS bet_guest,
|
b.goals_guest AS bet_guest,
|
||||||
|
IFNULL(m2.match_no,m3.match_no),
|
||||||
" . select_points() . '
|
" . select_points() . '
|
||||||
FROM ' . FOOTB_MATCHES . ' AS m
|
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_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 ' . 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
|
WHERE m.season = $season
|
||||||
AND m.league = $league
|
AND m.league = $league
|
||||||
AND m.matchday = $matchday
|
AND m.matchday = $matchday
|
||||||
ORDER BY LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
|
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);
|
||||||
@@ -181,7 +219,15 @@ foreach ($matches AS $match)
|
|||||||
if ($bet_index == 0)
|
if ($bet_index == 0)
|
||||||
{
|
{
|
||||||
$count_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';
|
$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';
|
||||||
@@ -300,12 +346,22 @@ if ($count_matches > 0)
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
$count_user = 0;
|
$count_user = 0;
|
||||||
$bet_index = 0;
|
$bet_index = 0;
|
||||||
|
if(!empty($bet_line))
|
||||||
|
{
|
||||||
foreach ($bet_line[$split_index] AS $user_bet)
|
foreach ($bet_line[$split_index] AS $user_bet)
|
||||||
{
|
{
|
||||||
if ($bet_index == 0)
|
if ($bet_index == 0)
|
||||||
{
|
{
|
||||||
$count_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';
|
$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';
|
||||||
@@ -355,6 +411,7 @@ if ($count_matches > 0)
|
|||||||
$bet_index = 0;
|
$bet_index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('match_panel.tendency_footer', array(
|
$template->assign_block_vars('match_panel.tendency_footer', array(
|
||||||
'S_TOTAL' => true,
|
'S_TOTAL' => true,
|
||||||
@@ -463,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';
|
||||||
|
|||||||
Reference in New Issue
Block a user