Version 0.9.5
6
Readme - Update from MOD.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
Follow the phpBB instruction to the convert from 3.0 to 3.1.
|
||||
Don't remove football MOD permissions, custom profile fields and football tables in database.
|
||||
Please remove recursive the "football MOD Version 0.9.3" ACP Modules in ACP-SYSTEM-MODUL MANAGEMENT.
|
||||
|
||||
Unzip Football Prediction League extension in folder ext/
|
||||
Activate the Football Prediction League extension in ACP.
|
||||
25
acp/all_bets_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class all_bets_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\all_bets_module',
|
||||
'title' => 'ACP_FOOTBALL_ALL_BETS_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_ALL_BETS_VIEW', 'auth' => 'acl_a_football_editbets', 'cat' => array('ACP_FOOTBALL_ALL_BETS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
600
acp/all_bets_module.php
Normal file
@@ -0,0 +1,600 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class all_bets_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template, $helper;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_all_bets');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->tpl_name = 'acp_football_all_bets';
|
||||
$this->page_title = 'ACP_FOOTBALL_ALL_BETS_VIEW';
|
||||
|
||||
$form_key = 'acp_football_all_bets';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('m', 0);
|
||||
$start = $this->request->variable('start', 0);
|
||||
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = curr_season();
|
||||
}
|
||||
|
||||
// Grab basic data for select season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name_short'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab current league
|
||||
if (!$league)
|
||||
{
|
||||
$league = current_league($season);
|
||||
}
|
||||
|
||||
$league_info = league_info($season, $league);
|
||||
// Grab basic data for select league
|
||||
if ($league)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$league_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||
$league_options .= '<option value="' . $row['league'] . '"' . $selected . '>' . $row['league_name'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$league_matchdays = $row['matchdays'];
|
||||
$matches_matchday = $row['matches_on_matchday'];
|
||||
$league_name = $row['league_name'];
|
||||
$league_type = $row['league_type'];
|
||||
$ko_league = ($row['league_type'] == LEAGUE_KO) ? true : false;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_LEAGUE'], $season) . adm_back_link($this->u_action . "&m=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for select matchday
|
||||
if (!$matchday)
|
||||
{
|
||||
$matchday = curr_matchday($season, $league);
|
||||
}
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$matchday_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($matchday && $row['matchday'] == $matchday) ? ' selected="selected"' : '';
|
||||
$day_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_options .= '<option value="' . $row['matchday'] . '"' . $selected . '>' . $day_name . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$matchday_name = $day_name;
|
||||
if ($matches_matchday)
|
||||
{
|
||||
$matches_on_matchday = $matches_matchday;
|
||||
}
|
||||
else
|
||||
{
|
||||
$matches_on_matchday = $row['matches'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
if ($matchday_options == '')
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_MATCHDAY'], $league_name, $season) . adm_back_link($this->u_action . "&m=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$matches_on_matchday = false;
|
||||
|
||||
$sql = 'SELECT
|
||||
COUNT(DISTINCT user_id) AS num_users
|
||||
FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$result = $db->sql_query($sql);
|
||||
$total_users = (int) $db->sql_fetchfield('num_users');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SELECT
|
||||
m.match_no,
|
||||
m.status,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_name_short AS hname,
|
||||
t2.team_name_short AS gname,
|
||||
t1.team_id AS hid,
|
||||
t2.team_id AS gid,
|
||||
m.goals_home,
|
||||
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 = 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
|
||||
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 t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON(b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
GROUP BY m.match_no
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC
|
||||
";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$matches = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$count_matches = sizeof($matches);
|
||||
if ($count_matches > 11)
|
||||
{
|
||||
$split_after = 8;
|
||||
$splits = ceil($count_matches / 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
$split_after = $count_matches;
|
||||
$splits = 1;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
if ($start < 0 || $start >= $total_users)
|
||||
{
|
||||
$start = ($start < 0) ? 0 : floor(($total_users - 1) / $this->config['football_users_per_page']) * $this->config['football_users_per_page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = floor($start / $this->config['football_users_per_page']) * $this->config['football_users_per_page'];
|
||||
}
|
||||
|
||||
$sql_start = $start * $count_matches;
|
||||
$sql_limit = $this->config['football_users_per_page'] * $count_matches;
|
||||
|
||||
// handle pagination.
|
||||
$base_url = $this->u_action . "&s=$season&l=$league&m=$matchday";
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||
|
||||
if ($count_matches > 0)
|
||||
{
|
||||
$matches_on_matchday = true;
|
||||
|
||||
$sql = "SELECT
|
||||
u.user_id,
|
||||
u.username,
|
||||
m.status,
|
||||
b.goals_home AS bet_home,
|
||||
b.goals_guest AS bet_guest,
|
||||
" . 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)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
ORDER BY LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
|
||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||
$user_bets = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$bet_index = 0;
|
||||
$split_index = 0;
|
||||
foreach ($user_bets AS $user_bet)
|
||||
{
|
||||
if ($bet_index == $count_matches)
|
||||
{
|
||||
$bet_index = 0;
|
||||
$split_index = 0;
|
||||
}
|
||||
if (!($bet_index % $split_after))
|
||||
{
|
||||
$split_index++;
|
||||
}
|
||||
$sum_total[$user_bet['username']] = 0;
|
||||
$bet_line[$split_index][] = $user_bet;
|
||||
$bet_index++;
|
||||
}
|
||||
}
|
||||
$match_index = 0;
|
||||
$last_match_index = 0;
|
||||
$split_index = 0;
|
||||
$matchday_sum_total = 0;
|
||||
$colorstyle_total = ' color_finally';
|
||||
foreach ($matches AS $match)
|
||||
{
|
||||
if (!($match_index % $split_after))
|
||||
{
|
||||
if ($match_index > 0)
|
||||
{
|
||||
$total = 0;
|
||||
$count_user = 0;
|
||||
$bet_index = 0;
|
||||
$last_match_index = 0;
|
||||
foreach ($bet_line[$split_index] AS $user_bet)
|
||||
{
|
||||
if ($bet_index == 0)
|
||||
{
|
||||
$count_user++;
|
||||
$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';
|
||||
}
|
||||
$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'];
|
||||
if ($user_bet['status'] < 3)
|
||||
{
|
||||
$colorstyle_total = ' color_provisionally';
|
||||
}
|
||||
$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 == $split_after)
|
||||
{
|
||||
$sum_total[$user_bet['username']] += $total;
|
||||
$matchday_sum_total += $total;
|
||||
$bet_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('match_panel.tendency_footer', array(
|
||||
'S_TOTAL' => false,
|
||||
)
|
||||
);
|
||||
foreach ($matches_tendency AS $match_tendency)
|
||||
{
|
||||
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
|
||||
'TENDENCY' => $match_tendency[0],
|
||||
'MATCH_ENTRY' => $match_tendency[1],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$matches_tendency = array();
|
||||
$split_index++;
|
||||
if ($split_index == $splits)
|
||||
{
|
||||
$display_total = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_total = false;
|
||||
}
|
||||
$template->assign_block_vars('match_panel', array(
|
||||
'S_TOTAL' => $display_total,
|
||||
)
|
||||
);
|
||||
}
|
||||
if (0 == $match['hid'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $match['match_no'], 'team_id_home', $match['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homename = $home_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homename = $match['hname'];
|
||||
}
|
||||
if (0 == $match['gid'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $match['match_no'], 'team_id_guest', $match['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestname = $guest_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestname = $match['gname'];
|
||||
}
|
||||
$colorstyle_match = color_style($match['status']);
|
||||
$template->assign_block_vars('match_panel.match', array(
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'RESULT' => $match['goals_home']. ':'.$match['goals_guest'],
|
||||
'COLOR_STYLE' => $colorstyle_match,
|
||||
)
|
||||
);
|
||||
|
||||
$matches_tendency[] = array($match['home'] . '-' . $match['draw'] . '-' . $match['guest'], $homename . '-' . $guestname);
|
||||
$match_index++;
|
||||
$last_match_index++;
|
||||
}
|
||||
if ($count_matches > 0)
|
||||
{
|
||||
$total = 0;
|
||||
$count_user = 0;
|
||||
$bet_index = 0;
|
||||
foreach ($bet_line[$split_index] AS $user_bet)
|
||||
{
|
||||
if ($bet_index == 0)
|
||||
{
|
||||
$count_user++;
|
||||
$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';
|
||||
}
|
||||
$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'];
|
||||
if ($user_bet['status'] < 3)
|
||||
{
|
||||
$colorstyle_total = ' color_provisionally';
|
||||
}
|
||||
$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)
|
||||
{
|
||||
$sum_total[$user_bet['username']] += $total;
|
||||
$matchday_sum_total += $total;
|
||||
$template->assign_block_vars('match_panel.user_row.points', array(
|
||||
'COLOR_STYLE' => $colorstyle_total,
|
||||
'POINTS_TOTAL' => $sum_total[$user_bet['username']],
|
||||
)
|
||||
);
|
||||
$bet_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('match_panel.tendency_footer', array(
|
||||
'S_TOTAL' => true,
|
||||
'COLOR_STYLE' => $colorstyle_total, //currently ignored
|
||||
'SUMTOTAL' => $matchday_sum_total,
|
||||
)
|
||||
);
|
||||
foreach ($matches_tendency AS $match_tendency)
|
||||
{
|
||||
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
|
||||
'TENDENCY' => $match_tendency[0],
|
||||
'MATCH_ENTRY' => $match_tendency[1],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//extra bets
|
||||
// Calculate extra bets of matchday
|
||||
$sql_start = $start;
|
||||
$sql_limit = $this->config['football_users_per_page'];
|
||||
$sql = "SELECT e.*,
|
||||
t1.team_name AS result_team
|
||||
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)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
AND e.matchday = $matchday
|
||||
ORDER BY e.extra_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extra_no = $row['extra_no'];
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
$extra_colorstyle = color_style($row['extra_status']);
|
||||
|
||||
$template->assign_block_vars('extra_panel', array(
|
||||
'QUESTION' => $row['question'],
|
||||
'RESULT' => ($display_type == 1) ? $row['result_team'] : $row['result'],
|
||||
'POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
|
||||
// Get all extra bets of matchday
|
||||
$bet_number = 0;
|
||||
$sql = "SELECT u.user_id,
|
||||
u.username,
|
||||
e.*,
|
||||
eb.bet,
|
||||
eb.bet_points,
|
||||
t2.team_name AS bet_team
|
||||
FROM " . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
|
||||
LEFT JOIN ' . FOOTB_EXTRA . " AS e ON (e.season = b.season AND e.league = b.league AND e.matchday = $matchday AND e.extra_no = $extra_no)
|
||||
LEFT JOIN " . FOOTB_EXTRA_BETS . " AS eb ON (eb.season = b.season AND eb.league = b.league AND eb.extra_no = $extra_no AND eb.user_id = b.user_id)
|
||||
LEFT JOIN " . FOOTB_TEAMS . " AS t2 ON (t2.season = b.season AND t2.league = b.league AND t2.team_id = eb.bet)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND b.match_no = 1
|
||||
GROUP by b.user_id
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
$result_bet = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||
|
||||
while ($user_row = $db->sql_fetchrow($result_bet))
|
||||
{
|
||||
$bet_number++ ;
|
||||
$row_class = (!($bet_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($user_row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
|
||||
$bet = ($user_row['bet'] == '') ? ' ' : $user_row['bet'];
|
||||
$bet_team = ($user_row['bet_team'] == NULL) ? ' ' : $user_row['bet_team'];
|
||||
|
||||
|
||||
$template->assign_block_vars('extra_panel.user_row', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'USER_NAME' => $user_row['username'],
|
||||
'BET' => ($display_type == 1) ? $bet_team : $bet,
|
||||
'BET_POINTS' => $user_row['bet_points'],
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$legend = delivery($season, $league, $matchday);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_MATCHDAY' => $matchday,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_OPTIONS' => $league_options,
|
||||
'S_MATCHDAY_OPTIONS' => $matchday_options,
|
||||
'S_DISPLAY_ALL_BETS' => true,
|
||||
'S_MATCHES_ON_MATCHDAY' => $matches_on_matchday,
|
||||
'S_SPALTEN' => ($count_matches * 2)+2,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
||||
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
25
acp/bank_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class bank_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\bank_module',
|
||||
'title' => 'ACP_FOOTBALL_BANK_MANAGEMENT',
|
||||
'version' => '0.9.2',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_BANK_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_BANK')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
673
acp/bank_module.php
Normal file
@@ -0,0 +1,673 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class bank_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template, $phpbb_container;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_bank');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info, $functions_points;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
if (!$this->config['football_bank'])
|
||||
{
|
||||
trigger_error($user->lang['FOOTBALL_BANK_OFF'], E_USER_WARNING);
|
||||
}
|
||||
|
||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints'))
|
||||
{
|
||||
$user->add_lang_ext('dmzx/ultimatepoints', 'common');
|
||||
// Get an instance of the ultimatepoints functions_points
|
||||
$functions_points = $phpbb_container->get('dmzx.ultimatepoints.core.functions.points');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get an instance of the football functions_points
|
||||
$functions_points = $phpbb_container->get('football.football.core.functions.points');
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_football_bank';
|
||||
$this->page_title = 'ACP_FOOTBALL_BANK_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_bank';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addmembers'])) ? 'addmembers' : $this->request->variable('action', ''));
|
||||
$edit = $this->request->variable('edit', 0);
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('m', 0);
|
||||
$type = $this->request->variable('t', 0);
|
||||
$start = $this->request->variable('start', 0);
|
||||
|
||||
// Clear some vars
|
||||
$league_info = array();
|
||||
$error = array();
|
||||
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = curr_season();
|
||||
}
|
||||
// Grab basic data for season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for league, if league is set and exists
|
||||
if ($league)
|
||||
{
|
||||
$league_info = league_info($season, $league);
|
||||
}
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'bet':
|
||||
case 'deposit':
|
||||
case 'delete_wins':
|
||||
case 'pay':
|
||||
switch ($action)
|
||||
{
|
||||
case 'bet':
|
||||
$type = POINTS_BET;
|
||||
$default_matchday = 1;
|
||||
$select_win = 'l.bet_points - SUM(IF(p.points_type = ' . POINTS_BET . ', p.points, 0.00)) AS win';
|
||||
$points_var = 'BET';
|
||||
break;
|
||||
case 'deposit':
|
||||
$type = POINTS_DEPOSITED;
|
||||
$default_matchday = 1;
|
||||
$select_win = '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 win';
|
||||
$points_var = 'DEPOSIT';
|
||||
break;
|
||||
case 'delete_wins':
|
||||
$default_matchday = 0;
|
||||
$points_var = 'DELETE_WIN';
|
||||
break;
|
||||
case 'pay':
|
||||
$type = POINTS_PAID;
|
||||
$default_matchday = 1;
|
||||
$select_win = '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 win';
|
||||
$points_var = 'PAY';
|
||||
break;
|
||||
}
|
||||
|
||||
$mark_ary = $this->request->variable('markleague', array(0));
|
||||
$cash = $this->request->variable('cash', false);
|
||||
|
||||
if (sizeof($mark_ary) == 0)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUES_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$count_updates = 0;
|
||||
for ($i = 0; $i < sizeof($mark_ary); $i++)
|
||||
{
|
||||
$league = $mark_ary[$i];
|
||||
if ($action == 'delete_wins')
|
||||
{
|
||||
rollback_points(POINTS_MATCHDAY, $season, $league, 0, $cash);
|
||||
rollback_points(POINTS_SEASON, $season, $league, 0, $cash);
|
||||
rollback_points(POINTS_MOST_HITS, $season, $league, 0, $cash);
|
||||
rollback_points(POINTS_MOST_HITS_AWAY, $season, $league, 0, $cash);
|
||||
$sql = 'DELETE FROM ' . FOOTB_POINTS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND points_type IN (" . POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
$count_updates += $db->sql_affectedrows();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT b.user_id,
|
||||
$select_win
|
||||
FROM " . FOOTB_BETS . ' AS b
|
||||
JOIN ' . FOOTB_LEAGUES . " AS l ON (l.season = $season AND l.league = $league )
|
||||
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
|
||||
AND b.league = $league
|
||||
AND b.match_no = 1
|
||||
GROUP BY b.season, b.league, b.user_id
|
||||
HAVING win > 0";
|
||||
$result = $db->sql_query($sql);
|
||||
$points_ary = $db->sql_fetchrowset($result);
|
||||
if (!$default_matchday)
|
||||
{
|
||||
$matchday = (curr_matchday($season, $league) > 0) ? curr_matchday($season, $league) : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$matchday = $default_matchday;
|
||||
}
|
||||
if (sizeof($points_ary) > 0)
|
||||
{
|
||||
$count_updates += sizeof($points_ary);
|
||||
set_footb_points($type, $season, $league, $matchday, $points_ary, $cash);
|
||||
}
|
||||
}
|
||||
}
|
||||
$back_link = $this->u_action . '&s=' . $season;
|
||||
trigger_error(sprintf($user->lang['LEAGUE_' . $points_var . ($count_updates == 1 ? '' : 'S')], $count_updates) .adm_back_link($back_link));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['CONFIRM_LEAGUE_' . $points_var]), build_hidden_fields(array(
|
||||
'markleague'=> $mark_ary,
|
||||
'cash' => $cash,
|
||||
's' => $season,
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'book':
|
||||
switch ($type)
|
||||
{
|
||||
case POINTS_BET:
|
||||
$points_var = 'BET';
|
||||
break;
|
||||
case POINTS_DEPOSITED:
|
||||
$points_var = 'DEPOSIT';
|
||||
break;
|
||||
case POINTS_PAID:
|
||||
$points_var = 'PAY';
|
||||
break;
|
||||
}
|
||||
|
||||
$mark_ary = $this->request->variable('mark', array(0));
|
||||
|
||||
if (sizeof($mark_ary) == 0)
|
||||
{
|
||||
trigger_error($user->lang['NO_MEMBERS_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
$cash = $this->request->variable('cash', false);
|
||||
$newvalue_ary = $this->request->variable('newvalue', array(0.00));
|
||||
if (sizeof($newvalue_ary) == 0)
|
||||
{
|
||||
for ($i = 0; $i < sizeof($mark_ary); $i++)
|
||||
{
|
||||
$newvalue_ary[] = 1.00 * str_replace (",", ".", $this->request->variable('newvalue' . $mark_ary[$i], '0.00'));
|
||||
}
|
||||
}
|
||||
if (confirm_box(true))
|
||||
{
|
||||
for ($i = 0; $i < sizeof($mark_ary); $i++)
|
||||
{
|
||||
if ($newvalue_ary[$i] <> 0)
|
||||
{
|
||||
$points_ary[] = array('user_id' => $mark_ary[$i], 'win' => $newvalue_ary[$i]);
|
||||
}
|
||||
}
|
||||
$back_link = $this->u_action . '&action=list&s=' . $season . '&l=' . $league . '&t=' . $type . '&start=' . $start;
|
||||
if (sizeof($points_ary) > 0)
|
||||
{
|
||||
set_footb_points($type, $season, $league, $matchday, $points_ary, $cash);
|
||||
}
|
||||
trigger_error(sprintf($user->lang['LEAGUE_' . $points_var . (sizeof($points_ary) == 1 ? '' : 'S')], sizeof($points_ary)) . adm_back_link($back_link));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['CONFIRM_' . $points_var]), build_hidden_fields(array(
|
||||
'mark' => $mark_ary,
|
||||
'start' => $start,
|
||||
'cash' => $cash,
|
||||
'newvalue' => $newvalue_ary,
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
'm' => $matchday,
|
||||
't' => $type,
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'cancel':
|
||||
switch ($type)
|
||||
{
|
||||
case POINTS_BET:
|
||||
$points_var .= 'CANCEL_BET';
|
||||
break;
|
||||
case POINTS_DEPOSITED:
|
||||
$points_var .= 'CANCEL_DEPOSIT';
|
||||
break;
|
||||
case POINTS_PAID:
|
||||
$points_var .= 'CANCEL_PAY';
|
||||
break;
|
||||
}
|
||||
|
||||
$mark_ary = $this->request->variable('mark', array(0.00));
|
||||
|
||||
if (sizeof($mark_ary) == 0)
|
||||
{
|
||||
trigger_error($user->lang['NO_MEMBERS_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
$cash = $this->request->variable('cash', false);
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$count_updates = 0;
|
||||
for ($i = 0; $i < sizeof($mark_ary); $i++)
|
||||
{
|
||||
$curr_user = $mark_ary[$i];
|
||||
if ($cash)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_POINTS . " AS p
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND user_id = $curr_user
|
||||
AND points_type = $type
|
||||
AND cash = 1";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while( $row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($type == POINTS_BET OR $type == POINTS_PAID)
|
||||
{
|
||||
$functions_points->add_points($curr_user, round($row['points'],2));
|
||||
}
|
||||
if ($type == POINTS_DEPOSITED)
|
||||
{
|
||||
$functions_points->substract_points($curr_user, round($row['points'],2));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
}
|
||||
$sql = 'DELETE FROM ' . FOOTB_POINTS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND user_id = $curr_user
|
||||
AND points_type = $type";
|
||||
$result = $db->sql_query($sql);
|
||||
$count_updates += $db->sql_affectedrows();
|
||||
}
|
||||
$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));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['CONFIRM_' . $points_var]), build_hidden_fields(array(
|
||||
'mark' => $mark_ary,
|
||||
'start' => $start,
|
||||
'cash' => $cash,
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
't' => $type,
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'carryover':
|
||||
|
||||
if ($type <> POINTS_PAID)
|
||||
{
|
||||
trigger_error($user->lang['NO_VALID_CALL'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
$points_var .= 'CARRYOVER_PAY';
|
||||
$bet_points = $league_info['bet_points'];
|
||||
$league_info_next = league_info($season + 1, $league);
|
||||
if (sizeof($league_info_next) > 0)
|
||||
{
|
||||
$bet_points = $league_info_next['bet_points'];
|
||||
}
|
||||
|
||||
$mark_ary = $this->request->variable('mark', array(0));
|
||||
|
||||
if (sizeof($mark_ary) == 0)
|
||||
{
|
||||
trigger_error($user->lang['NO_MEMBERS_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
$newvalue_ary = $this->request->variable('newvalue', array(0.00));
|
||||
if (sizeof($newvalue_ary) == 0)
|
||||
{
|
||||
for ($i = 0; $i < sizeof($mark_ary); $i++)
|
||||
{
|
||||
$newvalue_ary[] = 1.00 * str_replace (",", ".", $this->request->variable('newvalue' . $mark_ary[$i], '0.00'));
|
||||
}
|
||||
}
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$count_updates = 0;
|
||||
for ($i = 0; $i < sizeof($mark_ary); $i++)
|
||||
{
|
||||
$curr_user = $mark_ary[$i];
|
||||
$carryover = ($newvalue_ary[$i] >= $bet_points) ? $bet_points : $newvalue_ary[$i];
|
||||
if ($carryover > 0)
|
||||
{
|
||||
// Payout old season
|
||||
$points_comment = sprintf($user->lang['CARRYOVER_NEW_SEASON']);
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'matchday' => (int) $matchday,
|
||||
'points_type' => POINTS_PAID,
|
||||
'user_id' => (int) $curr_user,
|
||||
'points' => round($carryover,2),
|
||||
'points_comment'=> $points_comment,
|
||||
'cash' => 1,
|
||||
);
|
||||
$sql = 'INSERT INTO ' . FOOTB_POINTS . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Deposit new season
|
||||
$points_comment = sprintf($user->lang['CARRYOVER_OLD_SEASON']);
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season + 1,
|
||||
'league' => (int) $league,
|
||||
'matchday' => 1,
|
||||
'points_type' => POINTS_DEPOSITED,
|
||||
'user_id' => (int) $curr_user,
|
||||
'points' => round($carryover,2),
|
||||
'points_comment'=> $points_comment,
|
||||
'cash' => 1,
|
||||
);
|
||||
$sql = 'INSERT INTO ' . FOOTB_POINTS . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
$count_updates++;
|
||||
}
|
||||
}
|
||||
$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));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['CONFIRM_' . $points_var]), build_hidden_fields(array(
|
||||
'mark' => $mark_ary,
|
||||
'start' => $start,
|
||||
'newvalue' => $newvalue_ary,
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
'm' => $matchday,
|
||||
't' => $type,
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'list':
|
||||
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$bet_points = $league_info['bet_points'];
|
||||
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case POINTS_BET:
|
||||
$page_type = sprintf($user->lang['DEBIT_BET']);
|
||||
$page_type_explain = sprintf($user->lang['DEBIT_BET_EXPLAIN']);
|
||||
$this->page_title = 'BET_POINTS';
|
||||
$target = sprintf($user->lang['BET_POINTS']);
|
||||
$actual = sprintf($user->lang['BOOKED']);
|
||||
$sum_target = "$bet_points AS target,";
|
||||
$sum_actual = 'SUM(IF(p.points_type = ' . POINTS_BET . ', p.points, 0.00)) AS actual,';
|
||||
$new_value = $bet_points . ' - SUM(IF(p.points_type = ' . POINTS_BET . ', p.points, 0.00)) AS new_value';
|
||||
$options = array('book' => 'BET', 'cancel' => 'CANCEL_BET');
|
||||
break;
|
||||
case POINTS_DEPOSITED:
|
||||
$page_type = sprintf($user->lang['BET_DEPOSIT']);
|
||||
$page_type_explain = sprintf($user->lang['BET_DEPOSIT_EXPLAIN']);
|
||||
$this->page_title = 'DEPOSITED';
|
||||
$target = sprintf($user->lang['BET_POINTS']);
|
||||
$actual = sprintf($user->lang['DEPOSITED']);
|
||||
$sum_target = "$bet_points AS target,";
|
||||
$sum_actual = 'SUM(IF(p.points_type = ' . POINTS_DEPOSITED . ', p.points, 0.00)) AS actual,';
|
||||
$new_value = '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_value';
|
||||
$options = array('book' => 'DEPOSITED', 'cancel' => 'CANCEL_DEPOSITED');
|
||||
break;
|
||||
case POINTS_PAID:
|
||||
$page_type = sprintf($user->lang['PAY_WINS']);
|
||||
$page_type_explain = sprintf($user->lang['PAY_WINS_EXPLAIN']);
|
||||
$this->page_title = 'PAID';
|
||||
$target = sprintf($user->lang['WINS']);
|
||||
$actual = sprintf($user->lang['PAID']);
|
||||
$sum_target = 'SUM(IF(p.points_type IN (' .
|
||||
POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY .
|
||||
'), p.points, 0.00)) AS target,';
|
||||
$sum_actual = 'SUM(IF(p.points_type = ' . POINTS_PAID . ', p.points, 0.00)) AS actual,';
|
||||
$new_value = '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_value';
|
||||
$options = array('book' => 'PAID', 'cancel' => 'CANCEL_PAID', 'carryover' => 'CARRYOVER_PAID');
|
||||
break;
|
||||
}
|
||||
|
||||
// Total number of league members
|
||||
$sql = 'SELECT
|
||||
COUNT(DISTINCT user_id) AS total_members
|
||||
FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$result = $db->sql_query($sql);
|
||||
$total_members = (int) $db->sql_fetchfield('total_members');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$s_action_options = '';
|
||||
|
||||
foreach ($options as $option => $lang)
|
||||
{
|
||||
$s_action_options .= '<option value="' . $option . '">' . $user->lang['MEMBER_' . $lang] . '</option>';
|
||||
}
|
||||
$curr_matchday = (curr_matchday($season, $league) > 0) ? curr_matchday($season, $league) : 1;
|
||||
$matchday = ($type == 1) ? 1 : $curr_matchday;
|
||||
|
||||
$base_url = $this->u_action . "&action=$action&s=$season&l=$league&m=$matchday&t=$type";
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_members, $this->config['football_users_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_LIST' => true,
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_MATCHDAY' => $matchday,
|
||||
'S_START' => $start,
|
||||
'S_SELECT_MATCHDAY' => ($type == POINTS_BET) ? false : true,
|
||||
'S_TYPE' => $type,
|
||||
'S_ACTION_OPTIONS' => $s_action_options,
|
||||
'S_CASH_POINTS' => ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints')) ? true : false,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
'TOTAL_MEMBERS' => ($total_members == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_members),
|
||||
'PAGE_NUMBER' => $pagination->on_page($total_members, $this->config['football_users_per_page'], $start),
|
||||
'LEAGUE_NAME' => $league_info['league_name']. ' ' . $season_name,
|
||||
'PAGE_TYPE' => $page_type,
|
||||
'PAGE_TYPE_EXPLAIN' => $page_type_explain,
|
||||
'BET_POINTS' => $bet_points,
|
||||
'POINTS' => $this->config['points_name'],
|
||||
'TARGET' => $target,
|
||||
'ACTUAL' => $actual,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bank', 's' => $season, 'l' => $league)),
|
||||
'U_ACTION' => $this->u_action . "&s=$season&l=$league",
|
||||
'U_BACK' => $this->u_action. "&s=$season&l=$league",
|
||||
)
|
||||
);
|
||||
|
||||
$user_points = '';
|
||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints') && $this->config['points_enable'])
|
||||
{
|
||||
$user_points = 'u.user_points,';
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_points = "0,00 AS user_points,";
|
||||
}
|
||||
|
||||
// Grab the members
|
||||
$sql = "SELECT
|
||||
b.user_id,
|
||||
u.username,
|
||||
$user_points
|
||||
$sum_target
|
||||
$sum_actual
|
||||
$new_value
|
||||
FROM " . FOOTB_BETS . ' AS b
|
||||
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)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND b.match_no = 1
|
||||
GROUP BY b.user_id
|
||||
ORDER BY u.username ASC";
|
||||
$result = $db->sql_query_limit($sql, $this->config['football_users_per_page'], $start);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('member', array(
|
||||
'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),
|
||||
'U_USER_BANK' => $helper->route('football_main_controller',array('side' => 'bank', 's' => $season, 'l' => $league, 'u' => $row['user_id'])),
|
||||
'USERNAME' => $row['username'],
|
||||
'POINTS' => $functions_points->number_format_points($row['user_points']),
|
||||
'TARGET' => $functions_points->number_format_points($row['target']),
|
||||
'ACTUAL' => $functions_points->number_format_points($row['actual']),
|
||||
'NEW_VALUE' => $functions_points->number_format_points($row['new_value']),
|
||||
'USER_ID' => $row['user_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
$options = array('bet' => 'BET', 'deposit' => 'DEPOSITED', 'delete_wins' => 'DELETE_WINS', 'pay' => 'PAID');
|
||||
$s_action_options = '';
|
||||
|
||||
foreach ($options as $option => $lang)
|
||||
{
|
||||
$s_action_options .= '<option value="' . $option . '">' . $user->lang['MEMBER_' . $lang] . '</option>';
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bank', 's' => $season)),
|
||||
'U_DLOAD_BANK_OPEN' => $helper->route('football_football_download',array('downside' => 'dload_bank_open', 's' => $season)),
|
||||
'S_SEASON' => $season,
|
||||
'S_LIST_DEPOSITED' => ($this->config['football_ult_points'] == UP_POINTS) ? false : true,
|
||||
'S_LIST_PAID' => ($this->config['football_ult_points'] == UP_POINTS) ? false : true,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_ACTION_OPTIONS' => $s_action_options,
|
||||
'S_CASH_POINTS' => ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints')) ? true : false,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
|
||||
// Get us all the league banks
|
||||
$sql = 'SELECT
|
||||
l.league,
|
||||
l.league_name,
|
||||
SUM(IF(p.points_type = ' . POINTS_BET . ', p.points, 0.00)) AS bet_points,
|
||||
SUM(IF(p.points_type = ' . POINTS_DEPOSITED . ', p.points, 0.00)) AS deposited,
|
||||
SUM(IF(p.points_type IN (' .
|
||||
POINTS_MATCHDAY . ',' . POINTS_SEASON . ',' . POINTS_MOST_HITS . ',' . POINTS_MOST_HITS_AWAY .
|
||||
'), p.points, 0.00)) AS wins,
|
||||
SUM(IF(p.points_type = ' . POINTS_PAID . ', p.points, 0.00)) AS paid
|
||||
FROM ' . FOOTB_LEAGUES . ' AS l
|
||||
LEFT JOIN ' . FOOTB_POINTS . " AS p ON (p.season = $season AND p.league = l.league)
|
||||
WHERE l.season = $season
|
||||
GROUP BY l.league
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_leagues = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$row_number = 0;
|
||||
foreach ($rows_leagues as $row_league)
|
||||
{
|
||||
$template->assign_block_vars('leagues', array(
|
||||
'LEAGUE' => $row_league['league'],
|
||||
'LEAGUE_NAME' => $row_league['league_name'],
|
||||
'BET_POINTS' => $functions_points->number_format_points($row_league['bet_points']),
|
||||
'DEPOSITED' => $functions_points->number_format_points($row_league['deposited']),
|
||||
'WINS' => $functions_points->number_format_points($row_league['wins']),
|
||||
'PAID' => $functions_points->number_format_points($row_league['paid']),
|
||||
'U_LIST_BET_POINTS' => "{$this->u_action}&action=list&s=" . $season . "&l=" .$row_league['league'] . "&t=1",
|
||||
'U_LIST_DEPOSITED' => "{$this->u_action}&action=list&s=" . $season . "&l=" .$row_league['league'] . "&t=2",
|
||||
'U_LIST_WINS' => "{$this->u_action}&action=list&s=" . $season . "&l=" .$row_league['league'] . "&t=3",
|
||||
'U_LIST_PAID' => "{$this->u_action}&action=list&s=" . $season . "&l=" .$row_league['league'] . "&t=7",
|
||||
'U_DLOAD_BANK' => $helper->route('football_football_download', array('downside' => 'dload_bank', 's' => $season, 'l' => $row_league['league'])),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
25
acp/bets_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class bets_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\bets_module',
|
||||
'title' => 'ACP_FOOTBALL_BETS_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_BETS_MANAGE', 'auth' => 'acl_a_football_editbets', 'cat' => array('ACP_FOOTBALL_BETS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
753
acp/bets_module.php
Normal file
@@ -0,0 +1,753 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class bets_module
|
||||
{
|
||||
public $u_action;
|
||||
public $ext_football_path;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_bets');
|
||||
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info, $functions_points;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->ext_football_path = $phpbb_root_path . 'ext/football/football/';
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->ext_football_path . 'includes/functions.' . $phpEx);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->ext_football_path . 'includes/constants.' . $phpEx);
|
||||
}
|
||||
|
||||
|
||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints'))
|
||||
{
|
||||
//$this->user->add_lang_ext('football/football', 'modules/points');
|
||||
// Get an instance of the ultimatepoints functions_points
|
||||
$functions_points = $phpbb_container->get('dmzx.ultimatepoints.core.functions.points');
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_football_bets';
|
||||
$this->page_title = 'ACP_FOOTBALL_BETS_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_bets';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['bet'])) ? 'bet' : $this->request->variable('action', '');
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('m', 0);
|
||||
$user_id = $this->request->variable('u', 0);
|
||||
|
||||
// Clear some vars
|
||||
$success = array();
|
||||
|
||||
// Grab current season
|
||||
$curr_season = curr_season();
|
||||
if (!$season)
|
||||
{
|
||||
$season = $curr_season;
|
||||
}
|
||||
|
||||
// Grab basic data for select season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name_short'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab current league
|
||||
if (!$league)
|
||||
{
|
||||
$league = current_league($season);
|
||||
}
|
||||
|
||||
// Grab basic data for select league
|
||||
if ($league)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$league_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||
$league_options .= '<option value="' . $row['league'] . '"' . $selected . '>' . $row['league_name'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$league_matchdays = $row['matchdays'];
|
||||
$matches_matchday = $row['matches_on_matchday'];
|
||||
$league_name = $row['league_name'];
|
||||
$league_type = $row['league_type'];
|
||||
$ko_league = ($row['league_type'] == LEAGUE_KO) ? true : false;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_LEAGUE'], $season) . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for select matchday
|
||||
if (!$matchday)
|
||||
{
|
||||
$matchday = curr_matchday($season, $league);
|
||||
}
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$matchday_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($matchday && $row['matchday'] == $matchday) ? ' selected="selected"' : '';
|
||||
$day_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_options .= '<option value="' . $row['matchday'] . '"' . $selected . '>' . $day_name . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$matchday_name = $day_name;
|
||||
if ($matches_matchday)
|
||||
{
|
||||
$matches_on_matchday = $matches_matchday;
|
||||
}
|
||||
else
|
||||
{
|
||||
$matches_on_matchday = $row['matches'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
if ($matchday_options == '')
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_MATCHDAY'], $league_name, $season) . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for select user
|
||||
if (!$user_id)
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$user_id = $user->data['user_id'];
|
||||
}
|
||||
}
|
||||
$user_options = '';
|
||||
$sql = 'SELECT
|
||||
DISTINCT u.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS w
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = w.user_id)
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while( $row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!$user_id)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
$user_id = $row['user_id'];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected = ($user_id && $row['user_id'] == $user_id) ? ' selected="selected"' : '';
|
||||
}
|
||||
$user_options .= '<option value="' . $row['user_id'] . '"' . $selected . '>' . $row['username'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$user_name = $row['username'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
switch($action)
|
||||
{
|
||||
case 'bet':
|
||||
{
|
||||
if ($season < $curr_season)
|
||||
{
|
||||
trigger_error("Diese Saison kann nicht mehr gespeichert werden!", E_USER_WARNING);
|
||||
}
|
||||
$sqlopen = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = $matchday";
|
||||
$resultopen = $db->sql_query($sqlopen);
|
||||
$count_matches = 0;
|
||||
$count_updates = 0;
|
||||
while( $row = $db->sql_fetchrow($resultopen))
|
||||
{
|
||||
$match_no = $row['match_no'];
|
||||
$goalsh = $this->request->variable('goalsh' . $match_no, 'nv');
|
||||
$goalsg = $this->request->variable('goalsg' . $match_no, 'nv');
|
||||
if ($goalsh != 'nv' AND $goalsg != 'nv')
|
||||
{
|
||||
if(($goalsh != '') AND ($goalsg != ''))
|
||||
{
|
||||
if(is_numeric($goalsh) AND is_numeric($goalsg) AND $goalsh >= 0 AND $goalsg >= 0)
|
||||
{
|
||||
if (0 == $count_matches)
|
||||
{
|
||||
$sameh = $goalsh;
|
||||
$sameg = $goalsg;
|
||||
$same = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($goalsh != $sameh OR $goalsg != $sameg)
|
||||
$same = 0;
|
||||
}
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND match_no = $match_no
|
||||
AND user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$row2 = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
if(!$row2)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'match_no' => (int) $match_no,
|
||||
'user_id' => (int) $user_id,
|
||||
'goals_home' => (int) $goalsh,
|
||||
'goals_guest' => (int) $goalsg,
|
||||
'bet_time' => time(),
|
||||
);
|
||||
$sql = 'INSERT INTO ' . FOOTB_BETS . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
$count_updates++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($row2['goals_home'] != $goalsh OR $row2['goals_guest'] != $goalsg)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'goals_home' => (int) $goalsh,
|
||||
'goals_guest' => (int) $goalsg,
|
||||
'bet_time' => time(),
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_BETS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND match_no = $match_no
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
$count_updates++;
|
||||
}
|
||||
}
|
||||
$count_matches++;
|
||||
$lastmatch_no = $match_no;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Goals unset
|
||||
$sql_ary = array(
|
||||
'goals_home' => '',
|
||||
'goals_guest' => '',
|
||||
'bet_time' => time(),
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_BETS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND match_no = $match_no
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($count_updates > 0)
|
||||
{
|
||||
if ($same AND ($count_matches > 6) AND $this->config['football_same_allowed'] == 0)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'goals_home' => (int) $goalsh + 1,
|
||||
'bet_time' => time(),
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_BETS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND match_no = $lastmatch_no
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
$success[] = sprintf($user->lang['SAMESAVED'], $count_updates);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($count_updates == 1)
|
||||
{
|
||||
$success[] = sprintf($user->lang['BETSAVED']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$success[] = sprintf($user->lang['BETSSAVED'], $count_updates);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$success[] = sprintf($user->lang['NO_BETS_SAVED']);
|
||||
}
|
||||
$db->sql_freeresult($resultopen);
|
||||
|
||||
// extra bets
|
||||
$sql = 'SELECT * FROM ' . FOOTB_EXTRA . " WHERE season = $season AND league = $league AND matchday = $matchday";
|
||||
$resultextra = $db->sql_query($sql);
|
||||
$count_extra_updates = 0;
|
||||
while( $row = $db->sql_fetchrow($resultextra))
|
||||
{
|
||||
$extra_no = $row['extra_no'];
|
||||
$extra_bet = $this->request->variable('extra' . $extra_no, 'nv');
|
||||
if ($extra_bet != 'nv')
|
||||
{
|
||||
if ($row['question_type'] == 5 && !is_numeric($extra_bet))
|
||||
{
|
||||
$extra_bet = '';
|
||||
}
|
||||
if ($extra_bet != '')
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . FOOTB_EXTRA_BETS . " WHERE season = $season AND league = $league AND extra_no = $extra_no and user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$row2 = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
if(!$row2)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'extra_no' => (int) $extra_no,
|
||||
'user_id' => (int) $user_id,
|
||||
'bet' => $extra_bet,
|
||||
'bet_points' => 0,
|
||||
);
|
||||
$sql = 'INSERT INTO ' . FOOTB_EXTRA_BETS . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_ary = array(
|
||||
'bet' => $extra_bet,
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_EXTRA_BETS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND extra_no = $extra_no AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$count_extra_updates++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// extra bet unset
|
||||
$sql_ary = array(
|
||||
'bet' => '',
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_EXTRA_BETS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND extra_no = $extra_no AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($count_extra_updates)
|
||||
{
|
||||
$success[] = sprintf($user->lang['EXTRA_BET' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
||||
}
|
||||
$league_info = league_info($season, $league);
|
||||
$cash = $this->request->variable('cash', false);
|
||||
save_ranking_matchday($season, $league, $matchday, $cash);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$data_group = false;
|
||||
$matchnumber = 0;
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
|
||||
// Calculate matches and bets of matchday
|
||||
$sql = "SELECT
|
||||
s.league,
|
||||
s.match_no,
|
||||
s.matchday,
|
||||
s.status,
|
||||
s.group_id,
|
||||
s.formula_home,
|
||||
s.formula_guest,
|
||||
v1.team_symbol AS logo_home,
|
||||
v2.team_symbol AS logo_guest,
|
||||
v1.team_id AS hid,
|
||||
v2.team_id AS gid,
|
||||
v1.team_name AS hname,
|
||||
v2.team_name AS gname,
|
||||
w.bet_time,
|
||||
w.goals_home AS bet_home,
|
||||
w.goals_guest AS bet_guest,
|
||||
s.goals_home,
|
||||
s.goals_guest,
|
||||
CONCAT(
|
||||
CASE DATE_FORMAT(s.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(s.match_datetime,' %d.%m. %H:%i')
|
||||
) AS match_time
|
||||
FROM " . FOOTB_MATCHES . ' AS s
|
||||
INNER JOIN ' . FOOTB_BETS . " AS w ON (w.season = s.season AND w.league = s.league AND w.match_no = s.match_no AND w.user_id = $user_id)
|
||||
LEFT JOIN " . FOOTB_TEAMS . ' AS v1 ON (v1.season = s.season AND v1.league = s.league AND v1.team_id = s.team_id_home)
|
||||
LEFT JOIN ' . FOOTB_TEAMS . " AS v2 ON (v2.season = s.season AND v2.league = s.league AND v2.team_id = s.team_id_guest)
|
||||
WHERE s.season = $season
|
||||
AND s.league = $league
|
||||
AND s.matchday = $matchday
|
||||
GROUP BY s.match_no
|
||||
ORDER BY s.match_datetime ASC, s.match_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$matchnumber++ ;
|
||||
$class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$display_link = true;
|
||||
|
||||
if (0 == $row['hid'])
|
||||
{
|
||||
$display_link = false;
|
||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homelogo = $home_in_array[0];
|
||||
$homeid = $home_in_array[1];
|
||||
$homename = $home_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homelogo = $row['logo_home'];
|
||||
$homeid = $row['hid'];
|
||||
$homename = $row['hname'];
|
||||
}
|
||||
|
||||
if (0 == $row['gid'])
|
||||
{
|
||||
$display_link = false;
|
||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestlogo = $guest_in_array[0];
|
||||
$guestid = $guest_in_array[1];
|
||||
$guestname = $guest_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestlogo = $row['logo_guest'];
|
||||
$guestid = $row['gid'];
|
||||
$guestname = $row['gname'];
|
||||
}
|
||||
|
||||
if ($homelogo <> '')
|
||||
{
|
||||
$logoH = "<img src=\"". $this->ext_football_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoH = "<img src=\"". $this->ext_football_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($guestlogo <> '')
|
||||
{
|
||||
$logoG = "<img src=\"". $this->ext_football_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoG = "<img src=\"". $this->ext_football_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($row['status'] == -1)
|
||||
{
|
||||
$delivertag = "<strong style='color:green'>*</strong>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($row['status'] == -2)
|
||||
{
|
||||
$delivertag = "<strong style='color:green'>**</strong>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$delivertag = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['group_id'] == '')
|
||||
{
|
||||
$group_id = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_group = true;
|
||||
$group_id = $row['group_id'];
|
||||
}
|
||||
|
||||
$template->assign_block_vars('bet_edit', array(
|
||||
'ROW_CLASS' => $class,
|
||||
'LEAGUE_ID' => $row['league'],
|
||||
'MATCH_NUMBER' => $row['match_no'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'STATUS' => $row['status'],
|
||||
'MATCH_TIME' => $row['match_time'],
|
||||
'GROUP' => $group_id,
|
||||
'HOME_ID' => $homeid,
|
||||
'GUEST_ID' => $guestid,
|
||||
'LOGO_HOME' => $logoH,
|
||||
'LOGO_GUEST' => $logoG,
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'BET_HOME' => $row['bet_home'],
|
||||
'BET_GUEST' => $row['bet_guest'],
|
||||
'DELIVERTAG' => $delivertag,
|
||||
'GOALS_HOME' => ($row['goals_home'] == '') ? ' ' : $row['goals_home'],
|
||||
'GOALS_GUEST' => ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'],
|
||||
'BET_TIME' => ($row['bet_time'] == 0) ? '' : $user->format_date($row['bet_time']),
|
||||
'DISPLAY_LINK' => $display_link,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Calculate extra bets of matchday
|
||||
// Start select team
|
||||
$sql = 'SELECT
|
||||
team_id AS option_value,
|
||||
team_name AS option_name
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY team_name ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$option_rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SELECT e.*,
|
||||
eb.bet,
|
||||
eb.bet_points,
|
||||
t1.team_name AS result_team,
|
||||
t2.team_name AS bet_team
|
||||
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 = $user_id)
|
||||
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)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
AND e.matchday = $matchday
|
||||
ORDER BY e.extra_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$extra_bet = false;
|
||||
$extra_edit = false;
|
||||
$extra_results = false;
|
||||
$extranumber = 0;
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extra_bet = true;
|
||||
$extranumber++ ;
|
||||
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// edit extra bets
|
||||
$extra_edit = true;
|
||||
$bet_extra = ($row['bet_team'] == NULL) ? '' : $row['bet_team'];
|
||||
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '3':
|
||||
case '4':
|
||||
{
|
||||
$option_arr = array();
|
||||
for ($i = 65; $i <= 72; $i++)
|
||||
{
|
||||
if (strstr($row['question'], chr($i) . ':'))
|
||||
{
|
||||
$option_arr[] = array(
|
||||
'option_value' => chr($i),
|
||||
'option_name' => chr($i),
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( sizeof($option_arr) > 1 )
|
||||
{
|
||||
$display_type = 1;
|
||||
$option_rows = $option_arr;
|
||||
$bet_extra = $row['bet'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('extra_edit', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'EXTRA_NO' => $row['extra_no'],
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'BET' => ($display_type == 1) ? $bet_extra : $row['bet'],
|
||||
'S_DISPLAY_TYPE' => $display_type,
|
||||
)
|
||||
);
|
||||
|
||||
if ($display_type == 1)
|
||||
{
|
||||
$selected = ($row['bet'] == '') ? ' selected="selected"' : '';
|
||||
|
||||
$template->assign_block_vars('extra_edit.extra_option', array(
|
||||
'OPTION_VALUE' => '',
|
||||
'OPTION_NAME' => sprintf($user->lang['SELECT']),
|
||||
'S_SELECTED' => $selected));
|
||||
|
||||
foreach ($option_rows as $option_row)
|
||||
{
|
||||
$selected = ($row['bet'] && $option_row['option_value'] == $row['bet']) ? ' selected="selected"' : '';
|
||||
$template->assign_block_vars('extra_edit.extra_option', array(
|
||||
'OPTION_VALUE' => $option_row['option_value'],
|
||||
'OPTION_NAME' => $option_row['option_name'],
|
||||
'S_SELECTED' => $selected));
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$legend = delivery($season, $league, $matchday);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'S_LEGEND' => $legend,
|
||||
'S_SUCCESS' => (sizeof($success)) ? true : false,
|
||||
'SUCCESS_MSG' => (sizeof($success)) ? implode('<br />', $success) : '',
|
||||
'S_CASH_POINTS' => ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints')) ? true : false,
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_MATCHDAY' => $matchday,
|
||||
'S_USER' => $user_id,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_OPTIONS' => $league_options,
|
||||
'S_MATCHDAY_OPTIONS' => $matchday_options,
|
||||
'S_USER_OPTIONS' => $user_options,
|
||||
'S_USERS' => ($user_options == '') ? false : true,
|
||||
'S_EXTRA_BET' => $extra_bet,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
25
acp/extra_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class extra_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\extra_module',
|
||||
'title' => 'ACP_FOOTBALL_EXTRA_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_EXTRA_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_EXTRA')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
463
acp/extra_module.php
Normal file
@@ -0,0 +1,463 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class extra_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_extra');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->tpl_name = 'acp_football_extra';
|
||||
$this->page_title = 'ACP_FOOTBALL_EXTRA_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_extra';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['remove'])) ? 'remove' : $this->request->variable('action', ''));
|
||||
$edit = $this->request->variable('edit', 0);
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('matchday', 0);
|
||||
$matchday_eval = $this->request->variable('matchday_eval', 0);
|
||||
$extra_no = $this->request->variable('e', 0);
|
||||
$update = (isset($_POST['update'])) ? true : false;
|
||||
|
||||
// Clear some vars
|
||||
$extra_row = array();
|
||||
$error = array();
|
||||
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = curr_season();
|
||||
}
|
||||
|
||||
// Grab basic data for select season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name_short'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab current league
|
||||
if (!$league)
|
||||
{
|
||||
$league = first_league($season, false);
|
||||
}
|
||||
|
||||
// Grab basic data for select league
|
||||
if ($league)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$league_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||
$league_options .= '<option value="' . $row['league'] . '"' . $selected . '>' . $row['league_name'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$league_matchdays = $row['matchdays'];
|
||||
$league_name = $row['league_name'];
|
||||
$league_type = $row['league_type'];
|
||||
$ko_league = ($row['league_type'] == LEAGUE_KO) ? true : false;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_LEAGUE'], $season) . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for extra bets, if extra bet is set and exists
|
||||
if ($extra_no)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_EXTRA . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND extra_no = $extra_no";
|
||||
$result = $db->sql_query($sql);
|
||||
$extra_row = $db->sql_fetchrow($result);
|
||||
$existing_extra = sizeof($extra_row);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'delete':
|
||||
if (!$season)
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$extra_no)
|
||||
{
|
||||
trigger_error($user->lang['NO_EXTRA'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$error = '';
|
||||
|
||||
if (!$auth->acl_get('a_football_delete'))
|
||||
{
|
||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
trigger_error($user->lang['EXTRA_NO_DELETE'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Delete extra
|
||||
$sql = 'DELETE FROM ' . FOOTB_EXTRA . "
|
||||
WHERE season = $season AND league = $league AND extra_no = $extra_no";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete extra bets
|
||||
$sql = 'DELETE FROM ' . FOOTB_EXTRA_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND extra_no = $extra_no";
|
||||
$db->sql_query($sql);
|
||||
|
||||
trigger_error($user->lang['EXTRA_DELETED'] . adm_back_link($this->u_action . "&s=$season&l=$league"));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['EXTRA_CONFIRM_DELETE'], $extra_row['question'], $league, $season), build_hidden_fields(array(
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
'e' => $extra_no,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$sql = "SELECT
|
||||
max(extra_no) AS max_extra_no
|
||||
FROM " . FOOTB_EXTRA . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$result = $db->sql_query($sql);
|
||||
$row_extra = $db->sql_fetchrow($result);
|
||||
$existing_extra = sizeof($row_extra);
|
||||
$db->sql_freeresult($result);
|
||||
$extra_no = ($existing_extra) ? $row_extra['max_extra_no'] + 1 : 1;
|
||||
$extra_row['extra_no'] = $extra_no;
|
||||
$extra_row['question_type'] = $this->request->variable('question_type', 3);
|
||||
$extra_row['question'] = utf8_normalize_nfc($this->request->variable('question', '', true));
|
||||
$extra_row['matchday'] = $this->request->variable('matchday', 0);
|
||||
$extra_row['matchday_eval'] = $this->request->variable('matchday_eval', 0);
|
||||
$extra_row['result'] = utf8_normalize_nfc($this->request->variable('result', ''));
|
||||
$extra_row['extra_points'] = $this->request->variable('extra_points', 0);
|
||||
$extra_row['extra_status'] = $this->request->variable('extra_status', 0);
|
||||
// No break for edit add
|
||||
case 'edit':
|
||||
$error_msg = array();
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($action == 'edit' && !$extra_no)
|
||||
{
|
||||
trigger_error($user->lang['NO_EXTRA'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$matchday = $extra_row['matchday'];
|
||||
$matchday_eval = $extra_row['matchday_eval'];
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$matchday_options = '<option value="0"' . ((!$matchday) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_MATCHDAY'] . '</option>';
|
||||
$matchday_eval_options = '<option value="0"' . ((!$matchday_eval) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_MATCHDAY'] . '</option>';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['status'] == 0 or $action == 'edit')
|
||||
{
|
||||
$selected_matchday = ($matchday && $row['matchday'] == $matchday) ? ' selected="selected"' : '';
|
||||
$selected_eval = ($matchday_eval && $row['matchday'] == $matchday_eval) ? ' selected="selected"' : '';
|
||||
$day_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_options .= '<option value="' . $row['matchday'] . '"' . $selected_matchday . '>' . $day_name . '</option>';
|
||||
$matchday_eval_options .= '<option value="' . $row['matchday'] . '"' . $selected_eval . '>' . $day_name . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$question_type_options = '';
|
||||
for($i = 1; $i<= 5; $i++)
|
||||
{
|
||||
$selected = ($i == $extra_row['question_type']) ? ' selected="selected"' : '';
|
||||
$question_type_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
|
||||
$extra_status_options = '';
|
||||
for($i = 0; $i<= 3; $i++)
|
||||
{
|
||||
$selected = ($i == $extra_row['extra_status']) ? ' selected="selected"' : '';
|
||||
$extra_status_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
{
|
||||
$data = array();
|
||||
if (!check_form_key($form_key))
|
||||
{
|
||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
$extra_row['extra_no'] = $extra_no;
|
||||
$extra_row['question_type'] = $this->request->variable('question_type', $extra_row['question_type']);
|
||||
$extra_row['question'] = $this->request->variable('question', $extra_row['question'], true);
|
||||
$extra_row['matchday'] = $this->request->variable('matchday', $extra_row['matchday']);
|
||||
$extra_row['matchday_eval'] = $this->request->variable('matchday_eval', $extra_row['matchday_eval']);
|
||||
$extra_row['extra_points'] = $this->request->variable('extra_points', $extra_row['extra_points']);
|
||||
$extra_row['extra_status'] = $this->request->variable('extra_status', $extra_row['extra_status']);
|
||||
|
||||
$data['extra_points'] = (int) $extra_row['extra_points'];
|
||||
$data['matchday'] = (int) $extra_row['matchday'];
|
||||
$data['matchday_eval'] = (int) $extra_row['matchday_eval'];
|
||||
|
||||
if ($data['matchday_eval'] < $data['matchday'])
|
||||
{
|
||||
$error[] = $user->lang['EVAL_BEFORE_DELIVERY'];
|
||||
}
|
||||
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'extra_no' => (int) $extra_no,
|
||||
'question_type' => (int) $extra_row['question_type'],
|
||||
'question' => strlen($extra_row['question']) ? $extra_row['question'] : '',
|
||||
'matchday' => (int) $extra_row['matchday'],
|
||||
'matchday_eval' => (int) $extra_row['matchday_eval'],
|
||||
'result' => $extra_row['result'],
|
||||
'extra_points' => (int) $extra_row['extra_points'],
|
||||
'extra_status' => (int) $extra_row['extra_status'],
|
||||
);
|
||||
|
||||
$var_ary = array(
|
||||
'extra_points' => array('num', false, 0, 99),
|
||||
'matchday' => array('num', false, 1),
|
||||
'matchday_eval' => array('num', false, 1),
|
||||
);
|
||||
if (!($error_vals = validate_data($data, $var_ary)))
|
||||
{
|
||||
if ($action == 'add')
|
||||
{
|
||||
$sql = 'INSERT INTO ' . FOOTB_EXTRA . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'UPDATE ' . FOOTB_EXTRA . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND extra_no = $extra_no";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
trigger_error($user->lang['EXTRA_UPDATED'] . adm_back_link($this->u_action . "&s=$season&l=$league"));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($error_vals as $error_val)
|
||||
{
|
||||
$error_msg[] = $user->lang[$error_val];
|
||||
}
|
||||
$error[] = $user->lang['EXTRA_UPDATE_FAILED'];
|
||||
$error = array_merge($error, $error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$u_back = $this->u_action . "&s=$season&l=$league";
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_ADD_EXTRA' => ($action == 'add') ? true : false,
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'S_EDIT_EXTRAS' => ($existing_extra) ? false : true,
|
||||
'S_QUESTION_TYPE_OPTIONS' => $question_type_options,
|
||||
'S_MATCHDAY_OPTIONS' => $matchday_options,
|
||||
'S_MATCHDAY_EVAL_OPTIONS' => $matchday_eval_options,
|
||||
'S_EXTRA_STATUS_OPTIONS' => $extra_status_options,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'SEASON' => $season,
|
||||
'SEASON_NAME' => $season_name,
|
||||
'LEAGUE' => $league,
|
||||
'LEAGUE_NAME' => $league_name,
|
||||
'EXTRA_NO' => $extra_no,
|
||||
'QUESTION_TYPE' => $extra_row['question_type'],
|
||||
'QUESTION' => $extra_row['question'],
|
||||
'MATCHDAY' => $extra_row['matchday'],
|
||||
'MATCHDAY_EVAL' => $extra_row['matchday_eval'],
|
||||
'MATCHDAY_OPTION' => $extra_row['matchday'],
|
||||
'MATCHDAY_EVAL' => $extra_row['matchday_eval'],
|
||||
'RESULT' => $extra_row['result'],
|
||||
'EXTRA_POINTS' => $extra_row['extra_points'],
|
||||
'EXTRA_STATUS' => $extra_row['extra_status'],
|
||||
'U_BACK' => $u_back,
|
||||
'U_ACTION' => "{$this->u_action}&action=$action&s=$season&l=$league",
|
||||
)
|
||||
);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check open matchday in league
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND status <= 0";
|
||||
$result = $db->sql_query($sql);
|
||||
$open_matchdays = sizeof($db->sql_fetchrowset($result));
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Get us all the extra
|
||||
$sql = "SELECT e.*,
|
||||
m1.matchday_name AS matchday_name,
|
||||
m2.matchday_name AS matchday_eval_name
|
||||
FROM " . FOOTB_EXTRA . ' AS e
|
||||
LEFT JOIN ' . FOOTB_MATCHDAYS . ' AS m1 ON (m1.season = e.season AND m1.league = e.league AND m1.matchday = e.matchday)
|
||||
LEFT JOIN ' . FOOTB_MATCHDAYS . " AS m2 ON (m2.season = e.season AND m2.league = e.league AND m2.matchday = e.matchday_eval)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
ORDER BY e.extra_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_extra = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet', 's' => $season, 'l' => $league)),
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_OPTIONS' => $league_options,
|
||||
'S_EXTRA_ADD' => ($open_matchdays) ? true : false,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
|
||||
// Check if the user is allowed to delete a extra.
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
$allow_delete = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$allow_delete = true;
|
||||
}
|
||||
|
||||
$row_number = 0;
|
||||
foreach ($rows_extra as $row_extra)
|
||||
{
|
||||
$row_number++;
|
||||
$row_class = (!($row_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('extras', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'EXTRA_NO' => $row_extra['extra_no'],
|
||||
'QUESTION_TYPE' => $row_extra['question_type'],
|
||||
'QUESTION' => $row_extra['question'],
|
||||
'MATCHDAY' => (strlen($row_extra['matchday_name']) > 0) ? $row_extra['matchday_name'] : $row_extra['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']),
|
||||
'MATCHDAY_EVAL' => (strlen($row_extra['matchday_name']) > 0) ? $row_extra['matchday_eval_name'] : $row_extra['matchday_eval'] . '. ' . sprintf($user->lang['MATCHDAY']),
|
||||
'EXTRA_POINTS' => $row_extra['extra_points'],
|
||||
'EXTRA_STATUS' => $row_extra['extra_status'],
|
||||
'U_EDIT' => "{$this->u_action}&action=edit&s=" . $season . "&l=" .$league . "&e=" .$row_extra['extra_no'],
|
||||
'U_DELETE' => ($allow_delete) ? "{$this->u_action}&action=delete&s=" . $season . "&l=" . $league . "&e=" . $row_extra['extra_no'] : '',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
28
acp/football_info.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class football_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\football_module',
|
||||
'title' => 'ACP_FOOTBALL_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'settings' => array('title' => 'ACP_FOOTBALL_SETTINGS', 'auth' => 'acl_a_football_config', 'cat' => array('ACP_FOOTBALL_CONFIGURATION')),
|
||||
'features' => array('title' => 'ACP_FOOTBALL_FEATURES', 'auth' => 'acl_a_football_config', 'cat' => array('ACP_FOOTBALL_CONFIGURATION')),
|
||||
'menu' => array('title' => 'ACP_FOOTBALL_MENU', 'auth' => 'acl_a_football_config', 'cat' => array('ACP_FOOTBALL_CONFIGURATION')),
|
||||
'userguide' => array('title' => 'ACP_FOOTBALL_USERGUIDE','auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_CONFIGURATION')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
426
acp/football_module.php
Normal file
@@ -0,0 +1,426 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class football_module
|
||||
{
|
||||
var $new_config = array();
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log, $phpbb_container, $version_check;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template, $phpbb_container;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'help_football');
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_football');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_container = $phpbb_container;
|
||||
$this->version_check = $this->phpbb_container->get('football.football.version.check');
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info, $phpbb_log;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
$action = $this->request->variable('action', '');
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
|
||||
$form_key = 'acp_football';
|
||||
add_form_key($form_key);
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'userguide':
|
||||
$this->page_title = 'ACP_FOOTBALL_USERGUIDE';
|
||||
$this->tpl_name = 'acp_football_userguide';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_IN_FOOTBALL_USERGUIDE' => true,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet')),
|
||||
'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP'],
|
||||
'ICON_BACK_TO_TOP' => '<img src="' . $phpbb_admin_path . 'images/icon_up.gif" style="vertical-align: middle;" alt="' . $user->lang['BACK_TO_TOP'] . '" title="' . $user->lang['BACK_TO_TOP'] . '" />',
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
));
|
||||
|
||||
// Pull the array data from the lang pack
|
||||
foreach ($user->help as $help_ary)
|
||||
{
|
||||
if ($help_ary[0] == '--')
|
||||
{
|
||||
$template->assign_block_vars('userguide_block', array(
|
||||
'BLOCK_TITLE' => $help_ary[1])
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('userguide_block.userguide_row', array(
|
||||
'USERGUIDE_QUESTION' => $help_ary[0],
|
||||
'USERGUIDE_ANSWER' => $help_ary[1])
|
||||
);
|
||||
}
|
||||
return;
|
||||
break;
|
||||
case 'settings':
|
||||
$display_vars = array(
|
||||
'title' => 'ACP_FOOTBALL_SETTINGS',
|
||||
'vars' => array(
|
||||
'legend1' => 'ACP_FOOTBALL_SETTINGS',
|
||||
'football_name' => array('lang' => 'FOOTBALL_NAME', 'validate' => 'string', 'type' => 'text:25:25', 'explain' => true),
|
||||
'football_disable' => array('lang' => 'DISABLE_FOOTBALL', 'validate' => 'bool', 'type' => 'custom', 'method' => 'football_disable', 'explain' => true),
|
||||
'football_disable_msg' => false,
|
||||
'football_fullscreen' => array('lang' => 'FOOTBALL_FULLSCREEN','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_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_info_display' => array('lang' => 'FOOTBALL_INFO', 'validate' => 'bool', 'type' => 'custom', 'method' => 'football_info', 'explain' => true),
|
||||
'football_info' => false,
|
||||
'football_win_name' => array('lang' => 'WIN_NAME', 'validate' => 'string', 'type' => 'text:6:6', 'explain' => true),
|
||||
'football_code' => array('lang' => 'FOOTBALL_CODE', 'validate' => 'string', 'type' => 'text:25:25', 'explain' => true),
|
||||
'football_style' => array('lang' => 'FOOTBALL_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false),
|
||||
'football_override_style' => array('lang' => 'FOOTBALL_OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_update_source' => array('lang' => 'FOOTBALL_UPDATE_SOURCE', 'validate' => 'string', 'type' => 'text:80:255', 'explain' => true),
|
||||
'football_update_code' => array('lang' => 'FOOTBALL_UPDATE_CODE', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true),
|
||||
|
||||
'legend2' => 'GENERAL_SETTINGS',
|
||||
'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_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),
|
||||
|
||||
'legend3' => 'ACP_SUBMIT_CHANGES',
|
||||
)
|
||||
);
|
||||
// show the extension version check on Settings page
|
||||
$this->version_check->check();
|
||||
break;
|
||||
|
||||
case 'features':
|
||||
$display_vars = array(
|
||||
'title' => 'ACP_FOOTBALL_FEATURES',
|
||||
'vars' => array(
|
||||
'legend1' => 'ACP_FOOTBALL_FEATURES',
|
||||
'football_founder_delete' => array('lang' => 'FOUNDER_DELETE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_results_at_time' => array('lang' => 'RESULTS_AT_TIME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_win_hits02' => array('lang' => 'WIN_HITS02', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_same_allowed' => array('lang' => 'SAME_ALLOWED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_season_start' => array('lang' => 'FOOTBALL_SEASON_START', 'validate' => 'int', 'type' => 'select', 'method' => 'season_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true),
|
||||
'football_view_current' => array('lang' => 'VIEW_CURRENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_view_bets' => array('lang' => 'VIEW_BETS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_view_tendencies' => array('lang' => 'VIEW_TENDENCIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_bank' => array('lang' => 'BANK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_ult_points' => array('lang' => 'ULT_POINTS', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_up_method', 'explain' => true),
|
||||
'football_ult_points_factor'=> array('lang' => 'ULT_POINTS_FACTOR', 'validate' => 'dec:3:2','type' => 'text:4:10', 'explain' => true),
|
||||
'football_remember_enable' => array('lang' => 'FOOTBALL_REMEMBER_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_remember_next_run'=> array('lang' => 'FOOTBALL_REMEMBER_NEXT_RUN','validate' => 'int', 'type' => 'custom', 'method' => 'next_run', 'explain' => true),
|
||||
|
||||
'legend2' => 'ACP_SUBMIT_CHANGES',
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'menu':
|
||||
$display_vars = array(
|
||||
'title' => 'ACP_FOOTBALL_MENU',
|
||||
'vars' => array(
|
||||
'legend1' => 'ACP_FOOTBALL_MENU',
|
||||
'football_breadcrumb' => array('lang' => 'FOOTBALL_BREADCRUMB', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_side' => array('lang' => 'FOOTBALL_SIDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_menu' => array('lang' => 'FOOTBALL_MENU', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'football_menu_link1' => array('lang' => 'MENU_LINK1', 'validate' => 'string', 'type' => 'text:80:255', 'explain' => true),
|
||||
'football_menu_desc1' => array('lang' => 'MENU_DESC1', 'validate' => 'string', 'type' => 'text:20:20', 'explain' => true),
|
||||
'football_menu_link2' => array('lang' => 'MENU_LINK2', 'validate' => 'string', 'type' => 'text:80:255', 'explain' => false),
|
||||
'football_menu_desc2' => array('lang' => 'MENU_DESC2', 'validate' => 'string', 'type' => 'text:20:20', 'explain' => false),
|
||||
'football_menu_link3' => array('lang' => 'MENU_LINK3', 'validate' => 'string', 'type' => 'text:80:255', 'explain' => false),
|
||||
'football_menu_desc3' => array('lang' => 'MENU_DESC3', 'validate' => 'string', 'type' => 'text:20:20', 'explain' => false),
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
trigger_error('NO_MODE', E_USER_ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($display_vars['lang']))
|
||||
{
|
||||
$user->add_lang($display_vars['lang']);
|
||||
}
|
||||
|
||||
$this->new_config = $this->config;
|
||||
$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc($this->request->variable('config', array('' => ''), true)) : $this->new_config;
|
||||
$error = array();
|
||||
|
||||
// We validate the complete config if whished
|
||||
validate_config_vars($display_vars['vars'], $cfg_array, $error);
|
||||
|
||||
if ($submit && !check_form_key($form_key))
|
||||
{
|
||||
$error[] = $user->lang['FORM_INVALID'];
|
||||
}
|
||||
// Do not write values if there is an error
|
||||
if (sizeof($error))
|
||||
{
|
||||
$submit = false;
|
||||
}
|
||||
|
||||
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
|
||||
foreach ($display_vars['vars'] as $this->config_name => $null)
|
||||
{
|
||||
if (!isset($cfg_array[$this->config_name]) || strpos($this->config_name, 'legend') !== false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$this->new_config[$this->config_name] = $this->config_value = $cfg_array[$this->config_name];
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
if ($this->config_name == 'football_ult_points' && $this->config_value)
|
||||
{
|
||||
$this->config->set('football_bank', 1);
|
||||
}
|
||||
if ($this->config_name == 'football_remember_enable')
|
||||
{
|
||||
$day = $this->request->variable('next_run_day', 0);
|
||||
$month = $this->request->variable('next_run_month', 0);
|
||||
$year = $this->request->variable('next_run_year', 0);
|
||||
$hour = $this->request->variable('next_run_hour', 0);
|
||||
$minute = $this->request->variable('next_run_minute', 0);
|
||||
|
||||
$next_run = mktime($hour, $minute, 0, $month, $day, $year);
|
||||
$this->config->set('football_remember_next_run', $next_run);
|
||||
}
|
||||
$this->config->set($this->config_name, $this->config_value);
|
||||
}
|
||||
}
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FOOTBALL_' . strtoupper($mode));
|
||||
|
||||
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_football';
|
||||
$this->page_title = $display_vars['title'];
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet')),
|
||||
'L_TITLE' => $user->lang[$display_vars['title']],
|
||||
'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'],
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'ERROR_MSG' => implode('<br />', $error),
|
||||
'U_ACTION' => $this->u_action,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
|
||||
// Output relevant page
|
||||
foreach ($display_vars['vars'] as $this->config_key => $vars)
|
||||
{
|
||||
if (!is_array($vars) && strpos($this->config_key, 'legend') === false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($this->config_key, 'legend') !== false)
|
||||
{
|
||||
$template->assign_block_vars('options', array(
|
||||
'S_LEGEND' => true,
|
||||
'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars,
|
||||
)
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = explode(':', $vars['type']);
|
||||
|
||||
$l_explain = '';
|
||||
if ($vars['explain'] && isset($vars['lang_explain']))
|
||||
{
|
||||
$l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
|
||||
}
|
||||
else if ($vars['explain'])
|
||||
{
|
||||
$l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
|
||||
}
|
||||
|
||||
$content = build_cfg_template($type, $this->config_key, $this->new_config, $this->config_key, $vars);
|
||||
|
||||
if (empty($content))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('options', array(
|
||||
'KEY' => $this->config_key,
|
||||
'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
|
||||
'S_EXPLAIN' => $vars['explain'],
|
||||
'TITLE_EXPLAIN' => $l_explain,
|
||||
'CONTENT' => $content,
|
||||
)
|
||||
);
|
||||
|
||||
unset($display_vars['vars'][$this->config_key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Football disable option and message
|
||||
*/
|
||||
function football_disable($value, $key)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$radio_ary = array(1 => 'YES', 0 => 'NO');
|
||||
|
||||
return h_radio('config[football_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[football_disable_msg]" maxlength="255" size="80" value="' . $this->new_config['football_disable_msg'] . '" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Football info option and message
|
||||
*/
|
||||
function football_info($value, $key)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$radio_ary = array(1 => 'YES', 0 => 'NO');
|
||||
|
||||
return h_radio('config[football_info_display]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[football_info]" maxlength="255" size="80" value="' . $this->new_config['football_info'] . '" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Select ultimate points method
|
||||
*/
|
||||
function select_up_method($value, $key = '')
|
||||
{
|
||||
global $user, $config;
|
||||
|
||||
$radio_ary = array(UP_NONE => 'UP_NONE', UP_WINS => 'UP_WINS', UP_POINTS => 'UP_POINTS');
|
||||
|
||||
return h_radio('config[football_ult_points]', $radio_ary, $value, $key);
|
||||
}
|
||||
|
||||
|
||||
function season_select($default = 0)
|
||||
{
|
||||
global $user, $db;
|
||||
|
||||
$sql = 'SELECT DISTINCT s.season, s.season_name_short FROM ' . FOOTB_SEASONS . ' AS s
|
||||
INNER JOIN ' . FOOTB_LEAGUES . ' AS l ON (l.season = s.season)
|
||||
INNER JOIN ' . FOOTB_MATCHDAYS . ' AS md ON (md.season = s.season AND md.league = l.league)
|
||||
WHERE 1
|
||||
ORDER BY s.season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$selected = (0 == $default) ? ' selected="selected"' : '';
|
||||
$season_options = '<option value="0"' . $selected . '>' . $user->lang['AUTO'] . '</option>';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($row['season'] == $default) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $season_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust Cronjob EMail remember next un
|
||||
*/
|
||||
function next_run($value, $key = '')
|
||||
{
|
||||
global $user, $db;
|
||||
$next_run = getdate($this->config['football_remember_next_run']);
|
||||
|
||||
// Days
|
||||
$day_options = '<select name="next_run_day" id="next_run_day">';
|
||||
for ($i = 1; $i < 32; $i++)
|
||||
{
|
||||
$selected = ($i == $next_run['mday']) ? ' selected="selected"' : '';
|
||||
$day_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
$day_options .= '</select>';
|
||||
|
||||
// Months
|
||||
$month_options = '<select name="next_run_month" id="next_run_month">';
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$selected = ($i == $next_run['mon']) ? ' selected="selected"' : '';
|
||||
$month_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
$month_options .= '</select>';
|
||||
|
||||
// Years
|
||||
$year_options = '<select name="next_run_year" id="next_run_year">';
|
||||
for ($i = date("Y"); $i < (date("Y") + 1); $i++)
|
||||
{
|
||||
$selected = ($i == $next_run['year']) ? ' selected="selected"' : '';
|
||||
$year_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
$year_options .= '</select>';
|
||||
|
||||
// Hours
|
||||
$hour_options = '<select name="next_run_hour" id="next_run_hour">';
|
||||
for ($i = 0; $i < 24; $i++)
|
||||
{
|
||||
$selected = ($i == $next_run['hours']) ? ' selected="selected"' : '';
|
||||
$hour_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
$hour_options .= '</select>';
|
||||
|
||||
// Minutes
|
||||
$minute_options = '<select name="next_run_minute" id="next_run_minute">';
|
||||
for ($i = 0; $i < 60; $i++)
|
||||
{
|
||||
$selected = ($i == $next_run['minutes']) ? ' selected="selected"' : '';
|
||||
$minute_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
$minute_options .= '</select>';
|
||||
|
||||
|
||||
return $user->lang['DAY'] . ': ' . $day_options . ' ' . $user->lang['MONTH'] . ': ' . $month_options . ' ' . $user->lang['YEAR'] . ': ' .
|
||||
$year_options . ' ' . $user->lang['HOURS'] . ': ' . $hour_options . ' ' . $user->lang['MINUTES'] . ': ' . $minute_options;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
25
acp/ko_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class ko_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\ko_module',
|
||||
'title' => 'ACP_FOOTBALL_KO_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_KO_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_KO')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
257
acp/ko_module.php
Normal file
@@ -0,0 +1,257 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class ko_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_ko');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->tpl_name = 'acp_football_ko';
|
||||
$this->page_title = 'ACP_FOOTBALL_KO_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_ko';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['update'])) ? 'update' : $this->request->variable('action', '');
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday_from = $this->request->variable('matchday_from', 0);
|
||||
$matchday_to = $this->request->variable('matchday_to', 0);
|
||||
$matchday_new = $this->request->variable('matchday_new', 0);
|
||||
$check_rank = $this->request->variable('check_rank', 0);
|
||||
$rank = $this->request->variable('rank', 2);
|
||||
$move_rank = $this->request->variable('move_rank', 3);
|
||||
$move_league = $this->request->variable('move_league', 0);
|
||||
$move_matchday = $this->request->variable('move_matchday', 8);
|
||||
|
||||
// Clear some vars
|
||||
$error = array();
|
||||
$success = array();
|
||||
|
||||
$curr_season = curr_season();
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = $curr_season;
|
||||
}
|
||||
|
||||
// Grab basic data for select season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
DISTINCT s.*
|
||||
FROM ' . FOOTB_SEASONS . ' AS s
|
||||
LEFT JOIN ' . FOOTB_LEAGUES . ' AS l ON (l.season = s.season)
|
||||
WHERE l.league_type = 2
|
||||
ORDER BY s.season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name_short'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for select league
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . '
|
||||
WHERE season = ' . $season . '
|
||||
AND league_type = ' . LEAGUE_KO . '
|
||||
ORDER BY league ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$league_options = '';
|
||||
if ($move_league == 0)
|
||||
{
|
||||
$league_move_options = '<option value="0" selected="selected">' . sprintf($user->lang['CHOOSE_LEAGUE']) . '</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$league_move_options = '<option value="0">' . sprintf($user->lang['CHOOSE_LEAGUE']) . '</option>';
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// Grab current league
|
||||
if (!$league)
|
||||
{
|
||||
$league = $row['league'];
|
||||
}
|
||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||
$league_options .= '<option value="' . $row['league'] . '"' . $selected . '>' . $row['league_name'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$league_matchdays = $row['matchdays'];
|
||||
$matches_matchday = $row['matches_on_matchday'];
|
||||
$league_name = $row['league_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected_move = ($move_league && $row['league'] == $move_league) ? ' selected="selected"' : '';
|
||||
$league_move_options .= '<option value="' . $row['league'] . '"' . $selected_move . '>' . $row['league_name'] . '</option>';
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_LEAGUE'], $season) . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for select matchday
|
||||
if (!$matchday_from)
|
||||
{
|
||||
$matchday_from = curr_matchday($season, $league);
|
||||
if ($matchday_from > 1)
|
||||
{
|
||||
$matchday_from = $matchday_from - 1;
|
||||
}
|
||||
}
|
||||
if (!$matchday_to)
|
||||
{
|
||||
$matchday_to = $matchday_from;
|
||||
}
|
||||
if (!$matchday_new)
|
||||
{
|
||||
$matchday_new = $matchday_to + 1;
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$matchday_from_options = '';
|
||||
$matchday_to_options = '';
|
||||
$matchday_new_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected_from = ($matchday_from && $row['matchday'] == $matchday_from) ? ' selected="selected"' : '';
|
||||
$selected_to = ($matchday_to && $row['matchday'] == $matchday_to) ? ' selected="selected"' : '';
|
||||
$selected_new = ($matchday_new && $row['matchday'] == $matchday_new) ? ' selected="selected"' : '';
|
||||
$day_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_from_options .= '<option value="' . $row['matchday'] . '"' . $selected_from . '>' . $day_name . '</option>';
|
||||
$matchday_to_options .= '<option value="' . $row['matchday'] . '"' . $selected_to . '>' . $day_name . '</option>';
|
||||
$matchday_new_options .= '<option value="' . $row['matchday'] . '"' . $selected_new . '>' . $day_name . '</option>';
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
if ($matchday_from_options == '')
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_MATCHDAY'], $league_name, $season) . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'update':
|
||||
{
|
||||
if ($matchday_from > $matchday_to)
|
||||
{
|
||||
$error[] = sprintf($user->lang['ERROR_FROM_TO']);
|
||||
}
|
||||
if ($matchday_new <= $matchday_to)
|
||||
{
|
||||
$error[] = sprintf($user->lang['ERROR_TARGET']);
|
||||
}
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if (1 == $check_rank)
|
||||
{
|
||||
$success = ko_group_next_round($season, $league, $matchday_from, $matchday_to, $matchday_new, $rank, $move_rank, $move_league, $move_matchday);
|
||||
}
|
||||
else
|
||||
{
|
||||
$success = ko_next_round($season, $league, $matchday_from, $matchday_to, $matchday_new);
|
||||
}
|
||||
trigger_error($success . adm_back_link($this->u_action));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet', 's' => $season, 'l' => $league)),
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'S_SUCCESS' => (sizeof($success)) ? true : false,
|
||||
'SUCCESS_MSG' => (sizeof($success)) ? implode('<br />', $success) : '',
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_OPTIONS' => $league_options,
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_MATCHDAY_FROM_OPTIONS'=> $matchday_from_options,
|
||||
'S_MATCHDAY_TO_OPTIONS' => $matchday_to_options,
|
||||
'S_MATCHDAY_NEW_OPTIONS'=> $matchday_new_options,
|
||||
'S_CHECK_RANK' => $check_rank,
|
||||
'S_RANK' => $rank,
|
||||
'S_MOVE_RANK' => $move_rank,
|
||||
'S_MOVE_LEAGUE_OPTIONS' => $league_move_options,
|
||||
'S_MOVE_MATCHDAY' => $move_matchday,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
25
acp/leagues_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class leagues_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\leagues_module',
|
||||
'title' => 'ACP_FOOTBALL_LEAGUES_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_LEAGUES_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_LEAGUES')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
736
acp/leagues_module.php
Normal file
@@ -0,0 +1,736 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class leagues_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_leagues');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->tpl_name = 'acp_football_leagues';
|
||||
$this->page_title = 'ACP_FOOTBALL_LEAGUES_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_leagues';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addmembers'])) ? 'addmembers' : $this->request->variable('action', ''));
|
||||
$edit = $this->request->variable('edit', 0);
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$group_id = $this->request->variable('g', 0);
|
||||
$start = $this->request->variable('start', 0);
|
||||
$update = (isset($_POST['update'])) ? true : false;
|
||||
|
||||
// Clear some vars
|
||||
$league_info = array();
|
||||
$error = array();
|
||||
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = curr_season();
|
||||
}
|
||||
// Grab basic data for season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for league, if league is set and exists
|
||||
if ($league)
|
||||
{
|
||||
$league_info = league_info($season, $league);
|
||||
}
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'addmembers':
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$usernames = $this->request->variable('usernames', '', true);
|
||||
if ($usernames)
|
||||
{
|
||||
$username_ary = array_unique(explode("\n", $usernames));
|
||||
|
||||
// Add user/s to league
|
||||
// We need both username and user_id info
|
||||
$user_id_ary = false;
|
||||
$result = user_get_id_name($user_id_ary, $username_ary);
|
||||
|
||||
if (!sizeof($user_id_ary) || $result !== false)
|
||||
{
|
||||
trigger_error($user->lang['NO_MEMBERS_SELECTED'] . adm_back_link($this->u_action . "&action=list&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($group_id)
|
||||
{
|
||||
$sql = 'SELECT u.user_id, u.username
|
||||
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
|
||||
WHERE ug.group_id = ' . $group_id . '
|
||||
AND ug.user_pending = 0
|
||||
AND u.user_id = ug.user_id
|
||||
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
||||
ORDER BY u.user_id';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT user_id, username
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
||||
ORDER BY user_id';
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
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);
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
$username_ary[$row['user_id']] = $row['username'];
|
||||
$user_id_ary[] = $row['user_id'];
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
|
||||
if ($league_info['league_type'] == LEAGUE_KO)
|
||||
{
|
||||
// Check matchdays
|
||||
$sql = 'SELECT
|
||||
COUNT(matchday) AS matchdays
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$result = $db->sql_query($sql);
|
||||
$matchdays = (int) $db->sql_fetchfield('matchdays');
|
||||
$db->sql_freeresult($result);
|
||||
if ($matchdays < $league_info['matchdays'])
|
||||
{
|
||||
trigger_error($user->lang['NO_MATCHDAYS_KO'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($user_id_ary as $user_id)
|
||||
{
|
||||
// Test user is member
|
||||
$sql = 'SELECT
|
||||
COUNT(user_id) AS total_bets
|
||||
FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$total_bets = (int) $db->sql_fetchfield('total_bets');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($total_bets > 0)
|
||||
{
|
||||
$error[] = $user->lang['MEMBER_EXISTS'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$count_updates = join_league($season, $league, $user_id);
|
||||
}
|
||||
}
|
||||
|
||||
$back_link = $this->u_action . '&action=list&s=' . $season . '&l=' . $league;
|
||||
trigger_error($user->lang['LEAGUE_USERS_ADD'] . adm_back_link($back_link));
|
||||
break;
|
||||
case 'deletemembers':
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$mark_ary = $this->request->variable('mark', array(0));
|
||||
if (sizeof($mark_ary) == 0)
|
||||
{
|
||||
trigger_error($user->lang['NO_MEMBERS_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
if (!$auth->acl_get('a_football_delete'))
|
||||
{
|
||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
trigger_error($user->lang['SEASONS_NO_DELETE'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
// Delete bets
|
||||
$sql = 'DELETE FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND " . $db->sql_in_set('user_id', $mark_ary);
|
||||
$db->sql_query($sql);
|
||||
// Delete ranks
|
||||
$sql = 'DELETE FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND " . $db->sql_in_set('user_id', $mark_ary);
|
||||
$db->sql_query($sql);
|
||||
// Delete bank statements
|
||||
$sql = 'DELETE FROM ' . FOOTB_POINTS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND " . $db->sql_in_set('user_id', $mark_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$back_link = $this->u_action . '&action=list&s=' . $season . '&l=' . $league;
|
||||
trigger_error($user->lang['LEAGUE_USERS_REMOVE'] . adm_back_link($back_link));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['MEMBER_CONFIRM_DELETE'], $league_info['league_name'], $season), build_hidden_fields(array(
|
||||
'mark' => $mark_ary,
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'list':
|
||||
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$this->page_title = 'LEAGUE_MEMBERS';
|
||||
|
||||
// Total number of league members
|
||||
$sql = 'SELECT
|
||||
COUNT(DISTINCT user_id) AS total_members
|
||||
FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$result = $db->sql_query($sql);
|
||||
$total_members = (int) $db->sql_fetchfield('total_members');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$s_action_options = '';
|
||||
$options = array('deletemembers' => 'DELETE');
|
||||
|
||||
foreach ($options as $option => $lang)
|
||||
{
|
||||
$s_action_options .= '<option value="' . $option . '">' . $user->lang['MEMBER_' . $lang] . '</option>';
|
||||
}
|
||||
|
||||
// Exclude bots and guests...
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_name IN ('BOTS', 'GUESTS')";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$exclude = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$exclude[] = $row['group_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
|
||||
$select_list .= group_select_options($group_id, $exclude);
|
||||
$base_url = $this->u_action . "&action=list&s=$season&l=$league";
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_members, $this->config['football_users_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_LIST' => true,
|
||||
'S_ACTION_OPTIONS' => $s_action_options,
|
||||
'TOTAL_MEMBERS' => ($total_members == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_members),
|
||||
'PAGE_NUMBER' => $pagination->on_page($total_members, $this->config['football_users_per_page'], $start),
|
||||
'LEAGUE_NAME' => $league_info['league_name']. ' ' . $season_name,
|
||||
'U_ACTION' => $this->u_action . "&s=$season&l=$league",
|
||||
'U_BACK' => $this->u_action. "&s=$season&l=$league",
|
||||
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames'),
|
||||
'U_DEFAULT_ALL' => "{$this->u_action}&action=addmembers&s=$season&l=$league&g=0",
|
||||
'S_GROUP_OPTIONS' => $select_list,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
|
||||
// Grab the members
|
||||
$sql = 'SELECT
|
||||
DISTINCT u.user_id,
|
||||
u.username,
|
||||
u.username_clean,
|
||||
u.user_regdate
|
||||
FROM ' . FOOTB_BETS . ' b, ' . USERS_TABLE . " u
|
||||
WHERE b.season = $season AND b.league = $league
|
||||
AND u.user_id = b.user_id
|
||||
ORDER BY u.username_clean";
|
||||
$result = $db->sql_query_limit($sql, $this->config['football_users_per_page'], $start);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('member', array(
|
||||
'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),
|
||||
'USERNAME' => $row['username'],
|
||||
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
|
||||
'USER_ID' => $row['user_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return;
|
||||
break;
|
||||
case 'delete':
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$error = '';
|
||||
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
trigger_error($user->lang['LEAGUES_NO_DELETE'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Delete league
|
||||
$sql = 'DELETE FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete matchdays
|
||||
$sql = 'DELETE FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete matches
|
||||
$sql = 'DELETE FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete teams
|
||||
$sql = 'DELETE FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete ranks
|
||||
$sql = 'DELETE FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete bets
|
||||
$sql = 'DELETE FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$db->sql_query($sql);
|
||||
|
||||
trigger_error($user->lang['LEAGUE_DELETED'] . adm_back_link($this->u_action . "&s=$season"));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['LEAGUE_CONFIRM_DELETE'], $league_info['league_name'], $season), build_hidden_fields(array(
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
if ($league > 0 AND $league <= 99)
|
||||
{
|
||||
if ($league_info)
|
||||
{
|
||||
if ($edit)
|
||||
{
|
||||
$error[] = $user->lang['LEAGUE_TAKEN'];
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['LEAGUE_TAKEN'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
$league_info['league_name'] = utf8_normalize_nfc($this->request->variable('league_name', '', true));
|
||||
$league_info['league_name_short'] = utf8_normalize_nfc($this->request->variable('league_short', '', true));
|
||||
$league_info['league_type'] = $this->request->variable('league_type', 1, true);
|
||||
$league_info['bet_ko_type'] = $this->request->variable('bet_ko_type', 1, true);
|
||||
$league_info['matchdays'] = $this->request->variable('league_matchdays', 34, true);
|
||||
$league_info['matches_on_matchday'] = $this->request->variable('league_matches', 9, true);
|
||||
$league_info['bet_points'] = round($this->request->variable('bet_points', 0), 2);
|
||||
$league_info['win_result'] = $this->request->variable('league_win_hits', 0, true);
|
||||
$league_info['win_result_02'] = $this->request->variable('league_win_hits_away', 0, true);
|
||||
$league_info['win_matchday'] = $this->request->variable('league_win_matchdays', 0, true);
|
||||
$league_info['win_season'] = $this->request->variable('league_win_season', 0, true);
|
||||
$league_info['points_mode'] = $this->request->variable('league_points_mode', 1, true);
|
||||
$league_info['points_result'] = $this->request->variable('league_points_hit', 0, true);
|
||||
$league_info['points_tendency'] = $this->request->variable('league_points_tendency', 0, true);
|
||||
$league_info['points_diff'] = $this->request->variable('league_points_diff', 0, true);
|
||||
$league_info['points_last'] = $this->request->variable('league_points_last', 1, true);
|
||||
$league_info['join_by_user'] = $this->request->variable('league_join_by_user', 0, true);
|
||||
$league_info['join_in_season'] = $this->request->variable('league_join_in_season', 0, true);
|
||||
$league_info['bet_in_time'] = $this->request->variable('league_bet_in_time', 0, true);
|
||||
$league_info['rules_post_id'] = $this->request->variable('league_rules_post_id', 0, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['LEAGUE_NUMBER'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
// No break for edit add
|
||||
case 'edit':
|
||||
|
||||
$data = array();
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($action == 'edit' && !$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
{
|
||||
if (!check_form_key($form_key))
|
||||
{
|
||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$league_info['league_name'] = utf8_normalize_nfc($this->request->variable('league_name', '', true));
|
||||
$league_info['league_name_short'] = utf8_normalize_nfc($this->request->variable('league_short', '', true));
|
||||
$league_info['league_type'] = $this->request->variable('league_type', $league_info['league_type'], true);
|
||||
$league_info['bet_ko_type'] = $this->request->variable('bet_ko_type', $league_info['bet_ko_type'], true);
|
||||
$league_info['matchdays'] = $this->request->variable('league_matchdays', $league_info['matchdays'], true);
|
||||
$league_info['matches_on_matchday'] = $this->request->variable('league_matches', $league_info['matches_on_matchday'], true);
|
||||
$league_info['bet_points'] = round($this->request->variable('bet_points', $league_info['bet_points']),2);
|
||||
$league_info['win_result'] = $this->request->variable('league_win_hits', $league_info['win_result'], true);
|
||||
$league_info['win_result_02'] = $this->request->variable('league_win_hits_away', $league_info['win_result_02'], true);
|
||||
$league_info['win_matchday'] = $this->request->variable('league_win_matchdays', $league_info['win_matchday'], true);
|
||||
$league_info['win_season'] = $this->request->variable('league_win_season', $league_info['win_season'], true);
|
||||
$league_info['points_mode'] = $this->request->variable('league_points_mode', $league_info['points_mode'], true);
|
||||
$league_info['points_result'] = $this->request->variable('league_points_hit', $league_info['points_result'], true);
|
||||
$league_info['points_tendency'] = $this->request->variable('league_points_tendency', $league_info['points_tendency'], true);
|
||||
$league_info['points_diff'] = $this->request->variable('league_points_diff', $league_info['points_diff'], true);
|
||||
$league_info['points_last'] = $this->request->variable('league_points_last', $league_info['points_last'], true);
|
||||
$league_info['join_by_user'] = $this->request->variable('league_join_by_user', $league_info['join_by_user'], true);
|
||||
$league_info['join_in_season'] = $this->request->variable('league_join_in_season', $league_info['join_in_season'], true);
|
||||
$league_info['bet_in_time'] = $this->request->variable('league_bet_in_time', $league_info['bet_in_time'], true);
|
||||
$league_info['rules_post_id'] = $this->request->variable('league_rules_post_id', $league_info['rules_post_id'], true);
|
||||
|
||||
if (!$league_info['rules_post_id'] and $league_info['join_by_user'] == 1)
|
||||
{
|
||||
$error[] = $user->lang['CHECK_RULES_POST_ID'];
|
||||
}
|
||||
|
||||
if (!is_numeric($league_info['win_result']) or $league_info['win_result'] < 0)
|
||||
{
|
||||
$error[] = $user->lang['CHECK_HIT_WINS'];
|
||||
}
|
||||
|
||||
if (!is_numeric($league_info['win_result_02']) or $league_info['win_result_02'] < 0)
|
||||
{
|
||||
$error[] = $user->lang['CHECK_HITS02_WINS'];
|
||||
}
|
||||
|
||||
$matchday_wins = explode(';',$league_info['win_matchday']);
|
||||
foreach ($matchday_wins as $matchday_win)
|
||||
{
|
||||
if (!is_numeric($matchday_win) or $matchday_win < 0)
|
||||
{
|
||||
$error[] = $user->lang['CHECK_MATCHDAY_WINS'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$season_wins = explode(';',$league_info['win_season']);
|
||||
foreach ($season_wins as $season_win)
|
||||
{
|
||||
if (!is_numeric($season_win) or $season_win < 0)
|
||||
{
|
||||
$error[] = $user->lang['CHECK_SEASON_WINS'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'league_name' => $league_info['league_name'],
|
||||
'league_name_short' => $league_info['league_name_short'],
|
||||
'league_type' => $league_info['league_type'],
|
||||
'bet_ko_type' => $league_info['bet_ko_type'],
|
||||
'matchdays' => $league_info['matchdays'],
|
||||
'matches_on_matchday' => ($league_info['league_type'] == LEAGUE_KO) ? 0 : $league_info['matches_on_matchday'],
|
||||
'win_result' => $league_info['win_result'],
|
||||
'win_result_02' => $league_info['win_result_02'],
|
||||
'win_matchday' => $league_info['win_matchday'],
|
||||
'win_season' => $league_info['win_season'],
|
||||
'points_mode' => $league_info['points_mode'],
|
||||
'points_result' => (is_numeric($league_info['points_result'])) ? $league_info['points_result'] : 0,
|
||||
'points_tendency' => (is_numeric($league_info['points_tendency'])) ? $league_info['points_tendency'] : 0,
|
||||
'points_diff' => (is_numeric($league_info['points_diff'])) ? $league_info['points_diff'] : 0,
|
||||
'points_last' => $league_info['points_last'],
|
||||
'join_by_user' => $league_info['join_by_user'],
|
||||
'join_in_season' => $league_info['join_in_season'],
|
||||
'bet_in_time' => $league_info['bet_in_time'],
|
||||
'rules_post_id' => (is_numeric($league_info['rules_post_id'])) ? $league_info['rules_post_id'] : 0,
|
||||
'bet_points' => $league_info['bet_points'],
|
||||
);
|
||||
|
||||
$data['league'] = $league;
|
||||
$data['league_name'] = $league_info['league_name'];
|
||||
$data['league_short'] = $league_info['league_name_short'];
|
||||
$data['league_matchdays'] = $league_info['matchdays'];
|
||||
$data['league_matches'] = ($league_info['league_type'] == LEAGUE_KO) ? 0 : $league_info['matches_on_matchday'];
|
||||
|
||||
$var_ary = array(
|
||||
'league' => array('num', false, 1, 99),
|
||||
'league_name' => array('string', false, 2, 20),
|
||||
'league_short' => array('string', false, 1, 3),
|
||||
'league_matchdays' => array('num', false, 0, 99),
|
||||
'league_matches' => array('num', false, 0, 99),
|
||||
);
|
||||
if (!($error_vals = validate_data($data, $var_ary)))
|
||||
{
|
||||
if ($action == 'add')
|
||||
{
|
||||
$sql = 'INSERT INTO ' . FOOTB_LEAGUES . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'UPDATE ' . FOOTB_LEAGUES . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
if ($league_info['bet_in_time'])
|
||||
{
|
||||
set_bet_in_time_delivery($season, $league);
|
||||
}
|
||||
$message = ($action == 'edit') ? 'LEAGUE_UPDATED' : 'LEAGUE_CREATED';
|
||||
trigger_error($user->lang[$message] . adm_back_link($this->u_action . "&s=$season"));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($error_vals as $error_val)
|
||||
{
|
||||
$error_msg[] = $user->lang[$error_val];
|
||||
}
|
||||
$message = ($action == 'edit') ? 'LEAGUE_UPDATE_FAILED' : 'LEAGUE_CREATE_FAILED';
|
||||
$error[] = $user->lang[$message];
|
||||
$error = array_merge($error, $error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$type_champ = ($league_info['league_type'] == LEAGUE_CHAMP) ? ' checked="checked"' : '';
|
||||
$type_ko = ($league_info['league_type'] == LEAGUE_KO) ? ' checked="checked"' : '';
|
||||
$bet_ko_90 = ($league_info['bet_ko_type'] == BET_KO_90) ? ' checked="checked"' : '';
|
||||
$bet_ko_extratime = ($league_info['bet_ko_type'] == BET_KO_EXTRATIME) ? ' checked="checked"' : '';
|
||||
$bet_ko_penalty = ($league_info['bet_ko_type'] == BET_KO_PENALTY) ? ' checked="checked"' : '';
|
||||
$mode_options = '';
|
||||
for($i = 1; $i <= 6; $i++)
|
||||
{
|
||||
$selected = ($i == $league_info['points_mode']) ? ' selected="selected"' : '';
|
||||
$mode_options .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
|
||||
// check if matches created
|
||||
$existing_matches_on_league = count_existing_matches($season, $league, 0);
|
||||
|
||||
$u_back = $this->u_action . "&s=$season";
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_ADD_LEAGUE' => ($action == 'add') ? true : false,
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'S_EDIT_MATCHES' => ($existing_matches_on_league) ? false : true,
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'SEASON' => $season,
|
||||
'BET_IN_TIME_YES' => ($league_info['bet_in_time'] == 1) ? ' checked="checked"' : '',
|
||||
'BET_IN_TIME_NO' => ($league_info['bet_in_time'] == 0) ? ' checked="checked"' : '',
|
||||
'BET_TYPE_KO_90' => BET_KO_90,
|
||||
'BET_TYPE_KO_EXTRATIME' => BET_KO_EXTRATIME,
|
||||
'BET_TYPE_KO_PENALTY' => BET_KO_PENALTY,
|
||||
'BET_KO_90' => $bet_ko_90,
|
||||
'BET_KO_EXTRATIME' => $bet_ko_extratime,
|
||||
'BET_KO_PENALTY' => $bet_ko_penalty,
|
||||
'JOIN_BY_USER_YES' => ($league_info['join_by_user'] == 1) ? ' checked="checked"' : '',
|
||||
'JOIN_BY_USER_NO' => ($league_info['join_by_user'] == 0) ? ' checked="checked"' : '',
|
||||
'JOIN_IN_SEASON_YES' => ($league_info['join_in_season'] == 1) ? ' checked="checked"' : '',
|
||||
'JOIN_IN_SEASON_NO' => ($league_info['join_in_season'] == 0) ? ' checked="checked"' : '',
|
||||
'LEAGUE' => $league,
|
||||
'LEAGUE_NAME' => $league_info['league_name'],
|
||||
'LEAGUE_SHORT' => $league_info['league_name_short'],
|
||||
'LEAGUE_TYPE_CHAMP' => LEAGUE_CHAMP,
|
||||
'LEAGUE_TYPE_KO' => LEAGUE_KO,
|
||||
'LEAGUE_CHAMP' => $type_champ,
|
||||
'LEAGUE_KO' => $type_ko,
|
||||
'LEAGUE_MATCHDAYS' => $league_info['matchdays'],
|
||||
'LEAGUE_MATCHES' => $league_info['matches_on_matchday'],
|
||||
'LEAGUE_POINTS_MODE_OPTIONS' => $mode_options,
|
||||
'LEAGUE_POINTS_HIT' => $league_info['points_result'],
|
||||
'LEAGUE_POINTS_TENDENCY'=> $league_info['points_tendency'],
|
||||
'LEAGUE_POINTS_DIFF' => $league_info['points_diff'],
|
||||
'LEAGUE_RULES_POST_ID' => $league_info['rules_post_id'],
|
||||
'BET_POINTS' => $league_info['bet_points'],
|
||||
'LEAGUE_WIN_HITS' => $league_info['win_result'],
|
||||
'LEAGUE_WIN_HITS_AWAY' => $league_info['win_result_02'],
|
||||
'LEAGUE_WIN_MATCHDAYS' => $league_info['win_matchday'],
|
||||
'LEAGUE_WIN_SEASON' => $league_info['win_season'],
|
||||
'POINTS_LAST_YES' => ($league_info['points_last'] == 1) ? ' checked="checked"' : '',
|
||||
'POINTS_LAST_NO' => ($league_info['points_last'] == 0) ? ' checked="checked"' : '',
|
||||
'U_BACK' => $u_back,
|
||||
'U_ACTION' => "{$this->u_action}&action=$action&s=$season",
|
||||
)
|
||||
);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet', 's' => $season)),
|
||||
'S_SEASON' => $season,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_ADD' => true,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
|
||||
// Get us all the leagues
|
||||
$sql = 'SELECT
|
||||
l.season,
|
||||
l.league,
|
||||
l.league_name,
|
||||
l.league_name_short,
|
||||
COUNT(DISTINCT b.user_id) AS members
|
||||
FROM ' . FOOTB_LEAGUES . ' AS l
|
||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = l.season AND b.league = l.league)
|
||||
WHERE l.season = $season
|
||||
GROUP BY league
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_leagues = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Check if the user is allowed to delete a league.
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
$allow_delete = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$allow_delete = true;
|
||||
}
|
||||
|
||||
$row_number = 0;
|
||||
foreach ($rows_leagues as $row_league)
|
||||
{
|
||||
// check if matches created
|
||||
$existing_matches_on_league = count_existing_matches($row_league['season'], $row_league['league'], 0);
|
||||
|
||||
$row_number++;
|
||||
$row_class = (!($row_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('leagues', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'SEASON' => $row_league['season'],
|
||||
'LEAGUE' => $row_league['league'],
|
||||
'LEAGUE_NAME' => $row_league['league_name'],
|
||||
'LEAGUE_SHORT' => $row_league['league_name_short'],
|
||||
'MEMBERS' => $row_league['members'],
|
||||
'S_MEMBER' => ($existing_matches_on_league) ? true : false,
|
||||
'U_LIST' => "{$this->u_action}&action=list&s=" . $season . "&l=" .$row_league['league'],
|
||||
'U_EDIT' => "{$this->u_action}&action=edit&s=" . $season . "&l=" .$row_league['league'],
|
||||
'U_DELETE' => ($allow_delete) ? "{$this->u_action}&action=delete&s=" . $season . "&l=" . $row_league['league'] : '',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
25
acp/matchdays_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class matchdays_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\matchdays_module',
|
||||
'title' => 'ACP_FOOTBALL_MATCHDAYS_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_MATCHDAYS_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_MATCHDAYS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1134
acp/matchdays_module.php
Normal file
25
acp/matches_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class matches_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\matches_module',
|
||||
'title' => 'ACP_FOOTBALL_MATCHES_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_MATCHES_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_MATCHES')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
767
acp/matches_module.php
Normal file
@@ -0,0 +1,767 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class matches_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_matches');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->tpl_name = 'acp_football_matches';
|
||||
$this->page_title = 'ACP_FOOTBALL_MATCHES_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_matches';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['add'])) ? 'add' : $this->request->variable('action', '');
|
||||
$edit = $this->request->variable('edit', 0);
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('m', 0);
|
||||
$match_number = $this->request->variable('g', 0);
|
||||
$update = (isset($_POST['update'])) ? true : false;
|
||||
|
||||
// Clear some vars
|
||||
$match_row = array();
|
||||
$error = array();
|
||||
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = curr_season();
|
||||
}
|
||||
|
||||
// Grab basic data for select season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name_short'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab current league
|
||||
if (!$league)
|
||||
{
|
||||
$league = current_league($season, false);
|
||||
}
|
||||
|
||||
// Grab basic data for select league
|
||||
if ($league)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$league_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||
$league_options .= '<option value="' . $row['league'] . '"' . $selected . '>' . $row['league_name'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$league_info = $row;
|
||||
$league_matchdays = $row['matchdays'];
|
||||
$matches_matchday = $row['matches_on_matchday'];
|
||||
$league_name = $row['league_name'];
|
||||
$league_type = $row['league_type'];
|
||||
$ko_league = ($row['league_type'] == LEAGUE_KO) ? true : false;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_LEAGUE'], $season) . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for select matchday
|
||||
if (!$matchday)
|
||||
{
|
||||
$matchday = curr_matchday($season, $league);
|
||||
}
|
||||
$sql = 'SELECT *,
|
||||
UNIX_TIMESTAMP(delivery_date) AS unix_delivery_date
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$delivery2 = '';
|
||||
$delivery3 = '';
|
||||
$matchday_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($matchday && $row['matchday'] == $matchday) ? ' selected="selected"' : '';
|
||||
$day_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_options .= '<option value="' . $row['matchday'] . '"' . $selected . '>' . $day_name . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$unix_delivery_date = $row['unix_delivery_date'];
|
||||
$delivery2 = $row['delivery_date_2'];
|
||||
$delivery3 = $row['delivery_date_3'];
|
||||
$matchday_name = $day_name;
|
||||
if ($matches_matchday)
|
||||
{
|
||||
$matches_on_matchday = $matches_matchday;
|
||||
}
|
||||
else
|
||||
{
|
||||
$matches_on_matchday = $row['matches'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
if ($matchday_options == '')
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_MATCHDAY'], $league_name, $season) . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for match, if match is set and exists
|
||||
if ($match_number)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND match_no = $match_number";
|
||||
$result = $db->sql_query($sql);
|
||||
$match_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'delete':
|
||||
if (!$season)
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$matchday)
|
||||
{
|
||||
trigger_error($user->lang['NO_MATCHDAY'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$error = '';
|
||||
|
||||
if (!$auth->acl_get('a_football_delete'))
|
||||
{
|
||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"), E_USER_WARNING);
|
||||
}
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
trigger_error($user->lang['MATCHES_NO_DELETE'] . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Delete match
|
||||
$sql = 'DELETE FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season AND league = $league AND match_no = $match_number";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete bets
|
||||
$sql = 'DELETE FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season AND league = $league AND match_no = $match_number";
|
||||
$db->sql_query($sql);
|
||||
|
||||
trigger_error($user->lang['MATCH_DELETED'] . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['MATCH_CONFIRM_DELETE'], $match_row['match_no'], $league_name, $season), build_hidden_fields(array(
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
'm' => $matchday,
|
||||
'g' => $match_number,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$sql = "SELECT DISTINCT user_id
|
||||
FROM " . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_users = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$sql = "SELECT
|
||||
matchday,
|
||||
matches AS matches_matchday,
|
||||
delivery_date
|
||||
FROM " . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_matchdays = $db->sql_fetchrowset($result);
|
||||
$existing_matchdays = sizeof($rows_matchdays);
|
||||
$db->sql_freeresult($result);
|
||||
if ($existing_matchdays < $league_matchdays)
|
||||
{
|
||||
trigger_error($user->lang['MATCHDAY_MISSED'] . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_match = 0;
|
||||
$count_updates = 0;
|
||||
$sql_betary = array();
|
||||
foreach ($rows_matchdays as $current_matchday)
|
||||
{
|
||||
if ($matches_matchday)
|
||||
{
|
||||
$matches_on_matchday = $matches_matchday;
|
||||
}
|
||||
else
|
||||
{
|
||||
$matches_on_matchday = $current_matchday['matches_matchday'];
|
||||
}
|
||||
for ( $i = 1; $i <= $matches_on_matchday; $i++ )
|
||||
{
|
||||
$current_match++;
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'match_no' => (int) $current_match,
|
||||
'team_id_home' => 0,
|
||||
'team_id_guest' => 0,
|
||||
'goals_home' => '',
|
||||
'goals_guest' => '',
|
||||
'matchday' => $current_matchday['matchday'],
|
||||
'status' => 0,
|
||||
'odd_1' => 0,
|
||||
'odd_x' => 0,
|
||||
'odd_2' => 0,
|
||||
'rating' => 0,
|
||||
'match_datetime' => $current_matchday['delivery_date'],
|
||||
'group_id' => '',
|
||||
'formula_home' => '',
|
||||
'formula_guest' => '',
|
||||
'ko_match' => 0,
|
||||
'goals_overtime_home' => '',
|
||||
'goals_overtime_guest' => '',
|
||||
);
|
||||
$sql = 'INSERT IGNORE INTO ' . FOOTB_MATCHES . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
if ($db->sql_affectedrows())
|
||||
{
|
||||
$count_updates++;
|
||||
foreach ($rows_users as $current_user)
|
||||
{
|
||||
$sql_betary[] = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'match_no' => (int) $current_match,
|
||||
'user_id' => $current_user['user_id'],
|
||||
'goals_home' => '',
|
||||
'goals_guest' => '',
|
||||
'bet_time' => 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sizeof($sql_betary))
|
||||
{
|
||||
$db->sql_multi_insert(FOOTB_BETS, $sql_betary);
|
||||
}
|
||||
$message = ($count_updates > 1) ? 'MATCHES_CREATED' : 'MATCH_CREATED';
|
||||
trigger_error(sprintf($user->lang[$message],$count_updates) . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"));
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
$data = array();
|
||||
$error_msg = array();
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($action == 'edit' && !$match_number)
|
||||
{
|
||||
trigger_error($user->lang['NO_MATCH'] . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'mday_day' => 0,
|
||||
'mday_month' => 0,
|
||||
'mday_year' => 0,
|
||||
'mday_hour' => 0,
|
||||
'mday_min' => 0,
|
||||
);
|
||||
if ($match_row['match_datetime'])
|
||||
{
|
||||
list($data['mday_date'], $data['mday_time']) = explode(' ', $match_row['match_datetime']);
|
||||
list($data['mday_year'], $data['mday_month'], $data['mday_day']) = explode('-', $data['mday_date']);
|
||||
list($data['mday_hour'], $data['mday_min'], $data['mday_sec']) = explode(':', $data['mday_time']);
|
||||
}
|
||||
|
||||
$data['mday_day'] = $this->request->variable('mday_day', $data['mday_day']);
|
||||
$data['mday_month'] = $this->request->variable('mday_month', $data['mday_month']);
|
||||
$data['mday_year'] = $this->request->variable('mday_year', $data['mday_year']);
|
||||
$data['mday_hour'] = $this->request->variable('mday_hour', $data['mday_hour']);
|
||||
$data['mday_min'] = $this->request->variable('mday_min', $data['mday_min']);
|
||||
$data['mday_sec'] = '00';
|
||||
$data['mday_date'] = sprintf('%02d-%02d-%04d', $data['mday_day'], $data['mday_month'], $data['mday_year']);
|
||||
$data['mday_time'] = sprintf('%02d:%02d:%02d', $data['mday_hour'], $data['mday_min'], $data['mday_sec']);
|
||||
$match_row['match_datetime'] = sprintf('%04d-%02d-%02d', $data['mday_year'], $data['mday_month'], $data['mday_day']) . ' ' . $data['mday_time'];
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
{
|
||||
if (!check_form_key($form_key))
|
||||
{
|
||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$match_row['status'] = utf8_normalize_nfc($this->request->variable('match_status', '', true));
|
||||
$match_row['odd_1'] = round($this->request->variable('odd_1', $match_row['odd_1']),2);
|
||||
$match_row['odd_x'] = round($this->request->variable('odd_x', $match_row['odd_x']),2);
|
||||
$match_row['odd_2'] = round($this->request->variable('odd_2', $match_row['odd_2']),2);
|
||||
$match_row['rating'] = round($this->request->variable('rating', $match_row['rating']),2);
|
||||
$match_row['team_id_home'] = utf8_normalize_nfc($this->request->variable('team_home', '', true));
|
||||
$match_row['team_id_guest'] = utf8_normalize_nfc($this->request->variable('team_guest', '', true));
|
||||
$match_row['formula_home'] = utf8_normalize_nfc($this->request->variable('formula_home', '', true));
|
||||
$match_row['formula_guest'] = utf8_normalize_nfc($this->request->variable('formula_guest', '', true));
|
||||
$match_row['ko_match'] = $this->request->variable('match_ko', false);
|
||||
$match_row['group_id'] = ($this->request->variable('group_match', false)) ? utf8_normalize_nfc($this->request->variable('match_group', '', true)) : '';
|
||||
|
||||
if ($match_row['team_id_home'] <> '')
|
||||
{
|
||||
$team_arr = explode(';', $match_row['team_id_home']);
|
||||
$match_row['team_id_home'] = $team_arr[1];
|
||||
}
|
||||
if ($match_row['team_id_guest'] <> '')
|
||||
{
|
||||
$team_arr = explode(';', $match_row['team_id_guest']);
|
||||
$match_row['team_id_guest'] = $team_arr[1];
|
||||
}
|
||||
|
||||
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']);
|
||||
$local_board_time = time() + (($this->config['board_timezone'] - $this->config['football_host_timezone']) * 3600);
|
||||
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
|
||||
$match_row['status'] = 0;
|
||||
}
|
||||
|
||||
if ($match_timestamp <= $local_board_time AND $match_row['status'] == 0 AND $league_info['bet_in_time'] == 1)
|
||||
{
|
||||
// Bet in time and match moved to past
|
||||
$match_row['status'] = 1;
|
||||
}
|
||||
|
||||
if ($match_timestamp < $unix_delivery_date AND $match_row['status'] == 0 AND !$league_info['bet_in_time'])
|
||||
{
|
||||
// No bet in time and match moved before delivery
|
||||
$error[] = $user->lang['MATCH_BEFORE_DELIVERY'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = $user->lang['NO_MATCH_BEGIN'];
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'match_no' => (int) $match_number,
|
||||
'team_id_home' => (is_numeric($match_row['team_id_home'])) ? $match_row['team_id_home'] : 0,
|
||||
'team_id_guest' => (is_numeric($match_row['team_id_guest'])) ? $match_row['team_id_guest'] : 0,
|
||||
'goals_home' => (is_numeric($match_row['goals_home'])) ? $match_row['goals_home'] : '',
|
||||
'goals_guest' => (is_numeric($match_row['goals_guest'])) ? $match_row['goals_guest'] : '',
|
||||
'matchday' => $match_row['matchday'],
|
||||
'status' => (is_numeric($match_row['status'])) ? $match_row['status'] : 0,
|
||||
'odd_1' => (is_numeric($match_row['odd_1'])) ? $match_row['odd_1'] : 0,
|
||||
'odd_x' => (is_numeric($match_row['odd_x'])) ? $match_row['odd_x'] : 0,
|
||||
'odd_2' => (is_numeric($match_row['odd_2'])) ? $match_row['odd_2'] : 0,
|
||||
'rating' => (is_numeric($match_row['rating'])) ? $match_row['rating'] : 0,
|
||||
'match_datetime' => $match_row['match_datetime'],
|
||||
'group_id' => strlen($match_row['group_id']) ? $match_row['group_id'] : '',
|
||||
'formula_home' => strlen($match_row['formula_home']) ? $match_row['formula_home'] : '',
|
||||
'formula_guest' => strlen($match_row['formula_guest']) ? $match_row['formula_guest'] : '',
|
||||
'ko_match' => $match_row['ko_match'] ? $match_row['ko_match'] : 0,
|
||||
'goals_overtime_home' => (is_numeric($match_row['goals_overtime_home'])) ? $match_row['goals_overtime_home'] : '',
|
||||
'goals_overtime_guest' => (is_numeric($match_row['goals_overtime_guest'])) ? $match_row['goals_overtime_guest'] : '',
|
||||
);
|
||||
|
||||
|
||||
$var_ary = array(
|
||||
'mday_date' => array('date', false),
|
||||
);
|
||||
if (!($error_vals = validate_data($data, $var_ary)))
|
||||
{
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHES . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND match_no = $match_number";
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($match_timestamp > $local_board_time AND $match_row['status'] == 0 AND $league_info['bet_in_time'] == 1)
|
||||
{
|
||||
// Bet in time and match (re)open so reopen matchday and set first delivery
|
||||
$sql_ary = array(
|
||||
'status' => 0,
|
||||
'delivery_date' => first_delivery($season, $league, $matchday),
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHDAYS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND matchday = $matchday";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
if ($match_timestamp <= $local_board_time AND $match_row['status'] <= 1 AND $league_info['bet_in_time'] == 1)
|
||||
{
|
||||
// Bet in time and match is closed so reopen matchday and set first delivery
|
||||
$first_delivery = first_delivery($season, $league, $matchday);
|
||||
if ($first_delivery <> '')
|
||||
{
|
||||
// Matchday has open matches, so set matchday status = 0 and first delivery
|
||||
$sql_ary = array(
|
||||
'status' => 0,
|
||||
'delivery_date' => first_delivery($season, $league, $matchday),
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHDAYS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND matchday = $matchday";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Matchday has no open match, so set matchday status = 1
|
||||
$sql_ary = array(
|
||||
'status' => 1,
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHDAYS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND matchday = $matchday";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
trigger_error($user->lang['MATCH_UPDATED'] . adm_back_link($this->u_action . "&s=$season&l=$league&m=$matchday"));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($error_vals as $error_val)
|
||||
{
|
||||
$error_msg[] = $user->lang[$error_val];
|
||||
}
|
||||
$error[] = $user->lang['MATCH_UPDATE_FAILED'];
|
||||
$error = array_merge($error, $error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$s_matchday_day_options = '<option value="0"' . ((!$data['mday_day']) ? ' selected="selected"' : '') . '>--</option>';
|
||||
for ($i = 1; $i < 32; $i++)
|
||||
{
|
||||
$selected = ($i == $data['mday_day']) ? ' selected="selected"' : '';
|
||||
$s_matchday_day_options .= "<option value=\"" . sprintf('%02d',$i) . "\"$selected>" . sprintf('%02d',$i) . "</option>";
|
||||
}
|
||||
|
||||
$s_matchday_month_options = '<option value="0"' . ((!$data['mday_month']) ? ' selected="selected"' : '') . '>--</option>';
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$selected = ($i == $data['mday_month']) ? ' selected="selected"' : '';
|
||||
$s_matchday_month_options .= "<option value=\"" . sprintf('%02d',$i) . "\"$selected>" . sprintf('%02d',$i) . "</option>";
|
||||
}
|
||||
$s_matchday_year_options = '';
|
||||
|
||||
$s_matchday_year_options = '<option value="0"' . ((!$data['mday_year']) ? ' selected="selected"' : '') . '>--</option>';
|
||||
for ($i = $season - 1 ; $i <= $season; $i++)
|
||||
{
|
||||
$selected = ($i == $data['mday_year']) ? ' selected="selected"' : '';
|
||||
$s_matchday_year_options .= "<option value=\"$i\"$selected>$i</option>";
|
||||
}
|
||||
|
||||
$s_matchday_hour_options = '';
|
||||
if (!$data['mday_hour'])
|
||||
{
|
||||
$data['mday_hour'] = 0;
|
||||
}
|
||||
for ($i = 0; $i < 24; $i++)
|
||||
{
|
||||
$selected = ($i == $data['mday_hour']) ? ' selected="selected"' : '';
|
||||
$s_matchday_hour_options .= "<option value=\"" . sprintf('%02d',$i) . "\"$selected>" . sprintf('%02d',$i) . "</option>";
|
||||
}
|
||||
|
||||
$s_matchday_min_options = '';
|
||||
if (!$data['mday_min'])
|
||||
{
|
||||
$data['mday_min'] = 0;
|
||||
}
|
||||
for ($i = 0; $i < 12; $i++)
|
||||
{
|
||||
$selected = (($i * 5) == $data['mday_min']) ? ' selected="selected"' : '';
|
||||
$s_matchday_min_options .= "<option value=\"" . sprintf('%02d',($i * 5)) . "\"$selected>" . sprintf('%02d',($i * 5)) . "</option>";
|
||||
}
|
||||
|
||||
// Selection status
|
||||
$edit_status = false;
|
||||
if ($match_row['status'] < 1)
|
||||
{
|
||||
$edit_status = true;
|
||||
$selected_status = ($match_row['status'] == 0) ? ' selected="selected"' : '';
|
||||
$status_options = '<option value="0"' . $selected_status . '>0</option>';
|
||||
if ($delivery2 != '')
|
||||
{
|
||||
$selected_status = ($match_row['status'] == -1) ? ' selected="selected"' : '';
|
||||
$status_options .= '<option value="-1"' . $selected_status . '>-1</option>';
|
||||
if ($delivery3 != '')
|
||||
{
|
||||
$selected_status = ($match_row['status'] == -2) ? ' selected="selected"' : '';
|
||||
$status_options .= '<option value="-2"' . $selected_status . '>-2</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$status_options = '<option value="' . $row['status'] . '" selected="selected">' . $row['status'] . '</option>';
|
||||
}
|
||||
// Grab for teams for selection
|
||||
if ($ko_league)
|
||||
{
|
||||
$where_round = " AND matchday >= $matchday";
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_round = "";
|
||||
}
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
$where_round
|
||||
ORDER BY team_name ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$team_guest_options = '<option value=" ;0">' . sprintf($user->lang['UNKNOWN']) . '</option>';
|
||||
$team_home_options = '<option value=" ;0">' . sprintf($user->lang['UNKNOWN']) . '</option>';
|
||||
$match_group = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$guest_id = (empty($match_row['team_id_guest'])) ? 0 : $match_row['team_id_guest'];
|
||||
$selected_guest = ($guest_id && $row['team_id'] == $guest_id) ? ' selected="selected"' : '';
|
||||
if ($row['team_id'] == $guest_id)
|
||||
{
|
||||
$match_group = $row['group_id'];
|
||||
}
|
||||
$team_guest_options .= '<option value="' . $row['group_id'] . ';' . $row['team_id'] . '"' . $selected_guest . '>' . $row['team_name'] . '</option>';
|
||||
$home_id = (empty($match_row['team_id_home'])) ? 0 : $match_row['team_id_home'];
|
||||
$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>';
|
||||
}
|
||||
|
||||
$u_back = $this->u_action . "&s=$season&l=$league&m=$matchday";
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_ADD_MATCH' => ($action == 'add') ? true : false,
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'S_KO_LEAGUE' => $ko_league,
|
||||
'S_EDIT_STATUS' => $edit_status,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'SEASON' => $season,
|
||||
'SEASON_NAME' => $season_name,
|
||||
'LEAGUE' => $league,
|
||||
'LEAGUE_NAME' => $league_name,
|
||||
'MATCHDAY' => $matchday,
|
||||
'MATCHDAY_NAME' => $matchday_name,
|
||||
'MATCH_NUMBER' => $match_number,
|
||||
'MATCH_STATUS' => $match_row['status'],
|
||||
'STATUS_OPTIONS' => $status_options,
|
||||
'S_GROUP_CHECKED' => (strlen($match_row['group_id']) > 0) ? true : false,
|
||||
'MATCH_GROUP' => $match_group,
|
||||
'S_KO_CHECKED' => $match_row['ko_match'],
|
||||
'FORMULA_HOME' => $match_row['formula_home'],
|
||||
'FORMULA_GUEST' => $match_row['formula_guest'],
|
||||
'FORMULA_HOME' => $match_row['formula_home'],
|
||||
'TEAM_GUEST_OPTIONS' => $team_guest_options,
|
||||
'TEAM_HOME_OPTIONS' => $team_home_options,
|
||||
'S_MATCHDAY_DAY_OPTIONS' => $s_matchday_day_options,
|
||||
'S_MATCHDAY_MONTH_OPTIONS' => $s_matchday_month_options,
|
||||
'S_MATCHDAY_YEAR_OPTIONS' => $s_matchday_year_options,
|
||||
'S_MATCHDAY_HOUR_OPTIONS' => $s_matchday_hour_options,
|
||||
'S_MATCHDAY_MIN_OPTIONS' => $s_matchday_min_options,
|
||||
'MATCH_BEGIN_D' => substr($match_row['match_datetime'],8,2),
|
||||
'MATCH_BEGIN_M' => substr($match_row['match_datetime'],5,2),
|
||||
'MATCH_BEGIN_Y' => substr($match_row['match_datetime'],0,4),
|
||||
'MATCH_BEGIN_H' => substr($match_row['match_datetime'],11,2),
|
||||
'MATCH_BEGIN_MIN' => substr($match_row['match_datetime'],14,2),
|
||||
'ODD_1' => $match_row['odd_1'],
|
||||
'ODD_x' => $match_row['odd_x'],
|
||||
'ODD_2' => $match_row['odd_2'],
|
||||
'RATING' => $match_row['rating'],
|
||||
'U_BACK' => $u_back,
|
||||
'U_ACTION' => "{$this->u_action}&action=$action&s=$season&l=$league&m=$matchday",
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
// Get us all the matches
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
$sql = "SELECT
|
||||
m.match_no,
|
||||
m.status,
|
||||
m.group_id,
|
||||
m.ko_match,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
m.team_id_home AS home_id,
|
||||
m.team_id_guest AS guest_id,
|
||||
th.team_name AS home_name,
|
||||
tg.team_name AS guest_name,
|
||||
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.%y %H:%i')
|
||||
) AS match_begin
|
||||
FROM " . FOOTB_MATCHES . ' AS m
|
||||
LEFT JOIN ' . FOOTB_TEAMS . ' AS th ON (th.season = m.season AND th.league = m.league AND th.team_id = m.team_id_home)
|
||||
LEFT JOIN ' . FOOTB_TEAMS . " AS tg ON (tg.season = m.season AND tg.league = m.league AND tg.team_id = m.team_id_guest)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_matches = $db->sql_fetchrowset($result);
|
||||
$existing_matches = sizeof($rows_matches);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_KO_LEAGUE' => $ko_league,
|
||||
'S_MATCHDAY' => $matchday,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_OPTIONS' => $league_options,
|
||||
'S_MATCHDAY_OPTIONS'=> $matchday_options,
|
||||
'S_MATCH_ADD' => ($matches_on_matchday == $existing_matches) ? false:true,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
|
||||
// Check if the user is allowed to delete a match.
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
$allow_delete = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$allow_delete = true;
|
||||
}
|
||||
|
||||
$row_number = 0;
|
||||
foreach ($rows_matches as $row_match)
|
||||
{
|
||||
$row_number++;
|
||||
$row_class = (!($row_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('match', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'MATCH_NUMBER' => $row_match['match_no'],
|
||||
'MATCH_STATUS' => $row_match['status'],
|
||||
'MATCH_GROUP' => $row_match['group_id'],
|
||||
'MATCH_KO' => ($row_match['ko_match']) ? 'KO' : '',
|
||||
'MATCH_BEGIN' => $row_match['match_begin'],
|
||||
'MATCH_HOME' => ($row_match['home_name'] == '') ? $row_match['formula_home'] : $row_match['home_name'],
|
||||
'MATCH_GUEST' => ($row_match['guest_name'] == '') ? $row_match['formula_guest'] : $row_match['guest_name'],
|
||||
'U_EDIT' => "{$this->u_action}&action=edit&s=" . $season . "&l=" .$league . "&m=" .$matchday . "&g=" .$row_match['match_no'],
|
||||
'U_DELETE' => ($allow_delete) ? "{$this->u_action}&action=delete&s=" . $season . "&l=" . $league . "&m=" . $matchday . "&g=" . $row_match['match_no'] : '',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
25
acp/results_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class results_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\results_module',
|
||||
'title' => 'ACP_FOOTBALL_RESULTS_MANAGEMENT',
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_RESULTS_MANAGE', 'auth' => 'acl_a_football_results', 'cat' => array('ACP_FOOTBALL_RESULTS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
819
acp/results_module.php
Normal file
@@ -0,0 +1,819 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class results_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_results');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info, $functions_points;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints')) {
|
||||
// Get an instance of the ultimatepoints functions_points
|
||||
$functions_points = $phpbb_container->get('dmzx.ultimatepoints.core.functions.points');
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_football_results';
|
||||
$this->page_title = 'ACP_FOOTBALL_RESULTS_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_results';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['edit'])) ? 'edit' : $this->request->variable('action', '');
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('m', 0);
|
||||
$update = (isset($_POST['update'])) ? true : false;
|
||||
|
||||
// Close matchday
|
||||
close_open_matchdays();
|
||||
|
||||
// Clear some vars
|
||||
$success = array();
|
||||
|
||||
$curr_season = curr_season();
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = $curr_season;
|
||||
}
|
||||
|
||||
// Grab basic data for select season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name_short'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab current league
|
||||
if (!$league)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND status in (0,1,2,4,5)
|
||||
ORDER BY match_datetime ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$league = $row['league'];
|
||||
$matchday = $row['matchday'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$league = first_league($season);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Grab basic data for select league
|
||||
if ($league)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$league_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||
$league_options .= '<option value="' . $row['league'] . '"' . $selected . '>' . $row['league_name'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$league_info = $row;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_LEAGUE'], $season) . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab basic data for select matchday
|
||||
if (!$matchday)
|
||||
{
|
||||
$matchday = curr_matchday($season, $league);
|
||||
}
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$matchday_options = '';
|
||||
$worldfootball = false;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($matchday && $row['matchday'] == $matchday) ? ' selected="selected"' : '';
|
||||
$day_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_options .= '<option value="' . $row['matchday'] . '"' . $selected . '>' . $day_name . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$matchday_name = $day_name;
|
||||
if ($league_info['matches_on_matchday'])
|
||||
{
|
||||
$matches_on_matchday = $league_info['matches_on_matchday'];
|
||||
$worldfootball = ($row['status'] > 0) ? true : false; }
|
||||
else
|
||||
{
|
||||
$matches_on_matchday = $row['matches'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
if ($matchday_options == '')
|
||||
{
|
||||
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);
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
if ($season < $curr_season)
|
||||
{
|
||||
trigger_error("Diese Saison kann nicht mehr gespeichert werden!", E_USER_WARNING);
|
||||
}
|
||||
$sql = "SELECT * ,
|
||||
IF( match_datetime > FROM_UNIXTIME('$local_board_time'), 1, 0) As open_match
|
||||
FROM " . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = $matchday";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_matches = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$matches_on_matchday = sizeof($rows_matches);
|
||||
$count_delete = 0;
|
||||
$count_no_valuation = 0;
|
||||
$count_results = 0;
|
||||
foreach ($rows_matches as $row_match)
|
||||
{
|
||||
$match_num = $row_match['match_no'];
|
||||
$status = $row_match['status'];
|
||||
$select = $this->request->variable('select_' . $match_num, false);
|
||||
$no_valuation = $this->request->variable('no_valuation_' . $match_num, false);
|
||||
$open_match = $row_match['open_match'];
|
||||
|
||||
if ($select or $no_valuation or (!$no_valuation and $status > 3))
|
||||
{
|
||||
$goals_home = $this->request->variable('goals_home_' . $match_num, '');
|
||||
$goals_guest = $this->request->variable('goals_guest_' . $match_num, '');
|
||||
$overtime_home = $this->request->variable('overtime_home_' . $match_num, '');
|
||||
$overtime_guest = $this->request->variable('overtime_guest_' . $match_num, '');
|
||||
$delete = $this->request->variable('delete_' . $match_num, false);
|
||||
|
||||
if ($delete)
|
||||
{
|
||||
$goals_home = '';
|
||||
$goals_guest = '';
|
||||
$overtime_home = '';
|
||||
$overtime_guest = '';
|
||||
}
|
||||
if ($no_valuation)
|
||||
{
|
||||
$status = 4;
|
||||
$count_no_valuation++;
|
||||
}
|
||||
else if ($status > 3)
|
||||
{
|
||||
$status = 3;
|
||||
}
|
||||
if(is_numeric($goals_home) && is_numeric($goals_guest) && $goals_home >= 0 && $goals_guest >= 0)
|
||||
{
|
||||
if ($status <= 3)
|
||||
$status = 3;
|
||||
else
|
||||
{
|
||||
$status = 6;
|
||||
}
|
||||
$sql_ary = array(
|
||||
'goals_home' => $goals_home,
|
||||
'goals_guest' => $goals_guest,
|
||||
'status' => $status,
|
||||
'goals_overtime_home' => (!is_numeric($overtime_home) OR !is_numeric($overtime_guest)) ? '' : $overtime_home,
|
||||
'goals_overtime_guest' => (!is_numeric($overtime_home) OR !is_numeric($overtime_guest)) ? '' : $overtime_guest,
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHES . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND match_no = $match_num";
|
||||
$db->sql_query($sql);
|
||||
$count_results++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($status <= 3)
|
||||
{
|
||||
if (($league_info['bet_in_time'] == 1) and $open_match)
|
||||
{
|
||||
$status = 0;
|
||||
$sql_ary = array('status' => $status);
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHDAYS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND matchday = $matchday AND delivery_date_2 = ''";
|
||||
$db->sql_query($sql);
|
||||
$success[] = sprintf($user->lang['SET_STATUS_TO'], $status) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = 4;
|
||||
}
|
||||
$sql_ary = array(
|
||||
'goals_home' => '',
|
||||
'goals_guest' => '',
|
||||
'status' => $status,
|
||||
'goals_overtime_home' => '',
|
||||
'goals_overtime_guest' => '',
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHES . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND match_no = $match_num";
|
||||
$db->sql_query($sql);
|
||||
$count_delete++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($count_results)
|
||||
{
|
||||
$success[] = sprintf($user->lang['RESULT' . (($count_results == 1) ? '' : 'S') . '_SAVED'],$count_results) ;
|
||||
}
|
||||
if ($count_delete)
|
||||
{
|
||||
$success[] = sprintf($user->lang['RESULT' . (($count_delete == 1) ? '' : 'S') . '_DELETED'],$count_delete) ;
|
||||
}
|
||||
if ($count_no_valuation)
|
||||
{
|
||||
$success[] = sprintf($user->lang['RESULT' . (($count_delete == 1) ? '' : 'S') . '_NO_VALUATION'],$count_no_valuation) ;
|
||||
}
|
||||
|
||||
// extra bets
|
||||
$sql = 'SELECT * FROM ' . FOOTB_EXTRA . " WHERE season = $season AND league = $league AND matchday_eval = $matchday AND extra_status > 0";
|
||||
$resultextra = $db->sql_query($sql);
|
||||
$count_extra_updates = 0;
|
||||
$count_extra_delete = 0;
|
||||
$count_extra_bets = 0;
|
||||
while( $row = $db->sql_fetchrow($resultextra))
|
||||
{
|
||||
$count_extra_bets++;
|
||||
$extra_no = $row['extra_no'];
|
||||
$extra_results = $this->request->variable('extra' . $extra_no, array('nv'));
|
||||
$extra_result = '';
|
||||
if (sizeof($extra_results) > 0)
|
||||
{
|
||||
foreach ($extra_results as $extra_selected_value)
|
||||
{
|
||||
$extra_result = ($extra_result == '') ? $extra_selected_value : $extra_result . ';' . $extra_selected_value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra_result = $this->request->variable('extra' . $extra_no, 'nv');
|
||||
}
|
||||
if ($extra_result != 'nv' && $this->request->variable('select' . $extra_no, false))
|
||||
{
|
||||
if ($row['question_type'] == 5 && !is_numeric($extra_result))
|
||||
{
|
||||
$extra_result = '';
|
||||
}
|
||||
if ($extra_result != '')
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . FOOTB_EXTRA . " WHERE season = $season AND league = $league AND extra_no = $extra_no";
|
||||
$result = $db->sql_query($sql);
|
||||
$row2 = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
if($row2)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'result' => $extra_result,
|
||||
'extra_status' => 3,
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_EXTRA . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND extra_no = $extra_no";
|
||||
$db->sql_query($sql);
|
||||
$count_extra_updates++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// extra result unset
|
||||
$sql_ary = array(
|
||||
'result' => '',
|
||||
'extra_status' => 1,
|
||||
);
|
||||
$sql = 'UPDATE ' . FOOTB_EXTRA . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND extra_no = $extra_no";
|
||||
$db->sql_query($sql);
|
||||
$count_extra_delete++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($count_extra_updates)
|
||||
{
|
||||
$success[] = sprintf($user->lang['EXTRA_RESULT' . (($count_extra_updates == 1) ? '' : 'S') . '_SAVED'], $count_extra_updates);
|
||||
}
|
||||
if ($count_extra_delete)
|
||||
{
|
||||
$success[] = sprintf($user->lang['EXTRA_RESULT' . (($count_extra_delete == 1) ? '' : 'S') . '_DELETED'], $count_extra_delete);
|
||||
}
|
||||
calculate_extra_points($season, $league, $matchday, true);
|
||||
|
||||
$sql = 'Select
|
||||
MIN(status) AS min_status,
|
||||
MAX(status) AS max_status
|
||||
FROM
|
||||
((SELECT
|
||||
matchday_eval AS matchday,
|
||||
extra_status AS status
|
||||
FROM ' . FOOTB_EXTRA . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday_eval = $matchday)
|
||||
UNION
|
||||
(SELECT
|
||||
matchday,
|
||||
status
|
||||
FROM " . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = $matchday )) AS ebm
|
||||
GROUP BY matchday";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
if($row['min_status'] > 0)
|
||||
{
|
||||
if ($row['max_status'] < 3)
|
||||
{
|
||||
$new_status = $row['max_status'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($row['min_status'] > 2)
|
||||
{
|
||||
$new_status = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_status = 2;
|
||||
}
|
||||
}
|
||||
$sql_ary = array('status' => $new_status);
|
||||
$sql = 'UPDATE ' . FOOTB_MATCHDAYS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND matchday = $matchday AND delivery_date_2 = ''";
|
||||
$db->sql_query($sql);
|
||||
$success[] = sprintf($user->lang['SET_STATUS_TO'], $new_status) ;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$cash = $this->request->variable('cash', false);
|
||||
save_ranking_matchday($season, $league, $matchday, $cash);
|
||||
|
||||
// Patch delevirey
|
||||
if ($league_info['bet_in_time'] == 1)
|
||||
{
|
||||
set_bet_in_time_delivery($season, $league);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Check KO matchday
|
||||
$sql = 'SELECT
|
||||
SUM(ko_match) AS ko_matchday
|
||||
FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = $matchday
|
||||
GROUP BY matchday";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$ko_matchday = $row['ko_matchday'];
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
// Get us all the matches
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
$sql = "SELECT
|
||||
m.match_no,
|
||||
m.status,
|
||||
m.team_id_home AS home_id,
|
||||
m.team_id_guest AS guest_id,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
m.goals_home,
|
||||
m.goals_guest,
|
||||
m.goals_overtime_home,
|
||||
m.goals_overtime_guest,
|
||||
m.ko_match,
|
||||
th.team_name AS home_name,
|
||||
tg.team_name AS guest_name,
|
||||
UNIX_TIMESTAMP(m.match_datetime) AS unix_match_begin,
|
||||
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.%y %H:%i')
|
||||
) AS match_begin
|
||||
FROM " . FOOTB_MATCHES . ' AS m
|
||||
LEFT JOIN ' . FOOTB_TEAMS . ' AS th ON (th.season = m.season AND th.league = m.league AND th.team_id = m.team_id_home)
|
||||
LEFT JOIN ' . FOOTB_TEAMS . " AS tg ON (tg.season = m.season AND tg.league = m.league AND tg.team_id = m.team_id_guest)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
ORDER BY unix_match_begin ASC, m.match_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_matches = $db->sql_fetchrowset($result);
|
||||
$existing_matches = sizeof($rows_matches);
|
||||
$db->sql_freeresult($result);
|
||||
$legend = delivery($season, $league, $matchday);
|
||||
|
||||
$row_number = 0;
|
||||
foreach ($rows_matches as $row_match)
|
||||
{
|
||||
$row_number++;
|
||||
if ($this->config['football_results_at_time'])
|
||||
{
|
||||
$edit = (($row_match['unix_match_begin'] + 6300 < time()) && $row_match['status'] > 0) ? true :false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$edit = ($row_match['status'] > 0) ? true :false;
|
||||
}
|
||||
if (0 == $row_match['home_id'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $row_match['match_no'], 'team_id_home', $row_match['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homename = $home_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homename = $row_match['home_name'];
|
||||
}
|
||||
if (0 == $row_match['guest_id'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $row_match['match_no'], 'team_id_guest', $row_match['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestname = $guest_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestname = $row_match['guest_name'];
|
||||
}
|
||||
|
||||
$row_class = (!($row_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('match', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'EDIT' => $edit,
|
||||
'SELECT_CHECKED' => ($row_match['status'] > 0 AND $row_match['status'] < 3) ? ' selected="selected"' : '',
|
||||
'BEGIN' => $row_match['match_begin'],
|
||||
'NUMBER' => $row_match['match_no'],
|
||||
'STATUS' => $row_match['status'],
|
||||
'STATUS_COLOR' => color_match($row_match['status'], $row_match['status']),
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'GOALS_HOME' => $row_match['goals_home'],
|
||||
'GOALS_GUEST' => $row_match['goals_guest'],
|
||||
'OVERTIME_HOME' => $row_match['goals_overtime_home'],
|
||||
'OVERTIME_GUEST' => $row_match['goals_overtime_guest'],
|
||||
'NO_VALUATION_CHECKED' => ($row_match['status'] > 3) ? ' selected="selected"' : '',
|
||||
'KO_MATCH' => $row_match['ko_match'],
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($worldfootball AND $season >= $curr_season)
|
||||
{
|
||||
$template->assign_block_vars('worldfootball', array(
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
// Calculate extra bets of matchday
|
||||
// Start select team
|
||||
$sql = 'SELECT
|
||||
team_id AS option_value,
|
||||
team_name AS option_name
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY team_name ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$option_rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SELECT e.*,
|
||||
t1.team_name AS result_team
|
||||
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)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
AND e.matchday_eval = $matchday
|
||||
ORDER BY e.extra_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$extra_results = false;
|
||||
$extranumber = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extra_results = true;
|
||||
$extranumber++ ;
|
||||
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($row['extra_status'] > 0)
|
||||
{
|
||||
$edit_mode = true;
|
||||
$result_extra = ($row['result_team'] == NULL) ? '' : $row['result_team'];
|
||||
|
||||
$multiple = '';
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '2':
|
||||
{
|
||||
$multiple = ' multiple="multiple" size="3" ';
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$option_arr = array();
|
||||
for ($i = 65; $i <= 72; $i++)
|
||||
{
|
||||
if (strstr($row['question'], chr($i) . ':'))
|
||||
{
|
||||
$option_arr[] = array(
|
||||
'option_value' => chr($i),
|
||||
'option_name' => chr($i),
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( sizeof($option_arr) > 1 )
|
||||
{
|
||||
$display_type = 1;
|
||||
$option_rows = $option_arr;
|
||||
$result_extra = $row['result'];
|
||||
$multiple = ' multiple="multiple" size="3" ';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$option_arr = array();
|
||||
for ($i = 65; $i <= 72; $i++)
|
||||
{
|
||||
if (strstr($row['question'], chr($i) . ':'))
|
||||
{
|
||||
$option_arr[] = array(
|
||||
'option_value' => chr($i),
|
||||
'option_name' => chr($i),
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( sizeof($option_arr) > 1 )
|
||||
{
|
||||
$display_type = 1;
|
||||
$option_rows = $option_arr;
|
||||
$result_extra = $row['result'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('extra_result', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'EXTRA_NO' => $row['extra_no'],
|
||||
'S_EDIT_EXTRA' => true,
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'RESULT' => ($display_type == 1) ? $result_extra : $row['result'],
|
||||
'S_DISPLAY_TYPE' => $display_type,
|
||||
'S_MULTIPLE' => $multiple,
|
||||
'S_MULTIPLE_ARR' => ($multiple == '') ? '' : '[]',
|
||||
'STATUS' => $row['extra_status'],
|
||||
'STATUS_COLOR' => color_match($row['extra_status'], $row['extra_status']),
|
||||
)
|
||||
);
|
||||
|
||||
if ($display_type == 1)
|
||||
{
|
||||
$selected = ($row['result'] == '') ? ' selected="selected"' : '';
|
||||
|
||||
$template->assign_block_vars('extra_result.extra_option', array(
|
||||
'OPTION_VALUE' => '',
|
||||
'OPTION_NAME' => sprintf($user->lang['SELECT']),
|
||||
'S_SELECTED' => $selected));
|
||||
|
||||
foreach ($option_rows as $option_row)
|
||||
{
|
||||
if (strstr($row['result'], ';'))
|
||||
{
|
||||
$selected = '';
|
||||
$result_arr = explode(';', $row['result']);
|
||||
foreach($result_arr AS $result_value)
|
||||
{
|
||||
if ($result_value <> '')
|
||||
{
|
||||
if ($option_row['option_value'] == $result_value)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected = ($option_row['option_value'] == $row['result']) ? ' selected="selected"' : '';
|
||||
}
|
||||
$template->assign_block_vars('extra_result.extra_option', array(
|
||||
'OPTION_VALUE' => $option_row['option_value'],
|
||||
'OPTION_NAME' => $option_row['option_name'],
|
||||
'S_SELECTED' => $selected));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra_colorstyle = color_style($row['extra_status']);
|
||||
$extra_result = ($row['result'] == '') ? ' ' : $row['result'];
|
||||
$result_extra = ($row['result_team'] == NULL) ? ' ' : $row['result_team'];
|
||||
|
||||
$template->assign_block_vars('extra_result', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'S_EDIT_EXTRA' => false,
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'RESULT' => ($display_type == 1) ? $result_extra : $extra_result,
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($league_info['bet_ko_type'])
|
||||
{
|
||||
case BET_KO_90:
|
||||
$result_explain = sprintf($user->lang['MIN90']);
|
||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||
break;
|
||||
case BET_KO_EXTRATIME:
|
||||
$result_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
||||
$label_finalresult = sprintf($user->lang['PENALTY']);
|
||||
break;
|
||||
case BET_KO_PENALTY:
|
||||
$result_explain = sprintf($user->lang['PENALTY']);
|
||||
$ko_matchday = false;
|
||||
break;
|
||||
default:
|
||||
$result_explain = sprintf($user->lang['MIN90']);
|
||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'S_LEGEND' => $legend,
|
||||
'S_SUCCESS' => (sizeof($success)) ? true : false,
|
||||
'SUCCESS_MSG' => (sizeof($success)) ? implode('<br />', $success) : '',
|
||||
'RESULT_EXPLAIN' => $result_explain,
|
||||
'LABEL_FINALRESULT' => (isset($label_finalresult)) ? $label_finalresult : sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']),
|
||||
'S_CASH_POINTS' => ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints')) ? true : false,
|
||||
'S_CASH' => ($season >= $curr_season) ? true : false,
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_MATCHDAY' => $matchday,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_OPTIONS' => $league_options,
|
||||
'S_KO_MATCHDAY' => $ko_matchday,
|
||||
'S_MATCHDAY_OPTIONS'=> $matchday_options,
|
||||
'S_EXTRA_RESULTS' => $extra_results,
|
||||
'S_TIME' => sprintf($user->lang['TIME']) . ': ' . date("d.m.Y H:i", $local_board_time),
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
25
acp/seasons_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class seasons_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\seasons_module',
|
||||
'title' => 'ACP_FOOTBALL_SEASONS_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_SEASONS_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_SEASONS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
396
acp/seasons_module.php
Normal file
@@ -0,0 +1,396 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class seasons_module
|
||||
{
|
||||
public $u_action;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_seasons');
|
||||
|
||||
$this->root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions.' . $this->php_ext);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->tpl_name = 'acp_football_seasons';
|
||||
$this->page_title = 'ACP_FOOTBALL_SEASONS_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_seasons';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['add'])) ? 'add' : $this->request->variable('action', '');
|
||||
$season = $this->request->variable('s', 0);
|
||||
$edit = $this->request->variable('edit', 0);
|
||||
$update = (isset($_POST['update'])) ? true : false;
|
||||
|
||||
// Clear some vars
|
||||
$season_row = array();
|
||||
$error = array();
|
||||
|
||||
// Grab basic data for season, if season is set and exists
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . "
|
||||
WHERE season = $season";
|
||||
$result = $db->sql_query($sql);
|
||||
$season_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'delete':
|
||||
if (!$season)
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$error = '';
|
||||
if (!$auth->acl_get('a_football_delete'))
|
||||
{
|
||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
trigger_error($user->lang['SEASONS_NO_DELETE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
// Delete season
|
||||
$sql = 'DELETE FROM ' . FOOTB_SEASONS . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete leagues
|
||||
$sql = 'DELETE FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete matchdays
|
||||
$sql = 'DELETE FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete matches
|
||||
$sql = 'DELETE FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete teams
|
||||
$sql = 'DELETE FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete ranks
|
||||
$sql = 'DELETE FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete bets
|
||||
$sql = 'DELETE FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
|
||||
trigger_error($user->lang['SEASON_DELETED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['SEASON_CONFIRM_DELETE'], $season), build_hidden_fields(array(
|
||||
's' => $season,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
if ($season >= 1963 AND $season <= 2099)
|
||||
{
|
||||
if ($season_row)
|
||||
{
|
||||
if ($edit)
|
||||
{
|
||||
$error[] = $user->lang['SEASON_TAKEN'];
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['SEASON_TAKEN'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
$season_row['season_name'] = utf8_normalize_nfc($this->request->variable('season_name', '', true));
|
||||
if ($season_row['season_name'] <> '')
|
||||
{
|
||||
$sql = 'SELECT
|
||||
season_name
|
||||
FROM ' . FOOTB_SEASONS . "
|
||||
WHERE season_name = '" . $season_row['season_name'] . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
$error[] = $user->lang['SEASON_NAME_TAKEN'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$intseason = ((int) $season) - 1;
|
||||
$season_row['season_name'] = $user->lang['SEASON'] . ' ' . $intseason . '/' . $season;
|
||||
}
|
||||
|
||||
$season_row['season_name_short'] = utf8_normalize_nfc($this->request->variable('season_short', '', true));
|
||||
if ($season_row['season_name_short'] <> '')
|
||||
{
|
||||
$sql = 'SELECT
|
||||
season_name_short
|
||||
FROM ' . FOOTB_SEASONS . "
|
||||
WHERE season_name_short = '" . $season_row['season_name_short'] . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
$error[] = $user->lang['SEASON_SHORT_TAKEN'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$intseason = ((int) $season) - 1;
|
||||
$season_row['season_name_short'] = $intseason . '/' . $season;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['SEASON_NUMBER'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
// No break for edit add
|
||||
case 'edit':
|
||||
$data = array();
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($action == 'edit' && !$season)
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
{
|
||||
if (!check_form_key($form_key))
|
||||
{
|
||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
$season_row['season_name'] = utf8_normalize_nfc($this->request->variable('season_name', '', true));
|
||||
if ($season_row['season_name'] <> '')
|
||||
{
|
||||
$sql = 'SELECT
|
||||
season
|
||||
FROM ' . FOOTB_SEASONS . "
|
||||
WHERE season_name = '" . $season_row['season_name'] . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
if ($row['season'] <> $season)
|
||||
{
|
||||
$error[] = $user->lang['SEASON_NAME_TAKEN'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = $user->lang['SEASON_NAME_EMPTY'];
|
||||
}
|
||||
|
||||
$season_row['season_name_short'] = utf8_normalize_nfc($this->request->variable('season_short', '', true));
|
||||
if ($season_row['season_name_short'] <> '')
|
||||
{
|
||||
$sql = 'SELECT
|
||||
season
|
||||
FROM ' . FOOTB_SEASONS . "
|
||||
WHERE season_name_short = '" . $season_row['season_name_short'] . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
if ($row['season'] <> $season)
|
||||
{
|
||||
$error[] = $user->lang['SEASON_SHORT_TAKEN'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = $user->lang['SEASON_SHORT_EMPTY'];
|
||||
}
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'season_name' => $season_row['season_name'],
|
||||
'season_name_short' => $season_row['season_name_short'],
|
||||
);
|
||||
|
||||
$data['season'] = $season;
|
||||
$data['season_name'] = $this->request->variable('season_name', '');
|
||||
$data['season_short'] = $this->request->variable('season_short', '');
|
||||
|
||||
$var_ary = array(
|
||||
'season' => array('num', false, 1963, 2099),
|
||||
'season_name' => array('string', false, 4, 20),
|
||||
'season_short' => array('string', false, 2, 10),
|
||||
);
|
||||
if (!($error_vals = validate_data($data, $var_ary)))
|
||||
{
|
||||
if ($action == 'add')
|
||||
{
|
||||
$sql = 'INSERT INTO ' . FOOTB_SEASONS . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'UPDATE ' . FOOTB_SEASONS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$message = ($action == 'edit') ? 'SEASON_UPDATED' : 'SEASON_CREATED';
|
||||
trigger_error($user->lang[$message] . adm_back_link($this->u_action));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($error_vals as $error_val)
|
||||
{
|
||||
$error_msg[] = $user->lang[$error_val];
|
||||
}
|
||||
$message = ($action == 'edit') ? 'SEASON_UPDATE_FAILED' : 'SEASON_CREATE_FAILED';
|
||||
$error[] = $user->lang[$message];
|
||||
$error = array_merge($error, $error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$u_back = $this->u_action;
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_ADD_SEASON' => ($action == 'add') ? true : false,
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'SEASON' => $season,
|
||||
'SEASON_NAME' => $season_row['season_name'],
|
||||
'SEASON_SHORT' => $season_row['season_name_short'],
|
||||
'U_BACK' => $u_back,
|
||||
'U_ACTION' => "{$this->u_action}&action=$action&s=$season",
|
||||
)
|
||||
);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet')),
|
||||
'S_SEASON_ADD' => true,
|
||||
)
|
||||
);
|
||||
|
||||
// Get us all the seasons
|
||||
$sql = 'SELECT
|
||||
s.season,
|
||||
s.season_name,
|
||||
s.season_name_short,
|
||||
COUNT(l.league) AS leagues
|
||||
FROM ' . FOOTB_SEASONS . ' s
|
||||
LEFT JOIN ' . FOOTB_LEAGUES . ' l on l.season = s.season
|
||||
GROUP BY season
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_seasons = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Check if the user is allowed to delete a season.
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
$allow_delete = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$allow_delete = true;
|
||||
}
|
||||
|
||||
$row_number = 0;
|
||||
foreach ($rows_seasons as $row_season)
|
||||
{
|
||||
$row_number++;
|
||||
$row_class = (!($row_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('seasons', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'SEASON' => $row_season['season'],
|
||||
'SEASON_NAME' => $row_season['season_name'],
|
||||
'SEASON_SHORT' => $row_season['season_name_short'],
|
||||
'LEAGUES' => $row_season['leagues'],
|
||||
'U_EDIT' => "{$this->u_action}&action=edit&s=" .$row_season['season'],
|
||||
'U_DELETE' => ($allow_delete) ? "{$this->u_action}&action=delete&s=" . $row_season['season'] : '',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
25
acp/teams_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class teams_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\teams_module',
|
||||
'title' => 'ACP_FOOTBALL_TEAMS_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_TEAMS_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_TEAMS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
659
acp/teams_module.php
Normal file
@@ -0,0 +1,659 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class teams_module
|
||||
{
|
||||
public $u_action;
|
||||
public $ext_football_path;
|
||||
|
||||
protected $db, $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
protected $root_path, $request, $php_ext, $log;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $request, $template;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$user->add_lang_ext('football/football', 'football');
|
||||
$user->add_lang_ext('football/football', 'info_acp_teams');
|
||||
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->php_ext = $phpEx;
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $auth, $phpbb_container, $phpbb_admin_path, $league_info;
|
||||
global $template, $user, $config, $phpbb_extension_manager, $request, $phpbb_root_path, $phpEx;
|
||||
$provider = new \phpbb\controller\ provider();
|
||||
$symphony_request = new \phpbb\ symfony_request($request);
|
||||
$filesystem = new \phpbb\ filesystem();
|
||||
$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
|
||||
|
||||
$this->ext_football_path = $phpbb_root_path . 'ext/football/football/';
|
||||
if(!function_exists('season_info'))
|
||||
{
|
||||
include($this->ext_football_path . 'includes/functions.' . $phpEx);
|
||||
}
|
||||
if (!defined('FOOTB_SEASONS'))
|
||||
{
|
||||
include($this->ext_football_path . 'includes/constants.' . $phpEx);
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_football_teams';
|
||||
$this->page_title = 'ACP_FOOTBALL_TEAMS_MANAGE';
|
||||
|
||||
$form_key = 'acp_football_teams';
|
||||
add_form_key($form_key);
|
||||
|
||||
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
||||
// Check and set some common vars
|
||||
$action = (isset($_POST['add'])) ? 'add' : $this->request->variable('action', '');
|
||||
$edit = $this->request->variable('edit', 0);
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$team = $this->request->variable('t', 0);
|
||||
$update = (isset($_POST['update'])) ? true : false;
|
||||
if ($action == 'add' AND $team > 0 AND !$edit)
|
||||
{
|
||||
$action = 'add_old';
|
||||
}
|
||||
if ($action == 'add' AND $team == 0 AND !$edit)
|
||||
{
|
||||
$team = nextfree_teamid();
|
||||
}
|
||||
// Clear some vars
|
||||
$team_row = array();
|
||||
$error = array();
|
||||
|
||||
// Grab current season
|
||||
if (!$season)
|
||||
{
|
||||
$season = curr_season();
|
||||
}
|
||||
|
||||
// Grab basic data for select season
|
||||
if ($season)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_SEASONS . '
|
||||
ORDER BY season DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$season_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($season && $row['season'] == $season) ? ' selected="selected"' : '';
|
||||
$season_options .= '<option value="' . $row['season'] . '"' . $selected . '>' . $row['season_name_short'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$season_name = $row['season_name_short'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab current league
|
||||
if (!$league)
|
||||
{
|
||||
$league = first_league($season, false);
|
||||
}
|
||||
|
||||
// Grab basic data for select league
|
||||
if ($league)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
ORDER BY league ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$league_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($league && $row['league'] == $league) ? ' selected="selected"' : '';
|
||||
$league_options .= '<option value="' . $row['league'] . '"' . $selected . '>' . $row['league_name'] . '</option>';
|
||||
if ($selected <> '')
|
||||
{
|
||||
$league_matchdays = $row['matchdays'];
|
||||
$league_name = $row['league_name'];
|
||||
$league_type = $row['league_type'];
|
||||
$ko_league = ($row['league_type'] == LEAGUE_KO) ? true : false;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error(sprintf($user->lang['NO_LEAGUE'], $season) . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Grab all teams for selection
|
||||
$sql = 'SELECT
|
||||
DISTINCT team_id,
|
||||
team_name
|
||||
FROM ' . FOOTB_TEAMS . '
|
||||
ORDER BY team_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
$team_options = '<option value="0" selected="selected">' . sprintf($user->lang['NEW_TEAM']) . '</option>';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = '';
|
||||
$team_options .= '<option value="' . $row['team_id'] . '"' . $selected . '>' . $row['team_name'] . '</option>';
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Grab basic data for team, if team is set and exists
|
||||
if ($team)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND team_id = $team";
|
||||
$result = $db->sql_query($sql);
|
||||
$team_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
if ($action == 'add' or $action == 'edit' )
|
||||
{
|
||||
// Grab all Teamsymbol for selection
|
||||
$teamsymbol_options = '<option value="blank.gif">blank.gif</option>';
|
||||
$folder = $this->ext_football_path . 'images/flags/';
|
||||
$directory = opendir($folder);
|
||||
$files = array();
|
||||
while($file = readdir($directory))
|
||||
{
|
||||
if( !(bool) preg_match('/.+\.(?:jpe?g|gif|png)$/i', $file) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$files[] = $file;
|
||||
}
|
||||
sort($files);
|
||||
|
||||
foreach( $files as $file )
|
||||
{
|
||||
$selected = (strtoupper($file) == strtoupper($team_row['team_symbol'])) ? ' selected="selected"' : '';
|
||||
$teamsymbol_options .= '<option value="' . $file . '"' . $selected . '>' . $file . '</option>';
|
||||
}
|
||||
closedir($directory);
|
||||
}
|
||||
|
||||
// Which page?
|
||||
switch ($action)
|
||||
{
|
||||
case 'delete':
|
||||
if (!$season)
|
||||
{
|
||||
trigger_error($user->lang['NO_SEASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$league)
|
||||
{
|
||||
trigger_error($user->lang['NO_LEAGUE'] . adm_back_link($this->u_action . "&s=$season"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$team)
|
||||
{
|
||||
trigger_error($user->lang['NO_TEAM'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$error = '';
|
||||
|
||||
if (!$auth->acl_get('a_football_delete'))
|
||||
{
|
||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
trigger_error($user->lang['TEAMS_NO_DELETE'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Delete team
|
||||
$sql = 'DELETE FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season AND league = $league AND team_id = $team";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete bets
|
||||
$sql = 'DELETE FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND match_no IN
|
||||
(SELECT
|
||||
DISTINCT match_no
|
||||
FROM " . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND (team_id_home = $team OR team_id_home = $team))";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete matches
|
||||
$sql = 'DELETE FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season AND league = $league AND (team_id_home = $team OR team_id_home = $team)";
|
||||
$db->sql_query($sql);
|
||||
|
||||
trigger_error($user->lang['TEAM_DELETED'] . adm_back_link($this->u_action . "&s=$season&l=$league"));
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, sprintf($user->lang['TEAM_CONFIRM_DELETE'], $team_row['team_name'], $season, $league), build_hidden_fields(array(
|
||||
's' => $season,
|
||||
'l' => $league,
|
||||
't' => $team,
|
||||
'mode' => $mode,
|
||||
'action' => $action))
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add_old':
|
||||
if (!check_form_key($form_key))
|
||||
{
|
||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE team_id = $team";
|
||||
$result = $db->sql_query($sql);
|
||||
$oldteam_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$matchday_options = '';
|
||||
if ($ko_league)
|
||||
{
|
||||
// Grab all matchdays for selection
|
||||
$sql = 'SELECT
|
||||
DISTINCT matchday,
|
||||
matchday_name
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$matchdays = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($row['matchday'] == 1) ? ' selected="selected"' : '';
|
||||
$day_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_options .= '<option value="' . $row['matchday'] . '"' . $selected . '>' . $day_name . '</option>';
|
||||
$matchdays++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
if (!$matchdays)
|
||||
{
|
||||
trigger_error($user->lang['NO_MATCHDAYS'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
// Grab all teamsymbol for selection
|
||||
$teamsymbol_options = '<option value="blank.gif">blank.gif</option>';
|
||||
$folder = $this->ext_football_path . 'images/flags/';
|
||||
$directory = opendir($folder);
|
||||
$files = array();
|
||||
while($file = readdir($directory))
|
||||
{
|
||||
if( !(bool) preg_match('/.+\.(?:jpe?g|gif|png)$/i', $file) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$files[] = $file;
|
||||
}
|
||||
sort($files);
|
||||
|
||||
foreach( $files as $file )
|
||||
{
|
||||
$selected = (strtoupper($file) == strtoupper($oldteam_row['team_symbol'])) ? ' selected="selected"' : '';
|
||||
$teamsymbol_options .= '<option value="' . $file . '"' . $selected . '>' . $file . '</option>';
|
||||
}
|
||||
closedir($directory);
|
||||
|
||||
$u_back = $this->u_action . "&s=$season&l=$league";
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_ADD_TEAM' => true,
|
||||
'S_ERROR' => false,
|
||||
'S_KO_LEAGUE' => $ko_league,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'SEASON' => $season,
|
||||
'SEASON_NAME' => $season_name,
|
||||
'LEAGUE' => $league,
|
||||
'LEAGUE_NAME' => $league_name,
|
||||
'TEAM' => $team,
|
||||
'TEAM_NAME' => $oldteam_row['team_name'],
|
||||
'TEAM_SHORT' => $oldteam_row['team_name_short'],
|
||||
'TEAM_SYMBOL' => $oldteam_row['team_symbol'],
|
||||
'TEAM_SYMBOL_OPTIONS' => $teamsymbol_options,
|
||||
'TEAM_IMAGE' => ($oldteam_row['team_symbol']) ? $this->ext_football_path . 'images/flags/' . $oldteam_row['team_symbol'] : $phpbb_root_path . 'football/images/flags/blank.gif',
|
||||
'TEAM_GROUP' => '',
|
||||
'TEAM_MATCHDAY_OPTIONS' => $matchday_options,
|
||||
'PHPBB_ROOT_PATH' => $phpbb_root_path,
|
||||
'U_BACK' => $u_back,
|
||||
'U_ACTION' => "{$this->u_action}&action=add&s=$season&l=$league",
|
||||
)
|
||||
);
|
||||
return;
|
||||
break;
|
||||
case 'add':
|
||||
if ($team > 0 AND $team <= 65535)
|
||||
{
|
||||
if ($team_row)
|
||||
{
|
||||
if ($edit)
|
||||
{
|
||||
$error[] = $user->lang['TEAM_TAKEN'];
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['TEAM_TAKEN'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
$team_row['team_name'] = utf8_normalize_nfc($this->request->variable('team_name', '', true));
|
||||
$team_row['team_name_short'] = utf8_normalize_nfc($this->request->variable('team_short', '', true));
|
||||
$team_row['team_symbol'] = utf8_normalize_nfc($this->request->variable('team_symbol', '', true));
|
||||
$team_row['group_id'] = utf8_normalize_nfc($this->request->variable('team_group', '', true));
|
||||
$team_row['matchday'] = utf8_normalize_nfc($this->request->variable('team_round', '', true));
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['TEAM_NUMBER'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
// No break for edit the new team
|
||||
case 'edit':
|
||||
|
||||
$data = array();
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
if ($action == 'edit' && !$team)
|
||||
{
|
||||
trigger_error($user->lang['NO_TEAM'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
{
|
||||
if (!check_form_key($form_key))
|
||||
{
|
||||
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$team_row['team_name'] = utf8_normalize_nfc($this->request->variable('team_name', '', true));
|
||||
$team_row['team_name_short'] = utf8_normalize_nfc($this->request->variable('team_short', '', true));
|
||||
$team_row['team_symbol'] = utf8_normalize_nfc($this->request->variable('team_symbol', '', true));
|
||||
$team_row['group_id'] = utf8_normalize_nfc($this->request->variable('team_group', '', true));
|
||||
$team_row['matchday'] = utf8_normalize_nfc($this->request->variable('team_round', '', true));
|
||||
|
||||
$where_team_id = '';
|
||||
if ($team >= 6000 AND $team <= 6999)
|
||||
{
|
||||
$where_team_id = ' AND team_id < 7000 AND team_id > 7999';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($team >= 7000 AND $team <= 7999)
|
||||
{
|
||||
$where_team_id = ' AND team_id < 6000 AND team_id > 6999';
|
||||
}
|
||||
}
|
||||
// Check teamname
|
||||
if (strlen($team_row['team_name']) > 2)
|
||||
{
|
||||
// Check double entry for team
|
||||
$sql = 'SELECT
|
||||
DISTINCT team_id
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE team_name = '" . $team_row['team_name'] . "'" . $where_team_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$name_rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
if (sizeof($name_rows) > 1)
|
||||
{
|
||||
$error[] = $user->lang['TEAM_NAME_DOUBLE'];
|
||||
}
|
||||
elseif (sizeof($name_rows) == 1)
|
||||
{
|
||||
if ($name_rows[0]['team_id'] <> $team)
|
||||
{
|
||||
$error[] = $user->lang['TEAM_NAME_DOUBLE'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check teamname short
|
||||
if (strlen($team_row['team_name_short']) > 1)
|
||||
{
|
||||
// Check double entry for team
|
||||
$sql = 'SELECT
|
||||
DISTINCT team_id
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE team_name_short = '" . $team_row['team_name_short'] . "'" . $where_team_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$short_rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
if (sizeof($short_rows) > 1)
|
||||
{
|
||||
$error[] = $user->lang['TEAM_SHORT_DOUBLE'];
|
||||
}
|
||||
elseif (sizeof($short_rows) == 1)
|
||||
{
|
||||
if ($short_rows[0]['team_id'] <> $team)
|
||||
{
|
||||
$error[] = $user->lang['TEAM_SHORT_DOUBLE'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'season' => (int) $season,
|
||||
'league' => (int) $league,
|
||||
'team_id' => (int) $team,
|
||||
'team_name' => $team_row['team_name'],
|
||||
'team_name_short' => $team_row['team_name_short'],
|
||||
'team_symbol' => strlen($team_row['team_symbol']) ? $team_row['team_symbol'] : 'blank.gif',
|
||||
'group_id' => strlen($team_row['group_id']) ? $team_row['group_id'] : '',
|
||||
'matchday' => strlen($team_row['matchday']) ? $team_row['matchday'] : 0,
|
||||
);
|
||||
|
||||
if ($ko_league)
|
||||
{
|
||||
$data['team_group'] = $team_row['group_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['team_group'] = '';
|
||||
}
|
||||
$data['team'] = $team;
|
||||
$data['team_name'] = $team_row['team_name'];
|
||||
$data['team_short'] = $team_row['team_name_short'];
|
||||
|
||||
$var_ary = array(
|
||||
'team' => array('num', false, 1, 9999),
|
||||
'team_name' => array('string', false, 3, 30),
|
||||
'team_short' => array('string', false, 1, 10),
|
||||
'team_group' => array(
|
||||
array('string', true, 1, 1),
|
||||
array('match', true, '#^[A-Z]#')),
|
||||
);
|
||||
if (!($error_vals = validate_data($data, $var_ary)))
|
||||
{
|
||||
if ($action == 'add')
|
||||
{
|
||||
$sql = 'INSERT INTO ' . FOOTB_TEAMS . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'UPDATE ' . FOOTB_TEAMS . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE season = $season AND league = $league AND team_id = $team";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$message = ($action == 'edit') ? 'TEAM_UPDATED' : 'TEAM_CREATED';
|
||||
trigger_error($user->lang[$message] . adm_back_link($this->u_action . "&s=$season&l=$league"));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($error_vals as $error_val)
|
||||
{
|
||||
$error_msg[] = $user->lang[$error_val];
|
||||
}
|
||||
$message = ($action == 'edit') ? 'TEAM_UPDATE_FAILED' : 'TEAM_CREATE_FAILED';
|
||||
$error[] = $user->lang[$message];
|
||||
$error = array_merge($error, $error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$matchday_options = '';
|
||||
if ($ko_league)
|
||||
{
|
||||
// Grab all matchdays for selection
|
||||
$sql = 'SELECT
|
||||
DISTINCT matchday,
|
||||
matchday_name
|
||||
FROM ' . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY matchday ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$matchdays = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$selected = ($team_row['matchday'] && $row['matchday'] == $team_row['matchday']) ? ' selected="selected"' : '';
|
||||
$matchday_name = (strlen($row['matchday_name']) > 0) ? $row['matchday_name'] : $row['matchday'] . '. ' . sprintf($user->lang['MATCHDAY']);
|
||||
$matchday_options .= '<option value="' . $row['matchday'] . '"' . $selected . '>' . $matchday_name . '</option>';
|
||||
$matchdays++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
if (!$matchdays)
|
||||
{
|
||||
trigger_error($user->lang['NO_MATCHDAYS'] . adm_back_link($this->u_action . "&s=$season&l=$league"), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
$u_back = $this->u_action . "&s=$season&l=$league";
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_ADD_TEAM' => ($action == 'add') ? true : false,
|
||||
'S_ERROR' => (sizeof($error)) ? true : false,
|
||||
'S_KO_LEAGUE' => $ko_league,
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
'SEASON' => $season,
|
||||
'SEASON_NAME' => $season_name,
|
||||
'LEAGUE' => $league,
|
||||
'LEAGUE_NAME' => $league_name,
|
||||
'TEAM' => $team,
|
||||
'TEAM_NAME' => $team_row['team_name'],
|
||||
'TEAM_SHORT' => $team_row['team_name_short'],
|
||||
'TEAM_SYMBOL' => $team_row['team_symbol'],
|
||||
'TEAM_SYMBOL_OPTIONS' => $teamsymbol_options,
|
||||
'TEAM_IMAGE' => ($team_row['team_symbol']) ? $this->ext_football_path . 'images/flags/' . $team_row['team_symbol'] : $phpbb_root_path . 'football/images/flags/blank.gif',
|
||||
'TEAM_GROUP' => $team_row['group_id'],
|
||||
'TEAM_ROUND' => $team_row['matchday'],
|
||||
'TEAM_MATCHDAY_OPTIONS' => $matchday_options,
|
||||
'PHPBB_ROOT_PATH' => $phpbb_root_path,
|
||||
'U_BACK' => $u_back,
|
||||
'U_ACTION' => "{$this->u_action}&action=$action&s=$season&l=$league",
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'U_FOOTBALL' => $helper->route('football_main_controller',array('side' => 'bet', 's' => $season, 'l' => $league)),
|
||||
'S_SEASON' => $season,
|
||||
'S_LEAGUE' => $league,
|
||||
'S_KO_LEAGUE' => $ko_league,
|
||||
'S_SEASON_OPTIONS' => $season_options,
|
||||
'S_LEAGUE_OPTIONS' => $league_options,
|
||||
'S_TEAM_OPTIONS' => $team_options,
|
||||
'S_TEAM_ADD' => true,
|
||||
)
|
||||
);
|
||||
|
||||
// Get us all the teams
|
||||
$sql = 'SELECT t.*,
|
||||
SUM(IF(m.team_id_home = t.team_id, 1 , 0)) AS matches_home,
|
||||
SUM(IF(m.team_id_guest = t.team_id, 1 , 0)) AS matches_away
|
||||
FROM ' . FOOTB_TEAMS . ' AS t
|
||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = $season AND m.league = $league AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id))
|
||||
WHERE t.season = $season
|
||||
AND t.league = $league
|
||||
GROUP BY t.team_id
|
||||
ORDER BY team_id ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows_teams = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Check if the user is allowed to delete a team.
|
||||
if ($user->data['user_type'] != USER_FOUNDER && $this->config['football_founder_delete'])
|
||||
{
|
||||
$allow_delete = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$allow_delete = true;
|
||||
}
|
||||
|
||||
$row_number = 0;
|
||||
$matches = 0;
|
||||
foreach ($rows_teams as $row_team)
|
||||
{
|
||||
$row_number++;
|
||||
$row_class = (!($row_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$matches += ($row_team['matches_home'] + $row_team['matches_away']) / 2;
|
||||
$template->assign_block_vars('teams', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'TEAM' => $row_team['team_id'],
|
||||
'TEAM_IMAGE' => ($row_team['team_symbol']) ? $this->ext_football_path . 'images/flags/' . $row_team['team_symbol'] : $this->ext_football_path . 'images/flags/blank.gif',
|
||||
'TEAM_NAME' => $row_team['team_name'],
|
||||
'TEAM_SHORT' => $row_team['team_name_short'],
|
||||
'TEAM_MATCHES' => $row_team['matches_home'] + $row_team['matches_away'],
|
||||
'TEAM_HOME' => $row_team['matches_home'],
|
||||
'TEAM_GROUP' => $row_team['group_id'],
|
||||
'TEAM_ROUND' => $row_team['matchday'],
|
||||
'U_EDIT' => "{$this->u_action}&action=edit&s=" . $season . "&l=" .$league . "&t=" .$row_team['team_id'],
|
||||
'U_DELETE' => ($allow_delete) ? "{$this->u_action}&action=delete&s=" . $season . "&l=" . $league . "&t=" . $row_team['team_id'] : '',
|
||||
'S_VERSION_NO' => $this->config['football_version'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$template->assign_vars(array(
|
||||
'S_TEAMS' => ($row_number) ? '(' . $row_number . ')' : '',
|
||||
'S_MATCHES' => ($row_number) ? $matches : '',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
25
acp/update_info.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\acp;
|
||||
|
||||
class update_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => '\football\football\acp\update_module',
|
||||
'title' => 'ACP_FOOTBALL_UPDATE_MANAGEMENT',
|
||||
'version' => '0.9.4',
|
||||
'modes' => array(
|
||||
'manage' => array('title' => 'ACP_FOOTBALL_UPDATE_MANAGE', 'auth' => 'acl_a_football_plan', 'cat' => array('ACP_FOOTBALL_UPDATE')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1462
acp/update_module.php
Normal file
65
adm/style/acp_football.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_TITLE}</h1>
|
||||
<p>{L_TITLE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<!-- BEGIN mods -->
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_FOOTBALL_VERSION_CHECK}</legend>
|
||||
<p style="font-weight: bold; color: <!-- IF mods.S_UP_TO_DATE -->#228822<!-- ELSE -->#BC2A4D<!-- ENDIF -->;">{mods.UP_TO_DATE}</p>
|
||||
<dl>
|
||||
<dt><label>{L_CURRENT_VERSION}</label></dt>
|
||||
<dd><strong>{mods.CURRENT_VERSION}</strong></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>{L_LATEST_VERSION}</label></dt>
|
||||
<dd><strong>{mods.LATEST_VERSION}</strong></dd>
|
||||
</dl>
|
||||
<!-- IF not mods.S_UP_TO_DATE -->
|
||||
<dl>
|
||||
<dt><label>{L_DOWNLOAD_LATEST}</label></dt>
|
||||
<dd><strong><a href="{mods.DOWNLOAD}">{L_DOWNLOAD} {mods.TITLE} {mods.LATEST_VERSION}</a></strong></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>{L_ANNOUNCEMENT_TOPIC}</label></dt>
|
||||
<dd><strong><a href="{mods.ANNOUNCEMENT}">{L_RELEASE_ANNOUNCEMENT}</a></strong></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
<!-- END mods -->
|
||||
<form id="acp_football" method="post" action="{U_ACTION}">
|
||||
|
||||
<!-- BEGIN options -->
|
||||
<!-- IF options.S_LEGEND -->
|
||||
<!-- IF not options.S_FIRST_ROW -->
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
<fieldset>
|
||||
<legend>{options.LEGEND}</legend>
|
||||
<!-- ELSE -->
|
||||
<dl>
|
||||
<dt><label for="{options.KEY}">{options.TITLE}:</label><!-- IF options.S_EXPLAIN --><br /><span>{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
|
||||
<dd>{options.CONTENT}</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<!-- END options -->
|
||||
<p class="submit-buttons">
|
||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
</p>
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
151
adm/style/acp_football_all_bets.html
Normal file
@@ -0,0 +1,151 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_ALL_BETS_VIEW}</h1>
|
||||
<p>{L_ACP_FOOTBALL_ALL_BETS_VIEW_EXPLAIN}</p>
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_MATCHDAY}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="match_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="match_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<select name="m" id="match_matchday" onchange="this.form.submit();">{S_MATCHDAY_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<fieldset>
|
||||
<legend>{S_LEGEND}</legend>
|
||||
<!-- IF .pagination -->
|
||||
<div class="pagination top-pagination">
|
||||
<!-- INCLUDE pagination.html -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .match_panel -->
|
||||
<!-- BEGIN match_panel -->
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: right;"><br/></th>
|
||||
<!-- BEGIN match -->
|
||||
<th colspan="2">{match_panel.match.HOME_NAME}-<br />{match_panel.match.GUEST_NAME}</th>
|
||||
<!-- END match -->
|
||||
<!-- IF match_panel.S_TOTAL -->
|
||||
<th style="text-align: center;"></th>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
<tr class="row_result">
|
||||
<td title="{L_RESULT_EXPLAIN}" style="text-align: right;"><b>{L_RESULT}</b></td>
|
||||
<!-- BEGIN match -->
|
||||
<td class="td_result {match_panel.match.COLOR_STYLE}">{match_panel.match.RESULT}</td>
|
||||
<td class="td_pts"></td>
|
||||
<!-- END match -->
|
||||
<!-- IF match_panel.S_TOTAL -->
|
||||
<td title="{L_TOTAL_EXPLAIN}" style="text-align: center;"><b>{L_TOTAL}</b></td>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- BEGIN tendency_footer -->
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="td_tendency" style="text-align: right;" title="{L_TEND_TEXT}">{L_TENDENCY}</td>
|
||||
<!-- BEGIN tendency -->
|
||||
<td class="td_tendency" colspan="2">
|
||||
<dfn style="display: none;">{match_panel.tendency_footer.tendency.MATCH_ENTRY}</dfn>
|
||||
{match_panel.tendency_footer.tendency.TENDENCY}
|
||||
</td>
|
||||
<!-- END tendency -->
|
||||
<!-- IF match_panel.tendency_footer.S_TOTAL -->
|
||||
<td class="td_pts_total" title="{L_POINTS_TOTAL}">
|
||||
<dfn style="display: none;">{L_POINTS_TOTAL}</dfn>
|
||||
{match_panel.tendency_footer.SUMTOTAL}
|
||||
</td>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
</tfoot>
|
||||
<!-- END tendency_footer -->
|
||||
<tbody>
|
||||
<!-- BEGIN user_row -->
|
||||
<tr class="{match_panel.user_row.ROW_CLASS}">
|
||||
<td class="td_name">{match_panel.user_row.USER_NAME}</td>
|
||||
<!-- BEGIN bet -->
|
||||
<td class="td_result">{match_panel.user_row.bet.BET}</td>
|
||||
<td class="{match_panel.bet.COLOR_STYLE}">{match_panel.user_row.bet.POINTS}</td>
|
||||
<!-- END bet -->
|
||||
<!-- BEGIN points -->
|
||||
<td class="td_pts_total {match_panel.points.COLOR_STYLE}">{match_panel.user_row.points.POINTS_TOTAL}</td>
|
||||
<!-- END points -->
|
||||
</tr>
|
||||
<!-- END user_row -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- END match_panel -->
|
||||
|
||||
<!-- BEGIN extra_panel -->
|
||||
<br />
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left;">{L_EXTRA_BET}</th>
|
||||
<th style="width:70%; text-align:left;">{extra_panel.QUESTION}</th>
|
||||
<th>{L_EVALUATION}</th>
|
||||
<th>{L_POINTS}</th>
|
||||
</tr>
|
||||
<tr class="row_result">
|
||||
<td><b>{L_RESULT}</b></td>
|
||||
<td style="text-align:left;" class="{extra_panel.COLOR_STYLE}">{extra_panel.RESULT}</td>
|
||||
<td style="text-align:center;">{extra_panel.EVALUATION}</td>
|
||||
<td style="text-align:center;" title="{extra_panel.EVALUATION_TITLE}">{extra_panel.POINTS}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN user_row -->
|
||||
<tr class="{extra_panel.user_row.ROW_CLASS}">
|
||||
<td class="td_name">{extra_panel.user_row.USER_NAME}</td>
|
||||
<td style="text-align:left;">{extra_panel.user_row.BET}</td>
|
||||
<td> </td>
|
||||
<td style="text-align:center;" class="{extra_panel.bet.COLOR_STYLE}">{extra_panel.user_row.POINTS}</td>
|
||||
</tr>
|
||||
<!-- END user_row -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF S_VIEW == 'print' -->
|
||||
<br />
|
||||
<!-- ENDIF -->
|
||||
<!-- END extra_panel -->
|
||||
<!-- IF .pagination or TOTAL_USERS -->
|
||||
<div class="pagination">
|
||||
{TOTAL_USERS}
|
||||
<!-- IF .pagination -->
|
||||
<!-- INCLUDE pagination.html -->
|
||||
<!-- ELSE -->
|
||||
• {PAGE_NUMBER}
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- ELSE -->
|
||||
<br />
|
||||
<div class="message">{L_NO_MATCHES_ON_MATCHDAY}</div>
|
||||
<br />
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
160
adm/style/acp_football_bank.html
Normal file
@@ -0,0 +1,160 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_LIST -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{PAGE_TYPE} :: {LEAGUE_NAME}</h1>
|
||||
<p>{PAGE_TYPE_EXPLAIN}</p>
|
||||
|
||||
<form id="list" method="post" action="{U_ACTION}">
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="setvalues('list', 'newvalue', 'curvalue', {BET_POINTS}); return false;">{L_SET_DEPOSITS}</a> •
|
||||
<a href="#" onclick="marklist('list', 'mark', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'mark', false); return false;">{L_UNMARK_ALL}</a></p>
|
||||
|
||||
<!-- IF .pagination -->
|
||||
<div class="pagination top-pagination">
|
||||
<!-- INCLUDE pagination.html -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_USERNAME}</th>
|
||||
<!-- IF POINTS -->
|
||||
<th>{POINTS}</th>
|
||||
<!-- ENDIF -->
|
||||
<th>{TARGET}</th>
|
||||
<th>{ACTUAL}</th>
|
||||
<th>{L_BOOK}</th>
|
||||
<th>{L_MARK}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN member -->
|
||||
<!-- IF member.S_ROW_COUNT is even --><tr class="bg1 row_light"><!-- ELSE --><tr class="bg2 row_dark"><!-- ENDIF -->
|
||||
<td><a href="{member.U_USER_BANK}">{member.USERNAME}</a></td>
|
||||
<!-- IF POINTS -->
|
||||
<td style="text-align: right;">{member.POINTS}</td>
|
||||
<!-- ENDIF -->
|
||||
<td style="text-align: right;">{member.TARGET}</td>
|
||||
<td style="text-align: right;">{member.ACTUAL}<input type="hidden" name="curvalue{member.USER_ID}" id="curvalue{member.USER_ID}" value="{member.ACTUAL}" /></td>
|
||||
<td style="text-align: right;"><input type="text" name="newvalue{member.USER_ID}" value="{member.NEW_VALUE}"
|
||||
onchange="document.getElementById('select_{member.USER_ID}').checked = true;" /></td>
|
||||
<td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" id="select_{member.USER_ID}" value="{member.USER_ID}" /></td>
|
||||
</tr>
|
||||
<!-- END member -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF S_CASH_POINTS -->
|
||||
{L_CASH_POINTS} <input name="cash" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
{L_MATCHDAY}: <!-- IF S_SELECT_MATCHDAY --><input type="text" name="m" value="{S_MATCHDAY}" /><!-- ELSE -->
|
||||
<input type="hidden" name="m" value="{S_MATCHDAY}" />{S_MATCHDAY}<!-- ENDIF -->
|
||||
<!-- IF .pagination or TOTAL_MEMBERS -->
|
||||
<div class="pagination">
|
||||
{TOTAL_MEMBERS}
|
||||
<!-- IF .pagination -->
|
||||
<!-- INCLUDE pagination.html -->
|
||||
<!-- ELSE -->
|
||||
• {PAGE_NUMBER}
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="t" value="{S_TYPE}" />
|
||||
<input type="hidden" name="start" value="{S_START}" />
|
||||
<select name="action"><option class="sep" value="">{L_SELECT_OPTION}</option>{S_ACTION_OPTIONS}</select>
|
||||
<input class="button2" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
</fieldset>
|
||||
|
||||
{S_FORM_TOKEN}
|
||||
</form>
|
||||
|
||||
<!-- ELSE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_BANK_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_BANK_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<h1 style="display:inline;">{L_SELECT_SEASON}:</h1>
|
||||
<select name="s" id="bank_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h1>{L_LEAGUE_BANK}</h1>
|
||||
|
||||
<p>{L_LEAGUE_BANK_EXPLAIN}</p>
|
||||
<p><a href="{U_DLOAD_BANK_OPEN}">Offene Posten bis einschließlich dieser Saison</a></p>
|
||||
<form id="overview" method="post" action="{U_ACTION}">
|
||||
<fieldset>
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('overview', 'markleague', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('overview', 'markleague', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_LEAGUE}</th>
|
||||
<th style="width: 25%">{L_LEAGUE_NAME}</th>
|
||||
<th>{L_BET_POINTS}</th>
|
||||
<th>{L_DEPOSITED}</th>
|
||||
<th>{L_WINS}</th>
|
||||
<th>{L_PAID}</th>
|
||||
<th>{L_MARK}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .leagues -->
|
||||
<!-- BEGIN leagues -->
|
||||
<!-- IF leagues.S_ROW_COUNT is even --><tr class="bg1 row_light"><!-- ELSE --><tr class="bg2 row_dark"><!-- ENDIF -->
|
||||
<td style="text-align: center;"><strong>{leagues.LEAGUE}</strong></td>
|
||||
<td><a href="{leagues.U_DLOAD_BANK}">{leagues.LEAGUE_NAME}</a></td>
|
||||
<td style="text-align: right;"><a href="{leagues.U_LIST_BET_POINTS}">{leagues.BET_POINTS}</a></td>
|
||||
<td style="text-align: right;">
|
||||
<!-- IF S_LIST_DEPOSITED --><a href="{leagues.U_LIST_DEPOSITED}"><!-- ENDIF -->
|
||||
{leagues.DEPOSITED}
|
||||
<!-- IF S_LIST_DEPOSITED --></a><!-- ENDIF --></td>
|
||||
<td style="text-align: right;">{leagues.WINS}</td>
|
||||
<td style="text-align: right;">
|
||||
<!-- IF S_LIST_PAID --><a href="{leagues.U_LIST_PAID}"><!-- ENDIF -->
|
||||
{leagues.PAID}
|
||||
<!-- IF S_LIST_PAID --></a><!-- ENDIF --></td>
|
||||
<td style="text-align: center;"><input type="checkbox" class="radio" name="markleague[]" value="{leagues.LEAGUE}" /></td>
|
||||
</tr>
|
||||
<!-- END leagues -->
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="3" class="row3">{L_NO_LEAGUES_CREATED}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF S_CASH_POINTS -->
|
||||
{L_CASH_POINTS} <input name="cash" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="action"><option class="sep" value="">{L_SELECT_OPTION}</option>{S_LEAGUE_ACTION_OPTIONS}</select>
|
||||
<input class="button2" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
</fieldset>
|
||||
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form><!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
153
adm/style/acp_football_bets.html
Normal file
@@ -0,0 +1,153 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_BETS_MANAGE}</h1>
|
||||
|
||||
<p>{L_ACP_FOOTBALL_BETS_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_MATCHDAY}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="match_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="match_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<select name="m" id="match_matchday" onchange="this.form.submit();">{S_MATCHDAY_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<!-- IF S_USERS -->
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="m" value="{S_MATCHDAY}" />
|
||||
<select name="u" id="match_user" onchange="this.form.submit();">{S_USER_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_SUCCESS -->
|
||||
<div class="successbox">
|
||||
<h3>{L_ADVICE}</h3>
|
||||
<p>{SUCCESS_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .bet_edit -->
|
||||
<form method="post" action="{U_ACTION}">
|
||||
<fieldset>
|
||||
<legend>{S_LEGEND}</legend>
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="m" value="{S_MATCHDAY}" />
|
||||
<input type="hidden" name="u" value="{S_USER}" />
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_DATE}</th>
|
||||
<th style="text-align:right">{L_NR}</th>
|
||||
<!-- IF S_DATA_GROUP -->
|
||||
<th>{L_GR}</th>
|
||||
<!-- ENDIF -->
|
||||
<th></th>
|
||||
<th>{L_HOME}</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>{L_GUEST}</th>
|
||||
<th style="text-align:right">{L_GOALS_HOME}</th>
|
||||
<th></th>
|
||||
<th>{L_GOALS_GUEST}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN bet_edit -->
|
||||
<tr class="{bet_edit.ROW_CLASS}">
|
||||
<td>{bet_edit.MATCH_TIME}</td>
|
||||
<td class="td_match_no">{bet_edit.MATCH_NUMBER}</td>
|
||||
<!-- IF S_DATA_GROUP -->
|
||||
<td class="td_group">{bet_edit.GROUP}</td>
|
||||
<!-- ENDIF -->
|
||||
<td style="text-align:right; width:32px;">{bet_edit.LOGO_HOME} </td>
|
||||
<td class="td_team">{bet_edit.HOME_NAME}</td>
|
||||
<td class="td_vs">:</td>
|
||||
<td style="text-align:right; width:32px;">{bet_edit.LOGO_GUEST} </td>
|
||||
<td class="td_team">{bet_edit.GUEST_NAME}</td>
|
||||
<td class="td_goals_home"><input style="text-align:right; width:30px;" type="number"
|
||||
name="goalsh{bet_edit.MATCH_NUMBER}" min="0" max="20" size="2" value="{bet_edit.BET_HOME}" /></td>
|
||||
<td class="td_vs">:</td>
|
||||
<td class="td_goals_guest"><input style="margin:0; width:30px;" type="number"
|
||||
name="goalsg{bet_edit.MATCH_NUMBER}" min="0" max="20" size="2" value="{bet_edit.BET_GUEST}" /></td>
|
||||
</tr>
|
||||
<!-- END bet_edit -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- IF S_EXTRA_BET -->
|
||||
<br />
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: left;">{L_QUESTION}</th>
|
||||
<th>{L_POSSIBLE_POINTS}</th>
|
||||
<th>{L_EVALUATION}</th>
|
||||
<th>{L_BET_OF}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN extra_edit -->
|
||||
<tr class="{extra_edit.ROW_CLASS}" style="height:30px">
|
||||
<td>{extra_edit.QUESTION}</td>
|
||||
<td style="text-align: center;">{extra_edit.EXTRA_POINTS}</td>
|
||||
<td style="text-align: center;" title="{extra_edit.EVALUATION_TITLE}">{extra_edit.EVALUATION}</td>
|
||||
<td style="text-align: center;">
|
||||
<!-- IF extra_edit.S_DISPLAY_TYPE == 1 -->
|
||||
<select name="extra{extra_edit.EXTRA_NO}">
|
||||
<!-- BEGIN extra_option -->
|
||||
<option {extra_edit.extra_option.S_SELECTED} value="{extra_edit.extra_option.OPTION_VALUE}">{extra_edit.extra_option.OPTION_NAME}</option>
|
||||
<!-- END extra_option -->
|
||||
</select>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF extra_edit.S_DISPLAY_TYPE == 2 -->
|
||||
<input style="display:inline; margin:0; padding:0;" type="text" name="extra{extra_edit.EXTRA_NO}" size="15" maxlength="255" value="{extra_edit.BET}">
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END extra_edit -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_CASH_POINTS -->{L_CASH_POINTS} <input name="cash" type="checkbox" class="radio" checked="checked" /> <!-- ENDIF -->
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<input class="button1" type="submit" id="submit" name="bet" value="{L_SAVE}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- ELSE -->
|
||||
<fieldset>
|
||||
<legend>{S_LEGEND}</legend>
|
||||
<br />
|
||||
<div class="message"><!-- IF S_USERS -->{L_NO_MATCHES_ON_MATCHDAY}<!-- ELSE -->{L_NO_USERS}<!-- ENDIF --></div>
|
||||
<br />
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
149
adm/style/acp_football_extra.html
Normal file
@@ -0,0 +1,149 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_EDIT -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_ACP_FOOTBALL_EXTRA_MANAGE}</h1>
|
||||
<p>{L_MATCHDAY_EDIT_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_EXTRA_DETAILS}</legend>
|
||||
<dl>
|
||||
<dt><label for="season">{L_SEASON}:</label></dt>
|
||||
<dd><strong>{SEASON_NAME}</strong><input name="s" type="hidden" id="season" value="{SEASON}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league">{L_LEAGUE}:</label></dt>
|
||||
<dd><strong>{LEAGUE_NAME}</strong><input name="l" type="hidden" id="league" value="{LEAGUE}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="extra_no">{L_EXTRA_NO}:</label></dt>
|
||||
<dd><strong>{EXTRA_NO}</strong><input name="e" type="hidden" id="extra_no" value="{EXTRA_NO}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="question_type">{L_EXTRA_QUESTION_TYPE}:</label><br /><span>{L_EXTRA_QUESTION_TYPE_EXPLAIN}</span></dt>
|
||||
<dd><select id="question_type" name="question_type">{S_QUESTION_TYPE_OPTIONS}</select> </dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="question">{L_EXTRA_QUESTION}:</label><br /><span>{L_EXTRA_QUESTION_EXPLAIN}</span></dt>
|
||||
<dd><input name="question" type="text" id="question" size="80" maxlength="255" value="{QUESTION}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday">{L_EXTRA_MATCHDAY}:</label><br /><span>{L_EXTRA_MATCHDAY_EXPLAIN}</span></dt>
|
||||
<dd><select id="matchday" name="matchday">{S_MATCHDAY_OPTIONS}</select> </dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday_eval">{L_EXTRA_MATCHDAY_EVAL}:</label><br /><span>{L_EXTRA_MATCHDAY_EVAL_EXPLAIN}</span></dt>
|
||||
<dd><select id="matchday_eval" name="matchday_eval">{S_MATCHDAY_EVAL_OPTIONS}</select> </dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="extra_points">{L_EXTRA_POINTS}:</label><br /><span>{L_EXTRA_POINTS_EXPLAIN}</span></dt>
|
||||
<dd><input name="extra_points" type="text" id="extra_points" size="2" maxlength="2" value="{EXTRA_POINTS}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="extra_status">{L_EXTRA_STATUS}:</label><br /><span>{L_EXTRA_STATUS_EXPLAIN}</span></dt>
|
||||
<dd><select id="extra_status" name="extra_status">{S_EXTRA_STATUS_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- ELSE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_EXTRA_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_EXTRA_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_LEAGUE}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="matchday_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="matchday_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form id="add_extra" method="post" action="{U_ACTION}">
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<!-- IF S_EXTRA_ADD -->
|
||||
<input class="button2" type="submit" name="submit" value="{L_EXTRA_ADD}" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<h1>{L_EXTRA_DEF}</h1>
|
||||
|
||||
<p>{L_EXTRA_DEF_EXPLAIN}</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_EXTRA_NO}</th>
|
||||
<th>{L_QUESTION_TYPE}</th>
|
||||
<th style="width: 40%">{L_EXTRA_QUESTION}</th>
|
||||
<th>{L_EXTRA_MATCHDAY}</th>
|
||||
<th>{L_EXTRA_MATCHDAY_EVAL}</th>
|
||||
<th>{L_EXTRA_POINTS}</th>
|
||||
<th>{L_STATUS}</th>
|
||||
<th>{L_OPTIONS}</th>
|
||||
<th>{L_ACTION}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .extras -->
|
||||
<!-- BEGIN extras -->
|
||||
<tr class="{extras.ROW_CLASS}">
|
||||
<td style="text-align:center;"><strong>{extras.EXTRA_NO}</strong></td>
|
||||
<td style="text-align:center;">{extras.QUESTION_TYPE}</td>
|
||||
<td>{extras.QUESTION}</td>
|
||||
<td style="text-align:right;">{extras.MATCHDAY}</td>
|
||||
<td style="text-align:right;">{extras.MATCHDAY_EVAL}</td>
|
||||
<td style="text-align:center;">{extras.EXTRA_POINTS}</td>
|
||||
<td style="text-align:center;">{extras.EXTRA_STATUS}</td>
|
||||
<td style="text-align: center;"><a href="{extras.U_EDIT}">{L_SETTINGS}</a></td>
|
||||
<td style="text-align: center;"><!-- IF extras.U_DELETE --><a href="{extras.U_DELETE}">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END extras -->
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="9" class="row3">{L_NO_EXTRA_CREATED}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
85
adm/style/acp_football_ko.html
Normal file
@@ -0,0 +1,85 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_KO_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_KO_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_LEAGUE}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="match_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="match_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_KO_MATCHDAYS}</legend>
|
||||
<dl>
|
||||
<dt><label for="matchday_from">{L_MATCHDAY_FROM}:</label></dt>
|
||||
<dd><select name="matchday_from" id="matchday_from" >{S_MATCHDAY_FROM_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday_to">{L_MATCHDAY_TO}:</label></dt>
|
||||
<dd><select name="matchday_to" id="matchday_to" >{S_MATCHDAY_TO_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_MATCHDAY_TARGET}</legend>
|
||||
<dl>
|
||||
<dt><label for="matchday_new">{L_MATCHDAY_NEW}:</label></dt>
|
||||
<dd><select name="matchday_new" id="matchday_new" >{S_MATCHDAY_NEW_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_KO_GROUP}</legend>
|
||||
<dl>
|
||||
<dt><label for="matchday_new">{L_MANAGE_GROUP}:</label></dt>
|
||||
<dd><input name="check_rank" id="check_rank" type="checkbox" value="1" class="radio" <!-- IF S_CHECK_RANK --> checked="checked"<!-- ENDIF --> /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="rank">{L_GROUP_RANK}:</label><br /><span>{L_GROUP_RANK_EXPLAIN}</span></dt>
|
||||
<dd><input name="rank" type="text" id="rank" value="{S_RANK}" size="1" maxlength="1" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="move_rank">{L_MOVE_RANK}:</label><br /><span>{L_MOVE_RANK_EXPLAIN}</span></dt>
|
||||
<dd><input name="move_rank" type="text" id="move_rank" value="{S_MOVE_RANK}" size="1" maxlength="1" />
|
||||
{L_MOVE_LEAGUE}
|
||||
<select name="move_league" id="move_league">{S_MOVE_LEAGUE_OPTIONS}</select>
|
||||
{L_MATCHDAY}
|
||||
<input name="move_matchday" type="text" id="move_matchday" value="{S_MOVE_MATCHDAY}" size="2" maxlength="2" />
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
321
adm/style/acp_football_leagues.html
Normal file
@@ -0,0 +1,321 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_EDIT -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_ACP_FOOTBALL_LEAGUES_MANAGE}</h1>
|
||||
<p>{L_LEAGUE_EDIT_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_LEAGUE_DETAILS}</legend>
|
||||
<dl>
|
||||
<dt><label for="season">{L_SEASON}:</label></dt>
|
||||
<dd><strong>{SEASON}</strong><input name="l" type="hidden" id="season" value="{SEASON}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league">{L_LEAGUE}:</label></dt>
|
||||
<dd>
|
||||
<!-- IF not S_ADD_LEAGUE -->
|
||||
<strong>{LEAGUE}</strong>
|
||||
<!-- ENDIF -->
|
||||
<input name="l" type="<!-- IF S_ADD_LEAGUE -->text<!-- ELSE -->hidden<!-- ENDIF -->" id="league" value="{LEAGUE}" />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_name">{L_LEAGUE_NAME}:</label></dt>
|
||||
<dd><input name="league_name" type="text" id="league_name" size="20" maxlength="20" value="{LEAGUE_NAME}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_short">{L_LEAGUE_SHORT}:</label><br /><span>{L_LEAGUE_SHORT_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_short" type="text" id="league_short" size="3" maxlength="3" value="{LEAGUE_SHORT}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_type">{L_LEAGUE_TYPE}:</label><br /><span>{L_LEAGUE_TYPE_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label><input name="league_type" type="radio" class="radio" id="league_type" value="{LEAGUE_TYPE_CHAMP}"{LEAGUE_CHAMP} /> {L_LEAGUE_CHAMP}</label>
|
||||
<label><input name="league_type" type="radio" class="radio" value="{LEAGUE_TYPE_KO}"{LEAGUE_KO} /> {L_LEAGUE_KO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="bet_ko_type">{L_BET_TYPE_KO}:</label><br /><span>{L_BET_TYPE_KO_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label><input name="bet_ko_type" type="radio" class="radio" id="bet_ko_type" value="{BET_TYPE_KO_90}"{BET_KO_90} /> {L_MIN90}</label>
|
||||
<label><input name="bet_ko_type" type="radio" class="radio" value="{BET_TYPE_KO_EXTRATIME}"{BET_KO_EXTRATIME} /> {L_EXTRATIME}</label>
|
||||
<label><input name="bet_ko_type" type="radio" class="radio" value="{BET_TYPE_KO_PENALTY}"{BET_KO_PENALTY} /> {L_PENALTY}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_matchdays">{L_LEAGUE_MATCHDAYS}:</label><br /><span>{L_LEAGUE_MATCHDAYS_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_matchdays" type="text" id="league_matchdays" size="2" maxlength="2" value="{LEAGUE_MATCHDAYS}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_matches">{L_LEAGUE_MATCHES}:</label><br /><span>{L_LEAGUE_MATCHES_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<!-- IF S_EDIT_MATCHES -->
|
||||
<input name="league_matches" type="text" id="league_matches" size="2" maxlength="2" value="{LEAGUE_MATCHES}" />
|
||||
<!-- ELSE -->
|
||||
{LEAGUE_MATCHES}
|
||||
<!-- ENDIF -->
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_rules_post_id">{L_LEAGUE_RULES_POST_ID}:</label><br /><span>{L_LEAGUE_RULES_POST_ID_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_rules_post_id" type="text" id="league_rules_post_id" size="8" maxlength="8" value="{LEAGUE_RULES_POST_ID}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_join_by_user">{L_LEAGUE_JOIN_BY_USER}:</label><br /><span>{L_LEAGUE_JOIN_BY_USER_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label><input name="league_join_by_user" type="radio" class="radio" id="league_join_by_user" value="1"{JOIN_BY_USER_YES} /> {L_YES}</label>
|
||||
<label><input name="league_join_by_user" type="radio" class="radio" value="0"{JOIN_BY_USER_NO}
|
||||
onchange="document.getElementById('no_league_join_in_season').checked=true;"/> {L_NO}</label>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_join_in_season">{L_LEAGUE_JOIN_IN_SEASON}:</label><br /><span>{L_LEAGUE_JOIN_IN_SEASON_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label><input name="league_join_in_season" type="radio" class="radio" id="league_join_in_season" value="1"{JOIN_IN_SEASON_YES}
|
||||
onchange="document.getElementById('league_join_by_user').checked=true;"/> {L_YES}</label>
|
||||
<label><input name="league_join_in_season" type="radio" class="radio" id="no_league_join_in_season" value="0"{JOIN_IN_SEASON_NO} /> {L_NO}</label>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF ! S_EDIT_MATCHES -->
|
||||
<dl>
|
||||
<dt><label for="league_bet_in_time">{L_LEAGUE_BET_IN_TIME}:</label><br /><span>{L_LEAGUE_BET_IN_TIME_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label><input name="league_bet_in_time" type="radio" class="radio" id="league_bet_in_time" value="1"{BET_IN_TIME_YES} /> {L_YES}</label>
|
||||
<label><input name="league_bet_in_time" type="radio" class="radio" id="no_league_bet_in_time" value="0"{BET_IN_TIME_NO} /> {L_NO}</label>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_LEAGUE_POINTS}</legend>
|
||||
<dl>
|
||||
<dt><label for="league_points_mode">{L_LEAGUE_POINTS_MODE}:</label><br /><span>{L_LEAGUE_POINTS_MODE_EXPLAIN}</span></dt>
|
||||
<dd><span><select style="vertical-align:top;" name="league_points_mode" id="league_points_mode">{LEAGUE_POINTS_MODE_OPTIONS}</select></span></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_points_hit">{L_LEAGUE_POINTS_HIT}:</label><br /><span>{L_LEAGUE_POINTS_HIT_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_points_hit" type="text" id="league_points_hit" size="2" maxlength="2" value="{LEAGUE_POINTS_HIT}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_points_tendency">{L_LEAGUE_POINTS_TENDENCY}:</label><br /><span>{L_LEAGUE_POINTS_TENDENCY_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_points_tendency" type="text" id="league_points_tendency" size="2" maxlength="2" value="{LEAGUE_POINTS_TENDENCY}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_points_diff">{L_LEAGUE_POINTS_DIFF}:</label><br /><span>{L_LEAGUE_POINTS_DIFF_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_points_diff" type="text" id="league_points_diff" size="2" maxlength="2" value="{LEAGUE_POINTS_DIFF}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_points_last">{L_LEAGUE_POINTS_LAST}:</label><br /><span>{L_LEAGUE_POINTS_LAST_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label><input name="league_points_last" type="radio" class="radio" id="league_points_last" value="1"{POINTS_LAST_YES} /> {L_YES}</label>
|
||||
<label><input name="league_points_last" type="radio" class="radio" value="0"{POINTS_LAST_NO} /> {L_NO}</label>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_LEAGUE_WINS}</legend>
|
||||
<dl>
|
||||
<dt><label for="bet_points">{L_BET_POINTS}:</label><br /><span>{L_BET_POINTS_EXPLAIN}</span></dt>
|
||||
<dd><input name="bet_points" type="text" id="bet_points" size="10" maxlength="10" value="{BET_POINTS}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_win_hits">{L_LEAGUE_WIN_HITS}:</label><br /><span>{L_LEAGUE_WIN_HITS_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_win_hits" type="text" id="league_win_hits" size="10" maxlength="10" value="{LEAGUE_WIN_HITS}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_win_hits_away">{L_LEAGUE_WIN_HITS_AWAY}:</label><br /><span>{L_LEAGUE_WIN_HITS_AWAY_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_win_hits_away" type="text" id="league_win_hits_away" size="10" maxlength="10" value="{LEAGUE_WIN_HITS_AWAY}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><br /><span>{L_LEAGUE_WIN_EXPLAIN}</span></dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_win_matchdays">{L_LEAGUE_WIN_MATCHDAYS}:</label><br /><span>{L_LEAGUE_WIN_MATCHDAYS_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_win_matchdays" type="text" id="league_win_matchdays" value="{LEAGUE_WIN_MATCHDAYS}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league_win_season">{L_LEAGUE_WIN_SEASON}:</label><br /><span>{L_LEAGUE_WIN_SEASON_EXPLAIN}</span></dt>
|
||||
<dd><input name="league_win_season" type="text" id="league_win_season" value="{LEAGUE_WIN_SEASON}" /></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
<!-- IF S_ADD_LEAGUE -->
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
<input type="hidden" name="edit" value="1" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- ELSEIF S_LIST -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_LEAGUE_MEMBERS} :: {LEAGUE_NAME}</h1>
|
||||
<p>{L_MEMBER_EXPLAIN}</p>
|
||||
|
||||
<form id="list" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset class="quick">
|
||||
<a href="{U_DEFAULT_ALL}">» {L_MEMBER_ALL}</a>
|
||||
</fieldset>
|
||||
|
||||
<!-- IF .pagination -->
|
||||
<div class="pagination top-pagination">
|
||||
<!-- INCLUDE pagination.html -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_USERNAME}</th>
|
||||
<th>{L_JOINED}</th>
|
||||
<th>{L_MARK}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN member -->
|
||||
<!-- IF member.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td><a href="{member.U_USER_EDIT}">{member.USERNAME}</a></td>
|
||||
<td style="text-align: center;">{member.JOINED}</td>
|
||||
<td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" value="{member.USER_ID}" /></td>
|
||||
</tr>
|
||||
<!-- BEGINELSE -->
|
||||
<tr>
|
||||
<td class="row1" colspan="3" style="text-align: center;">{L_LEAGUE_NO_MEMBER}</td>
|
||||
</tr>
|
||||
<!-- END member -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF .pagination or TOTAL_MEMBERS -->
|
||||
<div class="pagination">
|
||||
{TOTAL_MEMBERS}
|
||||
<!-- IF .pagination -->
|
||||
<!-- INCLUDE pagination.html -->
|
||||
<!-- ELSE -->
|
||||
• {PAGE_NUMBER}
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<fieldset class="quick">
|
||||
<select name="action"><option class="sep" value="">{L_SELECT_OPTION}</option>{S_ACTION_OPTIONS}</select>
|
||||
<input class="button2" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
<p class="small"><a href="#" onclick="marklist('list', 'mark', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'mark', false); return false;">{L_UNMARK_ALL}</a></p>
|
||||
</fieldset>
|
||||
|
||||
<h1>{L_ADD_USERS}</h1>
|
||||
|
||||
<p>{L_ADD_USERS_EXPLAIN}</p>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_ADD_USERS}</legend>
|
||||
<dl>
|
||||
<dt><label for="group">{L_ADD_GROUP}:</label></dt>
|
||||
<dd><select id="group" name="g">{S_GROUP_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="usernames">{L_USERNAME}:</label><br /><span>{L_USERNAMES_EXPLAIN}</span></dt>
|
||||
<dd><textarea id="usernames" name="usernames" cols="40" rows="5"></textarea></dd>
|
||||
<dd>[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</dd>
|
||||
</dl>
|
||||
|
||||
<p class="quick">
|
||||
<input class="button2" type="submit" name="addmembers" value="{L_SUBMIT}" />
|
||||
</p>
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- ELSE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_LEAGUES_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_LEAGUES_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<h1 style="display:inline;">{L_SELECT_SEASON}:</h1>
|
||||
<select name="s" id="league_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form id="acp_leagues" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<!-- IF S_LEAGUE_ADD -->
|
||||
{L_CREATE_LEAGUE}: <input type="text" name="l" value="" /> <input class="button2" type="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<h1>{L_LEAGUE_DEF}</h1>
|
||||
|
||||
<p>{L_LEAGUE_DEF_EXPLAIN}</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_SEASON}</th>
|
||||
<th>{L_LEAGUE}</th>
|
||||
<th style="width: 25%">{L_LEAGUE_NAME}</th>
|
||||
<th></th>
|
||||
<th>{L_MEMBER}</th>
|
||||
<th colspan="2">{L_OPTIONS}</th>
|
||||
<th>{L_ACTION}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .leagues -->
|
||||
<!-- BEGIN leagues -->
|
||||
<tr class="{leagues.ROW_CLASS}">
|
||||
<td style="text-align: center;"><strong>{leagues.SEASON}</strong></td>
|
||||
<td style="text-align: center;"><strong>{leagues.LEAGUE}</strong></td>
|
||||
<td>{leagues.LEAGUE_NAME}</td>
|
||||
<td>{leagues.LEAGUE_SHORT}</td>
|
||||
<td style="text-align: center;">{leagues.MEMBERS}</td>
|
||||
<td style="text-align: center;"><a href="{leagues.U_EDIT}">{L_SETTINGS}</a></td>
|
||||
<td style="text-align: center;"><!-- IF leagues.S_MEMBER --><a href="{leagues.U_LIST}">{L_MEMBER}</a><!-- ELSE -->{L_MEMBER}<!-- ENDIF --></td>
|
||||
<td style="text-align: center;"><!-- IF leagues.U_DELETE --><a href="{leagues.U_DELETE}">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END leagues -->
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="3" class="row3">{L_NO_LEAGUES_CREATED}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
285
adm/style/acp_football_matchdays.html
Normal file
@@ -0,0 +1,285 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_EDIT -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_ACP_FOOTBALL_MATCHDAYS_MANAGE}</h1>
|
||||
<p>{L_MATCHDAY_EDIT_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_MATCHDAY_DETAILS}</legend>
|
||||
<dl>
|
||||
<dt><label for="season">{L_SEASON}:</label></dt>
|
||||
<dd><strong>{SEASON_NAME}</strong><input name="s" type="hidden" id="season" value="{SEASON}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league">{L_LEAGUE}:</label></dt>
|
||||
<dd><strong>{LEAGUE_NAME}</strong><input name="l" type="hidden" id="league" value="{LEAGUE}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday">{L_MATCHDAY}:</label></dt>
|
||||
<dd><strong>{MATCHDAY}</strong><input name="m" type="hidden" id="matchday" value="{MATCHDAY}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday_name">{L_MATCHDAY_NAME}:</label></dt>
|
||||
<dd><input name="matchday_name" type="text" id="matchday_name" size="30" maxlength="30" value="{MATCHDAY_NAME}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday_status">{L_MATCHDAY_STATUS}:</label><br /><span>{L_MATCHDAY_STATUS_EXPLAIN}</span></dt>
|
||||
<dd><strong>{MATCHDAY_STATUS}</strong><input name="matchday_status" type="hidden" id="matchday_status" value="{MATCHDAY_STATUS}" /></dd>
|
||||
</dl>
|
||||
<!-- IF S_EDIT_DELIVERY -->
|
||||
<dl>
|
||||
<dt><label for="delivery1">{L_MATCHDAY_DELIVERY}:</label><br /><span>{L_MATCHDAY_DELIVERY_EXPLAIN}</span></dt>
|
||||
<dd>{L_DAY}: <select id="delivery1" name="dday1_day">{S_DELIVERY1_DAY_OPTIONS}</select>
|
||||
{L_MONTH}: <select name="dday1_month">{S_DELIVERY1_MONTH_OPTIONS}</select>
|
||||
{L_YEAR}: <select name="dday1_year">{S_DELIVERY1_YEAR_OPTIONS}</select>
|
||||
{L_TIME}: <select name="dday1_hour">{S_DELIVERY1_HOUR_OPTIONS}</select>:
|
||||
<select name="dday1_min">{S_DELIVERY1_MIN_OPTIONS}</select>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="delivery2">{L_MATCHDAY_DELIVERY2}:</label><br /><span>{L_MATCHDAY_DELIVERY2_EXPLAIN}</span></dt>
|
||||
<dd>{L_DAY}: <select id="delivery2" name="dday2_day">{S_DELIVERY2_DAY_OPTIONS}</select>
|
||||
{L_MONTH}: <select name="dday2_month">{S_DELIVERY2_MONTH_OPTIONS}</select>
|
||||
{L_YEAR}: <select name="dday2_year">{S_DELIVERY2_YEAR_OPTIONS}</select>
|
||||
{L_TIME}: <select name="dday2_hour">{S_DELIVERY2_HOUR_OPTIONS}</select>:
|
||||
<select name="dday2_min">{S_DELIVERY2_MIN_OPTIONS}</select>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="delivery3">{L_MATCHDAY_DELIVERY3}:</label><br /><span>{L_MATCHDAY_DELIVERY3_EXPLAIN}</span></dt>
|
||||
<dd>{L_DAY}: <select id="delivery3" name="dday3_day">{S_DELIVERY3_DAY_OPTIONS}</select>
|
||||
{L_MONTH}: <select name="dday3_month">{S_DELIVERY3_MONTH_OPTIONS}</select>
|
||||
{L_YEAR}: <select name="dday3_year">{S_DELIVERY3_YEAR_OPTIONS}</select>
|
||||
{L_TIME}: <select name="dday3_hour">{S_DELIVERY3_HOUR_OPTIONS}</select>:
|
||||
<select name="dday3_min">{S_DELIVERY3_MIN_OPTIONS}</select>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ELSE -->
|
||||
<dl>
|
||||
<dt><label for="matchday_delivery1">{L_MATCHDAY_DELIVERY}:</label><br /><span>{L_MATCHDAY_DELIVERY_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
{MATCHDAY_DEL1}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday_delivery2">{L_MATCHDAY_DELIVERY2}:</label><br /><span>{L_MATCHDAY_DELIVERY2_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
{MATCHDAY_DEL2}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday_delivery3">{L_MATCHDAY_DELIVERY3}:</label><br /><span>{L_MATCHDAY_DELIVERY3_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
{MATCHDAY_DEL3}
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<dl>
|
||||
<dt><label for="matchday_matches">{L_MATCHDAY_MATCHES}:</label><br /><span>{L_MATCHDAY_MATCHES_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<!-- IF S_EDIT_MATCHES -->
|
||||
<input name="matchday_matches" type="text" id="matchday_matches" size="2" maxlength="2" value="{MATCHDAY_MATCHES}" />
|
||||
<!-- ELSE -->
|
||||
{MATCHDAY_MATCHES}
|
||||
<!-- ENDIF -->
|
||||
</dd>
|
||||
</dl>
|
||||
<input type="hidden" name="ko_league" value="1" />
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_CHANGE_DELIVERY -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_CHANGE_DELIVERY}</h1>
|
||||
<p>{L_CHANGE_DELIVERY_EXPLAIN}</p>
|
||||
|
||||
<form id="change_delivery" method="post" action="{U_ACTION}">
|
||||
|
||||
<!-- IF S_SHOW_DELIVERY_SELECT -->
|
||||
<fieldset>
|
||||
<legend>{L_DELIVERY_SET_TIME}</legend>
|
||||
<dl>
|
||||
<dt><label> {L_BACKWARD_DELIVERY}:</label><br /><span>{L_BACKWARD_DELIVERY_EXPLAIN}</span></dt>
|
||||
<dd>{L_DAYS}: <select id="backward_days" name="backward_days">{S_BACKWARD_DAYS_OPTIONS}</select>
|
||||
{L_HOURS}: <select name="backward_hours">{S_BACKWARD_HOURS_OPTIONS}</select>
|
||||
{L_MINUTES}: <select name="backward_minutes">{S_BACKWARD_MINUTES_OPTIONS}</select>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_SHOW_DELIVERY -->
|
||||
<h1>{L_UPDATE_DELIVERY}</h1>
|
||||
|
||||
<p>{L_UPDATE_DELIVERY_EXPLAIN}</p>
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('change_delivery', 'delivery_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('change_delivery', 'delivery_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_MATCHDAY}</th>
|
||||
<th>{L_DELIVERY_NUMBER}</th>
|
||||
<th>{L_DELIVERY}</th>
|
||||
<th>{L_NEW_DELIVERY}</th>
|
||||
<th>{L_SELECT}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN delivery -->
|
||||
<tr class="{delivery.ROW_CLASS}">
|
||||
<td style="text-align: center;"><strong>{delivery.MATCHDAY}</strong></td>
|
||||
<td>{delivery.NUMBER}</td>
|
||||
<td><b>{delivery.DELIVERY_DATE_DAY}</b>
|
||||
<!-- IF delivery.DELIVERY_ERROR --><span style="color: #FF0000;"><!-- ENDIF -->
|
||||
{delivery.DELIVERY_DATE}
|
||||
<!-- IF delivery.DELIVERY_ERROR --></span><!-- ENDIF -->
|
||||
</td>
|
||||
<td><b>{delivery.NEW_DELIVERY_DAY}</b> {delivery.NEW_DELIVERY}
|
||||
<input type="hidden" name="new_delivery_{delivery.MATCHDAY}_{delivery.NUMBER}" value="{delivery.NEW_DELIVERY}" />
|
||||
</td>
|
||||
<td>
|
||||
<input name="delivery_{delivery.MATCHDAY}_{delivery.NUMBER}" id="delivery_{delivery.MATCHDAY}_{delivery.NUMBER}"
|
||||
type="checkbox" class="radio" <!-- IF delivery.SELECT_CHECKED --> checked="checked"<!-- ENDIF --> />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END delivery -->
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('update_delivery', 'delivery_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('update_delivery', 'delivery_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
|
||||
<!-- ENDIF -->
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<!-- IF S_SHOW_DELIVERY -->
|
||||
<input class="button1" type="submit" id="update_delivery" name="update_delivery" value="{L_SUBMIT}" />
|
||||
<!-- ELSE -->
|
||||
<input class="button1" type="submit" id="show_delivery" name="show_delivery" value="{L_SHOW_DELIVERY}" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- ELSE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_MATCHDAYS_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_MATCHDAYS_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_LEAGUE}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="matchday_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="matchday_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form style="display:inline;" id="add_matchday" method="post" action="{U_ACTION}">
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="m" value="{S_MATCHDAY}" />
|
||||
<input type="hidden" name="ko_league" value="{KO_LEAGUE}" />
|
||||
<!-- IF S_MATCHDAYS_REMOVE -->
|
||||
<input class="button2" type="submit" name="submit" value="{L_REMOVE_MATCHDAYS}" />
|
||||
<input type="hidden" name="remove" value="1" />
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_MATCHDAY_ADD -->
|
||||
|
||||
<input class="button2" type="submit" name="submit" value="{L_GENERATE_MATCHDAY}" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form style="display:inline;" id="change_delivery" method="post" action="{U_ACTION}">
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<!-- IF not S_MATCHDAY_ADD and not S_MATCHDAYS_REMOVE -->
|
||||
|
||||
<input class="button2" type="submit" name="change_delivery" value="{L_CHANGE_DELIVERY}" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<h1>{L_MATCHDAY_DEF}</h1>
|
||||
|
||||
<p>{L_MATCHDAY_DEF_EXPLAIN}</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_MATCHDAY}</th>
|
||||
<th style="width: 25%">{L_MATCHDAY_NAME}</th>
|
||||
<th>{L_MATCHDAY_STATUS}</th>
|
||||
<th>{L_MATCHDAY_DELIVERY}</th>
|
||||
<th>{L_MATCHDAY_DELIVERY} 2</th>
|
||||
<th>{L_MATCHDAY_DELIVERY} 3</th>
|
||||
<th>{L_OPTIONS}</th>
|
||||
<th>{L_ACTION}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .matchdays -->
|
||||
<!-- BEGIN matchdays -->
|
||||
<tr class="{matchdays.ROW_CLASS}">
|
||||
<td style="text-align: center;"><strong>{matchdays.MATCHDAY}</strong></td>
|
||||
<td>{matchdays.MATCHDAY_NAME}</td>
|
||||
<td style="text-align: center;">{matchdays.MATCHDAY_STATUS}</td>
|
||||
<td>{matchdays.MATCHDAY_DELIVERY}</td>
|
||||
<td>{matchdays.MATCHDAY_DELIVERY_2}</td>
|
||||
<td>{matchdays.MATCHDAY_DELIVERY_3}</td>
|
||||
<td style="text-align: center;"><a href="{matchdays.U_EDIT}">{L_SETTINGS}</a></td>
|
||||
<td style="text-align: center;"><!-- IF matchdays.U_DELETE --><a href="{matchdays.U_DELETE}">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END matchdays -->
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="4" class="row3">{L_NO_MATCHDAYS_CREATED}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
205
adm/style/acp_football_matches.html
Normal file
@@ -0,0 +1,205 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_EDIT -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_ACP_FOOTBALL_MATCHES_MANAGE}</h1>
|
||||
<p>{L_MATCH_EDIT_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_MATCH_DETAILS}</legend>
|
||||
<dl>
|
||||
<dt><label for="season">{L_SEASON}:</label></dt>
|
||||
<dd><strong>{SEASON_NAME}</strong><input name="s" type="hidden" id="season" value="{SEASON}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="league">{L_LEAGUE}:</label></dt>
|
||||
<dd><strong>{LEAGUE_NAME}</strong><input name="l" type="hidden" id="league" value="{LEAGUE}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="matchday">{L_MATCHDAY}:</label></dt>
|
||||
<dd><strong>{MATCHDAY_NAME}</strong><input name="m" type="hidden" id="matchday" value="{MATCHDAY}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="match_number">{L_MATCH_NUMBER}:</label></dt>
|
||||
<dd><strong>{MATCH_NUMBER}</strong><input name="g" type="hidden" id="match_number" value="{MATCH_NUMBER}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="match_begin">{L_MATCH_BEGIN}:</label></dt>
|
||||
<dd>{L_DAY}: <select id="match_begin" name="mday_day">{S_MATCHDAY_DAY_OPTIONS}</select>
|
||||
{L_MONTH}: <select name="mday_month">{S_MATCHDAY_MONTH_OPTIONS}</select>
|
||||
{L_YEAR}: <select name="mday_year">{S_MATCHDAY_YEAR_OPTIONS}</select>
|
||||
{L_TIME}: <select name="mday_hour">{S_MATCHDAY_HOUR_OPTIONS}</select>:
|
||||
<select name="mday_min">{S_MATCHDAY_MIN_OPTIONS}</select>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="match_status">{L_MATCH_STATUS}:</label><br /><span>{L_MATCH_STATUS_EXPLAIN}</span></dt>
|
||||
<dd><!-- IF S_EDIT_STATUS -->
|
||||
<select name="match_status" id="match_status">{STATUS_OPTIONS}</select>
|
||||
<!-- ELSE -->
|
||||
<strong>{MATCH_STATUS}</strong><input name="match_status" type="hidden" id="match_status" value="{MATCH_STATUS}" />
|
||||
<!-- ENDIF -->
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="match_odds">{L_MATCH_ODDS}:</label></dt>
|
||||
<dd>{L_ODD_1}: <input name="odd_1" type="text" id="odd_1" size="10" maxlength="6" value="{ODD_1}" />
|
||||
{L_ODD_x}: <input name="odd_x" type="text" id="odd_x" size="10" maxlength="6" value="{ODD_x}" />
|
||||
{L_ODD_2}: <input name="odd_2" type="text" id="odd_2" size="10" maxlength="6" value="{ODD_2}" />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="rating">{L_MATCH_RATING}:</label></dt>
|
||||
<dd><input name="rating" type="text" id="rating" size="10" maxlength="6" value="{RATING}" /></dd>
|
||||
</dl>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<dl>
|
||||
<dt><label for="match_group">{L_MATCH_GROUP}:</label></dt>
|
||||
<dd><input name="group_match" id="group_match" type="checkbox" class="radio"
|
||||
onchange="if(this.checked){document.getElementById('match_ko').checked=false;}" <!-- IF S_GROUP_CHECKED --> checked="checked"<!-- ENDIF --> />
|
||||
<input name="match_group" type="text" id="match_group" value="{MATCH_GROUP}" size="1" maxlength="1" readonly/></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="match_ko">{L_MATCH_KO}:</label><br /><span>{L_MATCH_KO_EXPLAIN}</span></dt>
|
||||
<dd><input name="match_ko" id="match_ko" type="checkbox" class="radio"
|
||||
onchange="if(this.checked){document.getElementById('group_match').checked=false;}" <!-- IF S_KO_CHECKED --> checked="checked"<!-- ENDIF --> /></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<dl>
|
||||
<dt><label for="team_home">{L_MATCH_HOME}:</label></dt>
|
||||
<dd><select name="team_home" id="team_home" onchange="document.getElementById('match_group').value = this.value.substring(0, 1);">{TEAM_HOME_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<dl>
|
||||
<dt><label for="formula_home">{L_FORMULA_HOME}:</label><br /><span>{L_FORMULA_HOME_EXPLAIN}</span></dt>
|
||||
<dd><input name="formula_home" type="text" id="formula_home" size="9" maxlength="9" value="{FORMULA_HOME}" /></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<dl>
|
||||
<dt><label for="team_guest">{L_MATCH_GUEST}:</label></dt>
|
||||
<dd><select name="team_guest" id="team_guest" onchange="document.getElementById('match_group').value = this.value.substring(0, 1);">{TEAM_GUEST_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<dl>
|
||||
<dt><label for="formula_guest">{L_FORMULA_GUEST}:</label><br /><span>{L_FORMULA_GUEST_EXPLAIN}</span></dt>
|
||||
<dd><input name="formula_guest" type="text" id="formula_guest" size="9" maxlength="9" value="{FORMULA_GUEST}" /></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<input type="hidden" name="ko_league" value="1" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- ELSE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_MATCHES_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_MATCHES_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_MATCHDAY}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="match_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="match_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<select name="m" id="match_matchday" onchange="this.form.submit();">{S_MATCHDAY_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form id="add_match" method="post" action="{U_ACTION}">
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="m" value="{S_MATCHDAY}" />
|
||||
<input type="hidden" name="ko_league" value="{KO_LEAGUE}" />
|
||||
<!-- IF S_MATCH_ADD -->
|
||||
<input class="button2" type="submit" name="submit" value="{L_GENERATE_MATCHES}" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<h1>{L_MATCHES_DEF}</h1>
|
||||
|
||||
<p>{L_MATCHES_DEF_EXPLAIN}</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_MATCH_NUMBER}</th>
|
||||
<th>{L_MATCH_BEGIN}</th>
|
||||
<th>{L_MATCH_STATUS}</th>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<th>{L_GROUP}</th>
|
||||
<th>{L_KO}</th>
|
||||
<!-- ENDIF -->
|
||||
<th style="width: 20%">{L_MATCH_HOME}</th>
|
||||
<th style="width: 20%">{L_MATCH_GUEST}</th>
|
||||
<th>{L_OPTIONS}</th>
|
||||
<th>{L_ACTION}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .match -->
|
||||
<!-- BEGIN match -->
|
||||
<tr class="{match.ROW_CLASS}">
|
||||
<td style="text-align:center;"><strong>{match.MATCH_NUMBER}</strong></td>
|
||||
<td>{match.MATCH_BEGIN}</td>
|
||||
<td style="text-align:center;">{match.MATCH_STATUS}</td>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<td style="text-align:center;">{match.MATCH_GROUP}</td>
|
||||
<td style="text-align:center;">{match.MATCH_KO}</td>
|
||||
<!-- ENDIF -->
|
||||
<td>{match.MATCH_HOME}</td>
|
||||
<td>{match.MATCH_GUEST}</td>
|
||||
<td style="text-align:center;"><a href="{match.U_EDIT}">{L_SETTINGS}</a></td>
|
||||
<td style="text-align:center;"><!-- IF match.U_DELETE --><a href="{match.U_DELETE}">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END match -->
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="4" class="row3">{L_NO_MATCHES_CREATED}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
223
adm/style/acp_football_results.html
Normal file
@@ -0,0 +1,223 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_RESULTS_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_RESULTS_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_MATCHDAY}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="match_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="match_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<select name="m" id="match_matchday" onchange="this.form.submit();">{S_MATCHDAY_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- IF S_SUCCESS -->
|
||||
<div class="successbox">
|
||||
<h3>{L_ADVICE}</h3>
|
||||
<p>{SUCCESS_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="list" method="post" action="{U_ACTION}">
|
||||
<fieldset>
|
||||
<legend>{S_LEGEND}</legend>
|
||||
<p class="small" style="margin:0px">{S_TIME}</p>
|
||||
<input type="hidden" name="s" value="{S_SEASON}" style="display:inline" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" style="display:inline" />
|
||||
<input type="hidden" name="m" value="{S_MATCHDAY}" style="display:inline" />
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('list', 'delete_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'delete_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th title="{L_SELECT_EXPLAIN}" style="text-align:center">{L_SELECT}</th>
|
||||
<th>{L_MATCH_BEGIN}</th>
|
||||
<th colspan="3" style="text-align:center">{L_VS}</th>
|
||||
<th title="{L_RESULT_EXPLAIN}" colspan="3" style="text-align:center">{L_RESULT} ({RESULT_EXPLAIN})</th>
|
||||
<!-- IF S_KO_MATCHDAY -->
|
||||
<th title="{L_OVERTIME_EXPLAIN}" colspan="3" style="text-align:center">{LABEL_FINALRESULT}</th>
|
||||
<!-- ENDIF -->
|
||||
<th title="{L_MATCH_STATUS_TITLE}" style="text-align:center">{L_STATUS} </th>
|
||||
<th title="{L_NO_VALUATION_EXPLAIN}" style="text-align:center">{L_NO_VALUATION}</th>
|
||||
<th title="{L_DELETE_EXPLAIN}" style="text-align:center">{L_DELETE}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .match -->
|
||||
<!-- BEGIN match -->
|
||||
<tr class="{match.ROW_CLASS}">
|
||||
<td style="text-align:center">
|
||||
<!-- IF match.EDIT -->
|
||||
<input name="select_{match.NUMBER}" id="select_{match.NUMBER}" type="checkbox"
|
||||
class="radio" <!-- IF match.SELECT_CHECKED --> checked="checked"<!-- ENDIF --> />
|
||||
<!-- ELSE -->
|
||||
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td> {match.BEGIN}</td>
|
||||
<td>{match.HOME_NAME}</td>
|
||||
<td>:</td>
|
||||
<td style="text-align:left">{match.GUEST_NAME}</td>
|
||||
<td style="text-align:right">
|
||||
<!-- IF match.EDIT -->
|
||||
<input name="goals_home_{match.NUMBER}" style="margin:0; width:30px;"
|
||||
type="number" min="0" max="20" size="2" value="{match.GOALS_HOME}"
|
||||
onchange="document.getElementById('select_{match.NUMBER}').checked = true;" />
|
||||
<!-- ELSE -->
|
||||
{match.GOALS_HOME}
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td style="text-align:center;width:3px;">:</td>
|
||||
<td style="text-align:left">
|
||||
<!-- IF match.EDIT -->
|
||||
<input name="goals_guest_{match.NUMBER}" style="margin:0; width:30px;"
|
||||
type="number" min="0" max="20" size="2" value="{match.GOALS_GUEST}"
|
||||
onchange="document.getElementById('select_{match.NUMBER}').checked = true;" />
|
||||
<!-- ELSE -->
|
||||
{match.GOALS_GUEST}
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
|
||||
<!-- IF S_KO_MATCHDAY -->
|
||||
<td style="text-align:right">
|
||||
<!-- IF match.KO_MATCH -->
|
||||
<!-- IF match.EDIT -->
|
||||
<input name="overtime_home_{match.NUMBER}" style="margin:0; width:30px;"
|
||||
type="number" min="0" max="20" size="2" value="{match.OVERTIME_HOME}"
|
||||
onchange="document.getElementById('select_{match.NUMBER}').checked = true;" />
|
||||
<!-- ELSE -->
|
||||
{match.OVERTIME_HOME}
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td style="text-align:center; width:3px;">:</td>
|
||||
<td style="text-align:left">
|
||||
<!-- IF match.KO_MATCH -->
|
||||
<!-- IF match.EDIT -->
|
||||
<input name="overtime_guest_{match.NUMBER}" style="margin:0; width:30px;"
|
||||
type="number" min="0" max="20" size="2" value="{match.OVERTIME_GUEST}"
|
||||
onchange="document.getElementById('select_{match.NUMBER}').checked = true;" />
|
||||
<!-- ELSE -->
|
||||
{match.OVERTIME_GUEST}
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<!-- ENDIF -->
|
||||
<td style="text-align:center"><input type="hidden" name="status" value="{match.STATUS}" />{match.STATUS_COLOR}</td>
|
||||
<td style="text-align:center">
|
||||
<input name="no_valuation_{match.NUMBER}" type="checkbox" class="radio"
|
||||
<!-- IF match.NO_VALUATION_CHECKED --> checked="checked"<!-- ENDIF -->
|
||||
onchange="document.getElementById('select_{match.NUMBER}').checked = true;" />
|
||||
</td>
|
||||
<td style="text-align:center">
|
||||
<input name="delete_{match.NUMBER}" type="checkbox" class="radio"
|
||||
onchange="document.getElementById('select_{match.NUMBER}').checked = true;" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END match -->
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="small">
|
||||
<a href="#" onclick="marklist('list', 'select_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'select_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
|
||||
<!-- IF S_EXTRA_RESULTS -->
|
||||
<br />
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:center">{L_SELECT}</th>
|
||||
<th style="text-align: left;">{L_QUESTION}</th>
|
||||
<th>{L_POSSIBLE_POINTS}</th>
|
||||
<th>{L_EVALUATION}</th>
|
||||
<th>{L_RESULT}</th>
|
||||
<th>{L_STATUS} </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN extra_result -->
|
||||
<tr class="{extra_result.ROW_CLASS}">
|
||||
<td style="text-align:center">
|
||||
<!-- IF extra_result.S_EDIT_EXTRA -->
|
||||
<input name="select{extra_result.EXTRA_NO}" id="select{extra_result.EXTRA_NO}" type="checkbox" class="radio" />
|
||||
<!-- ELSE -->
|
||||
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td>{extra_result.QUESTION}</td>
|
||||
<td style="text-align: center;">{extra_result.EXTRA_POINTS}</td>
|
||||
<td style="text-align: center;" title="{extra_result.EVALUATION_TITLE}">{extra_result.EVALUATION}</td>
|
||||
<td style="text-align: center;">
|
||||
<!-- IF extra_result.S_EDIT_EXTRA -->
|
||||
<!-- IF extra_result.S_DISPLAY_TYPE == 1 -->
|
||||
<!-- IF S_VIEW <> 'print' -->
|
||||
<select {extra_result.S_MULTIPLE} name="extra{extra_result.EXTRA_NO}{extra_result.S_MULTIPLE_ARR}"
|
||||
onchange="document.getElementById('select{extra_result.EXTRA_NO}').checked = true;">
|
||||
<!-- BEGIN extra_option -->
|
||||
<option {extra_result.extra_option.S_SELECTED} value="{extra_result.extra_option.OPTION_VALUE}">{extra_result.extra_option.OPTION_NAME}</option>
|
||||
<!-- END extra_option -->
|
||||
</select>
|
||||
<!-- ELSE -->
|
||||
_{extra_result.RESULT}_
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF extra_result.S_DISPLAY_TYPE == 2 -->
|
||||
<!-- IF S_VIEW <> 'print' -->
|
||||
<input style="display:inline; margin:0; padding:0;" type="text" name="extra{extra_result.EXTRA_NO}" size="15" maxlength="255"
|
||||
value="{extra_result.RESULT}" onchange="document.getElementById('select{extra_result.EXTRA_NO}').checked = true;">
|
||||
<!-- ELSE -->
|
||||
_{extra_result.RESULT}_
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- ELSE -->
|
||||
{extra_result.RESULT}
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td style="text-align:center"><input type="hidden" name="status" value="{extra_result.STATUS}" />{extra_result.STATUS_COLOR}</td>
|
||||
</tr>
|
||||
<!-- END extra_result -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_CASH_POINTS -->{L_CASH_POINTS} <input name="cash" type="checkbox" class="radio" <!-- IF S_CASH -->checked="checked"<!-- ENDIF --> /> <!-- ENDIF -->
|
||||
|
||||
</fieldset>
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="edit" value="{L_SAVE}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="14" class="row3">{L_NO_MATCHES}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE frame_results.html -->
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
105
adm/style/acp_football_seasons.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_EDIT -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_ACP_FOOTBALL_SEASONS_MANAGE}</h1>
|
||||
<p>{L_SEASON_EDIT_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_SEASON_DETAILS}</legend>
|
||||
<dl>
|
||||
<dt><label for="season">{L_SEASON}:</label></dt>
|
||||
<dd><!-- IF not S_ADD_SEASON --><strong>{SEASON}</strong><!-- ENDIF -->
|
||||
<input name="s" type="<!-- IF S_ADD_SEASON -->text<!-- ELSE -->hidden<!-- ENDIF -->" id="season" value="{SEASON}" size="4" maxlength="4" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="season_name">{L_SEASON_NAME}:</label><br /><span>{L_SEASON_NAME_EXPLAIN}</span></dt>
|
||||
<dd><input name="season_name" type="text" id="season_name" value="{SEASON_NAME}" size="20" maxlength="20" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="season_short">{L_SEASON_SHORT}:</label><br /><span>{L_SEASON_SHORT_EXPLAIN}</span></dt>
|
||||
<dd><input name="season_short" type="text" id="season_short" value="{SEASON_SHORT}" size="10" maxlength="10" /></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
<!-- IF S_ADD_SEASON -->
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
<input type="hidden" name="edit" value="1" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- ELSE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_SEASONS_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_SEASONS_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="acp_football_seasons" method="post" action="{U_ACTION}">
|
||||
<fieldset class="quick">
|
||||
<!-- IF S_SEASON_ADD -->
|
||||
{L_CREATE_SEASON}: <input type="text" name="s" value="" /> <input class="button2" type="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<h1>{L_SEASON_DEF}</h1>
|
||||
|
||||
<p>{L_SEASON_DEF_EXPLAIN}</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_SEASON}</th>
|
||||
<th style="width: 35%">{L_SEASON_NAME}</th>
|
||||
<th>{L_SEASON_SHORT}</th>
|
||||
<th>{L_LEAGUES}</th>
|
||||
<th>{L_OPTIONS}</th>
|
||||
<th>{L_ACTION}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .seasons -->
|
||||
<!-- BEGIN seasons -->
|
||||
<tr class="{seasons.ROW_CLASS}">
|
||||
<td style="text-align: center;"><strong>{seasons.SEASON}</strong></td>
|
||||
<td>{seasons.SEASON_NAME}</td>
|
||||
<td>{seasons.SEASON_SHORT}</td>
|
||||
<td style="text-align: center;">{seasons.LEAGUES}</td>
|
||||
<td style="text-align: center;"><a href="{seasons.U_EDIT}">{L_SETTINGS}</a></td>
|
||||
<td style="text-align: center;"><!-- IF seasons.U_DELETE --><a href="{seasons.U_DELETE}">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END seasons -->
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="4" class="row3">{L_NO_SEASONS_CREATED}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
164
adm/style/acp_football_teams.html
Normal file
@@ -0,0 +1,164 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_EDIT -->
|
||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||
<h1>{L_ACP_FOOTBALL_TEAMS_MANAGE}</h1>
|
||||
<p>{L_TEAM_EDIT_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_TEAM_DETAILS}</legend>
|
||||
<dl>
|
||||
<dt><label for="team">{L_SEASON}:</label></dt>
|
||||
<dd><strong>{SEASON_NAME}</strong><input name="s" type="hidden" id="season" value="{SEASON}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="team">{L_LEAGUE}:</label></dt>
|
||||
<dd><strong>{LEAGUE_NAME}</strong><input name="l" type="hidden" id="league" value="{LEAGUE}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="team">{L_TEAM}:</label></dt>
|
||||
<dd><!-- IF not S_ADD_TEAM --><strong>{TEAM}</strong><!-- ENDIF -->
|
||||
<input name="t" type="<!-- IF S_ADD_TEAM -->text<!-- ELSE -->hidden<!-- ENDIF -->" id="team" value="{TEAM}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="team_name">{L_TEAM_NAME}:</label></dt>
|
||||
<dd><input name="team_name" type="text" id="team_name" size="30" maxlength="30" value="{TEAM_NAME}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="team_short">{L_TEAM_SHORT}:</label><br /><span>{L_TEAM_SHORT_EXPLAIN}</span></dt>
|
||||
<dd><input name="team_short" type="text" id="team_short" size="10" maxlength="10" value="{TEAM_SHORT}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="team_symbol">{L_TEAM_SYMBOL}:</label><br /><span>{L_TEAM_SYMBOL_EXPLAIN}</span></dt>
|
||||
<dd><span>
|
||||
<select style="vertical-align:top;" name="team_symbol" id="team_symbol"
|
||||
onchange="document.getElementById('teamsymbol').src = '{PHPBB_ROOT_PATH}images/flags/' + this.value;">
|
||||
{TEAM_SYMBOL_OPTIONS}
|
||||
</select> <img src="{TEAM_IMAGE}" id="teamsymbol" alt="{TEAM_NAME}" title="{TEAM_NAME}" /></span></dd>
|
||||
</dl>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<dl>
|
||||
<dt><label for="team_group">{L_TEAM_GROUP}:</label><br /><span>{L_TEAM_GROUP_EXPLAIN}</span></dt>
|
||||
<dd><input name="team_group" type="text" id="team_group" size="1" maxlength="1" value="{TEAM_GROUP}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="team_round">{L_TEAM_ROUND}:</label><br /><span>{L_TEAM_ROUND_EXPLAIN}</span></dt>
|
||||
<dd><select name="team_round" id="team_round">{TEAM_MATCHDAY_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<input type="hidden" name="ko_league" value="1" />
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
<!-- IF S_ADD_TEAM -->
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
<input type="hidden" name="edit" value="1" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- ELSE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_TEAMS_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_TEAMS_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<h1 style="display:inline;">{L_SELECT_LEAGUE}:</h1>
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="team_season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form style="display:inline;" method="post" action="{U_ACTION}">
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<select name="l" id="team_league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
{S_FORM_TOKEN}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form id="add_team" method="post" action="{U_ACTION}">
|
||||
<fieldset class="quick">
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="ko_league" value="{S_KO_LEAGUE}" />
|
||||
<!-- IF S_TEAM_ADD -->
|
||||
{L_ADD_TEAM}: <select name="t" id="old_team">{S_TEAM_OPTIONS}</select> <input class="button2" type="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<h1>{L_TEAM_DEF} {S_TEAMS}</h1>
|
||||
|
||||
<p>{L_TEAM_DEF_EXPLAIN}</p>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_TEAM}</th>
|
||||
<th></th>
|
||||
<th style="width: 25%">{L_TEAM_NAME}</th>
|
||||
<th></th>
|
||||
<th>{L_TEAM_MATCHES}</th>
|
||||
<th>{L_TEAM_AWAY}</th>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<th>{L_GROUP}</th>
|
||||
<th>{L_MATCHDAY}</th>
|
||||
<!-- ENDIF -->
|
||||
<th>{L_OPTIONS}</th>
|
||||
<th>{L_ACTION}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .teams -->
|
||||
<!-- BEGIN teams -->
|
||||
<tr class="{teams.ROW_CLASS}">
|
||||
<td style="text-align: center;"><strong>{teams.TEAM}</strong></td>
|
||||
<td style="text-align: center;"><img src="{teams.TEAM_IMAGE}" alt="{teams.TEAM_NAME}" title="{teams.TEAM_NAME}" width="20" height="20" /></td>
|
||||
<td>{teams.TEAM_NAME}</td>
|
||||
<td>{teams.TEAM_SHORT}</td>
|
||||
<td>{teams.TEAM_MATCHES}</td>
|
||||
<td>{teams.TEAM_HOME}</td>
|
||||
<!-- IF S_KO_LEAGUE -->
|
||||
<td style="text-align: center;">{teams.TEAM_GROUP}</td>
|
||||
<td style="text-align: center;">{teams.TEAM_ROUND}</td>
|
||||
<!-- ENDIF -->
|
||||
<td style="text-align: center;"><a href="{teams.U_EDIT}">{L_SETTINGS}</a></td>
|
||||
<td style="text-align: center;"><!-- IF teams.U_DELETE --><a href="{teams.U_DELETE}">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END teams -->
|
||||
<!-- ELSE -->
|
||||
<tr>
|
||||
<td colspan="2" class="row3">{L_NO_TEAMS_CREATED}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF S_MATCHES --> {S_MATCHES} {L_TEAM_MATCHES} <!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
430
adm/style/acp_football_update.html
Normal file
@@ -0,0 +1,430 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<h1>{L_ACP_FOOTBALL_UPDATE_MANAGE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_UPDATE_MANAGE_EXPLAIN}</p>
|
||||
|
||||
<!-- IF S_SUCCESS -->
|
||||
<div class="successbox">
|
||||
<h3>{L_ADVICE}</h3>
|
||||
<p>{SUCCESS_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="settings" method="post" action="{U_ACTION}">
|
||||
<fieldset>
|
||||
<legend>{L_SOURCE}</legend>
|
||||
<dl>
|
||||
<dt><label for="xml_season_url">{L_XML_SEASON_URL}:</label><br /><span>{L_XML_SEASON_URL_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<input name="xml_season_url" type="text" id="xml_season_url" value="{XML_SEASON_URL}" size="60" maxlength="100"
|
||||
<!-- IF not S_ALLOW_URL_FOPEN --> DISABLED <!-- ENDIF -->/>
|
||||
<input class="button1" type="submit" id="load_xml_season" name="load_xml_season" value="{L_LOAD}" />
|
||||
<!-- IF not S_ALLOW_URL_FOPEN -->
|
||||
<br /> <span style="color: red;">{L_ALLOW_URL_FOPEN}</span>
|
||||
<!-- ENDIF -->
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- IF S_CHOOSE -->
|
||||
|
||||
<form method="post" action="{U_CHOOSE_ACTION}">
|
||||
<fieldset>
|
||||
<legend>{L_CHOOSE_LEAGUES}</legend>
|
||||
<dl>
|
||||
<dt><label for="xs">{L_SOURCE}:</label></dt>
|
||||
<dd>
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<input type="hidden" name="xml_season_url" value="{XML_SEASON_URL}" />
|
||||
<input type="hidden" name="league_name" value="{S_LEAGUE_NAME}" />
|
||||
<input type="hidden" name="xcode" value="{S_XCODE}" />
|
||||
<select name="xs" id="xs" onchange="this.form.submit();">{S_XSEASON_OPTIONS}</select>
|
||||
</div>
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="xl" id="xl" onchange="this.form.submit();">{S_XLEAGUE_OPTIONS}</select>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="s">{L_TARGET}:</label></dt>
|
||||
<dd>
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="s" id="season" onchange="this.form.submit();">{S_SEASON_OPTIONS}</select>
|
||||
</div>
|
||||
<div style="display:inline; margin:0; padding:0;">
|
||||
<select name="l" id="league" onchange="this.form.submit();">{S_LEAGUE_OPTIONS}</select>
|
||||
</div>
|
||||
<div title="{L_NEW_LEAGUE_EXPLAIN}" style="display:inline; margin:0; padding:0;">
|
||||
<input name="new_league" type="text" id="new_league" value="{NEW_LEAGUE}" size="2" maxlength="2" />
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</fieldset>
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<!-- IF S_LEAGUE -->
|
||||
<input class="button1" type="submit" id="team_mapping" name="team_mapping" value="{L_COMPARE_UPDATE}" />
|
||||
<!-- ELSE -->
|
||||
<input class="button1" type="submit" id="load_xml_league" name="load_xml_league" value="{L_SHOW_UPDATE}" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_TEAMS -->
|
||||
<form id="teams" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_TEAM_MAPPING}</legend>
|
||||
<!-- IF S_MISSING_TEAMS --><span style="color: red;">{S_MISSING_TEAMS}</span><!-- ENDIF -->
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_TEAM}</th>
|
||||
<th style="width: 25%">{L_TEAM_NAME}</th>
|
||||
<th>{L_TEAM_NAME_SHORT}</th>
|
||||
<th>{L_TEAM_MAPPING}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN teams -->
|
||||
<tr class="{teams.ROW_CLASS}">
|
||||
<td>{teams.TEAM_ID_XML}</td>
|
||||
<td><img src="{teams.TEAM_IMAGE_XML}" id="teamsymbol" alt="{teams.TEAM_NAME_XML}" title="{teams.TEAM_NAME_XML}" />
|
||||
{teams.TEAM_NAME_XML}
|
||||
</td>
|
||||
<td>{teams.TEAM_NAME_SHORT_XML}</td>
|
||||
<td <!-- IF teams.DUPLICATE_TEAM -->title="{L_DUPLICATE_TEAM}" bgcolor=#ECD5D8<!-- ENDIF -->>
|
||||
<select name="team_id_db_{teams.TEAM_ID_XML}" id="team_id_{teams.TEAM_ID_XML}" onchange="this.form.submit();">{teams.TEAM_OPTIONS}</select>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END teams -->
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input type="hidden" name="xml_season_url" value="{XML_SEASON_URL}" />
|
||||
<input type="hidden" name="league_name" value="{S_LEAGUE_NAME}" />
|
||||
<input type="hidden" name="xml_ary" value="{XML_ARY}" />
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="xs" value="{S_XSEASON}" />
|
||||
<input type="hidden" name="xl" value="{S_XLEAGUE}" />
|
||||
<input type="hidden" name="xcode" value="{S_XCODE}" />
|
||||
<input class="button1" type="submit" id="submit" name="map_teams" value="{L_MAP_TEAMS}" />
|
||||
<input class="button1" type="submit" id="submit" name="choose" value="{L_CHOOSE_OTHER_LEAGUE}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_LIST -->
|
||||
<form id="list" method="post" action="{U_ACTION}">
|
||||
<!-- IF S_INSERT_LEAGUE --><h1>{L_INSERT_LEAGUE}</h3><!-- ELSE --><h1>{L_UPDATE_LEAGUE}</h3><!-- ENDIF -->
|
||||
<fieldset>
|
||||
<dl>
|
||||
<dt><label for="xml_season_url">{L_SEASON}:</label></dt>
|
||||
<dd>{S_SEASON}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="xml_season_url">{L_LEAGUE}:</label></dt>
|
||||
<dd>{S_LEAGUE}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="xml_season_url">{L_LEAGUE_NAME}:</label></dt>
|
||||
<dd>{S_LEAGUE_NAME}</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<!-- IF S_INSERT_SEASON -->
|
||||
<fieldset>
|
||||
<legend>{L_INSERT_SEASON}</legend>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_SEASON}</th>
|
||||
<th>{L_SEASON_NAME}</th>
|
||||
<th>{L_SEASON_SHORT}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN footb_seasons -->
|
||||
{footb_seasons.TPL}
|
||||
<!-- END footb_seasons -->
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_INSERT_LEAGUE -->
|
||||
<fieldset>
|
||||
<legend>{L_INSERT_LEAGUE}</legend>
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 20%">{L_LEAGUE_NAME}</th>
|
||||
<th>{L_LEAGUE_SHORTCUT}</th>
|
||||
<th>{L_LEAGUE_TYPE}</th>
|
||||
<th>{L_LEAGUE_MATCHDAYS}</th>
|
||||
<th>{L_LEAGUE_MATCHES}</th>
|
||||
<th>{L_LEAGUE_POINTS_MODE}</th>
|
||||
<th>{L_LEAGUE_BET_IN_TIME}</th>
|
||||
<th>{L_BET_TYPE_KO}</th>
|
||||
<th>{L_OTHER_FIELDS}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN footb_leagues -->
|
||||
{footb_leagues.TPL}
|
||||
<!-- END footb_leagues -->
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .footb_matchdays -->
|
||||
<fieldset>
|
||||
<legend>{DO_MATCHDAYS}</legend>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHDAYS_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHDAYS_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<!-- ENDIF -->
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_MATCHDAY}</th>
|
||||
<th>{L_MATCHDAY_STATUS}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matchdays_status" id="update_matchdays_status" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_MATCHDAY_DELIVERY}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matchdays_delivery_date" id="update_matchdays_delivery_date" type="checkbox" class="radio" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_MATCHDAY_DELIVERY} 2
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matchdays_delivery_date_2" id="update_matchdays_delivery_date_2" type="checkbox" class="radio" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_MATCHDAY_DELIVERY} 3
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matchdays_delivery_date_3" id="update_matchdays_delivery_date_3" type="checkbox" class="radio" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th style="width: 25%">{L_MATCHDAY_NAME}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matchdays_matchday_name" id="update_matchdays_matchday_name" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_MATCHES}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matchdays_matches" id="update_matchdays_matches" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<th title="{L_SELECT_EXPLAIN}" style="text-align:center">{L_SELECT}</th>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN footb_matchdays -->
|
||||
{footb_matchdays.TPL}
|
||||
<!-- END footb_matchdays -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHDAYS_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHDAYS_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .footb_teams -->
|
||||
<fieldset>
|
||||
<legend>{DO_TEAMS}</legend>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_TEAMS_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_TEAMS_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<!-- ENDIF -->
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_TEAM}</th>
|
||||
<th style="width: 25%">{L_TEAM_NAME}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_teams_team_name" id="update_teams_team_nmae" type="checkbox" class="radio" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_TEAM_NAME_SHORT}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_teams_team_name_short" id="update_teams_team_name_short" type="checkbox" class="radio" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_TEAM_SYMBOL}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_teams_team_symbol" id="update_teams_team_symbol" type="checkbox" class="radio" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_GROUP}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_teams_group_id" id="update_teams_group_id" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_MATCHDAY}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_teams_matchday" id="update_teams_matchday" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<th title="{L_SELECT_EXPLAIN}" style="text-align:center">{L_SELECT}</th>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN footb_teams -->
|
||||
{footb_teams.TPL}
|
||||
<!-- END footb_teams -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_TEAMS_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_TEAMS_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .footb_matches -->
|
||||
<fieldset>
|
||||
<legend>{DO_MATCHES}</legend>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<p class="small"><input name="update_neg_status" id="update_neg_status" type="checkbox" class="radio" {S_CHECK_NEG_STATUS} /> {L_UPDATE_NEG_STATUS}</p>
|
||||
<p class="small"><input name="update_same_status" id="update_same_status" type="checkbox" class="radio" {S_CHECK_SAME_STATUS} /> {L_UPDATE_SAME_STATUS}</p>
|
||||
<p class="small"><input name="update_only_final" id="update_only_final" type="checkbox" class="radio" {S_CHECK_ONLY_FINAL} /> {L_UPDATE_ONLY_FINAL}</p>
|
||||
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHES_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHES_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<!-- ENDIF -->
|
||||
<table class="type_f">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_MATCHDAY}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_matchday" id="update_matches_matchday" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF --><br />
|
||||
{L_MATCH_NUMBER}
|
||||
</th>
|
||||
<th>{L_MATCH_BEGIN}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_match_datetime" id="update_matches_match_datetime" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF --><br />
|
||||
{L_MATCH_OF_GROUP}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_group_id" id="update_matches_group_id" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_MATCH_HOME}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_team_id_home" id="update_matches_team_id_home" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF --><br />
|
||||
{L_MATCH_GUEST}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_team_id_guest" id="update_matches_team_id_guest" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF -->
|
||||
</th>
|
||||
<th>{L_RESULT}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_goals" id="update_matches_goals" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF --><br />
|
||||
|
||||
</th>
|
||||
<th>{L_EXTRATIME_SHORT}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_goals_overtime" id="update_matches_goals_overtime" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF --><br />
|
||||
|
||||
</th>
|
||||
<th>{L_FORMULA}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_formula" id="update_matches_formula" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF --><br />
|
||||
|
||||
</th>
|
||||
<th>{L_STATUS}
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<input title="{L_UPDATE_THIS}" name="update_matches_status" id="update_matches_status" type="checkbox" class="radio" checked="checked" />
|
||||
<!-- ENDIF --><br />
|
||||
{L_KO}
|
||||
</th>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<th title="{L_SELECT_EXPLAIN}" style="text-align:center">{L_SELECT}<br />
|
||||
|
||||
</th>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN footb_matches -->
|
||||
{footb_matches.TPL}
|
||||
<!-- END footb_matches -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- IF not S_INSERT_LEAGUE -->
|
||||
<p class="small" style="text-align:right;margin-bottom:0px">
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHES_', true); return false;">{L_MARK_ALL}</a> •
|
||||
<a href="#" onclick="marklist('list', 'FOOTB_MATCHES_', false); return false;">{L_UNMARK_ALL}</a>
|
||||
</p>
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .footb_matchdays or .footb_teams or .footb_matches -->
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input type="hidden" name="xml_ary" value="{XML_ARY}" />
|
||||
<input type="hidden" name="s" value="{S_SEASON}" />
|
||||
<input type="hidden" name="l" value="{S_LEAGUE}" />
|
||||
<input type="hidden" name="league_name" value="{S_LEAGUE_NAME}" />
|
||||
<input type="hidden" name="xcode" value="{S_XCODE}" />
|
||||
<!-- IF S_INSERT_LEAGUE -->
|
||||
<input class="button1" type="submit" id="submit" name="insert" value="{L_INSERT_LEAGUE}" />
|
||||
<!-- ELSE -->
|
||||
<input class="button1" type="submit" id="submit" name="update" value="{L_UPDATE_LEAGUE}" />
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
<!-- ELSE -->
|
||||
<div class="successbox">
|
||||
<h3>{L_ADVICE}</h3>
|
||||
<p>{L_NO_DIFFERENCES}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
</form>
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
44
adm/style/acp_football_userguide.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!-- INCLUDECSS css/football_acp.css -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a id="maincontent"></a>
|
||||
<!-- IF S_IN_FOOTBALL_USERGUIDE -->
|
||||
<!-- IF U_FOOTBALL --><a href="{U_FOOTBALL}" style="float: {S_CONTENT_FLOW_END};">« {L_PREDICTION_LEAGUE}</a><!-- ENDIF -->
|
||||
<!-- IF S_ERROR -->
|
||||
<div class="errorbox">
|
||||
<h3>{L_WARNING}</h3>
|
||||
<p>{ERROR_MSG}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<h1>{L_ACP_FOOTBALL} - {L_ACP_FOOTBALL_USERGUIDE}</h1>
|
||||
<p>{L_ACP_FOOTBALL_USERGUIDE_EXPLAIN}</p>
|
||||
|
||||
<fieldset id="userguidelinks">
|
||||
<!-- BEGIN userguide_block -->
|
||||
<div style="font-size: 0.85em; padding-bottom: 5px; margin-bottom: 0.7em; line-height: 1.40em;"><strong>{userguide_block.BLOCK_TITLE}</strong><br />
|
||||
<!-- BEGIN userguide_row -->
|
||||
<a href="#ug{userguide_block.S_ROW_COUNT}{userguide_block.userguide_row.S_ROW_COUNT}">{userguide_block.userguide_row.USERGUIDE_QUESTION}</a><br />
|
||||
<!-- END userguide_row -->
|
||||
</div>
|
||||
<!-- END userguide_block -->
|
||||
</fieldset>
|
||||
|
||||
<!-- BEGIN userguide_block -->
|
||||
<fieldset>
|
||||
<h2>{userguide_block.BLOCK_TITLE}</h2>
|
||||
<!-- BEGIN userguide_row -->
|
||||
<div style="font-size: 0.85em; padding-bottom: 5px; margin-bottom: 0.7em; line-height: 1.40em;">
|
||||
<span id="ug{userguide_block.S_ROW_COUNT}{userguide_block.userguide_row.S_ROW_COUNT}">
|
||||
<strong>{userguide_block.userguide_row.USERGUIDE_QUESTION}</strong></span><br />
|
||||
{userguide_block.userguide_row.USERGUIDE_ANSWER}<br /><br />
|
||||
<a href="#userguidelinks">{ICON_BACK_TO_TOP} {L_BACK_TO_TOP}</a>
|
||||
</div>
|
||||
<!-- IF not userguide_block.userguide_row.S_LAST_ROW --><hr class="dashed" /><!-- ENDIF -->
|
||||
<!-- END userguide_row -->
|
||||
</fieldset>
|
||||
<!-- END userguide_block -->
|
||||
<!-- ENDIF -->
|
||||
<br />
|
||||
<div style="text-align: center;">phpBB Extension - Football Prediction League - Version {S_VERSION_NO} © 2016 <a href="http://football.bplaced.net">football</a></div>
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
87
adm/style/css/football_acp.css
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -----------------------------------------------------------------------------------------
|
||||
* @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
|
||||
* ----------------------------------------------------------------------------------------- */
|
||||
/* Table for football data */
|
||||
/* Specific column styles */
|
||||
table.type_f thead th { font-weight:normal; text-transform:uppercase; line-height:1.3em; padding:0 4px 2px 4px; }
|
||||
table.type_f thead th span { padding-left:7px; }
|
||||
table.type_f tfoot td {
|
||||
padding: 3px 4px;
|
||||
color: #FFFFFF;
|
||||
background: #70AED3 url("../images/gradient2b.gif") bottom left repeat-x;
|
||||
border-bottom: 1px solid #6DACD2;
|
||||
border-top: 1px solid #327AA5;
|
||||
text-align: left;
|
||||
font-size: 0.75em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
table.type_f tbody tr:hover,
|
||||
table.type_f tbody tr.hover {
|
||||
background-color: #FFFFFF; color: #000000;
|
||||
}
|
||||
table.type_f body td { padding: 1px 2px; border-top: 1px solid #FAFAFA; }
|
||||
table.type_f tbody th { padding:1px 2px; border-top: 1px solid #000000; background-color: #BFC1CF; }
|
||||
table.type_f tbody tr { border: 1px solid #cfcfcf; }
|
||||
th.td_tendency { text-align: center; padding: 4px 2px 0 2px; font-weight: bold; }
|
||||
th.td_pts_total { text-align: right; padding: 4px 4px 0 2px; }
|
||||
td.td_rank { text-align: right; }
|
||||
td.td_group { text-align: center; }
|
||||
td.td_hits { text-align: center; }
|
||||
td.td_wins { text-align: right; padding: 0 2px 0 4px; }
|
||||
td.td_match_no { text-align: right; }
|
||||
td.td_logo { text-align: center; }
|
||||
td.td_team { text-align: left; padding: 0 1em 0 2px; }
|
||||
td.td_team_home { text-align: right; width: 155px; }
|
||||
td.td_team_guest { text-align: left; width: 155px; }
|
||||
td.td_vs { text-align: center; max-width: 1em; padding: 0; }
|
||||
td.td_goals_home { text-align: right; max-width: 3em; padding: 0;}
|
||||
td.td_goals_guest { text-align: left; max-width: 3em; padding: 0; white-space: nowrap;}
|
||||
td.td_pts { text-align: right; padding: 0 2px 0 2px; }
|
||||
td.td_button { text-align: right; padding-right: 4px; }
|
||||
td.td_result { text-align: center; }
|
||||
td.td_season { text-align: center; }
|
||||
td.td_league { text-align: center; }
|
||||
td.td_pts_total { text-align: right; padding: 0 4px 0 2px; }
|
||||
td.td_points { text-align: right; padding: 0 2em 0 2px; }
|
||||
td.td_fp { text-align: center; }
|
||||
td.td_matches { text-align: center; }
|
||||
td.td_diff { text-align: right; }
|
||||
td.td_counter { text-align: right; }
|
||||
td.td_name { text-align: left; }
|
||||
|
||||
table.rank td.color_finally, table.football .color_finally, .color_finally , table.football .match_win, .match_win {
|
||||
font-weight: bold;
|
||||
color: #00AA00;
|
||||
}
|
||||
|
||||
table.rank td.color_provisionally, table.football .color_provisionally, .color_provisionally , table.football .match_lost, .match_lost {
|
||||
font-weight: bold;
|
||||
color: #AA0000;
|
||||
}
|
||||
|
||||
table.football .match_draw, .match_draw {
|
||||
font-weight: bold;
|
||||
color: #6A6A6A;
|
||||
}
|
||||
|
||||
table.rank td.color_not_rated, table.football .color_not_rated, .color_not_rated {
|
||||
font-weight: bold;
|
||||
color: purple;
|
||||
}
|
||||
|
||||
/* Background colors where the tables iterate between two colors or mark user*/
|
||||
.row_light { background-color: #e1ebf2; }
|
||||
.row_dark { background-color: #cadceb; }
|
||||
.row_user { background-color: #99CC99; }
|
||||
.row_group td { background-color: #12A3EB; color: #FFFFFF !important; }
|
||||
.row_result { background-color: #BFC1CF; }
|
||||
.row_result td { padding: 1px 2px; }
|
||||
|
||||
|
||||
.message {
|
||||
font-weight: bold;
|
||||
color: #AA0000;
|
||||
}
|
||||
13
adm/style/frame_results.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!-- IF 0 -->
|
||||
Diese Datei existiert doppelt: Einmal im fooball\football\styles\prsilver\template und einmal im fooball\football\adm\style Ordner
|
||||
Mit Hilfe dieser Datei werden Fussballergebnisse zum Abgleich und schnelleren Erfassung von externen Seiten,
|
||||
wie z.B. den Weltfussball.de Torverteiler, eingebunden.
|
||||
Wenn ihr einen Weltfussball.de Account habt, könnt ihr dort in der Community einen Torverteiler erstellen und den Code hier
|
||||
unter der entsprechenden Liganummer reinhängen (also 999999 mit der Liganummer bzw. wfb_tv_id ersetzen).
|
||||
Der Frame wird dann bei der Ergebnisseingabe in der Liga angezeigt, wenn der Spieltag editierbar ist.
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_EDIT_MODE -->
|
||||
<!-- IF S_LEAGUE == 999999 -->
|
||||
<div id="tor_v1" style="width:400px;text-align:right;font-family:Arial,Helvetica,Verdana,sans-serif;color:#000000;font-size:8pt;background-color:#cadceb;"><div id="iTorV1"></div>Der Torverteiler - präsentiert von <a href="http://www.weltfussball.de/" target="_blank">weltfussball.de</a> <br />Alles über <a href="http://www.weltfussball.de/" target="_blank">Fußball</a> oder direkt zur <a href="http://www.weltfussball.de/wettbewerb/bundesliga/">Bundesliga</a> </div><script type="text/javascript">var wfb_tv_id="999999";</script><script id="wfb_link" type="text/javascript" src="http://www.weltfussball.de/js/get_tv.js"></script>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
501
block/all_bets.php
Normal file
@@ -0,0 +1,501 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$start = $this->request->variable('start', 0);
|
||||
$matches_on_matchday = false;
|
||||
|
||||
$sql = 'SELECT COUNT(DISTINCT user_id) AS num_users
|
||||
FROM ' . FOOTB_BETS . "
|
||||
WHERE season = $season AND league = $league";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$total_users = (int) $db->sql_fetchfield('num_users');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SELECT
|
||||
m.match_no,
|
||||
m.status,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_name_short AS home_name,
|
||||
t2.team_name_short AS guest_name,
|
||||
t1.team_id AS home_id,
|
||||
t2.team_id AS guest_id,
|
||||
m.goals_home,
|
||||
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 = 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
|
||||
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 t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON(b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
GROUP BY m.match_no
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$matches = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$count_matches = sizeof($matches);
|
||||
|
||||
if ($user->data['football_mobile'])
|
||||
{
|
||||
if ($count_matches > 3)
|
||||
{
|
||||
$split_after = 3;
|
||||
$splits = ceil($count_matches / 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
$split_after = $count_matches;
|
||||
$splits = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($count_matches > 11)
|
||||
{
|
||||
$split_after = 8;
|
||||
$splits = ceil($count_matches / 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
$split_after = $count_matches;
|
||||
$splits = 1;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
if ($start < 0 || $start >= $total_users)
|
||||
{
|
||||
$start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
|
||||
$sql_start = $start * $count_matches;
|
||||
$sql_limit = $config['football_users_per_page'] * $count_matches;
|
||||
|
||||
// If we've got a hightlight set pass it on to pagination.
|
||||
// handle pagination.
|
||||
$base_url = $this->helper->route('football_main_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday));
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
if ($user->data['football_mobile'])
|
||||
{
|
||||
$sql_start = 0;
|
||||
$sql_limit = 99999;
|
||||
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $sql_limit, $start);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||
}
|
||||
|
||||
$bet_line = array();
|
||||
if ($count_matches > 0)
|
||||
{
|
||||
$matches_on_matchday = true;
|
||||
|
||||
$sql = "SELECT
|
||||
u.user_id,
|
||||
u.username,
|
||||
m.status,
|
||||
b.goals_home AS bet_home,
|
||||
b.goals_guest AS bet_guest,
|
||||
" . 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)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
ORDER BY LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||
$user_bets = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$bet_index = 0;
|
||||
$split_index = 0;
|
||||
foreach ($user_bets AS $user_bet)
|
||||
{
|
||||
if ($bet_index == $count_matches)
|
||||
{
|
||||
$bet_index = 0;
|
||||
$split_index = 0;
|
||||
}
|
||||
if (!($bet_index % $split_after))
|
||||
{
|
||||
$split_index++;
|
||||
}
|
||||
$sum_total[$user_bet['username']] = 0;
|
||||
$bet_line[$split_index][] = $user_bet;
|
||||
$bet_index++;
|
||||
}
|
||||
}
|
||||
$match_index = 0;
|
||||
$last_match_index = 0;
|
||||
$split_index = 0;
|
||||
$matchday_sum_total = 0;
|
||||
$colorstyle_total = ' color_finally';
|
||||
foreach ($matches AS $match)
|
||||
{
|
||||
if (!($match_index % $split_after))
|
||||
{
|
||||
if ($match_index > 0)
|
||||
{
|
||||
$total = 0;
|
||||
$count_user = 0;
|
||||
$bet_index = 0;
|
||||
$last_match_index = 0;
|
||||
foreach ($bet_line[$split_index] AS $user_bet)
|
||||
{
|
||||
if ($bet_index == 0)
|
||||
{
|
||||
$count_user++;
|
||||
$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';
|
||||
}
|
||||
$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'];
|
||||
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 == $split_after)
|
||||
{
|
||||
$sum_total[$user_bet['username']] += $total;
|
||||
$matchday_sum_total += $total;
|
||||
$bet_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('match_panel.tendency_footer', array(
|
||||
'S_TOTAL' => false,
|
||||
)
|
||||
);
|
||||
foreach ($matches_tendency AS $match_tendency)
|
||||
{
|
||||
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
|
||||
'TENDENCY' => $match_tendency,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$matches_tendency = array();
|
||||
$split_index++;
|
||||
if ($split_index == $splits)
|
||||
{
|
||||
$display_total = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_total = false;
|
||||
}
|
||||
$template->assign_block_vars('match_panel', array(
|
||||
'S_TOTAL' => $display_total,
|
||||
)
|
||||
);
|
||||
}
|
||||
if (0 == $match['home_id'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $match['match_no'], 'team_id_home', $match['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homename = $home_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homename = $match['home_name'];
|
||||
}
|
||||
if (0 == $match['guest_id'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $match['match_no'], 'team_id_guest', $match['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestname = $guest_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestname = $match['guest_name'];
|
||||
}
|
||||
$colorstyle_match = color_style($match['status']);
|
||||
$template->assign_block_vars('match_panel.match_entry', array(
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'RESULT' => $match['goals_home']. ':'.$match['goals_guest'],
|
||||
'COLOR_STYLE' => $colorstyle_match,
|
||||
)
|
||||
);
|
||||
if ($match['status'] < 1 && !$config['football_view_tendencies'])
|
||||
{
|
||||
// hide tendencies
|
||||
$matches_tendency[] = '?-?-?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$matches_tendency[] = $match['home']. '-'.$match['draw']. '-'.$match['guest'];
|
||||
}
|
||||
$match_index++;
|
||||
$last_match_index++;
|
||||
}
|
||||
if ($count_matches > 0)
|
||||
{
|
||||
$total = 0;
|
||||
$count_user = 0;
|
||||
$bet_index = 0;
|
||||
foreach ($bet_line[$split_index] AS $user_bet)
|
||||
{
|
||||
if ($bet_index == 0)
|
||||
{
|
||||
$count_user++;
|
||||
$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';
|
||||
}
|
||||
$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'];
|
||||
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)
|
||||
{
|
||||
$sum_total[$user_bet['username']] += $total;
|
||||
$matchday_sum_total += $total;
|
||||
$template->assign_block_vars('match_panel.user_row.points', array(
|
||||
'COLOR_STYLE' => $colorstyle_total,
|
||||
'POINTS_TOTAL' => $sum_total[$user_bet['username']],
|
||||
)
|
||||
);
|
||||
$bet_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('match_panel.tendency_footer', array(
|
||||
'S_TOTAL' => true,
|
||||
'COLOR_STYLE' => $colorstyle_total, //currently ignored
|
||||
'SUMTOTAL' => $matchday_sum_total,
|
||||
)
|
||||
);
|
||||
foreach ($matches_tendency AS $match_tendency)
|
||||
{
|
||||
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
|
||||
'TENDENCY' => $match_tendency,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//extra bets
|
||||
// Calculate extra bets of matchday
|
||||
$sql_start = $start;
|
||||
$sql_limit = $config['football_users_per_page'];
|
||||
$sql = "SELECT e.*,
|
||||
t1.team_name AS result_team
|
||||
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)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
AND (e.matchday = $matchday OR e.matchday_eval = $matchday)
|
||||
ORDER BY e.extra_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extra_no = $row['extra_no'];
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
$extra_colorstyle = color_style($row['extra_status']);
|
||||
|
||||
$template->assign_block_vars('extra_panel', array(
|
||||
'QUESTION' => $row['question'],
|
||||
'RESULT' => ($display_type == 1) ? $row['result_team'] : $row['result'],
|
||||
'POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
|
||||
// Get all extra bets of matchday
|
||||
$bet_number = 0;
|
||||
$sql = "SELECT u.user_id,
|
||||
u.username,
|
||||
e.*,
|
||||
eb.bet,
|
||||
eb.bet_points,
|
||||
t2.team_name AS bet_team
|
||||
FROM " . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
|
||||
LEFT JOIN ' . FOOTB_EXTRA . " AS e ON (e.season = b.season AND e.league = b.league AND (e.matchday = $matchday OR e.matchday_eval = $matchday) AND e.extra_no = $extra_no)
|
||||
LEFT JOIN " . FOOTB_EXTRA_BETS . " AS eb ON (eb.season = b.season AND eb.league = b.league AND eb.extra_no = $extra_no AND eb.user_id = b.user_id)
|
||||
LEFT JOIN " . FOOTB_TEAMS . " AS t2 ON (t2.season = b.season AND t2.league = b.league AND t2.team_id = eb.bet)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND b.match_no = 1
|
||||
GROUP by b.user_id
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
|
||||
$result_bet = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||
|
||||
while ($user_row = $db->sql_fetchrow($result_bet))
|
||||
{
|
||||
$bet_number++ ;
|
||||
$row_class = (!($bet_number % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($user_row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
|
||||
if ($user_row['extra_status'] < 1 && !$config['football_view_bets'])
|
||||
{
|
||||
// hide bets
|
||||
$bet = ($user_row['bet'] == '') ? ' ' : '?';
|
||||
$bet_team = ($user_row['bet_team'] == NULL) ? ' ' : '?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bet = ($user_row['bet'] == '') ? ' ' : $user_row['bet'];
|
||||
$bet_team = ($user_row['bet_team'] == NULL) ? ' ' : $user_row['bet_team'];
|
||||
}
|
||||
|
||||
|
||||
$template->assign_block_vars('extra_panel.user_row', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'USER_NAME' => $user_row['username'],
|
||||
'BET' => ($display_type == 1) ? $bet_team : $bet,
|
||||
'BET_POINTS' => $user_row['bet_points'],
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sidename = sprintf($user->lang['ALL_BETS']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_ALL_BETS' => true,
|
||||
'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_SPALTEN' => ($count_matches * 2) + 2,
|
||||
'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),
|
||||
)
|
||||
);
|
||||
?>
|
||||
235
block/bank.php
Normal file
@@ -0,0 +1,235 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
|
||||
}
|
||||
|
||||
global $phpbb_extension_manager;
|
||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints'))
|
||||
{
|
||||
$this->user->add_lang_ext('dmzx/ultimatepoints', 'common');
|
||||
// Get an instance of the ultimatepoints functions_points
|
||||
$functions_points = $phpbb_container->get('dmzx.ultimatepoints.core.functions.points');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get an instance of the football functions_points
|
||||
$functions_points = $phpbb_container->get('football.football.core.functions.points');
|
||||
}
|
||||
|
||||
if (!$user_sel)
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league) or $league == 0)
|
||||
{
|
||||
$user_sel = $user->data['user_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$username = '';
|
||||
$member = true;
|
||||
if ($this->auth->acl_get('a_football_points'))
|
||||
{
|
||||
$where_user = '';
|
||||
$multi_view = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$multi_view = false;
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$where_user = ' AND b.user_id = ' . $user->data['user_id'] . ' ';
|
||||
$user_sel = $user->data['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($league)
|
||||
{
|
||||
$member = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$where_league = '';
|
||||
if ($league)
|
||||
{
|
||||
$where_league = " AND b.league = $league";
|
||||
}
|
||||
|
||||
$data = false;
|
||||
// Select user
|
||||
$total_users = 0;
|
||||
$sql = 'SELECT DISTINCT
|
||||
u.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE season = $season
|
||||
$where_league
|
||||
$where_user
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$total_users++;
|
||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||
{
|
||||
$selectid = ' selected="selected"';
|
||||
$username = $row['username'];
|
||||
$user_sel = $row['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid = '';
|
||||
}
|
||||
$template->assign_block_vars('form_user', array(
|
||||
'S_USER' => $row['user_id'],
|
||||
'S_USERNAME' => $row['username'],
|
||||
'S_SELECTEDID' => $selectid,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$where_season = '';
|
||||
if ($season)
|
||||
{
|
||||
$where_season = " AND fp.season = $season";
|
||||
}
|
||||
|
||||
$where_league = '';
|
||||
$order_by = 'ORDER BY fp.points_type ASC, fp.matchday ASC, fp.league ASC';
|
||||
|
||||
if ($league)
|
||||
{
|
||||
$where_league = " AND fp.league = $league";
|
||||
$order_by = 'ORDER BY fp.league ASC, fp.matchday ASC, fp.points_type ASC';
|
||||
}
|
||||
|
||||
// The different book types
|
||||
$types = array(
|
||||
0 => '--',
|
||||
1 => sprintf($user->lang['FOOTBALL_BET_POINTS']),
|
||||
2 => $user->lang['FOOTBALL_DEPOSIT'],
|
||||
3 => sprintf($user->lang['FOOTBALL_WIN']),
|
||||
4 => $user->lang['FOOTBALL_WIN'],
|
||||
5 => $user->lang['FOOTBALL_WIN'],
|
||||
6 => $user->lang['FOOTBALL_WIN'],
|
||||
7 => $user->lang['FOOTBALL_PAYOUT'],
|
||||
);
|
||||
|
||||
// Grab the football points
|
||||
$sql = 'SELECT fp.season,
|
||||
s.season_name,
|
||||
s.season_name_short,
|
||||
fp.league,
|
||||
l.league_name,
|
||||
l.league_name_short,
|
||||
fp.matchday,
|
||||
md.matchday_name,
|
||||
fp.points_type,
|
||||
fp.points,
|
||||
fp.points_comment,
|
||||
fp.cash
|
||||
FROM ' . FOOTB_POINTS . ' AS fp
|
||||
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_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_season
|
||||
$where_league
|
||||
$order_by";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$current_balance = 0.00;
|
||||
$count = 0;
|
||||
// Start looping all the football points
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$count = $count + 1;
|
||||
if ($row['points_type'] == POINTS_BET OR $row['points_type'] == POINTS_PAID)
|
||||
{
|
||||
$points_sign = '-';
|
||||
$points_style = " color: red;";
|
||||
$current_balance -= $row['points'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$points_sign = '+';
|
||||
$points_style = " color: green;";
|
||||
$current_balance += $row['points'];
|
||||
}
|
||||
// Add the items to the template
|
||||
$template->assign_block_vars('football', array(
|
||||
'SEASON' => $season,
|
||||
'SEASON_NAME' => $season_name,
|
||||
'LEAGUE' => $row['league'],
|
||||
'LEAGUE_NAME' => $row['league_name'],
|
||||
'LEAGUE_SHORT' => $row['league_name_short'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'MATCHDAY_NAME' => ($row['matchday_name'] == '') ? $row['matchday'] . '.' . sprintf($user->lang['FOOTBALL_MATCHDAY']) : $row['matchday_name'],
|
||||
'MATCHDAY_SHORT'=> $row['matchday'] . '.' . sprintf($user->lang['MATCHDAY_SHORT']),
|
||||
'POINTS_SIGN' => $points_sign,
|
||||
'POINTS_STYLE' => $points_style,
|
||||
'POINTS_TYPE' => $types[$row['points_type']],
|
||||
'S_CASH' => $row['cash'],
|
||||
'POINTS' => $functions_points->number_format_points($row['points']),
|
||||
'COMMENT' => nl2br($row['points_comment']),
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($current_balance < 0)
|
||||
{
|
||||
$points_style = " color: red;";
|
||||
}
|
||||
else
|
||||
{
|
||||
$points_style = " color: green;";
|
||||
}
|
||||
|
||||
$template->assign_block_vars('football', array(
|
||||
'SEASON' => $season,
|
||||
'SEASON_NAME' => '',
|
||||
'LEAGUE' => $league,
|
||||
'LEAGUE_NAME' => '',
|
||||
'MATCHDAY' => '',
|
||||
'MATCHDAY_NAME' => '',
|
||||
'POINTS_SIGN' => '',
|
||||
'POINTS_STYLE' => $points_style,
|
||||
'POINTS_TYPE' => '',
|
||||
'S_CASH' => 1,
|
||||
'POINTS' => $functions_points->number_format_points($current_balance),
|
||||
'COMMENT' => ($league == 0) ? sprintf($user->lang['FOOTBALL_BALANCES']) : sprintf($user->lang['FOOTBALL_BALANCE']),
|
||||
));
|
||||
|
||||
$sidename = sprintf($user->lang['FOOTBALL_BANK']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_BANK' => true,
|
||||
'S_MATCHDAY_HIDE' => true,
|
||||
'S_MEMBER' => $member,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_MULTI_VIEW' => $multi_view,
|
||||
'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)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['RANK_TOTAL']),
|
||||
'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'],
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
534
block/bet.php
Normal file
@@ -0,0 +1,534 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$edit_mode = false;
|
||||
$data_group = false;
|
||||
$data_bet_results = false;
|
||||
$data_bet = false;
|
||||
$join_league = false;
|
||||
$matchnumber = 0;
|
||||
$userid = $user->data['user_id'];
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
$user_is_member = user_is_member($userid, $season, $league);
|
||||
$display_rating = false;
|
||||
|
||||
// Calculate multiple delivery
|
||||
$display_delivery2 = false;
|
||||
$display_delivery3 = false;
|
||||
$delivery2 = '';
|
||||
$delivery3 = '';
|
||||
$sql = "SELECT
|
||||
delivery_date_2,
|
||||
delivery_date_3,
|
||||
CONCAT(
|
||||
CASE DATE_FORMAT(delivery_date_2,'%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(delivery_date_2,' %d.%m.%Y %H:%i')
|
||||
) as deliverytime2,
|
||||
CONCAT(
|
||||
CASE DATE_FORMAT(delivery_date_3,'%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(delivery_date_3,' %d.%m.%Y %H:%i')
|
||||
) as deliverytime3
|
||||
FROM " . FOOTB_MATCHDAYS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = $matchday";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['delivery_date_2'] <> '')
|
||||
{
|
||||
$display_delivery2 = true;
|
||||
$delivery2 = $row['deliverytime2'];
|
||||
}
|
||||
if ($row['delivery_date_3'] <> '')
|
||||
{
|
||||
$display_delivery3 = true;
|
||||
$delivery3 = $row['deliverytime3'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Calculate matches and bets of matchday
|
||||
$sql = "SELECT
|
||||
m.league,
|
||||
m.match_no,
|
||||
m.matchday,
|
||||
m.status,
|
||||
m.group_id,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_symbol AS home_symbol,
|
||||
t2.team_symbol AS guest_symbol,
|
||||
t1.team_id AS home_id,
|
||||
t2.team_id AS guest_id,
|
||||
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,
|
||||
b.goals_home AS bet_home,
|
||||
b.goals_guest AS bet_guest,
|
||||
m.goals_home,
|
||||
m.goals_guest,
|
||||
m.trend,
|
||||
m.odd_1,
|
||||
m.odd_x,
|
||||
m.odd_2,
|
||||
m.rating,
|
||||
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,
|
||||
" . select_points() . '
|
||||
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)
|
||||
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.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
GROUP BY m.match_no
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$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_bet = true;
|
||||
$matchnumber++ ;
|
||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$display_link = true;
|
||||
$display_rating = ($display_rating || ($row['rating'] <> '0.00'));
|
||||
|
||||
if (0 == $row['home_id'])
|
||||
{
|
||||
$display_link = false;
|
||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homelogo = $home_in_array[0];
|
||||
$homeid = $home_in_array[1];
|
||||
$homename = $home_in_array[2];
|
||||
$homeshort = $home_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homelogo = $row['home_symbol'];
|
||||
$homeid = $row['home_id'];
|
||||
$homename = $row['home_name'];
|
||||
$homeshort = $row['home_short'];
|
||||
}
|
||||
|
||||
if (0 == $row['guest_id'])
|
||||
{
|
||||
$display_link = false;
|
||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestlogo = $guest_in_array[0];
|
||||
$guestid = $guest_in_array[1];
|
||||
$guestname = $guest_in_array[2];
|
||||
$guestshort = $guest_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestlogo = $row['guest_symbol'];
|
||||
$guestid = $row['guest_id'];
|
||||
$guestname = $row['guest_name'];
|
||||
$guestshort = $row['guest_short'];
|
||||
}
|
||||
if ($homelogo <> '')
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($guestlogo <> '')
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($row['status'] == -1)
|
||||
{
|
||||
$delivertag = "<strong style='color:green'>*</strong>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($row['status'] == -2)
|
||||
{
|
||||
$delivertag = "<strong style='color:green'>**</strong>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$delivertag = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['group_id'] == '')
|
||||
{
|
||||
$group_id = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_group = true;
|
||||
$group_id = $row['group_id'];
|
||||
}
|
||||
|
||||
if ($row['status'] <= 0)
|
||||
{
|
||||
$edit_mode = true;
|
||||
$template->assign_block_vars('bet_edit', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LEAGUE_ID' => $row['league'],
|
||||
'MATCH_NUMBER' => $row['match_no'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'STATUS' => $row['status'],
|
||||
'MATCH_TIME' => $row['match_time'],
|
||||
'GROUP' => $group_id,
|
||||
'HOME_ID' => $homeid,
|
||||
'GUEST_ID' => $guestid,
|
||||
'LOGO_HOME' => $logoH,
|
||||
'LOGO_GUEST' => $logoG,
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'HOME_SHORT' => $homeshort,
|
||||
'GUEST_SHORT' => $guestshort,
|
||||
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||
'tid' => $homeid, 'mode' => 'all')),
|
||||
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||
'tid' => $guestid, 'mode' => 'all')),
|
||||
'BET_HOME' => $row['bet_home'],
|
||||
'BET_GUEST' => $row['bet_guest'],
|
||||
'DELIVERTAG' => $delivertag,
|
||||
'GOALS_HOME' => ($row['goals_home'] == '') ? ' ' : $row['goals_home'],
|
||||
'GOALS_GUEST' => ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'],
|
||||
'POINTS' => ($row['points'] == '') ? ' ' : $row['points'],
|
||||
'U_MATCH_STATS' => $this->helper->route('football_football_popup', array('popside' => 'hist_popup', 's' => $season, 'l' => $row['league'],
|
||||
'hid' => $homeid, 'gid' => $guestid, 'm' => $row['matchday'],
|
||||
'mn' => $row['match_no'], 'gr' => $row['group_id'])),
|
||||
'DATA_RESULTS' => $data_bet_results,
|
||||
'DISPLAY_LINK' => $display_link,
|
||||
'TREND' => $row['trend'],
|
||||
'ODDS' => ($row['odd_1'] == '') ? '' : $row['odd_1'] . '|' . $row['odd_x'] . '|' . $row['odd_2'],
|
||||
'RATING' => $row['rating'],
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_bet_results = true;
|
||||
$colorstyle = color_style($row['status']);
|
||||
|
||||
$template->assign_block_vars('bet_view', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LEAGUE_ID' => $row['league'],
|
||||
'MATCH_NUMBER' => $row['match_no'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'STATUS' => $row['status'],
|
||||
'MATCH_TIME' => $row['match_time'],
|
||||
'GROUP' => $group_id,
|
||||
'HOME_ID' => $homeid,
|
||||
'GUEST_ID' => $guestid,
|
||||
'LOGO_HOME' => $logoH,
|
||||
'LOGO_GUEST' => $logoG,
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'HOME_SHORT' => $homeshort,
|
||||
'GUEST_SHORT' => $guestshort,
|
||||
'BET_HOME' => ($row['bet_home'] == '') ? ' ' : $row['bet_home'],
|
||||
'BET_GUEST' => ($row['bet_guest'] == '') ? ' ' : $row['bet_guest'],
|
||||
'GOALS_HOME' => ($row['goals_home'] == '') ? ' ' : $row['goals_home'],
|
||||
'GOALS_GUEST' => ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'],
|
||||
'POINTS' => ($row['points'] == '') ? ' ' : $row['points'],
|
||||
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||
'tid' => $homeid, 'mode' => 'all')),
|
||||
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $row['league'],
|
||||
'tid' => $guestid, 'mode' => 'all')),
|
||||
'U_MATCH_STATS' => $this->helper->route('football_football_popup', array('popside' => 'hist_popup', 's' => $season, 'l' => $row['league'],
|
||||
'hid' => $homeid, 'gid' => $guestid, 'm' => $row['matchday'],
|
||||
'mn' => $row['match_no'], 'gr' => $row['group_id'])),
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
'DISPLAY_LINK' => $display_link,
|
||||
'TREND' => $row['trend'],
|
||||
'ODDS' => ($row['odd_1'] == '') ? '' : $row['odd_1'] . '|' . $row['odd_x'] . '|' . $row['odd_2'],
|
||||
'RATING' => $row['rating'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Calculate extra bets of matchday
|
||||
// Start select team
|
||||
$sql = 'SELECT
|
||||
team_id AS option_value,
|
||||
team_name AS option_name
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY team_name ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$option_rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SELECT e.*,
|
||||
eb.bet,
|
||||
eb.bet_points,
|
||||
t1.team_name AS result_team,
|
||||
t2.team_name AS bet_team
|
||||
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_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)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
AND e.matchday = $matchday
|
||||
ORDER BY e.extra_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$extra_bet = false;
|
||||
$extra_edit = false;
|
||||
$extra_results = false;
|
||||
$extranumber = 0;
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extra_bet = true;
|
||||
$extranumber++ ;
|
||||
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($row['extra_status'] <= 0)
|
||||
{
|
||||
// edit extra bets
|
||||
$extra_edit = true;
|
||||
$bet_extra = ($row['bet_team'] == NULL) ? '' : $row['bet_team'];
|
||||
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '3':
|
||||
case '4':
|
||||
{
|
||||
$option_arr = array();
|
||||
for ($i = 65; $i <= 72; $i++)
|
||||
{
|
||||
if (strstr($row['question'], chr($i) . ':'))
|
||||
{
|
||||
$option_arr[] = array(
|
||||
'option_value' => chr($i),
|
||||
'option_name' => chr($i),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (sizeof($option_arr) > 1)
|
||||
{
|
||||
$display_type = 1;
|
||||
$option_rows = $option_arr;
|
||||
$bet_extra = $row['bet'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('extra_edit', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'EXTRA_NO' => $row['extra_no'],
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'BET' => ($display_type == 1) ? $bet_extra : $row['bet'],
|
||||
'S_DISPLAY_TYPE' => $display_type,
|
||||
)
|
||||
);
|
||||
|
||||
if ($display_type == 1)
|
||||
{
|
||||
$selected = ($row['bet'] == '') ? ' selected="selected"' : '';
|
||||
|
||||
$template->assign_block_vars('extra_edit.extra_option', array(
|
||||
'OPTION_VALUE' => '',
|
||||
'OPTION_NAME' => sprintf($user->lang['SELECT']),
|
||||
'S_SELECTED' => $selected));
|
||||
|
||||
foreach ($option_rows as $option_row)
|
||||
{
|
||||
$selected = ($row['bet'] && $option_row['option_value'] == $row['bet']) ? ' selected="selected"' : '';
|
||||
$template->assign_block_vars('extra_edit.extra_option', array(
|
||||
'OPTION_VALUE' => $option_row['option_value'],
|
||||
'OPTION_NAME' => $option_row['option_name'],
|
||||
'S_SELECTED' => $selected));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// view extra bets
|
||||
$extra_results = true;
|
||||
$extra_colorstyle = color_style($row['extra_status']);
|
||||
$extra_result = ($row['result'] == '') ? ' ' : $row['result'];
|
||||
$result_extra = ($row['result_team'] == NULL) ? ' ' : $row['result_team'];
|
||||
$bet = ($row['bet'] == '') ? ' ' : $row['bet'];
|
||||
$bet_extra = ($row['bet_team'] == NULL) ? ' ' : $row['bet_team'];
|
||||
|
||||
$template->assign_block_vars('extra_view', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'RESULT' => ($display_type == 1) ? $result_extra : $extra_result,
|
||||
'BET' => ($display_type == 1) ? $bet_extra : $bet,
|
||||
'BET_POINTS' => $row['bet_points'],
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$league_info = league_info($season, $league);
|
||||
$bet_explain = '';
|
||||
switch ($league_info['bet_ko_type'])
|
||||
{
|
||||
case BET_KO_90:
|
||||
$bet_explain = sprintf($user->lang['MIN90']);
|
||||
break;
|
||||
case BET_KO_EXTRATIME:
|
||||
$bet_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
||||
break;
|
||||
case BET_KO_PENALTY:
|
||||
$bet_explain = sprintf($user->lang['PENALTY']);
|
||||
break;
|
||||
default:
|
||||
$bet_explain = sprintf($user->lang['MIN90']);
|
||||
break;
|
||||
}
|
||||
|
||||
$link_rules = '';
|
||||
if (!$data_bet AND join_allowed($season, $league) AND $user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
if ($league_info["rules_post_id"])
|
||||
{
|
||||
$join_league = true;
|
||||
$link_rules = append_sid($phpbb_root_path . "viewtopic.$phpEx?p=" . $league_info["rules_post_id"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_rules = '';
|
||||
}
|
||||
}
|
||||
|
||||
$sidename = sprintf($user->lang['BET']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_BET' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'BET_EXPLAIN' => $bet_explain,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'stat_results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['STAT_RESULTS']),
|
||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'RIGHT_LINK' => sprintf($user->lang['ALL_BETS']) . ' >',
|
||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_STAT_RESULTS']),
|
||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_ALL_BETS']),
|
||||
'JOIN_LEAGUE' => ($link_rules == '') ? '' : sprintf($user->lang['JOIN_LEAGUE'], $link_rules),
|
||||
'S_FORM_ACTION_BET' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'bet')),
|
||||
'S_FORM_ACTION_JOIN' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'join')),
|
||||
'S_USER_IS_MEMBER' => $user_is_member,
|
||||
'S_DATA_BET' => $data_bet,
|
||||
'S_DATA_GROUP' => $data_group,
|
||||
'S_DATA_BET_RESULTS' => $data_bet_results,
|
||||
'S_EDIT_MODE' => $edit_mode,
|
||||
'S_DISPLAY_DELIVERY2' => $display_delivery2,
|
||||
'S_DISPLAY_DELIVERY3' => $display_delivery3,
|
||||
'S_DELIVERY2' => $delivery2,
|
||||
'S_DELIVERY3' => $delivery3,
|
||||
'S_JOIN_LEAGUE' => $join_league,
|
||||
'S_EXTRA_BET' => $extra_bet,
|
||||
'S_EXTRA_RESULTS' => $extra_results,
|
||||
'S_EXTRA_EDIT' => $extra_edit,
|
||||
'S_DISPLAY_RATING' => $display_rating,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
391
block/bet_popup.php
Normal file
@@ -0,0 +1,391 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
// Can this user view Prediction Leagues pages?
|
||||
if (!$config['football_guest_view'])
|
||||
{
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
{
|
||||
trigger_error('NO_GUEST_VIEW');
|
||||
}
|
||||
}
|
||||
if (!$config['football_user_view'])
|
||||
{
|
||||
// Only Prediction League member should see this page
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
}
|
||||
|
||||
// Football disabled?
|
||||
if ($config['football_disable'])
|
||||
{
|
||||
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
$userid = $this->request->variable('u', 0);
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('m', 0);
|
||||
|
||||
$error_message = '';
|
||||
$username = '?';
|
||||
if (!$userid OR !$season OR !$league OR !$matchday)
|
||||
{
|
||||
$data_bet = false;
|
||||
if (!$userid)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_USERID']) . '<br />';
|
||||
}
|
||||
if (!$season)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||
}
|
||||
if (!$league)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||
}
|
||||
if (!$matchday)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_MATCHDAY']) . '<br />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$season_info = season_info($season);
|
||||
if (sizeof($season_info))
|
||||
{
|
||||
$league_info = league_info($season, $league);
|
||||
if (sizeof($league_info))
|
||||
{
|
||||
// Get username
|
||||
$sql = 'SELECT username
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE user_id = $userid ";
|
||||
$result = $db->sql_query($sql);
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$username = $row['username'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_bet = false;
|
||||
$error_message .= sprintf($user->lang['NO_USERID']) . '<br />';
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$display_group = false;
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
// Required for select_points function:
|
||||
$league_info = league_info($season, $league);
|
||||
|
||||
// Calculate matches and bets of matchday
|
||||
$sql = "SELECT
|
||||
m.league,
|
||||
m.match_no,
|
||||
m.matchday,
|
||||
m.status,
|
||||
m.group_id,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_symbol AS home_symbol,
|
||||
t2.team_symbol AS guest_symbol,
|
||||
t1.team_id AS home_id,
|
||||
t2.team_id AS guest_id,
|
||||
t1.team_name AS home_name,
|
||||
t2.team_name AS guest_name,
|
||||
b.goals_home AS bet_home,
|
||||
b.goals_guest AS bet_guest,
|
||||
m.goals_home,
|
||||
m.goals_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,
|
||||
" . select_points() . "
|
||||
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)
|
||||
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.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
GROUP BY m.match_no
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data_bet = true;
|
||||
$matchnumber = 0;
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
do
|
||||
{
|
||||
$matchnumber++ ;
|
||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$display_link = true;
|
||||
if (0 == $row['home_id'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homelogo = $home_in_array[0];
|
||||
$homeid = $home_in_array[1];
|
||||
$homename = $home_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homelogo = $row['home_symbol'];
|
||||
$homeid = $row['home_id'];
|
||||
$homename = $row['home_name'];
|
||||
}
|
||||
if (0 == $row['guest_id'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestlogo = $guest_in_array[0];
|
||||
$guestid = $guest_in_array[1];
|
||||
$guestname = $guest_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestlogo = $row['guest_symbol'];
|
||||
$guestid = $row['guest_id'];
|
||||
$guestname = $row['guest_name'];
|
||||
}
|
||||
if ($homelogo <> '')
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
if ($guestlogo <> '')
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($row['group_id'] == '')
|
||||
{
|
||||
$group_id = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_group = true;
|
||||
$group_id = $row['group_id'];
|
||||
}
|
||||
|
||||
|
||||
if ($row['status'] < 1 && !$config['football_view_bets'])
|
||||
{
|
||||
// hide bets
|
||||
$bet_home = ($row['bet_home'] == '') ? ' ' : '?';
|
||||
$bet_guest = ($row['bet_guest'] == '') ? ' ' : '?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bet_home = ($row['bet_home'] == '') ? ' ' : $row['bet_home'];
|
||||
$bet_guest = ($row['bet_guest'] == '') ? ' ' : $row['bet_guest'];
|
||||
}
|
||||
|
||||
$colorstyle = color_style($row['status']);
|
||||
$template->assign_block_vars('bet_view', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LEAGUE_ID' => $row['league'],
|
||||
'MATCH_NUMBER' => $row['match_no'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'STATUS' => $row['status'],
|
||||
'MATCH_TIME' => $row['match_time'],
|
||||
'GROUP' => $group_id,
|
||||
'HOME_ID' => $homeid,
|
||||
'GUEST_ID' => $guestid,
|
||||
'LOGO_HOME' => $logoH,
|
||||
'LOGO_GUEST' => $logoG,
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'BET_HOME' => $bet_home,
|
||||
'BET_GUEST' => $bet_guest,
|
||||
'GOALS_HOME' => ($row['goals_home'] == '') ? ' ' : $row['goals_home'],
|
||||
'GOALS_GUEST' => ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'],
|
||||
'POINTS' => ($row['points'] == '') ? ' ' : $row['points'],
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
)
|
||||
);
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_bet = false;
|
||||
$error_message .= sprintf($user->lang['NO_BETS']) . '<br />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_bet = false;
|
||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_bet = false;
|
||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate extra bets of matchday
|
||||
$sql = "SELECT e.*,
|
||||
eb.bet,
|
||||
eb.bet_points,
|
||||
t1.team_name AS result_team,
|
||||
t2.team_name AS bet_team
|
||||
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_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)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
AND e.matchday = $matchday
|
||||
ORDER BY e.extra_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$extra_bet = false;
|
||||
$extranumber = 0;
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extra_bet = true;
|
||||
$extranumber++ ;
|
||||
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
|
||||
if ($row['extra_status'] < 1 && !$config['football_view_bets'])
|
||||
{
|
||||
// hide bets
|
||||
$bet = ($row['bet'] == '') ? ' ' : '?';
|
||||
$bet_team = ($row['bet_team'] == NULL) ? ' ' : '?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bet = ($row['bet'] == '') ? ' ' : $row['bet'];
|
||||
$bet_team = ($row['bet_team'] == NULL) ? ' ' : $row['bet_team'];
|
||||
}
|
||||
$extra_colorstyle = color_style($row['extra_status']);
|
||||
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('extra_view', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'RESULT' => ($display_type == 1) ? $row['result_team'] : $row['result'],
|
||||
'BET' => ($display_type == 1) ? $bet_team : $bet,
|
||||
'BET_POINTS' => $row['bet_points'],
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$sidename = sprintf($user->lang['BET']);
|
||||
if ($data_bet)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_USER_NAME' => $username,
|
||||
'S_ERROR_MESSAGE' => $error_message,
|
||||
'S_FROM' => sprintf($user->lang['FROM_DAY_SEASON'], $matchday, $season),
|
||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||
'S_DATA_BET' => $data_bet,
|
||||
'S_DISPLAY_GROUP' => $display_group,
|
||||
'S_EXTRA_BET' => $extra_bet,
|
||||
)
|
||||
);
|
||||
|
||||
// output page
|
||||
page_header(sprintf($user->lang['BETS_OF']) . ' ' . $username);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_USER_NAME' => '',
|
||||
'S_ERROR_MESSAGE' => $error_message,
|
||||
'S_FROM' => '',
|
||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||
'S_DATA_BET' => $data_bet,
|
||||
'S_DISPLAY_GROUP' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// output page
|
||||
page_header(sprintf($user->lang['BETS_OF']));
|
||||
}
|
||||
|
||||
$template->set_filenames(array(
|
||||
'body' => 'bet_popup.html')
|
||||
);
|
||||
|
||||
page_footer();
|
||||
?>
|
||||
157
block/delivery.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$data_delivery = false;
|
||||
$user_id = $user->data['user_id'];
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
$index = 0;
|
||||
$local_board_time = time() + (($config['board_timezone'] - $config['football_host_timezone']) * 3600);
|
||||
$sql = "(SELECT
|
||||
m.season,
|
||||
m.league,
|
||||
m.matchday,
|
||||
l.league_name_short,
|
||||
CASE m.matchday_name
|
||||
WHEN ''
|
||||
THEN CONCAT(m.matchday, '." . sprintf($user->lang['MATCHDAY']) . "')
|
||||
ELSE m.matchday_name
|
||||
END AS matchday_name,
|
||||
CONCAT(
|
||||
CASE DATE_FORMAT(m.delivery_date,'%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.delivery_date,' %d.%m.%y %H:%i')
|
||||
) as delivery_time,
|
||||
m.delivery_date AS delivery,
|
||||
SUM(IF(((b.goals_home = '') OR (b.goals_guest = '')), 0, 1)) AS bets_count,
|
||||
COUNT(*) AS matches_count,
|
||||
SUM(IF(eb.extra_no > 0, IF(eb.bet = '', 0, 1), 0)) AS extra_bets_count,
|
||||
SUM(IF(e.extra_no > 0, 1, 0)) AS extra_count
|
||||
FROM " . FOOTB_MATCHDAYS . " AS m
|
||||
JOIN " . FOOTB_LEAGUES . " AS l ON(l.season = m.season AND l.league = m.league)
|
||||
JOIN " . FOOTB_MATCHES . " AS ma ON (ma.season = m.season AND ma.league = m.league AND ma.matchday = m.matchday AND ma.status = 0)
|
||||
JOIN " . FOOTB_BETS . " AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = ma.match_no AND b.user_id = $user_id)
|
||||
LEFT JOIN " . FOOTB_EXTRA . " AS e ON (e.season = m.season AND e.league = m.league AND e.matchday = m.matchday AND e.extra_status = 0)
|
||||
LEFT JOIN " . FOOTB_EXTRA_BETS . " AS eb ON (eb.season = m.season AND eb.league = m.league AND eb.extra_no = e.extra_no AND eb.user_id = $user_id)
|
||||
WHERE m.delivery_date > FROM_UNIXTIME('$local_board_time')
|
||||
AND m.status <= 0
|
||||
GROUP BY m.delivery_date, m.league, b.user_id
|
||||
)
|
||||
UNION
|
||||
(SELECT
|
||||
m.season,
|
||||
m.league,
|
||||
m.matchday,
|
||||
l.league_name_short,
|
||||
CASE m.matchday_name
|
||||
WHEN ''
|
||||
THEN CONCAT(m.matchday, '." . sprintf($user->lang['MATCHDAY']) . "')
|
||||
ELSE m.matchday_name
|
||||
END AS matchday_name,
|
||||
CONCAT(
|
||||
CASE DATE_FORMAT(m.delivery_date_2,'%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.delivery_date_2,' %d.%m.%y %H:%i')
|
||||
) as delivery_time,
|
||||
m.delivery_date_2 AS delivery ,
|
||||
SUM(IF(((b.goals_home = '') OR (b.goals_guest = '')), 0, 1)) AS bets_count,
|
||||
COUNT(*) AS matches_count,
|
||||
0 AS extra_bets_count,
|
||||
0 AS extra_count
|
||||
FROM " . FOOTB_MATCHDAYS . " AS m
|
||||
JOIN " . FOOTB_LEAGUES . " AS l ON(l.season = m.season AND l.league = m.league)
|
||||
JOIN " . FOOTB_MATCHES . " AS ma ON (ma.season = m.season AND ma.league = m.league AND ma.matchday = m.matchday AND ma.status = -1)
|
||||
JOIN " . FOOTB_BETS . " AS b ON (b.season = ma.season AND b.league = ma.league AND b.match_no = ma.match_no AND b.user_id = $user_id)
|
||||
WHERE m.delivery_date_2 > FROM_UNIXTIME('$local_board_time')
|
||||
AND m.status <= 0
|
||||
GROUP BY m.delivery_date, m.league, b.user_id
|
||||
)
|
||||
UNION
|
||||
(SELECT
|
||||
m.season,
|
||||
m.league,
|
||||
m.matchday,
|
||||
l.league_name_short,
|
||||
CASE m.matchday_name
|
||||
WHEN ''
|
||||
THEN CONCAT(m.matchday, '." . sprintf($user->lang['MATCHDAY']) . "')
|
||||
ELSE m.matchday_name
|
||||
END AS matchday_name,
|
||||
CONCAT(
|
||||
CASE DATE_FORMAT(m.delivery_date_3,'%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.delivery_date_3,' %d.%m.%y %H:%i')
|
||||
) as delivery_time,
|
||||
m.delivery_date_3 AS delivery,
|
||||
SUM(IF(((b.goals_home = '') OR (b.goals_guest = '')), 0, 1)) AS bets_count,
|
||||
COUNT(*) AS matches_count,
|
||||
0 AS extra_bets_count,
|
||||
0 AS extra_count
|
||||
FROM " . FOOTB_MATCHDAYS . " AS m
|
||||
JOIN " . FOOTB_LEAGUES . " AS l ON(l.season = m.season AND l.league = m.league)
|
||||
JOIN " . FOOTB_MATCHES . " AS ma ON (ma.season = m.season AND ma.league = m.league AND ma.matchday = m.matchday AND ma.status = -2)
|
||||
JOIN " . FOOTB_BETS . " AS b ON (b.season = ma.season AND b.league = ma.league AND b.match_no = ma.match_no AND b.user_id = $user_id)
|
||||
WHERE m.delivery_date_3 > FROM_UNIXTIME('$local_board_time')
|
||||
AND m.status <= 0
|
||||
GROUP BY m.delivery_date, m.league, b.user_id
|
||||
)
|
||||
ORDER BY delivery, league";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result) AND $index < 11)
|
||||
{
|
||||
$index++;
|
||||
$data_delivery = true;
|
||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
|
||||
$template->assign_block_vars('delivery', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'U_BET_LINK' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $row['season'], 'l' => $row['league'], 'm' => $row['matchday'])),
|
||||
'LEAGUE_SHORT' => $row['league_name_short'],
|
||||
'MATCHDAY_NAME' => $row['matchday_name'],
|
||||
'COLOR' => ($row['bets_count'] == $row['matches_count'] && $row['extra_bets_count'] == $row['extra_count']) ? 'green' : 'red',
|
||||
'TITLE' => ($row['bets_count'] == $row['matches_count']) ? sprintf($user->lang['DELIVERY_READY']) : sprintf($user->lang['DELIVERY_NOT_READY']),
|
||||
'DELIVERY' => $row['delivery_time'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_DELIVERY' => $data_delivery,
|
||||
'S_DATA_DELIVERY' => $data_delivery,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
134
block/dload_bank.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
$this->user->add_lang_ext('football/football', 'info_acp_bank');
|
||||
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
|
||||
$action='';
|
||||
$phpbb_root_path = './../../';
|
||||
|
||||
if (!$season OR !$league)
|
||||
{
|
||||
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$season_info = season_info($season);
|
||||
if (!sizeof($season_info))
|
||||
{
|
||||
$error_message = sprintf($user->lang['NO_SEASON']);
|
||||
trigger_error($error_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
$league_info = league_info($season, $league);
|
||||
if (!sizeof($league_info))
|
||||
{
|
||||
$error_message = sprintf($user->lang['NO_LEAGUE']);
|
||||
trigger_error($error_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
$bet_points = $league_info['bet_points'];
|
||||
$league_name =$league_info['league_name'];
|
||||
$league_short =$league_info['league_name_short'];
|
||||
|
||||
$user_points = '';
|
||||
global $phpbb_extension_manager;
|
||||
if ($phpbb_extension_manager->is_enabled('dmzx/ultimatepoints') && $config['points_enable'])
|
||||
{
|
||||
$user_points = 'u.user_points,';
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_points = "0.00 AS user_points,";
|
||||
}
|
||||
|
||||
// Grab the members points
|
||||
$sql = "SELECT
|
||||
b.user_id,
|
||||
u.username,
|
||||
$user_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_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 . '),
|
||||
IF(p.cash = 0, p.points, 0.00),
|
||||
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_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,
|
||||
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 . '),
|
||||
p.points, 0.00)) AS wins,
|
||||
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,
|
||||
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
|
||||
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)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND b.match_no = 1
|
||||
GROUP BY b.user_id
|
||||
ORDER BY u.username ASC";
|
||||
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
trigger_error('NO_LEAGUE');
|
||||
}
|
||||
$user_rows = $db->sql_fetchrowset($result);
|
||||
$export_file = $league_short . '_' . $season . '_bank.csv';
|
||||
$newline = "\r\n";
|
||||
header('Pragma: no-cache');
|
||||
header("Content-Type: text/csv; name=\"$export_file\"");
|
||||
header("Content-disposition: attachment; filename=$export_file");
|
||||
$export= '';
|
||||
$export .= $league_name . ' ' . sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
|
||||
$export .= sprintf($user->lang['NAME']) . ';' . $config['football_win_name'] . ';' . sprintf($user->lang['BET_POINTS']) . ';' .
|
||||
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)
|
||||
{
|
||||
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_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
|
||||
{
|
||||
$no_cash_bet_points = '';
|
||||
$no_cash_deposit = '';
|
||||
$no_cash_wins = '';
|
||||
$no_cash_paid = '';
|
||||
}
|
||||
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
|
||||
str_replace('.', ',', $user_row['user_points']) . ';' .
|
||||
str_replace('.', ',', $user_row['bet_points']) . $no_cash_bet_points . ';' .
|
||||
str_replace('.', ',', $user_row['deposit']) . $no_cash_deposit . ';' .
|
||||
str_replace('.', ',', $user_row['new_deposit']) . ';' .
|
||||
str_replace('.', ',', $user_row['wins']) . $no_cash_wins . ';' .
|
||||
str_replace('.', ',', $user_row['paid']) . $no_cash_paid . ';' .
|
||||
str_replace('.', ',', $user_row['new_pay']) . ';' . $newline;
|
||||
}
|
||||
echo utf8_decode($export);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
87
block/dload_bank_open.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
$this->user->add_lang_ext('football/football', 'info_acp_bank');
|
||||
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
if (!$season)
|
||||
{
|
||||
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$season_info = season_info($season);
|
||||
if (!sizeof($season_info))
|
||||
{
|
||||
$error_message = sprintf($user->lang['NO_SEASON']);
|
||||
trigger_error($error_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Grab the members points
|
||||
$sql = 'SELECT
|
||||
u.username,
|
||||
p.season,
|
||||
p.league,
|
||||
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
|
||||
JOIN ' . USERS_TABLE . " AS u ON (u.user_id = p.user_id)
|
||||
WHERE p.season <= $season
|
||||
GROUP BY p.season, p.league, u.username
|
||||
HAVING saldo <> 0.00
|
||||
ORDER BY u.username, p.season, p.league";
|
||||
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
trigger_error('NO_SEASON');
|
||||
}
|
||||
$user_rows = $db->sql_fetchrowset($result);
|
||||
$export_file = $season. '_bank.csv';
|
||||
$newline = "\r\n";
|
||||
header('Pragma: no-cache');
|
||||
header("Content-Type: text/csv; name=\"$export_file\"");
|
||||
header("Content-disposition: attachment; filename=$export_file");
|
||||
$export= '';
|
||||
$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;
|
||||
foreach ($user_rows as $user_row)
|
||||
{
|
||||
if ($last_username != '' AND $last_username != $user_row['username'])
|
||||
{
|
||||
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
|
||||
str_replace('.', ',', $sum_saldo) . ';' . $newline;
|
||||
$sum_saldo = 0.0;
|
||||
}
|
||||
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
|
||||
$user_row['season'] . ';' .
|
||||
$user_row['league'] . ';' .
|
||||
str_replace('.', ',', $user_row['saldo']) . ';' . $newline;
|
||||
$sum_saldo += $user_row['saldo'];
|
||||
$last_username = $user_row['username'];
|
||||
}
|
||||
if ($last_username != '')
|
||||
{
|
||||
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
|
||||
str_replace('.', ',', $sum_saldo) . ';' . $newline;
|
||||
}
|
||||
echo utf8_decode($export);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
52
block/dload_export.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
if (!$season OR !$league)
|
||||
{
|
||||
redirect($this->helper->route('football_main_controller', array('side' => 'bet')));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$season_info = season_info($season);
|
||||
if (!sizeof($season_info))
|
||||
{
|
||||
$error_message = sprintf($user->lang['NO_SEASON']);
|
||||
trigger_error($error_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
$league_info = league_info($season, $league);
|
||||
if (!sizeof($league_info))
|
||||
{
|
||||
$error_message = sprintf($user->lang['NO_LEAGUE']);
|
||||
trigger_error($error_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
include($this->football_includes_path . 'export.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
redirect($this->helper->route('football_main_controller', array('side' => 'bet')));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
1352
block/hist_popup.php
Normal file
65
block/last_users.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$display_last_users = false;
|
||||
// Last 5 users
|
||||
$sql = 'SELECT s.session_user_id
|
||||
, u.username
|
||||
, u.user_colour
|
||||
, u.user_lastvisit
|
||||
, 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(CONCAT(s.session_time,s.session_browser)), "") AS session_browser
|
||||
FROM ' . USERS_TABLE . ' AS u
|
||||
LEFT JOIN ' . SESSIONS_TABLE . ' AS s ON (u.user_id = s.session_user_id)
|
||||
WHERE u.user_lastvisit > 0
|
||||
GROUP BY u.user_id
|
||||
ORDER BY lastvisit DESC';
|
||||
|
||||
$result = $db->sql_query_limit($sql, 5);
|
||||
$first = true;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!$row['lastvisit'] && $first == true)
|
||||
{
|
||||
$display_last_users = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_last_users = true;
|
||||
if($row['lastvisit'] > 0)
|
||||
{
|
||||
$browser = '';
|
||||
if (preg_match('/iPad|iPhone|iOS|Opera Mobi|BlackBerry|Android|IEMobile|Symbian/', $row['session_browser'], $match_browser))
|
||||
{
|
||||
$browser = ' (' . $match_browser[0] . ')';
|
||||
}
|
||||
$template->assign_block_vars('last_users', array(
|
||||
'USER_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']) . $browser,
|
||||
'LAST_VISIT_DATE' => $user->format_date($row['lastvisit']),
|
||||
));
|
||||
}
|
||||
}
|
||||
$first = false;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'LAST_USERS' => sprintf($user->lang['LAST_VISITORS'], 5),
|
||||
'S_DISPLAY_LAST_USERS' => $display_last_users,
|
||||
'S_LAST_USERS' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
332
block/my_bets.php
Normal file
@@ -0,0 +1,332 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
if (!$user_sel)
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$user_sel = $user->data['user_id'];
|
||||
}
|
||||
}
|
||||
$username = '';
|
||||
|
||||
$data = false;
|
||||
// select user
|
||||
$sql = 'SELECT DISTINCT
|
||||
u.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE season = $season AND league = $league
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
|
||||
$numb_users = 0;
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$numb_users++;
|
||||
$data = true;
|
||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||
{
|
||||
$selectid = ' selected="selected"';
|
||||
$username = $row['username'];
|
||||
$user_sel = $row['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid = '';
|
||||
}
|
||||
$template->assign_block_vars('form_user', array(
|
||||
'S_USER' => $row['user_id'],
|
||||
'S_USERNAME' => $row['username'],
|
||||
'S_SELECTEDID' => $selectid,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// All bets of selected user group by bet
|
||||
$rank = 0;
|
||||
$bets_home_win = 0;
|
||||
$bets_draw = 0;
|
||||
$bets_guest_win = 0;
|
||||
$win_home_win = 0;
|
||||
$win_draw = 0;
|
||||
$win_guest_win = 0;
|
||||
$points_home_win = 0;
|
||||
$points_draw = 0;
|
||||
$points_guest_win = 0;
|
||||
|
||||
$sql = 'SELECT
|
||||
COUNT(b.match_no) AS bets,
|
||||
b.goals_home,
|
||||
b.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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
||||
)
|
||||
) AS hits,
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
)
|
||||
) AS tendencies,
|
||||
' . select_points('m',true) . '
|
||||
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)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.status = 3
|
||||
AND b.user_id = $user_sel
|
||||
AND m.matchday <= $matchday
|
||||
GROUP by b.goals_home, b.goals_guest
|
||||
ORDER by bets DESC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['goals_home'] > $row['goals_guest'])
|
||||
{
|
||||
$bets_home_win += $row['bets'];
|
||||
$win_home_win += $row['hits'] + $row['tendencies'];
|
||||
$points_home_win += $row['points'];
|
||||
}
|
||||
if ($row['goals_home'] == $row['goals_guest'])
|
||||
{
|
||||
$bets_draw += $row['bets'];
|
||||
$win_draw += $row['hits'] + $row['tendencies'];
|
||||
$points_draw += $row['points'];
|
||||
}
|
||||
if ($row['goals_home'] < $row['goals_guest'])
|
||||
{
|
||||
$bets_guest_win += $row['bets'];
|
||||
$win_guest_win += $row['hits'] + $row['tendencies'];
|
||||
$points_guest_win += $row['points'];
|
||||
}
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('bets', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'GOALSHOME' => $row['goals_home'],
|
||||
'GOALSGUEST' => $row['goals_guest'],
|
||||
'COUNT' => $row['bets'],
|
||||
'DIRECTHITS' => $row['hits'],
|
||||
'TENDENCIES' => $row['tendencies'],
|
||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||
'POINTS' => $row['points'],
|
||||
'AVERAGE' => round($row['points'] / $row['bets'],1),
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Tendencies of all results
|
||||
$sql = "SELECT
|
||||
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 + 0 < goals_guest,1,0)) AS SUM_GUEST_WIN
|
||||
FROM " . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND status = 3
|
||||
AND matchday <= $matchday";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('bets_wdl', array(
|
||||
'ROW_CLASS' => 'bg2 row_dark',
|
||||
'SCORE' => sprintf($user->lang['PLAYED']),
|
||||
'HOMEWIN' => $row['SUM_HOME_WIN'],
|
||||
'DRAW' => $row['SUM_DRAW'],
|
||||
'GUESTWIN' => $row['SUM_GUEST_WIN'],
|
||||
)
|
||||
);
|
||||
// Muliply with user of this league
|
||||
$template->assign_block_vars('bets_wdl_all', array(
|
||||
'ROW_CLASS' => 'bg2 row_dark',
|
||||
'SCORE' => sprintf($user->lang['PLAYED']),
|
||||
'HOMEWIN' => $row['SUM_HOME_WIN'] * $numb_users,
|
||||
'DRAW' => $row['SUM_DRAW'] * $numb_users,
|
||||
'GUESTWIN' => $row['SUM_GUEST_WIN'] * $numb_users,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Count tendencies (bets of selected user)
|
||||
$template->assign_block_vars('bets_wdl', array(
|
||||
'ROW_CLASS' => 'bg1 row_light',
|
||||
'SCORE' => sprintf($user->lang['GUESSED']),
|
||||
'HOMEWIN' => $bets_home_win,
|
||||
'DRAW' => $bets_draw,
|
||||
'GUESTWIN' => $bets_guest_win,
|
||||
)
|
||||
);
|
||||
// Scored with tendency (bets of selected user)
|
||||
$template->assign_block_vars('bets_wdl', array(
|
||||
'ROW_CLASS' => 'bg2 row_dark',
|
||||
'SCORE' => sprintf($user->lang['SCORED']),
|
||||
'HOMEWIN' => $win_home_win,
|
||||
'DRAW' => $win_draw,
|
||||
'GUESTWIN' => $win_guest_win,
|
||||
)
|
||||
);
|
||||
// Points with tendency (bets of selected user)
|
||||
$template->assign_block_vars('bets_wdl', array(
|
||||
'ROW_CLASS' => 'bg1 row_light',
|
||||
'SCORE' => sprintf($user->lang['POINTS']),
|
||||
'HOMEWIN' => $points_home_win,
|
||||
'DRAW' => $points_draw,
|
||||
'GUESTWIN' => $points_guest_win,
|
||||
)
|
||||
);
|
||||
|
||||
// All bets of all users group by bet
|
||||
$rank = 0;
|
||||
$bets_home_win = 0;
|
||||
$bets_draw = 0;
|
||||
$bets_guest_win = 0;
|
||||
$win_home_win = 0;
|
||||
$win_draw = 0;
|
||||
$win_guest_win = 0;
|
||||
$points_home_win = 0;
|
||||
$points_draw = 0;
|
||||
$points_guest_win = 0;
|
||||
|
||||
$sql = 'SELECT
|
||||
COUNT(b.match_no) AS bets,
|
||||
b.goals_home,
|
||||
b.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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
||||
)
|
||||
) AS hits,
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
)
|
||||
) AS tendencies,
|
||||
' . select_points('m',true) . '
|
||||
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)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.status = 3
|
||||
AND m.matchday <= $matchday
|
||||
GROUP by b.goals_home, b.goals_guest
|
||||
ORDER by bets DESC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['goals_home'] > $row['goals_guest'])
|
||||
{
|
||||
$bets_home_win += $row['bets'];
|
||||
$win_home_win += $row['hits'] + $row['tendencies'];
|
||||
$points_home_win += $row['points'];
|
||||
}
|
||||
if ($row['goals_home'] == $row['goals_guest'])
|
||||
{
|
||||
$bets_draw += $row['bets'];
|
||||
$win_draw += $row['hits'] + $row['tendencies'];
|
||||
$points_draw += $row['points'];
|
||||
}
|
||||
if ($row['goals_home'] < $row['goals_guest'])
|
||||
{
|
||||
$bets_guest_win += $row['bets'];
|
||||
$win_guest_win += $row['hits'] + $row['tendencies'];
|
||||
$points_guest_win += $row['points'];
|
||||
}
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('allbets', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'GOALSHOME' => $row['goals_home'],
|
||||
'GOALSGUEST' => $row['goals_guest'],
|
||||
'COUNT' => $row['bets'],
|
||||
'DIRECTHITS' => $row['hits'],
|
||||
'TENDENCIES' => $row['tendencies'],
|
||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||
'POINTS' => $row['points'],
|
||||
'AVERAGE' => round($row['points'] / $row['bets'],1),
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Count tendencies (bets of all user)
|
||||
$template->assign_block_vars('bets_wdl_all', array(
|
||||
'ROW_CLASS' => 'bg2 row_dark',
|
||||
'SCORE' => sprintf($user->lang['GUESSED']),
|
||||
'HOMEWIN' => $bets_home_win,
|
||||
'DRAW' => $bets_draw,
|
||||
'GUESTWIN' => $bets_guest_win,
|
||||
)
|
||||
);
|
||||
// Scored with tendency (bets of all user)
|
||||
$template->assign_block_vars('bets_wdl_all', array(
|
||||
'ROW_CLASS' => 'bg1 row_light',
|
||||
'SCORE' => sprintf($user->lang['SCORED']),
|
||||
'HOMEWIN' => $win_home_win,
|
||||
'DRAW' => $win_draw,
|
||||
'GUESTWIN' => $win_guest_win,
|
||||
)
|
||||
);
|
||||
// Points with tendency (bets of all user)
|
||||
$template->assign_block_vars('bets_wdl_all', array(
|
||||
'ROW_CLASS' => 'bg2 row_dark',
|
||||
'SCORE' => sprintf($user->lang['POINTS']),
|
||||
'HOMEWIN' => $points_home_win,
|
||||
'DRAW' => $points_draw,
|
||||
'GUESTWIN' => $points_guest_win,
|
||||
)
|
||||
);
|
||||
|
||||
$sidename = sprintf($user->lang['MY_BETS']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_MY_BETS' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'U_LEFT' => ($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' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => ($config['football_bank']) ? '< ' . sprintf($user->lang['FOOTBALL_BANK']) :
|
||||
'< ' . sprintf($user->lang['RANK_TOTAL']),
|
||||
'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,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
339
block/my_chart.php
Normal file
@@ -0,0 +1,339 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$data = false;
|
||||
$user1 = '';
|
||||
$user2 = '';
|
||||
$user3 = '';
|
||||
$user4 = '';
|
||||
$username = '';
|
||||
$username2 = '';
|
||||
$username3 = '';
|
||||
$username4 = '';
|
||||
// Calculate rank total
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
u.username,
|
||||
SUM(r.points) AS points_total
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
AND r.matchday <= $matchday
|
||||
GROUP BY r.user_id
|
||||
ORDER BY points_total DESC, LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$current_ranks = $db->sql_fetchrowset($result);
|
||||
$total_users = sizeof($current_ranks);
|
||||
if ($total_users > 3 AND $total_users <= 50)
|
||||
{
|
||||
$data = true;
|
||||
$middle = round($total_users / 2,0);
|
||||
// If user = leader then first = seconde
|
||||
$user_first = $current_ranks[0]['user_id'];
|
||||
if ($user_first == $user->data['user_id'])
|
||||
$user_first = $current_ranks[1]['user_id'];
|
||||
// If user = middle then middle = middle - 1
|
||||
$user_middle = $current_ranks[$middle-1]['user_id'];
|
||||
if ($user_middle == $user->data['user_id'])
|
||||
$user_middle = $current_ranks[$middle]['user_id'];
|
||||
// If user = last then last = last but one
|
||||
$user_last = $current_ranks[$total_users - 1]['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))
|
||||
{
|
||||
// Take user, leader, middle and last
|
||||
$user1 = $this->request->variable('user1', $user->data['user_id']);
|
||||
$user2 = $this->request->variable('user2', $user_first);
|
||||
$user3 = $this->request->variable('user3', $user_middle);
|
||||
$user4 = $this->request->variable('user4', $user_last);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only take leader, middle and last
|
||||
$user1 = $this->request->variable('user1', $user_first);
|
||||
$user2 = $this->request->variable('user2', $user_middle);
|
||||
$user3 = $this->request->variable('user3', $user_last);
|
||||
$user4 = $this->request->variable('user4', 0);
|
||||
}
|
||||
|
||||
// Add empty choice
|
||||
$template->assign_block_vars('form_user2', array(
|
||||
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
||||
'S_USERID' => 0,
|
||||
'S_SELECTEDID2' => '',
|
||||
)
|
||||
);
|
||||
$template->assign_block_vars('form_user3', array(
|
||||
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
||||
'S_USERID' => 0,
|
||||
'S_SELECTEDID3' => '',
|
||||
)
|
||||
);
|
||||
$template->assign_block_vars('form_user4', array(
|
||||
'S_USERNAME' => sprintf($user->lang['OPTION_USER']),
|
||||
'S_USERID' => 0,
|
||||
'S_SELECTEDID4' => '',
|
||||
)
|
||||
);
|
||||
|
||||
// Start select user
|
||||
foreach ($current_ranks as $rank_user)
|
||||
{
|
||||
$curr_userid =$rank_user['user_id'];
|
||||
if ($user1 == $curr_userid)
|
||||
{
|
||||
$selectid1 = ' selected="selected"';
|
||||
$username = $rank_user['username'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid1 = '';
|
||||
}
|
||||
if ($user2 == $curr_userid)
|
||||
{
|
||||
$selectid2 = ' selected="selected"';
|
||||
$username2 = $rank_user['username'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid2 = '';
|
||||
}
|
||||
if ($user3 == $curr_userid)
|
||||
{
|
||||
$selectid3 = ' selected="selected"';
|
||||
$username3 = $rank_user['username'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid3 = '';
|
||||
}
|
||||
if ($user4 == $curr_userid)
|
||||
{
|
||||
$selectid4 = ' selected="selected"';
|
||||
$username4 = $rank_user['username'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid4 = '';
|
||||
}
|
||||
if ($curr_userid != $user2 AND $curr_userid != $user3 AND $curr_userid != $user4)
|
||||
$template->assign_block_vars('form_user1', array(
|
||||
'S_USERNAME' => $rank_user['username'],
|
||||
'S_USERID' => $curr_userid,
|
||||
'S_SELECTEDID' => $selectid1));
|
||||
if ($curr_userid != $user1 AND $curr_userid != $user3 AND $curr_userid != $user4)
|
||||
$template->assign_block_vars('form_user2', array(
|
||||
'S_USERNAME' => $rank_user['username'],
|
||||
'S_USERID' => $curr_userid,
|
||||
'S_SELECTEDID' => $selectid2));
|
||||
if ($curr_userid != $user1 AND $curr_userid != $user2 AND $curr_userid != $user4)
|
||||
$template->assign_block_vars('form_user3', array(
|
||||
'S_USERNAME' => $rank_user['username'],
|
||||
'S_USERID' => $curr_userid,
|
||||
'S_SELECTEDID' => $selectid3));
|
||||
if ($curr_userid != $user1 AND $curr_userid != $user2 AND $curr_userid != $user3)
|
||||
$template->assign_block_vars('form_user4', array(
|
||||
'S_USERNAME' => $rank_user['username'],
|
||||
'S_USERID' => $curr_userid,
|
||||
'S_SELECTEDID' => $selectid4));
|
||||
}
|
||||
|
||||
$ranks_total_1 = '';
|
||||
$ranks_dayl_1 = '';
|
||||
$points_1 = '';
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday <= $matchday
|
||||
AND user_id = $user1
|
||||
ORDER BY matchday ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$points_1 = $points_1. $row['points']. ',';
|
||||
$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);
|
||||
$ranks_dayl_1 = substr($ranks_dayl_1, 0, strlen($ranks_dayl_1) - 1);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$ranks_total_2 = '';
|
||||
$ranks_dayl_2 = '';
|
||||
$points_2 = '';
|
||||
if ($user2 != 0)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday <= $matchday
|
||||
AND user_id = $user2
|
||||
ORDER BY matchday ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$points_2 = $points_2 . $row['points']. ',';
|
||||
$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);
|
||||
$ranks_dayl_2 = substr($ranks_dayl_2, 0, strlen($ranks_dayl_2) - 1);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$ranks_total_3 = '';
|
||||
$ranks_dayl_3 = '';
|
||||
$points_3 = '';
|
||||
if ($user3 != 0)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday <= $matchday
|
||||
AND user_id = $user3
|
||||
ORDER BY matchday ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$points_3 = $points_3. $row['points']. ',';
|
||||
$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);
|
||||
$ranks_dayl_3 = substr($ranks_dayl_3,0,strlen($ranks_dayl_3)-1);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$ranks_total_4 = '';
|
||||
$ranks_dayl_4 = '';
|
||||
$points_4 = '';
|
||||
if ($user4 != 0)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday <= $matchday
|
||||
AND user_id = $user4
|
||||
ORDER BY matchday ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$points_4 = $points_4. $row['points']. ',';
|
||||
$sptagplatz = $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);
|
||||
$ranks_dayl_4 = substr($ranks_dayl_4,0,strlen($ranks_dayl_4)-1);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$min = '';
|
||||
$max = '';
|
||||
if ($user1 != 0)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
MIN(points) As points_min,
|
||||
MAX(points) As points_max
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday <= $matchday
|
||||
GROUP BY matchday
|
||||
ORDER BY matchday ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$min = $min. $row['points_min']. ',';
|
||||
$max = $max. $row['points_max']. ',';
|
||||
}
|
||||
$min = substr($min,0,strlen($min)-1);
|
||||
$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
|
||||
. "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['PLACE']) . "' alt='"
|
||||
. sprintf($user->lang['CHART_TOTAL'])
|
||||
. "'/>";
|
||||
$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="
|
||||
. sprintf($user->lang['PLACE']) . "' alt='"
|
||||
. sprintf($user->lang['CHART_MATCHDAY'])
|
||||
. "'/>";
|
||||
$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="
|
||||
. sprintf($user->lang['POINTS']) . ',' . sprintf($user->lang['BANDWIDTH']) . "' alt='"
|
||||
. sprintf($user->lang['CHART_POINTS'])
|
||||
. "'/>";
|
||||
$template->assign_block_vars('chart_points', array(
|
||||
'CHARTIMAGE' => $chart,
|
||||
)
|
||||
);
|
||||
}
|
||||
$sidename = sprintf($user->lang['MY_CHART']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_MY_CHART' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_rank', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_RANK']),
|
||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_koeff', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'RIGHT_LINK' => sprintf($user->lang['MY_KOEFF']) . ' >',
|
||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_RANKS']),
|
||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_KOEFF']),
|
||||
'S_DATA_MY_CHART' => $data,
|
||||
'SEASON' => $season,
|
||||
'LEAGUE' => $league,
|
||||
'S_USER1' => $user1,
|
||||
'S_USER2' => $user2,
|
||||
'S_USER3' => $user3,
|
||||
'S_USER4' => $user4,
|
||||
'USERNAME1' => $username,
|
||||
'USERNAME2' => $username2,
|
||||
'USERNAME3' => $username3,
|
||||
'USERNAME4' => $username4,
|
||||
)
|
||||
);
|
||||
?>
|
||||
393
block/my_koeff.php
Normal file
@@ -0,0 +1,393 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$start = $this->request->variable('start', 0);
|
||||
$matches_on_matchday = false;
|
||||
|
||||
if (!$user_sel)
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$user_sel = $user->data['user_id'];
|
||||
}
|
||||
}
|
||||
$username = '';
|
||||
|
||||
$data = false;
|
||||
// Select user
|
||||
$total_users = 0;
|
||||
$sql = 'SELECT DISTINCT
|
||||
u.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$total_users++;
|
||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||
{
|
||||
$selectid = ' selected="selected"';
|
||||
$username = $row['username'];
|
||||
$user_sel = $row['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid = '';
|
||||
}
|
||||
$template->assign_block_vars('form_user', array(
|
||||
'S_USER' => $row['user_id'],
|
||||
'S_USERNAME' => $row['username'],
|
||||
'S_SELECTEDID' => $selectid,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
// Select matches with results and tendencies
|
||||
$sql = "SELECT
|
||||
m.match_no,
|
||||
m.status,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_name_short AS home_name,
|
||||
t2.team_name_short AS guest_name,
|
||||
t1.team_id AS home_id,
|
||||
t2.team_id AS guest_id,
|
||||
m.goals_home,
|
||||
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 = 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
|
||||
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 t2 ON (t2.season=m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||
LEFT JOIN ' . FOOTB_BETS . " AS b ON(b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
GROUP BY m.match_no
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$matches = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$count_matches = sizeof($matches);
|
||||
if ($count_matches > 11)
|
||||
{
|
||||
$split_after = 8;
|
||||
$splits = floor($count_matches / 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
$split_after = $count_matches;
|
||||
$splits = 1;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
if ($start < 0 || $start >= $total_users)
|
||||
{
|
||||
$start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
|
||||
$sql_start = $start * $count_matches;
|
||||
$sql_limit = $config['football_users_per_page'] * $count_matches;
|
||||
|
||||
// handle pagination.
|
||||
$base_url = $this->helper->route('football_main_controller', array('side' => 'my_koeff', 's' => $season, 'l' => $league, 'm' => $matchday, 'u' => "$user_sel"));
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||
|
||||
$bet_line = array();
|
||||
if ($count_matches > 0)
|
||||
{
|
||||
$matches_on_matchday = true;
|
||||
// Select user bets and points on user results
|
||||
$sql = "SELECT
|
||||
u.user_id,
|
||||
u.username,
|
||||
m.status,
|
||||
b.goals_home AS bet_home,
|
||||
b.goals_guest AS bet_guest,
|
||||
" . select_points("bu") . "
|
||||
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 bu ON(bu.season = m.season AND bu.league = m.league AND bu.match_no = m.match_no AND bu.user_id = $user_sel)
|
||||
LEFT JOIN " . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
ORDER BY LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||
$user_bets = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$bet_index = 0;
|
||||
$split_index = 0;
|
||||
foreach ($user_bets AS $user_bet)
|
||||
{
|
||||
$data = true;
|
||||
if ($bet_index == $count_matches)
|
||||
{
|
||||
$bet_index = 0;
|
||||
$split_index = 0;
|
||||
}
|
||||
if (!($bet_index % $split_after))
|
||||
{
|
||||
$split_index++;
|
||||
}
|
||||
$sum_total[$user_bet['username']] = 0;
|
||||
$bet_line[$split_index][] = $user_bet;
|
||||
$bet_index++;
|
||||
}
|
||||
}
|
||||
$match_index = 0;
|
||||
$split_index = 0;
|
||||
$matchday_sum_total = 0;
|
||||
$colorstyle_total = ' color_finally';
|
||||
foreach ($matches AS $match)
|
||||
{
|
||||
if (!($match_index % $split_after))
|
||||
{
|
||||
if ($match_index > 0)
|
||||
{
|
||||
$total = 0;
|
||||
$count_user = 0;
|
||||
$bet_index = 0;
|
||||
foreach ($bet_line[$split_index] AS $user_bet)
|
||||
{
|
||||
if ($bet_index == 0)
|
||||
{
|
||||
$count_user++;
|
||||
$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';
|
||||
}
|
||||
$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'];
|
||||
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 == $split_after)
|
||||
{
|
||||
$sum_total[$user_bet['username']] += $total;
|
||||
$matchday_sum_total += $total;
|
||||
$bet_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('match_panel.tendency_footer', array(
|
||||
'S_TOTAL' => false,
|
||||
)
|
||||
);
|
||||
foreach ($matches_tendency AS $match_tendency)
|
||||
{
|
||||
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
|
||||
'TENDENCY' => $match_tendency,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$matches_tendency = array();
|
||||
$split_index++;
|
||||
if ($split_index == $splits)
|
||||
{
|
||||
$display_total = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_total = false;
|
||||
}
|
||||
$template->assign_block_vars('match_panel', array(
|
||||
'S_TOTAL' => $display_total,
|
||||
)
|
||||
);
|
||||
}
|
||||
if (0 == $match['home_id'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $match['match_no'], 'team_id_home', $match['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homename = $home_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homename = $match['home_name'];
|
||||
}
|
||||
if (0 == $match['guest_id'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $match['match_no'], 'team_id_guest', $match['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestname = $guest_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestname = $match['guest_name'];
|
||||
}
|
||||
$colorstyle_match = color_style($match['status']);
|
||||
$template->assign_block_vars('match_panel.match_entry', array(
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'RESULT' => $match['goals_home'] . ':' . $match['goals_guest'],
|
||||
'COLOR_STYLE' => $colorstyle_match,
|
||||
)
|
||||
);
|
||||
if ($match['status'] < 1 && !$config['football_view_tendencies'])
|
||||
{
|
||||
// hide tendencies
|
||||
$matches_tendency[] = '?-?-?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$matches_tendency[] = $match['home'] . '-' . $match['draw'] . '-' . $match['guest'];
|
||||
}
|
||||
$match_index++;
|
||||
}
|
||||
if ($count_matches > 0)
|
||||
{
|
||||
$total = 0;
|
||||
$count_user = 0;
|
||||
$bet_index = 0;
|
||||
foreach ($bet_line[$split_index] AS $user_bet)
|
||||
{
|
||||
if ($bet_index == 0)
|
||||
{
|
||||
$count_user++;
|
||||
$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';
|
||||
}
|
||||
$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'];
|
||||
if ($user_bet['status'] < 1)
|
||||
{
|
||||
if ($user_bet['bet_home'] == '')
|
||||
{
|
||||
$bet_home = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bet_home = '?';
|
||||
}
|
||||
if ($user_bet['bet_guest'] == '')
|
||||
{
|
||||
$bet_guest = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$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 == $split_after)
|
||||
{
|
||||
$sum_total[$user_bet['username']] += $total;
|
||||
$matchday_sum_total += $total;
|
||||
$template->assign_block_vars('match_panel.user_row.points', array(
|
||||
'COLOR_STYLE' => $colorstyle_total,
|
||||
'POINTS_TOTAL' => $sum_total[$user_bet['username']],
|
||||
)
|
||||
);
|
||||
$bet_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('match_panel.tendency_footer', array(
|
||||
'S_TOTAL' => true,
|
||||
'COLOR_STYLE' => $colorstyle_total, //currently ignored
|
||||
'SUMTOTAL' => $matchday_sum_total,
|
||||
)
|
||||
);
|
||||
foreach ($matches_tendency AS $match_tendency)
|
||||
{
|
||||
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
|
||||
'TENDENCY' => $match_tendency,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sidename = sprintf($user->lang['MY_KOEFF']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_MY_KOEFF' => true,
|
||||
'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_SPALTEN' => ($count_matches * 2) + 2,
|
||||
'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),
|
||||
'USERNAME' => $username,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
204
block/my_points.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
if (!$user_sel)
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$user_sel = $user->data['user_id'];
|
||||
}
|
||||
}
|
||||
$username = '';
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
|
||||
$data = false;
|
||||
// Select user
|
||||
$sql = 'SELECT DISTINCT
|
||||
u.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data = true;
|
||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||
{
|
||||
$selectid = ' selected="selected"';
|
||||
$username = $row['username'];
|
||||
$user_sel = $row['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid = '';
|
||||
}
|
||||
$template->assign_block_vars('form_user', array(
|
||||
'S_USER' => $row['user_id'],
|
||||
'S_USERNAME' => $row['username'],
|
||||
'S_SELECTEDID' => $selectid,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Select sum of users points group by team
|
||||
$sql = "SELECT
|
||||
t.*,
|
||||
SUM(1) AS bets,
|
||||
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)
|
||||
)
|
||||
) AS win,
|
||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||
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)
|
||||
)
|
||||
) AS lost,
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest=m.goals_guest),
|
||||
0,1
|
||||
)
|
||||
)
|
||||
)AS tendencies,
|
||||
SUM(IF((b.goals_home = m.goals_home) AND (b.goals_guest=m.goals_guest),1,0))AS hits,
|
||||
" . select_points('m',true) . "
|
||||
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_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no=m.match_no)
|
||||
WHERE t.season = $season
|
||||
AND t.league = $league
|
||||
AND m.status IN (3,6)
|
||||
AND b.user_id = $user_sel
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.matchday <= $matchday
|
||||
GROUP BY t.team_id
|
||||
ORDER BY points DESC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$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\"/>" ;
|
||||
$template->assign_block_vars('points', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank,
|
||||
'LOGO' => $logo,
|
||||
'TEAM' => $row['team_name_short'],
|
||||
'COUNT' => $row['bets'],
|
||||
'WIN' => $row['win'],
|
||||
'DRAW' => $row['draw'],
|
||||
'LOST' => $row['lost'],
|
||||
'DIRECTHITS' => $row['hits'],
|
||||
'TENDENCIES' => $row['tendencies'],
|
||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Select sum of all users points group by team
|
||||
$sql = "SELECT
|
||||
t.*,
|
||||
SUM(1) AS bets,
|
||||
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)
|
||||
)
|
||||
) AS win,
|
||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||
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)
|
||||
)
|
||||
) AS lost,
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
)
|
||||
)AS tendencies,
|
||||
SUM(IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)) AS hits,
|
||||
" . select_points('m',true) . "
|
||||
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_BETS . " AS b ON (b.season = t.season AND b.league = t.league AND b.match_no=m.match_no)
|
||||
WHERE t.season = $season
|
||||
AND t.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.status IN (3,6)
|
||||
AND m.matchday <= $matchday
|
||||
GROUP BY t.team_id
|
||||
ORDER BY points DESC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$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\"/>" ;
|
||||
$template->assign_block_vars('allpoints', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank,
|
||||
'LOGO' => $logo,
|
||||
'TEAM' => $row['team_name_short'],
|
||||
'COUNT' => $row['bets'],
|
||||
'WIN' => $row['win'],
|
||||
'DRAW' => $row['draw'],
|
||||
'LOST' => $row['lost'],
|
||||
'DIRECTHITS' => $row['hits'],
|
||||
'TENDENCIES' => $row['tendencies'],
|
||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = sprintf($user->lang['MY_POINTS']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_MY_POINTS' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_BETS']),
|
||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'RIGHT_LINK' => sprintf($user->lang['MY_TABLE']) . ' >',
|
||||
'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,
|
||||
)
|
||||
);
|
||||
?>
|
||||
179
block/my_rank.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
if (!$user_sel)
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$user_sel = $user->data['user_id'];
|
||||
}
|
||||
}
|
||||
$username = '';
|
||||
|
||||
$data = false;
|
||||
// select user
|
||||
$sql = 'SELECT DISTINCT
|
||||
u.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS w
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = w.user_id)
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY LOWER(u.username) ASC ";
|
||||
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||
{
|
||||
$selectid = ' selected="selected"';
|
||||
$username = $row['username'];
|
||||
$user_sel = $row['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid = '';
|
||||
}
|
||||
$template->assign_block_vars('form_user', array(
|
||||
'S_USER' => $row['user_id'],
|
||||
'S_USERNAME' => $row['username'],
|
||||
'S_SELECTEDID' => $selectid,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Get ranks 1-3 of selected user
|
||||
$sql = 'SELECT
|
||||
season,
|
||||
COUNT(matchday) AS matchdays,
|
||||
SUM(points) AS points,
|
||||
SUM(IF(rank = 1, 1, 0)) AS rank1,
|
||||
SUM(IF(rank = 2, 1, 0)) AS rank2,
|
||||
SUM(IF(rank = 3, 1, 0)) AS rank3
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND user_id = $user_sel
|
||||
GROUP BY user_id, season
|
||||
ORDER BY season ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('myrank', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'SEASON' => $row['season'],
|
||||
'MATCHDAYS' => $row['matchdays'],
|
||||
'POINTS' => $row['points'],
|
||||
'RANK1' => $row['rank1'],
|
||||
'RANK2' => $row['rank2'],
|
||||
'RANK3' => $row['rank3'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Get all ranks 1-3 of selected user
|
||||
$sql = 'SELECT
|
||||
COUNT(matchday) AS matchdays,
|
||||
rank
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND user_id = $user_sel
|
||||
GROUP BY user_id, rank
|
||||
ORDER BY rank ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('season_ranks', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $row['rank'],
|
||||
'MATCHDAYS' => $row['matchdays'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Get ranks 1-3 of all users
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
u.username,
|
||||
COUNT(r.matchday) AS matchdays,
|
||||
SUM(r.points) AS points,
|
||||
SUM(IF(r.rank =1, 1, 0)) AS rank1,
|
||||
SUM(IF(r.rank =2, 1, 0)) AS rank2,
|
||||
SUM(IF(r.rank =3, 1, 0)) AS rank3
|
||||
FROM ' . FOOTB_RANKS . " AS r
|
||||
LEFT JOIN " . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
GROUP BY r.user_id
|
||||
ORDER BY rank1 DESC, rank2 DESC, rank3 DESC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data = true;
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$template->assign_block_vars('allranks', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'NAME' => $row['username'],
|
||||
'MATCHDAYS' => $row['matchdays'],
|
||||
'POINTS' => $row['points'],
|
||||
'AVERAGE' => round($row['points'] / $row['matchdays'],1),
|
||||
'RANK1' => $row['rank1'],
|
||||
'RANK2' => $row['rank2'],
|
||||
'RANK3' => $row['rank3'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = sprintf($user->lang['MY_RANK']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_MY_RANK' => true,
|
||||
'S_MATCHDAY_HIDE' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_TABLE']),
|
||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_chart', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'RIGHT_LINK' => sprintf($user->lang['MY_CHART']) . ' >',
|
||||
'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,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
438
block/my_table.php
Normal file
@@ -0,0 +1,438 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
if (!$user_sel)
|
||||
{
|
||||
if (user_is_member($user->data['user_id'], $season, $league))
|
||||
{
|
||||
$user_sel = $user->data['user_id'];
|
||||
}
|
||||
}
|
||||
$username = '';
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
|
||||
// select user
|
||||
$sql = 'SELECT DISTINCT
|
||||
u.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($user_sel == 900)
|
||||
{
|
||||
$selectid = ' selected="selected"';
|
||||
$username = 'Alle';
|
||||
$user_sel = 900;
|
||||
$where_user = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid = '';
|
||||
$where_user = "b.user_id = $user_sel AND ";
|
||||
}
|
||||
$template->assign_block_vars('form_user', array(
|
||||
'S_USER' => 900,
|
||||
'S_USERNAME' => 'Alle',
|
||||
'S_SELECTEDID' => $selectid,
|
||||
)
|
||||
);
|
||||
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($user_sel == $row['user_id'] OR !$user_sel)
|
||||
{
|
||||
$selectid = ' selected="selected"';
|
||||
$username = $row['username'];
|
||||
$user_sel = $row['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectid = '';
|
||||
}
|
||||
$template->assign_block_vars('form_user', array(
|
||||
'S_USER' => $row['user_id'],
|
||||
'S_USERNAME' => $row['username'],
|
||||
'S_SELECTEDID' => $selectid,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$data_table = false;
|
||||
$data_form = false;
|
||||
if ($matchday > 5)
|
||||
{
|
||||
$form_from = $matchday - 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
$form_from = 1;
|
||||
}
|
||||
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$league_type = $row['league_type'];
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$text_form = sprintf($user->lang['TABLE_FORM_FROM'], $form_from);
|
||||
|
||||
$rank = 0;
|
||||
// Select table on selected user bets
|
||||
$sql = 'SELECT
|
||||
t.*,
|
||||
SUM(1) AS matches,
|
||||
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)
|
||||
)
|
||||
) AS win,
|
||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||
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)
|
||||
)
|
||||
) AS lost,
|
||||
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))
|
||||
)
|
||||
) AS points,
|
||||
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))
|
||||
)
|
||||
) 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)) AS goals,
|
||||
SUM(IF(m.team_id_home = t.team_id, b.goals_guest, b.goals_home)) 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 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)
|
||||
WHERE $where_user
|
||||
t.season = $season
|
||||
AND t.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.matchday <= $matchday
|
||||
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";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$lastGroup = '';
|
||||
$sumdiff = 0;
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($lastGroup != $row['group_id'])
|
||||
{
|
||||
$lastGroup = $row['group_id'];
|
||||
$rank = 0;
|
||||
$template->assign_block_vars('total', array(
|
||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($league_type != 2 OR $row['group_id'] != '')
|
||||
{
|
||||
$data_table = true;
|
||||
$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\"/>" ;
|
||||
$pdiff = $row['points'] - $row['realpoints'];
|
||||
if ($pdiff >= 0)
|
||||
{
|
||||
$sumdiff += $pdiff;
|
||||
$pdiff = ' (+' . $pdiff . ')';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$sumdiff -= $pdiff;
|
||||
$pdiff = ' (' . $pdiff . ')';
|
||||
}
|
||||
if ($user_sel == 900)
|
||||
{
|
||||
$pdiff = '';
|
||||
}
|
||||
|
||||
$template->assign_block_vars('total', array(
|
||||
'RANK' => $rank . '.',
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'TEAM' => $row['team_name_short'],
|
||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'tid' => $row['team_id'], 'mode' => 'played')),
|
||||
'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'],
|
||||
'POINTS' => $row['points'] . $pdiff,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Select formtable on selected user bets
|
||||
$sql = 'SELECT
|
||||
t.*,
|
||||
SUM(1) AS matches,
|
||||
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)
|
||||
)
|
||||
) AS win,
|
||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||
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)
|
||||
)
|
||||
) AS lost,
|
||||
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))
|
||||
)
|
||||
) 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,
|
||||
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
|
||||
FROM ' . FOOTB_TEAMS . ' AS t
|
||||
LEFT JOIN ' . FOOTB_MATCHES . ' AS m ON (m.season = t.season AND m.league = t.league
|
||||
AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
||||
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
|
||||
t.season = $season
|
||||
AND t.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.matchday >= $form_from
|
||||
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";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$lastGroup = '';
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data_form = true;
|
||||
if ($lastGroup != $row['group_id'])
|
||||
{
|
||||
$lastGroup = $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++;
|
||||
$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\"/>" ;
|
||||
|
||||
$template->assign_block_vars('form', array(
|
||||
'RANK' => $rank . '.',
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'TEAM' => $row['team_name_short'],
|
||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'tid' => $row['team_id'], 'mode' => 'rest')),
|
||||
'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'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Select home-table on selected user bets
|
||||
$sql = 'SELECT
|
||||
t.*,
|
||||
SUM(1) AS matches,
|
||||
SUM(IF(b.goals_home + 0 > b.goals_guest, 1, 0)) AS win,
|
||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||
SUM(IF(b.goals_home + 0 < b.goals_guest, 1, 0)) AS lost,
|
||||
SUM(IF(b.goals_home + 0 > b.goals_guest, 3, IF(b.goals_home = b.goals_guest, 1, 0))) AS points,
|
||||
SUM(b.goals_home - b.goals_guest) AS goals_diff,
|
||||
SUM(b.goals_home) AS goals,
|
||||
SUM(b.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)
|
||||
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
|
||||
t.season = $season
|
||||
AND t.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.matchday <= $matchday
|
||||
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";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$lastGroup = '';
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($lastGroup != $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';
|
||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||
|
||||
$template->assign_block_vars('home', array(
|
||||
'RANK' => $rank . '.',
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'TEAM' => $row['team_name_short'],
|
||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'tid' => $row['team_id'], 'mode' => 'home')),
|
||||
'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'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
// Select away-table on selected user bets
|
||||
$sql = 'SELECT
|
||||
t.*,
|
||||
SUM(1) AS matches,
|
||||
SUM(IF(b.goals_home + 0 < b.goals_guest, 1, 0)) AS win,
|
||||
SUM(IF(b.goals_home = b.goals_guest, 1, 0)) AS draw,
|
||||
SUM(IF(b.goals_home + 0 > b.goals_guest, 1, 0)) AS lost,
|
||||
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 - b.goals_home) AS goals_diff,
|
||||
SUM(b.goals_guest) AS goals,
|
||||
SUM(b.goals_home) 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_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)
|
||||
WHERE $where_user
|
||||
t.season = $season
|
||||
AND t.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND m.matchday <= $matchday
|
||||
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";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$lastGroup = '';
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($lastGroup != $row['group_id'])
|
||||
{
|
||||
$lastGroup = $row['group_id'];
|
||||
$rank = 0;
|
||||
$template->assign_block_vars('away', 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';
|
||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||
|
||||
$template->assign_block_vars('away', array(
|
||||
'RANK' => $rank . '.',
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'TEAM' => $row['team_name_short'],
|
||||
'U_PLAN_TEAM' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'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'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = sprintf($user->lang['MY_TABLE']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_MY_TABLE' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'my_points', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_TABLE']),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_POINTS']),
|
||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'my_rank', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_TABLE']),
|
||||
'RIGHT_LINK' => sprintf($user->lang['MY_RANK']) . ' >',
|
||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_MY_POINTS']),
|
||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_MY_RANKS']),
|
||||
'S_DATA_MY_TABLE' => $data_table,
|
||||
'S_DATA_FORM' => $data_form,
|
||||
'SEASON' => $season,
|
||||
'LEAGUE' => $league,
|
||||
'TEXT_FORM' => $text_form,
|
||||
'S_PDIFF' => $sumdiff,
|
||||
'USERNAME' => $username,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
211
block/odds.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$data_odds = false;
|
||||
$matchnumber = 0;
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
|
||||
$sql = "SELECT
|
||||
m.league,
|
||||
m.match_no,
|
||||
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,
|
||||
t1.team_symbol AS home_symbol,
|
||||
t2.team_symbol AS guest_symbol,
|
||||
t1.team_name_short AS home_name,
|
||||
t2.team_name_short AS guest_name,
|
||||
t1.team_id AS home_id,
|
||||
t2.team_id AS guest_id,
|
||||
m.goals_home,
|
||||
m.goals_guest,
|
||||
m.goals_overtime_home AS kogoals_home,
|
||||
m.goals_overtime_guest AS kogoals_guest,
|
||||
m.ko_match,
|
||||
m.group_id,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
m.odd_1,
|
||||
m.odd_x,
|
||||
m.odd_2,
|
||||
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 t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
|
||||
$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));
|
||||
//while($row = $db->sql_fetchrow($result))
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$data_odds = true;
|
||||
$matchnumber++ ;
|
||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if (0 == $row['home_id'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homelogo = $home_in_array[0];
|
||||
$homeid = $home_in_array[1];
|
||||
$homename = $home_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homelogo = $row['home_symbol'];
|
||||
$homeid = $row['home_id'];
|
||||
$homename = $row['home_name'];
|
||||
}
|
||||
if (0 == $row['guest_id'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestlogo = $guest_in_array[0];
|
||||
$guestid = $guest_in_array[1];
|
||||
$guestname = $guest_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestlogo = $row['guest_symbol'];
|
||||
$guestid = $row['guest_id'];
|
||||
$guestname = $row['guest_name'];
|
||||
}
|
||||
if ($homelogo <> '')
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
if ($guestlogo <> '')
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($row['ko_match'])
|
||||
{
|
||||
$display_ko = true;
|
||||
$ko_match = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ko_match = false;
|
||||
}
|
||||
|
||||
if ($row['group_id'] == '')
|
||||
{
|
||||
$group_id = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_group = true;
|
||||
$group_id = $row['group_id'];
|
||||
}
|
||||
|
||||
$edit_match = false;
|
||||
$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'];
|
||||
|
||||
$template->assign_block_vars('odds', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'MATCH_NUMBER' => $row['match_no'],
|
||||
'MATCHDAY' => $matchday,
|
||||
'MATCH_TIME' => $row['match_time'],
|
||||
'GROUP' => $group_id,
|
||||
'HOME_ID' => $homeid,
|
||||
'GUEST_ID' => $guestid,
|
||||
'LOGO_HOME' => $logoH,
|
||||
'LOGO_GUEST' => $logoG,
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'tid' => $homeid, 'mode' => 'all')),
|
||||
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'tid' => $guestid, 'mode' => 'all')),
|
||||
'GOALS_HOME' => $goals_home,
|
||||
'GOALS_GUEST' => $goals_guest,
|
||||
'COLOR_STYLE' => '',
|
||||
'KOGOALS_HOME' => $kogoals_home,
|
||||
'KOGOALS_GUEST' => $kogoals_guest,
|
||||
'S_KO_MATCH' => $ko_match,
|
||||
'TREND' => $row['trend'],
|
||||
'U_MATCH_STATS' => $this->helper->route('football_football_popup', array('popside' => 'hist_popup', 's' => $season, 'l' => $league,
|
||||
'hid' => $homeid, 'gid' => $guestid, 'm' => $matchday,
|
||||
'mn' => $row['match_no'], 'gr' => $row['group_id'])),
|
||||
'ODD_1' => $row['odd_1'],
|
||||
'ODD_X' => $row['odd_x'],
|
||||
'ODD_2' => $row['odd_2'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = 'Chancen';
|
||||
switch ($league_info['bet_ko_type'])
|
||||
{
|
||||
case BET_KO_90:
|
||||
$result_explain = sprintf($user->lang['MIN90']);
|
||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||
break;
|
||||
case BET_KO_EXTRATIME:
|
||||
$result_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
||||
$label_finalresult = sprintf($user->lang['PENALTY']);
|
||||
break;
|
||||
case BET_KO_PENALTY:
|
||||
$result_explain = sprintf($user->lang['PENALTY']);
|
||||
$display_ko = false;
|
||||
break;
|
||||
default:
|
||||
$result_explain = sprintf($user->lang['MIN90']);
|
||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_ODDS' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'RESULT_EXPLAIN' => $result_explain,
|
||||
'LABEL_FINALRESULT' => $label_finalresult,
|
||||
'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' => '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,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
72
block/rank_matchday.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
if ($league <> 0)
|
||||
{
|
||||
$data_rank_matchday = false;
|
||||
$index = 0;
|
||||
$sql = "SELECT
|
||||
r.status,
|
||||
r.rank,
|
||||
r.user_id,
|
||||
u.username,
|
||||
r.points,
|
||||
IF(r.win=0, '', r.win) AS win
|
||||
FROM " . FOOTB_RANKS . ' AS r
|
||||
LEFT Join ' . USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
AND r.matchday = $matchday
|
||||
AND r.status IN (2,3)
|
||||
ORDER BY rank ASC, LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$index++;
|
||||
if (($index <= $config['football_display_ranks']) OR ($row['user_id'] == $user->data['user_id']))
|
||||
{
|
||||
$data_rank_matchday = true;
|
||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$colorstyle = color_style($row['status']);
|
||||
|
||||
$template->assign_block_vars('rank', array(
|
||||
'RANK' => $row['rank'],
|
||||
'ROW_CLASS' => $row_class,
|
||||
'USERID' => $row['user_id'],
|
||||
'USERNAME' => $row['username'],
|
||||
'U_BET_USER' => $this->helper->route('football_football_popup', array('popside' => 'bet_popup', 's' => $season, 'l' => $league,
|
||||
'm' => $matchday, 'u' => $row['user_id'])),
|
||||
'POINTS' => $row['points'],
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
'WIN' => $row['win'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$league_info = league_info($season, $league);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RANK_MATCHDAY' => true,
|
||||
'S_DATA_RANK_MATCHDAY' => $data_rank_matchday,
|
||||
'S_WIN' => ($league_info['win_matchday'] == '0') ? false : true,
|
||||
'WIN_NAME' => $config['football_win_name'],
|
||||
));
|
||||
}
|
||||
?>
|
||||
94
block/rank_total.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
if ($league <> 0)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
r.matchday AS last_matchday
|
||||
FROM '. FOOTB_RANKS . " AS r
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
AND r.status IN (2,3)
|
||||
ORDER BY r.matchday DESC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
if($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$last_matchday = $row['last_matchday'];
|
||||
$db->sql_freeresult($result);
|
||||
$rank_matchday = ($last_matchday < $matchday) ? $last_matchday : $matchday;
|
||||
|
||||
$sql = 'SELECT
|
||||
r.rank_total AS rank,
|
||||
r.user_id,
|
||||
u.username,
|
||||
u.user_colour,
|
||||
r.status AS status,
|
||||
r.points_total AS points,
|
||||
r.win_total AS win
|
||||
FROM '. FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN '. USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
AND r.matchday = $rank_matchday
|
||||
AND r.status IN (2,3)
|
||||
ORDER BY points DESC, LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$index = 0;
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$index++;
|
||||
$data_rank_total = true;
|
||||
if (($index <= $config['football_display_ranks']) OR ($row['user_id'] == $user->data['user_id']))
|
||||
{
|
||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$colorstyle = color_style($row['status']);
|
||||
|
||||
$template->assign_block_vars("ranktotal", array(
|
||||
'RANK' => $row['rank'],
|
||||
'ROW_CLASS' => $row_class,
|
||||
'USERID' => $row['user_id'],
|
||||
'USERNAME' => $row['username'],
|
||||
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'URL' => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $row['user_id'],
|
||||
'POINTS' => $row['points'],
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
'WIN' => $row['win'] ,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_rank_total = false;
|
||||
}
|
||||
$league_info = league_info($season, $league);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RANK_TOTAL' => true,
|
||||
'S_DATA_RANK_TOTAL' => $data_rank_total,
|
||||
'S_WIN' => ($league_info['win_matchday'] == '0' and $league_info['win_season'] == '0') ? false : true,
|
||||
'WIN_NAME' => $config['football_win_name'],
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
270
block/ranks_matchday.php
Normal file
@@ -0,0 +1,270 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$start = $this->request->variable('start', 0);
|
||||
$win_user_most_hits = array();
|
||||
$win_user_most_hits_away = array();
|
||||
$season_wins = array();
|
||||
$win_user_most_hits = win_user_most_hits($season, $league, $matchday);
|
||||
$win_user_most_hits_away = win_user_most_hits_away($season, $league, $matchday);
|
||||
|
||||
// Statistics of matchday
|
||||
$sql = "SELECT
|
||||
b.user_id,
|
||||
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 <> '',
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0),
|
||||
0
|
||||
)
|
||||
) AS hits,
|
||||
SUM(IF(b.goals_home <> '' AND b.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),
|
||||
0
|
||||
),
|
||||
0
|
||||
)
|
||||
) AS hits02,
|
||||
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
|
||||
(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),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
),
|
||||
0
|
||||
)
|
||||
) AS tendency
|
||||
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)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND m.status IN (2,3)
|
||||
AND m.matchday = $matchday
|
||||
GROUP BY user_id";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$usersstats = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
foreach ($usersstats AS $userstats)
|
||||
{
|
||||
$betsof[$userstats['user_id']] = $userstats['bets'];
|
||||
$nobetsof[$userstats['user_id']] = $userstats['matches'] - $userstats['bets'];
|
||||
$tendenciesof[$userstats['user_id']] = $userstats['tendency'];
|
||||
$hitsof[$userstats['user_id']] = $userstats['hits'];
|
||||
$hits02of[$userstats['user_id']] = $userstats['hits02'];
|
||||
}
|
||||
|
||||
// ranks of matchday
|
||||
$sql = 'SELECT
|
||||
rank,
|
||||
user_id
|
||||
FROM '. FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = $matchday
|
||||
AND status IN (2,3)
|
||||
ORDER BY rank ASC, user_id ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$ranks = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$total_users = sizeof($ranks);
|
||||
foreach ($ranks AS $rank)
|
||||
{
|
||||
$rankof[$rank['user_id']] = $rank['rank'];
|
||||
}
|
||||
|
||||
if ($matchday > 1)
|
||||
{
|
||||
// rank previous matchday
|
||||
$sql = 'SELECT
|
||||
rank AS last_rang,
|
||||
user_id
|
||||
FROM '. FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = ($matchday-1)
|
||||
AND status IN (2,3)
|
||||
ORDER BY last_rang ASC, user_id ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$ranks = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($ranks AS $rank)
|
||||
{
|
||||
$prevrankof[$rank['user_id']] = $rank['last_rang'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($matchday == $maxmatchday)
|
||||
{
|
||||
$season_wins = season_wins($season, $league, $matchday);
|
||||
}
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
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'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
$sql_limit = $config['football_users_per_page'];
|
||||
|
||||
// handle pagination.
|
||||
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday));
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||
$data_ranks = false;
|
||||
$index = 0;
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
|
||||
$sql = 'SELECT
|
||||
r.rank,
|
||||
r.status,
|
||||
r.user_id,
|
||||
r.points,
|
||||
r.win AS wins,
|
||||
u.user_colour,
|
||||
u.username
|
||||
FROM '. FOOTB_RANKS . ' AS r
|
||||
LEFT Join '. USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
AND r.matchday = $matchday
|
||||
AND r.status IN (2,3)
|
||||
ORDER BY r.rank ASC, r.points DESC, LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$index++;
|
||||
$data_ranks = true;
|
||||
if (isset($prevrankof[$row['user_id']]))
|
||||
{
|
||||
if ($rankof[$row['user_id']] == '')
|
||||
{
|
||||
$change_sign = '';
|
||||
$change_img = '';
|
||||
$change_differ = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rankof[$row['user_id']] == $prevrankof[$row['user_id']])
|
||||
{
|
||||
$change_sign = '=';
|
||||
$change_img = "<img src=\"" . $ext_path . "images/no_change.gif\" alt=\"" . $user->lang['NO_CHANGES'] . "\"/>";
|
||||
$change_differ = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rankof[$row['user_id']] > $prevrankof[$row['user_id']])
|
||||
{
|
||||
$change_sign = '+';
|
||||
$change_img = "<img src=\"" . $ext_path . "images/arrow_down.gif\" alt=\"" . $user->lang['WORSENED'] . "\"/>";
|
||||
$differ = $rankof[$row['user_id']] - $prevrankof[$row['user_id']];
|
||||
$change_differ = ' (' . $differ . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$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_img = '';
|
||||
$change_differ = ' ';
|
||||
}
|
||||
|
||||
if ($matchday == $maxmatchday)
|
||||
{
|
||||
// if someone didn't bet the hole Season
|
||||
if(!isset($win_user_most_hits[$row['user_id']]['win']))
|
||||
{
|
||||
$win_user_most_hits[$row['user_id']]['win'] = 0;
|
||||
}
|
||||
if(!isset($win_user_most_hits_away[$row['user_id']]['win']))
|
||||
{
|
||||
$win_user_most_hits_away[$row['user_id']]['win'] = 0;
|
||||
}
|
||||
if(!isset($season_wins[$row['user_id']]['win']))
|
||||
{
|
||||
$season_wins[$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']
|
||||
+ $season_wins[$row['user_id']]['win']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$win_total = sprintf('%01.2f',$row['wins']);
|
||||
}
|
||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$colorstyle = color_style($row['status']);
|
||||
|
||||
$template->assign_block_vars('rankstotal', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rankof[$row['user_id']],
|
||||
'CHANGE_SIGN' => $change_sign,
|
||||
'CHANGE_IMG' => $change_img,
|
||||
'CHANGE_DIFFER' => $change_differ,
|
||||
'USERID' => $row['user_id'],
|
||||
'USERNAME' => $row['username'],
|
||||
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
||||
'BETS' => $betsof[$row['user_id']],
|
||||
'NOBETS' => ($nobetsof[$row['user_id']] == 0) ? ' ' : $nobetsof[$row['user_id']],
|
||||
'TENDENCIES' => ($tendenciesof[$row['user_id']] == 0) ? ' ' : $tendenciesof[$row['user_id']],
|
||||
'DIRECTHITS' => ($hitsof[$row['user_id']] == 0) ? ' ' : $hitsof[$row['user_id']],
|
||||
'DIRECTHITS02' => ($hits02of[$row['user_id']] == 0) ? ' ' : $hits02of[$row['user_id']],
|
||||
'POINTS' => $row['points'],
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
'WIN' => $win_total,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$league_info = league_info($season, $league);
|
||||
|
||||
$sidename = sprintf($user->lang['RANK_MATCHDAY']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RANKS_MATCHDAY' => true,
|
||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_WIN' => ($league_info['win_matchday'] == '0') ? false : true,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'table', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'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'],
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
590
block/ranks_total.php
Normal file
@@ -0,0 +1,590 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$start = $this->request->variable('start', 0);
|
||||
$mode = $this->request->variable('mode', '');
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'alltime':
|
||||
// Statistics
|
||||
$sql = "SELECT
|
||||
b.user_id,
|
||||
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 <> '',
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
),
|
||||
0
|
||||
)
|
||||
) AS tendency
|
||||
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_LEAGUES . " AS l ON (l.season = b.season AND l.league = b.league)
|
||||
WHERE b.league = $league
|
||||
AND ((b.season < $season) OR (b.season = $season AND m.matchday <= $matchday))
|
||||
AND m.status IN (2,3)
|
||||
GROUP BY user_id";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
$total_users = sizeof($rows);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($rows AS $row)
|
||||
{
|
||||
$bets_of[$row['user_id']] = $row['bets'];
|
||||
$nobets_of[$row['user_id']] = $row['matches'] - $row['bets'];
|
||||
}
|
||||
|
||||
// Wins
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
sum(r.win_total) As win_total
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . FOOTB_LEAGUES . " AS l ON (l.season = r.season AND l.league = r.league)
|
||||
WHERE r.league = $league
|
||||
AND ((r.season < $season AND r.matchday = l.matchdays) OR (r.season = $season AND r.matchday = $matchday))
|
||||
AND r.status IN (2,3)
|
||||
GROUP BY user_id
|
||||
ORDER BY r.user_id ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$win_arr = array();
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$win_arr[$row['user_id']] = $row['win_total'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$data_ranks = false;
|
||||
$pagination = '';
|
||||
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
u.username,
|
||||
min(r.status) AS status,
|
||||
sum(r.points) As points_total,
|
||||
sum(r.tendencies) As tendencies,
|
||||
sum(r.correct_result) As hits
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . ' AS u ON (r.user_id = u.user_id)
|
||||
LEFT JOIN ' . FOOTB_LEAGUES . " AS l ON (l.season = r.season AND l.league = r.league)
|
||||
WHERE r.league = $league
|
||||
AND ((r.season < $season) OR (r.season = $season AND r.matchday <= $matchday))
|
||||
AND r.status IN (2,3)
|
||||
GROUP BY user_id
|
||||
ORDER BY points_total DESC, LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$ranking_arr = array();
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$ranking_arr[$row['user_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
if ($start < 0 || $start >= $total_users)
|
||||
{
|
||||
$index_start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$index_start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
$index_end = $index_start + $config['football_users_per_page'] - 1;
|
||||
|
||||
// handle pagination.
|
||||
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime'));
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||
|
||||
$index = 0;
|
||||
$rank = 0;
|
||||
$last_points = 0;
|
||||
$data_rank_total = false;
|
||||
foreach ($ranking_arr AS $curr_rank)
|
||||
{
|
||||
if ($curr_rank['points_total'] <> $last_points)
|
||||
{
|
||||
$rank = $index + 1;
|
||||
$last_points = $curr_rank['points_total'];
|
||||
}
|
||||
$data_ranks = true;
|
||||
if (($index_start <= $index) && ($index <= $index_end))
|
||||
{
|
||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($curr_rank['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$colorstyle = color_style($curr_rank['status']);
|
||||
|
||||
$template->assign_block_vars('rankstotal', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank,
|
||||
'USERID' => $curr_rank['user_id'],
|
||||
'USERNAME' => $curr_rank['username'],
|
||||
'URL' => $phpbb_root_path . 'profile.php?mode=viewprofile&u=' . $curr_rank['user_id'],
|
||||
'BETS' => $bets_of[$curr_rank['user_id']],
|
||||
'NOBETS' => ($nobets_of[$curr_rank['user_id']] == 0) ? ' ' : $nobets_of[$curr_rank['user_id']],
|
||||
'TENDENCIES' => ($curr_rank['tendencies'] == 0) ? ' ' : $curr_rank['tendencies'],
|
||||
'DIRECTHITS' => ($curr_rank['hits'] == 0) ? ' ' : $curr_rank['hits'],
|
||||
'POINTS' => $curr_rank['points_total'],
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
'WIN' => $win_arr[$curr_rank['user_id']],
|
||||
)
|
||||
);
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
||||
$league_info = league_info($season, $league);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RANKS_TOTAL' => true,
|
||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||
'S_DATA_RANKS' => $data_ranks,
|
||||
'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),
|
||||
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
|
||||
'S_WIN' => false,
|
||||
'WIN_NAME' => $config['football_win_name'],
|
||||
'S_SHOW_OTHER_LINKS' => true,
|
||||
'S_HEADER' => sprintf($user->lang['RANKING_ALL_TIME']),
|
||||
'S_LINK_RANKING' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'S_LINK_ALL_TIME' => '',
|
||||
'S_LINK_COMPARE' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare')),
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'compare':
|
||||
// Statistics
|
||||
$sql = "SELECT
|
||||
b.season as season,
|
||||
b.user_id,
|
||||
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 <> '',
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
),
|
||||
0
|
||||
)
|
||||
) AS tendency,
|
||||
SUM(IF(b.goals_home = m.goals_home AND b.goals_guest = m.goals_guest, 1, 0)) AS hits
|
||||
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)
|
||||
WHERE b.season <= $season
|
||||
AND b.league = $league
|
||||
AND m.matchday <= $matchday
|
||||
AND m.status IN (2,3)
|
||||
GROUP BY b.season, b.user_id";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
$total_users = sizeof($rows);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($rows AS $row)
|
||||
{
|
||||
$bets_of[$row['user_id'] . '#' . $row['season']] = $row['bets'];
|
||||
$nobets_of[$row['user_id'] . '#' . $row['season']] = $row['matches'] - $row['bets'];
|
||||
$tendency_of[$row['user_id'] . '#' . $row['season']] = $row['tendency'];
|
||||
$hits_of[$row['user_id'] . '#' . $row['season']] = $row['hits'];
|
||||
}
|
||||
|
||||
// Wins
|
||||
$sql = 'SELECT
|
||||
r.season as season,
|
||||
r.user_id,
|
||||
sum(r.win_total) As win_total
|
||||
FROM ' . FOOTB_RANKS . " AS r
|
||||
WHERE r.season <= $season
|
||||
AND r.league = $league
|
||||
AND r.matchday = $matchday
|
||||
AND r.status IN (2,3)
|
||||
GROUP BY season, user_id
|
||||
ORDER BY r.user_id ASC, season ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$win_arr = array();
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$win_arr[$row['user_id'] . '#' . $row['season']] = $row['win_total'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$data_ranks = false;
|
||||
$pagination = '';
|
||||
|
||||
$sql = 'SELECT
|
||||
r.season,
|
||||
r.user_id,
|
||||
u.username,
|
||||
r.rank_total,
|
||||
r.status,
|
||||
r.points_total
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
||||
WHERE r.season <= $season
|
||||
AND r.league = $league
|
||||
AND r.matchday = $matchday
|
||||
AND r.status IN (2,3)
|
||||
ORDER BY r.points_total DESC, LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$ranking_arr = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
if ($start < 0 || $start >= $total_users)
|
||||
{
|
||||
$index_start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$index_start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
$index_end = $index_start + $config['football_users_per_page'] - 1;
|
||||
|
||||
// handle pagination.
|
||||
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare'));
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||
|
||||
$index = 0;
|
||||
$rank = 0;
|
||||
$last_points = 0;
|
||||
$data_rank_total = false;
|
||||
foreach ($ranking_arr AS $curr_rank)
|
||||
{
|
||||
if ($curr_rank['points_total'] <> $last_points)
|
||||
{
|
||||
$rank = $index + 1;
|
||||
$last_points = $curr_rank['points_total'];
|
||||
}
|
||||
$data_ranks = true;
|
||||
if (($index_start <= $index) && ($index <= $index_end))
|
||||
{
|
||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($curr_rank['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$colorstyle = color_style($curr_rank['status']);
|
||||
|
||||
$template->assign_block_vars('rankstotal', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank,
|
||||
'USERID' => $curr_rank['user_id'],
|
||||
'USERNAME' => $curr_rank['username'],
|
||||
'SEASON' => $curr_rank['season'],
|
||||
'SEASON_RANK' => $curr_rank['rank_total'],
|
||||
'URL' => $phpbb_root_path . 'profile.php?mode=viewprofile&u=' . $curr_rank['user_id'],
|
||||
'BETS' => $bets_of[$curr_rank['user_id'] . '#' . $curr_rank['season']],
|
||||
'NOBETS' => ($nobets_of[$curr_rank['user_id'] . '#' . $curr_rank['season']] == 0) ? ' ' : $nobets_of[$curr_rank['user_id'] . '#' . $curr_rank['season']],
|
||||
'TENDENCIES' => ($tendency_of[$curr_rank['user_id'] . '#' . $curr_rank['season']] == 0) ? ' ' : $tendency_of[$curr_rank['user_id'] . '#' . $curr_rank['season']],
|
||||
'DIRECTHITS' => ($hits_of[$curr_rank['user_id'] . '#' . $curr_rank['season']] == 0) ? ' ' : $hits_of[$curr_rank['user_id'] . '#' . $curr_rank['season']],
|
||||
'POINTS' => $curr_rank['points_total'],
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
'WIN' => $win_arr[$curr_rank['user_id'] . '#' . $curr_rank['season']],
|
||||
)
|
||||
);
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
||||
$league_info = league_info($season, $league);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RANKS_TOTAL' => true,
|
||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||
'S_DATA_RANKS' => $data_ranks,
|
||||
'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),
|
||||
'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,
|
||||
'WIN_NAME' => $config['football_win_name'],
|
||||
'S_SHOW_OTHER_LINKS' => true,
|
||||
'S_HEADER' => sprintf($user->lang['RANKING_COMPARE']),
|
||||
'S_LINK_RANKING' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'S_LINK_ALL_TIME' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime')),
|
||||
'S_LINK_COMPARE' => '',
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$win_user_most_hits = array();
|
||||
$win_user_most_hits_away = array();
|
||||
$win_user_most_hits = win_user_most_hits($season, $league, $matchday);
|
||||
$win_user_most_hits_away = win_user_most_hits_away($season, $league, $matchday);
|
||||
|
||||
// Statistics
|
||||
$sql = "SELECT
|
||||
b.user_id,
|
||||
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 <> '',
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
),
|
||||
0
|
||||
)
|
||||
) AS tendency
|
||||
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)
|
||||
WHERE b.season = $season
|
||||
AND b.league = $league
|
||||
AND m.status IN (2,3)
|
||||
AND m.matchday <= $matchday
|
||||
GROUP BY user_id";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
$total_users = sizeof($rows);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($rows AS $row)
|
||||
{
|
||||
$bets_of[$row['user_id']] = $row['bets'];
|
||||
$nobets_of[$row['user_id']] = $row['matches'] - $row['bets'];
|
||||
$tendency_of[$row['user_id']] = $row['tendency'];
|
||||
}
|
||||
|
||||
$data_ranks = false;
|
||||
$pagination = '';
|
||||
|
||||
$prev_rank_of = array();
|
||||
if ($matchday > 1)
|
||||
{
|
||||
// previous rank total
|
||||
$sql = 'SELECT
|
||||
rank_total,
|
||||
user_id
|
||||
FROM ' . FOOTB_RANKS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
AND matchday = ($matchday-1)
|
||||
AND status IN (2,3)
|
||||
ORDER BY rank_total ASC, user_id ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($rows AS $row)
|
||||
{
|
||||
$prev_rank_of[$row['user_id']] = $row['rank_total'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT
|
||||
r.rank_total,
|
||||
r.user_id,
|
||||
u.username,
|
||||
u.user_colour,
|
||||
r.status,
|
||||
r.points_total,
|
||||
r.win_total
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (r.user_id = u.user_id)
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
AND r.matchday = $matchday
|
||||
AND r.status IN (2,3)
|
||||
GROUP BY user_id
|
||||
ORDER BY r.points_total DESC, LOWER(u.username) ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$ranking_arr = array();
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$ranking_arr[$row['user_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
if ($start < 0 || $start >= $total_users)
|
||||
{
|
||||
$index_start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$index_start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
|
||||
}
|
||||
$index_end = $index_start + $config['football_users_per_page'] - 1;
|
||||
|
||||
// handle pagination.
|
||||
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday));
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
if ($user->data['football_mobile'])
|
||||
{
|
||||
$index_start = 0;
|
||||
$index_end = 9999;
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $index_end, $start);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
|
||||
}
|
||||
|
||||
$index = 0;
|
||||
$data_rank_total = false;
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
foreach ($ranking_arr AS $curr_rank)
|
||||
{
|
||||
$data_ranks = true;
|
||||
$rank = $curr_rank['rank_total'];
|
||||
|
||||
if (($index_start <= $index) && ($index <= $index_end))
|
||||
{
|
||||
// Display page
|
||||
if (isset($prev_rank_of[$curr_rank['user_id']]))
|
||||
{
|
||||
if ($rank == $prev_rank_of[$curr_rank['user_id']])
|
||||
{
|
||||
$change_sign = '=';
|
||||
$change_img = "<img src=\"" . $ext_path . "images/no_change.gif\" alt=\"" . $user->lang['NO_CHANGES'] . "\"/>";
|
||||
$change_differ = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rank > $prev_rank_of[$curr_rank['user_id']])
|
||||
{
|
||||
$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']];
|
||||
$change_differ = ' (' . $differ . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$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;
|
||||
$change_differ = ' (' . $differ . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$change_sign = '';
|
||||
$change_img = '';
|
||||
$change_differ = '';
|
||||
}
|
||||
|
||||
$win_total = sprintf('%01.2f',$curr_rank['win_total']);
|
||||
if(!isset($win_user_most_hits[$curr_rank['user_id']]['direct_hit']))
|
||||
{
|
||||
$win_user_most_hits[$curr_rank['user_id']]['direct_hit'] = 0;
|
||||
}
|
||||
if(!isset($win_user_most_hits_away[$curr_rank['user_id']]['direct_hit']))
|
||||
{
|
||||
$win_user_most_hits_away[$curr_rank['user_id']]['direct_hit'] = 0;
|
||||
}
|
||||
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($curr_rank['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$colorstyle = color_style($curr_rank['status']);
|
||||
|
||||
$template->assign_block_vars('rankstotal', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank,
|
||||
'CHANGE_SIGN' => $change_sign,
|
||||
'CHANGE_IMG' => $change_img,
|
||||
'CHANGE_DIFFER' => $change_differ,
|
||||
'USERID' => $curr_rank['user_id'],
|
||||
'USERNAME' => $curr_rank['username'],
|
||||
'U_PROFILE' => get_username_string('profile', $curr_rank['user_id'], $curr_rank['username'], $curr_rank['user_colour']),
|
||||
'BETS' => $bets_of[$curr_rank['user_id']],
|
||||
'NOBETS' => ($nobets_of[$curr_rank['user_id']] == 0) ? ' ' : $nobets_of[$curr_rank['user_id']],
|
||||
'TENDENCIES' => ($tendency_of[$curr_rank['user_id']] == 0) ? ' ' : $tendency_of[$curr_rank['user_id']],
|
||||
'DIRECTHITS' => ($win_user_most_hits[$curr_rank['user_id']]['direct_hit'] == 0) ? ' ' : $win_user_most_hits[$curr_rank['user_id']]['direct_hit'],
|
||||
'DIRECTHITS02' => ($win_user_most_hits_away[$curr_rank['user_id']]['direct_hit'] == 0) ? ' ' : $win_user_most_hits_away[$curr_rank['user_id']]['direct_hit'],
|
||||
'POINTS' => $curr_rank['points_total'],
|
||||
'COLOR_STYLE' => $colorstyle,
|
||||
'WIN' => $win_total,
|
||||
)
|
||||
);
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = sprintf($user->lang['RANK_TOTAL']);
|
||||
$league_info = league_info($season, $league);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RANKS_TOTAL' => true,
|
||||
'S_DISPLAY_HITS02' => $config['football_win_hits02'],
|
||||
'S_DATA_RANKS' => $data_ranks,
|
||||
'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),
|
||||
'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,
|
||||
'WIN_NAME' => $config['football_win_name'],
|
||||
'S_SHOW_OTHER_LINKS' => true,
|
||||
'S_LINK_RANKING' => '',
|
||||
'S_LINK_ALL_TIME' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime')),
|
||||
'S_LINK_COMPARE' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare')),
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
433
block/results.php
Normal file
@@ -0,0 +1,433 @@
|
||||
<?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_results = false;
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
$matchnumber = 0;
|
||||
$editstatus = array(1, 2, 4, 5);
|
||||
|
||||
$league_info = league_info($season, $league);
|
||||
// Calculate matches AND results of matchday
|
||||
$sql = "SELECT
|
||||
m.match_no,
|
||||
m.matchday,
|
||||
m.status,
|
||||
m.group_id,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_symbol AS home_symbol,
|
||||
t2.team_symbol AS guest_symbol,
|
||||
t1.team_id AS home_id,
|
||||
t2.team_id AS guest_id,
|
||||
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_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.season = $season
|
||||
AND m.league = $league
|
||||
AND m.matchday = $matchday
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
|
||||
$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_results = true;
|
||||
$matchnumber++ ;
|
||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if (0 == $row['home_id'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $row['match_no'], 'team_id_home', $row['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homelogo = $home_in_array[0];
|
||||
$homeid = $home_in_array[1];
|
||||
$homename = $home_in_array[2];
|
||||
$homeshort = $home_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homelogo = $row['home_symbol'];
|
||||
$homeid = $row['home_id'];
|
||||
$homename = $row['home_name'];
|
||||
$homeshort = $row['home_short'];
|
||||
}
|
||||
if (0 == $row['guest_id'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $row['match_no'], 'team_id_guest', $row['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestlogo = $guest_in_array[0];
|
||||
$guestid = $guest_in_array[1];
|
||||
$guestname = $guest_in_array[2];
|
||||
$guestshort = $guest_in_array[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestlogo = $row['guest_symbol'];
|
||||
$guestid = $row['guest_id'];
|
||||
$guestname = $row['guest_name'];
|
||||
$guestshort = $row['guest_short'];
|
||||
}
|
||||
if ($homelogo <> '')
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
if ($guestlogo <> '')
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($row['ko_match'])
|
||||
{
|
||||
$display_ko = true;
|
||||
$ko_match = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ko_match = false;
|
||||
}
|
||||
|
||||
if ($row['group_id'] == '')
|
||||
{
|
||||
$group_id = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$display_group = true;
|
||||
$group_id = $row['group_id'];
|
||||
}
|
||||
|
||||
|
||||
if (in_array($row['status'], $editstatus) AND $user_is_member)
|
||||
{
|
||||
$edit_mode = true;
|
||||
$edit_match = true;
|
||||
$goals_home = $row['goals_home'];
|
||||
$goals_guest = $row['goals_guest'];
|
||||
$kogoals_home = $row['kogoals_home'];
|
||||
$kogoals_guest = $row['kogoals_guest'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$edit_match = false;
|
||||
$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'];
|
||||
}
|
||||
$template->assign_block_vars('result', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'MATCH_NUMBER' => $row['match_no'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'STATUS' => $row['status'],
|
||||
'MATCH_TIME' => $row['match_time'],
|
||||
'GROUP' => $group_id,
|
||||
'HOME_ID' => $homeid,
|
||||
'GUEST_ID' => $guestid,
|
||||
'LOGO_HOME' => $logoH,
|
||||
'LOGO_GUEST' => $logoG,
|
||||
'HOME_NAME' => $homename,
|
||||
'GUEST_NAME' => $guestname,
|
||||
'HOME_SHORT' => $homeshort,
|
||||
'GUEST_SHORT' => $guestshort,
|
||||
'U_PLAN_HOME' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'tid' => $homeid, 'mode' => 'all')),
|
||||
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
|
||||
'tid' => $guestid, 'mode' => 'all')),
|
||||
'GOALS_HOME' => $goals_home,
|
||||
'GOALS_GUEST' => $goals_guest,
|
||||
'COLOR_STYLE' => color_style($row['status']),
|
||||
'KOGOALS_HOME' => $kogoals_home,
|
||||
'KOGOALS_GUEST' => $kogoals_guest,
|
||||
'S_KO_MATCH' => $ko_match,
|
||||
'S_EDIT_MATCH' => $edit_match,
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Calculate extra bets of matchday
|
||||
// Start select team
|
||||
$sql = 'SELECT
|
||||
team_id AS option_value,
|
||||
team_name AS option_name
|
||||
FROM ' . FOOTB_TEAMS . "
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY team_name ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$option_rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($edit_mode)
|
||||
{
|
||||
$template->assign_block_vars('worldfootball', array('LEAGUE' => $league-1,));
|
||||
}
|
||||
|
||||
$sql = "SELECT e.*,
|
||||
t1.team_name AS result_team
|
||||
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)
|
||||
WHERE e.season = $season
|
||||
AND e.league = $league
|
||||
AND e.matchday_eval = $matchday
|
||||
ORDER BY e.extra_no ASC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$extra_results = false;
|
||||
$extranumber = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extra_results = true;
|
||||
$extranumber++ ;
|
||||
$row_class = (!($extranumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '1':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
{
|
||||
$display_type = 1;
|
||||
$eval_title = sprintf($user->lang['EXTRA_MULTI_HIT']);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_HIT']);
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
case '5':
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = sprintf($user->lang['EXTRA_DIFFERENCE']);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
$display_type = 2;
|
||||
$eval_title = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($row['extra_status'] > 0 && $row['extra_status'] < 3 && $user_is_member)
|
||||
{
|
||||
$edit_mode = true;
|
||||
$result_extra = ($row['result_team'] == NULL) ? '' : $row['result_team'];
|
||||
|
||||
$multiple = '';
|
||||
switch($row['question_type'])
|
||||
{
|
||||
case '2':
|
||||
{
|
||||
$multiple = ' multiple="multiple" size="3" ';
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
{
|
||||
$option_arr = array();
|
||||
for ($i = 65; $i <= 72; $i++)
|
||||
{
|
||||
if (strstr($row['question'], chr($i) . ':'))
|
||||
{
|
||||
$option_arr[] = array(
|
||||
'option_value' => chr($i),
|
||||
'option_name' => chr($i),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (sizeof($option_arr) > 1)
|
||||
{
|
||||
$display_type = 1;
|
||||
$option_rows = $option_arr;
|
||||
$result_extra = $row['result'];
|
||||
$multiple = ' multiple="multiple" size="3" ';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
{
|
||||
$option_arr = array();
|
||||
for ($i = 65; $i <= 72; $i++)
|
||||
{
|
||||
if (strstr($row['question'], chr($i) . ':'))
|
||||
{
|
||||
$option_arr[] = array(
|
||||
'option_value' => chr($i),
|
||||
'option_name' => chr($i),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (sizeof($option_arr) > 1)
|
||||
{
|
||||
$display_type = 1;
|
||||
$option_rows = $option_arr;
|
||||
$result_extra = $row['result'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('extra_result', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'EXTRA_NO' => $row['extra_no'],
|
||||
'S_EDIT_EXTRA' => true,
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'EVALUATION_TITLE' => $eval_title,
|
||||
'RESULT' => ($display_type == 1) ? $result_extra : $row['result'],
|
||||
'S_DISPLAY_TYPE' => $display_type,
|
||||
)
|
||||
);
|
||||
|
||||
if ($display_type == 1)
|
||||
{
|
||||
$selected = ($row['result'] == '') ? ' selected="selected"' : '';
|
||||
|
||||
$template->assign_block_vars('extra_result.extra_option', array(
|
||||
'OPTION_VALUE' => '',
|
||||
'OPTION_NAME' => sprintf($user->lang['SELECT']),
|
||||
'S_SELECTED' => $selected));
|
||||
|
||||
foreach ($option_rows as $option_row)
|
||||
{
|
||||
if (strstr($row['result'], ';'))
|
||||
{
|
||||
$selected = '';
|
||||
$result_arr = explode(';', $row['result']);
|
||||
foreach($result_arr AS $result_value)
|
||||
{
|
||||
if ($result_value <> '')
|
||||
{
|
||||
if ($option_row['option_value'] == $result_value)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected = ($option_row['option_value'] == $row['result']) ? ' selected="selected"' : '';
|
||||
}
|
||||
$template->assign_block_vars('extra_result.extra_option', array(
|
||||
'OPTION_VALUE' => $option_row['option_value'],
|
||||
'OPTION_NAME' => $option_row['option_name'],
|
||||
'S_SELECTED' => $selected));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra_colorstyle = color_style($row['extra_status']);
|
||||
$extra_result = ($row['result'] == '') ? ' ' : $row['result'];
|
||||
$result_extra = ($row['result_team'] == NULL) ? ' ' : $row['result_team'];
|
||||
|
||||
$template->assign_block_vars('extra_result', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'S_EDIT_EXTRA' => false,
|
||||
'QUESTION' => $row['question'],
|
||||
'EXTRA_POINTS' => $row['extra_points'],
|
||||
'EVALUATION' => ($row['matchday'] == $row['matchday_eval']) ? sprintf($user->lang['MATCHDAY']) : sprintf($user->lang['TOTAL']),
|
||||
'RESULT' => ($display_type == 1) ? $result_extra : $extra_result,
|
||||
'COLOR_STYLE' => $extra_colorstyle,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sidename = sprintf($user->lang['RESULTS']);
|
||||
switch ($league_info['bet_ko_type'])
|
||||
{
|
||||
case BET_KO_90:
|
||||
$result_explain = sprintf($user->lang['MIN90']);
|
||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||
break;
|
||||
case BET_KO_EXTRATIME:
|
||||
$result_explain = sprintf($user->lang['EXTRATIME_SHORT']);
|
||||
$label_finalresult = sprintf($user->lang['PENALTY']);
|
||||
break;
|
||||
case BET_KO_PENALTY:
|
||||
$result_explain = sprintf($user->lang['PENALTY']);
|
||||
$display_ko = false;
|
||||
break;
|
||||
default:
|
||||
$result_explain = sprintf($user->lang['MIN90']);
|
||||
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_RESULTS' => true,
|
||||
'S_EXTRA_RESULTS' => $extra_results,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'RESULT_EXPLAIN' => $result_explain,
|
||||
'LABEL_FINALRESULT' => $label_finalresult,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['ALL_BETS']),
|
||||
'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_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')),
|
||||
'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,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
226
block/rules_popup.php
Normal file
@@ -0,0 +1,226 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
// Can this user view Prediction Leagues pages?
|
||||
if (!$config['football_guest_view'])
|
||||
{
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
{
|
||||
trigger_error('NO_GUEST_VIEW');
|
||||
}
|
||||
}
|
||||
if (!$config['football_user_view'])
|
||||
{
|
||||
// Only Prediction League member should see this page
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
}
|
||||
|
||||
// Football disabled?
|
||||
if ($config['football_disable'])
|
||||
{
|
||||
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
|
||||
// Check parms
|
||||
$error_message = '';
|
||||
if (!$season OR !$league)
|
||||
{
|
||||
$data_rules = false;
|
||||
if (!$season)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||
}
|
||||
if (!$league)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$season_info = season_info($season);
|
||||
if (sizeof($season_info))
|
||||
{
|
||||
$season_name = $season_info['season_name'];
|
||||
$league_info = league_info($season, $league);
|
||||
if (sizeof($league_info))
|
||||
{
|
||||
$data_rules = true;
|
||||
$matchdays = $league_info['matchdays'];
|
||||
$league_name = $league_info['league_name'];
|
||||
|
||||
if ($user->data['is_registered'] and !$user->data['is_bot'])
|
||||
{
|
||||
$win_hits = '';
|
||||
$win_hits02 = '';
|
||||
$win_matchday = explode(';', "0;" . $league_info['win_matchday']);
|
||||
$win_season = explode(';',"0;" . $league_info['win_season']);
|
||||
$win_hits = $league_info['win_result'];
|
||||
$win_hits02 = $league_info['win_result_02'];
|
||||
|
||||
if($win_hits != '' AND $win_hits != 0)
|
||||
{
|
||||
$template->assign_block_vars('wintable', array(
|
||||
'WIN_DESC' => sprintf($user->lang['WIN_HITS']),
|
||||
)
|
||||
);
|
||||
$template->assign_block_vars('wintable.entry', array(
|
||||
'ROW_CLASS' => 'bg1 row_light',
|
||||
'RANK' => '1. ' . sprintf($user->lang['PLACE']),
|
||||
'WIN' => $win_hits,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if($win_hits02 != '' AND $win_hits02 != 0 AND $config['football_win_hits02'])
|
||||
{
|
||||
$template->assign_block_vars('wintable', array(
|
||||
'WIN_DESC' => sprintf($user->lang['WIN_HITS02']),
|
||||
)
|
||||
);
|
||||
$template->assign_block_vars('wintable.entry', array(
|
||||
'ROW_CLASS' => 'bg1 row_light',
|
||||
'RANK' => '1. ' . sprintf($user->lang['PLACE']),
|
||||
'WIN' => $win_hits02,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if($win_matchday[1] != '' AND $win_matchday[1] != 0)
|
||||
{
|
||||
$template->assign_block_vars('wintable', array(
|
||||
'WIN_DESC' => sprintf($user->lang['WINS_MATCHDAY']),
|
||||
)
|
||||
);
|
||||
$rank = 1;
|
||||
while ($win_matchday[$rank] != '')
|
||||
{
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('wintable.entry', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank . '. ' . sprintf($user->lang['PLACE']),
|
||||
'WIN' => $win_matchday[$rank],
|
||||
)
|
||||
);
|
||||
$rank++ ;
|
||||
if ($rank > sizeof($win_matchday)-1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($win_season[1] != '' AND $win_season[1] != 0)
|
||||
{
|
||||
$template->assign_block_vars('wintable', array(
|
||||
'WIN_DESC' => sprintf($user->lang['WINS_SEASON']),
|
||||
)
|
||||
);
|
||||
$rank = 1;
|
||||
while ($win_season[$rank] != '')
|
||||
{
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('wintable.entry', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank. '. ' . sprintf($user->lang['PLACE']),
|
||||
'WIN' => $win_season[$rank],
|
||||
)
|
||||
);
|
||||
$rank++ ;
|
||||
if ($rank > sizeof($win_season)-1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_rules = false;
|
||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||
$league_name = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_rules = false;
|
||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||
$season_name = '';
|
||||
}
|
||||
}
|
||||
|
||||
$sidename = sprintf($user->lang['FOOTBALL_RULES']);
|
||||
if ($data_rules)
|
||||
{
|
||||
$link_rules = append_sid($phpbb_root_path . "viewtopic.$phpEx?p=" . $league_info["rules_post_id"]);
|
||||
$points_tendency = ($league_info['points_mode'] < 3) ? sprintf($user->lang['POINTS_TENDENCY' . $league_info['points_mode']], $league_info['points_tendency']) : sprintf($user->lang['POINTS_TENDENCY'], $league_info['points_tendency']);
|
||||
$template->assign_vars(array(
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_DATA_RULES' => $data_rules,
|
||||
'S_BET_IN_TIME' => $league_info['bet_in_time'],
|
||||
'S_RULES_POST_ID' => $league_info['rules_post_id'],
|
||||
'S_ERROR_MESSAGE' => $error_message,
|
||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||
'WIN_NAME' => $config['football_win_name'],
|
||||
'JOIN_MODE' => ($league_info['join_by_user']) ? (($league_info['join_in_season']) ? sprintf($user->lang['JOIN_IN_SEASON']) : sprintf($user->lang['JOIN_BY_USER'])) : sprintf($user->lang['JOIN_BY_ADMIN']),
|
||||
'POINTS_HIT' => sprintf($user->lang['POINTS_HIT'], $league_info['points_result']) . '<br/>',
|
||||
'POINTS_TENDENCY' => $points_tendency . '<br/>',
|
||||
'POINTS_DIFF' => ($league_info['points_mode'] == 4) ? sprintf($user->lang['POINTS_DIFFERENCE'], $league_info['points_diff']) . '<br/>' : '',
|
||||
'POINTS_LAST' => ($league_info['points_last']) ? sprintf($user->lang['POINTS_NO_BET']) . '<br/>' : '',
|
||||
'LINK_RULES' => sprintf($user->lang['LINK_RULES'], $link_rules),
|
||||
'SEASONNAME' => $season_info['season_name'],
|
||||
'LEAGUENAME' => $league_name,
|
||||
)
|
||||
);
|
||||
|
||||
// output page
|
||||
page_header(sprintf($user->lang['FOOTBALL_RULES' ]) . ' ' . $league_info['league_name'] . ' ' . $season_info['season_name']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_DATA_RULES' => $data_rules,
|
||||
'S_BET_IN_TIME' => false,
|
||||
'S_RULES_POST_ID' => 0,
|
||||
'S_ERROR_MESSAGE' => $error_message,
|
||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||
'WIN_NAME' => $config['football_win_name'],
|
||||
'JOIN_MODE' => '',
|
||||
'POINTS_HIT' => '',
|
||||
'POINTS_TENDENCY' => '',
|
||||
'POINTS_DIFF' => '',
|
||||
'POINTS_LAST' => '',
|
||||
'LINK_RULES' => '',
|
||||
'SEASONNAME' => '',
|
||||
'LEAGUENAME' => '',
|
||||
)
|
||||
);
|
||||
|
||||
// output page
|
||||
page_header(sprintf($user->lang['FOOTBALL_RULES' ]));
|
||||
}
|
||||
$template->set_filenames(array(
|
||||
'body' => 'rules_popup.html'
|
||||
)
|
||||
);
|
||||
// $template->display('popup');
|
||||
|
||||
page_footer();
|
||||
|
||||
?>
|
||||
170
block/stat_points.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$data = false;
|
||||
$data_all = false;
|
||||
$rank = 0;
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
u.username,
|
||||
r.*
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||
WHERE season = $season
|
||||
AND league = $league
|
||||
ORDER BY r.points DESC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, 20);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data = true;
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$template->assign_block_vars('top20', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'NAME' => $row['username'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'POINTS' => $row['points'],
|
||||
'WIN' => $row['win'],
|
||||
'DIRECTHITS' => $row['correct_result'],
|
||||
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
||||
'TOTAL' => $row['tendencies'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
u.username,
|
||||
r.*
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||
WHERE r.season = $season
|
||||
AND r.league = $league
|
||||
ORDER BY r.points ASC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, 20);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$template->assign_block_vars('flop20', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'NAME' => $row['username'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'POINTS' => $row['points'],
|
||||
'DIRECTHITS' => $row['correct_result'],
|
||||
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
||||
'TOTAL' => $row['tendencies'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
u.username,
|
||||
r.*
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||
WHERE league = $league
|
||||
ORDER BY r.points DESC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, 20);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data_all = true;
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$template->assign_block_vars('alltop20', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'NAME' => $row['username'],
|
||||
'SEASON' => $row['season'],
|
||||
'MATCHDAY' => $row['matchday'],
|
||||
'POINTS' => $row['points'],
|
||||
'WIN' => $row['win'],
|
||||
'DIRECTHITS' => $row['correct_result'],
|
||||
'TENDENCIES' => $row['tendencies'] - $row['correct_result'],
|
||||
'TOTAL' => $row['tendencies'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$rank = 0;
|
||||
$sql = 'SELECT
|
||||
r.user_id,
|
||||
u.username,
|
||||
COUNT(points) AS count_zero
|
||||
FROM ' . FOOTB_RANKS . ' AS r
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
|
||||
WHERE r.league = $league
|
||||
AND r.points = 0
|
||||
GROUP BY r.user_id
|
||||
ORDER BY count_zero DESC";
|
||||
|
||||
$result = $db->sql_query_limit($sql, 20);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
if ($row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
$row_class = 'bg3 row_user';
|
||||
}
|
||||
$template->assign_block_vars('allflop20', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'NAME' => $row['username'],
|
||||
'COUNTZERO' => $row['count_zero'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$league_info = league_info($season, $league);
|
||||
$sidename = sprintf($user->lang['STAT_POINTS']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_STAT_POINTS' => true,
|
||||
'S_MATCHDAY_HIDE' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'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)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['MY_KOEFF']),
|
||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'stat_results', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'RIGHT_LINK' => sprintf($user->lang['STAT_RESULTS']) . ' >',
|
||||
'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,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
146
block/stat_results.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$data = false;
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
|
||||
$rank = 0;
|
||||
// Select results and count
|
||||
$sql = 'SELECT
|
||||
COUNT(DISTINCT(m.match_no)) AS count_result,
|
||||
COUNT(m.match_no) AS count_bets,
|
||||
m.goals_home,
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 1, 0)
|
||||
)
|
||||
) AS hits,
|
||||
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 + 0 > b.goals_guest) <> (m.goals_home + 0 > m.goals_guest),
|
||||
0,
|
||||
IF((b.goals_home = m.goals_home) AND (b.goals_guest = m.goals_guest), 0, 1)
|
||||
)
|
||||
) AS tendencies,
|
||||
' . select_points('m',true) . '
|
||||
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)
|
||||
WHERE m.season = $season
|
||||
AND m.league = $league
|
||||
AND b.goals_home <> ''
|
||||
AND b.goals_guest <> ''
|
||||
AND (m.status IN (3,6))
|
||||
AND m.matchday <= $matchday
|
||||
GROUP BY m.goals_home, m.goals_guest
|
||||
ORDER BY count_bets DESC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data = true;
|
||||
$rank++;
|
||||
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$template->assign_block_vars('result', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'GOALS_HOME' => $row['goals_home'],
|
||||
'GOALS_GUEST' => $row['goals_guest'],
|
||||
'RESULTS' => $row['count_result'],
|
||||
'BETS' => $row['count_bets'],
|
||||
'HITS' => $row['hits'],
|
||||
'TENDENCIES' => $row['tendencies'],
|
||||
'TOTAL' => $row['hits'] + $row['tendencies'],
|
||||
'POINTS' => $row['points'],
|
||||
'AVERAGE' => round($row['points'] / $row['count_bets'],1),
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
// Get goaldifferences by team
|
||||
$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 wins,
|
||||
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 = (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 + 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 + 0 > (goals_guest + 2), 1, 0))) AS minus3,
|
||||
SUM(IF(m.team_id_home = t.team_id,
|
||||
IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0)),
|
||||
IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))
|
||||
)
|
||||
) AS points,
|
||||
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS goal_diff,
|
||||
SUM(IF(m.team_id_home = t.team_id, goals_home , goals_guest)) AS goals,
|
||||
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) AS goals_get
|
||||
FROM " . FOOTB_TEAMS . ' AS t
|
||||
LEFT JOIN ' . FOOTB_MATCHES . " AS m ON (m.season = t.season AND m.league = t.league AND (m.team_id_home = t.team_id OR m.team_id_guest = t.team_id))
|
||||
WHERE t.season = $season
|
||||
AND t.league = $league
|
||||
AND m.season = $season
|
||||
AND m.league = $league
|
||||
AND m.status IN (3,6)
|
||||
AND m.matchday <= $matchday
|
||||
GROUP BY t.team_id
|
||||
ORDER BY points DESC, goal_diff DESC, goals DESC";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$rank = 0;
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$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\"/>" ;
|
||||
$template->assign_block_vars('points', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'RANK' => $rank,
|
||||
'LOGO' => $logo,
|
||||
'TEAM' => $row['team_name_short'],
|
||||
'MATCHES' => $row['matches'],
|
||||
'PLUS3' => $row['plus3'],
|
||||
'PLUS2' => $row['plus2'],
|
||||
'PLUS1' => $row['plus1'],
|
||||
'DRAW' => $row['draw'],
|
||||
'MINUS1' => $row['minus1'],
|
||||
'MINUS2' => $row['minus2'],
|
||||
'MINUS3' => $row['minus3'],
|
||||
'GOALS_DIFF' => $row['goal_diff'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sidename = sprintf($user->lang['STAT_RESULTS']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_STAT_RESULTS' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'U_LEFT' => $this->helper->route('football_main_controller', array('side' => 'stat_points', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'LEFT_LINK' => '< ' . sprintf($user->lang['STAT_POINTS']),
|
||||
'U_RIGHT' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday)),
|
||||
'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,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
420
block/table.php
Normal file
@@ -0,0 +1,420 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$data_table = false;
|
||||
$data_form = false;
|
||||
|
||||
if ($matchday > 5)
|
||||
{
|
||||
$form_from = $matchday - 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
$form_from = 1;
|
||||
}
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$league_type = $row['league_type'];
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$text_form = sprintf($user->lang['TABLE_FORM_FROM'], $form_from);
|
||||
|
||||
$rank = 0;
|
||||
// Get 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,
|
||||
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(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)) AS goals,
|
||||
SUM(IF(m.team_id_home = t.team_id, goals_guest , goals_home)) 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 OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
||||
WHERE t.season = $season
|
||||
AND t.league = $league
|
||||
AND m.matchday <= $matchday
|
||||
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);
|
||||
$last_group = '';
|
||||
$current_rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($last_group != $row['group_id'])
|
||||
{
|
||||
$last_group = $row['group_id'];
|
||||
$rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
$template->assign_block_vars('total', array(
|
||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($league_type != 2 OR $row['group_id'] != '')
|
||||
{
|
||||
$data_table = true;
|
||||
$rank++;
|
||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||
{
|
||||
$current_rank = $rank . '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_rank = '';
|
||||
}
|
||||
$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'] <> '')
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('total', array(
|
||||
'RANK' => $current_rank,
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'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'],
|
||||
'tid' => $row['team_id'], 'mode' => 'played')),
|
||||
'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'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$rank = 0;
|
||||
// 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,
|
||||
SUM(IF(m.team_id_home = t.team_id,
|
||||
IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0)),
|
||||
IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))
|
||||
)
|
||||
) AS points,
|
||||
SUM(IF(m.team_id_home = t.team_id, goals_home - goals_guest , goals_guest - goals_home)) AS 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_guest, goals_home)) 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 OR m.team_id_guest = t.team_id) AND m.group_id = t.group_id)
|
||||
WHERE t.season = $season
|
||||
AND t.league = $league
|
||||
AND m.matchday >= $form_from
|
||||
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);
|
||||
$last_group = '';
|
||||
$current_rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($last_group != $row['group_id'])
|
||||
{
|
||||
$last_group = $row['group_id'];
|
||||
$rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
$template->assign_block_vars('form', array(
|
||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($league_type != 2 OR $row['group_id'] != '')
|
||||
{
|
||||
$data_form = true;
|
||||
$rank++;
|
||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||
{
|
||||
$current_rank = $rank . '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_rank = '';
|
||||
}
|
||||
$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'] <> '')
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('form', array(
|
||||
'RANK' => $current_rank,
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'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'],
|
||||
'tid' => $row['team_id'], 'mode' => 'rest')),
|
||||
'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'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$rank = 0;
|
||||
// Get home-table-information
|
||||
$sql = 'SELECT
|
||||
t.*,
|
||||
SUM(1) AS matches,
|
||||
SUM(IF(goals_home + 0 > goals_guest, 1, 0)) AS win,
|
||||
SUM(IF(goals_home = goals_guest, 1, 0)) AS draw,
|
||||
SUM(IF(goals_home + 0 < goals_guest, 1, 0)) AS lost,
|
||||
SUM(IF(goals_home + 0 > goals_guest, 3, IF(goals_home = goals_guest, 1, 0))) AS points,
|
||||
SUM(goals_home - goals_guest) AS goals_diff,
|
||||
SUM(goals_home) AS goals,
|
||||
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
|
||||
AND t.league = $league
|
||||
AND m.matchday <= $matchday
|
||||
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);
|
||||
$last_group = '';
|
||||
$current_rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($last_group != $row['group_id'])
|
||||
{
|
||||
$last_group = $row['group_id'];
|
||||
$rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
$template->assign_block_vars('home', array(
|
||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($league_type != 2 OR $row['group_id'] != '')
|
||||
{
|
||||
$rank++;
|
||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||
{
|
||||
$current_rank = $rank . '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_rank = '';
|
||||
}
|
||||
$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'] <> '')
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('home', array(
|
||||
'RANK' => $current_rank,
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'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'],
|
||||
'tid' => $row['team_id'], 'mode' => 'home')),
|
||||
'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'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$rank = 0;
|
||||
// Get away-table-information
|
||||
$sql = 'SELECT
|
||||
t.*,
|
||||
SUM(1) AS matches,
|
||||
SUM(IF(goals_home + 0 < goals_guest, 1, 0)) AS win,
|
||||
SUM(IF(goals_home = goals_guest, 1, 0)) AS draw,
|
||||
SUM(IF(goals_home + 0 > goals_guest, 1, 0)) AS lost,
|
||||
SUM(IF(goals_home + 0 < goals_guest, 3, IF(goals_home = goals_guest, 1, 0))) AS points,
|
||||
SUM(goals_guest - goals_home) AS goals_diff,
|
||||
SUM(goals_guest) AS goals,
|
||||
SUM(goals_home) 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_guest = t.team_id AND m.group_id = t.group_id)
|
||||
WHERE t.season = $season
|
||||
AND t.league = $league
|
||||
AND m.matchday <= $matchday
|
||||
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);
|
||||
$last_group = '';
|
||||
$current_rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($last_group != $row['group_id'])
|
||||
{
|
||||
$last_group = $row['group_id'];
|
||||
$rank = 0;
|
||||
$last_goals = 0;
|
||||
$last_goals_againts = 0;
|
||||
$last_points = 0;
|
||||
$template->assign_block_vars('away', array(
|
||||
'GROUP' => sprintf($user->lang['GROUP']) . ' ' . $row['group_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($league_type != 2 OR $row['group_id'] != '')
|
||||
{
|
||||
$rank++;
|
||||
if ($last_points <> $row['points'] OR $last_goals <> $row['goals'] OR $last_goals_againts <> $row['goals_against'])
|
||||
{
|
||||
$current_rank = $rank . '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_rank = '';
|
||||
}
|
||||
$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'] <> '')
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $row['team_symbol'] . "\" alt=\"" . $row['team_symbol'] . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('away', array(
|
||||
'RANK' => $current_rank,
|
||||
'ROW_CLASS' => $row_class,
|
||||
'LOGO' => $logo,
|
||||
'TEAM_ID' => $row['team_id'],
|
||||
'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'],
|
||||
'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'],
|
||||
'POINTS' => $row['points'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
$sidename = sprintf($user->lang['TABLE']);
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_TABLE' => true,
|
||||
'S_SIDENAME' => $sidename,
|
||||
'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)),
|
||||
'RIGHT_LINK' => sprintf($user->lang['RANK_MATCHDAY']) . ' >',
|
||||
'LEFT_TITLE' => sprintf($user->lang['TITLE_RESULTS']),
|
||||
'RIGHT_TITLE' => sprintf($user->lang['TITLE_RANK_MATCHDAY']),
|
||||
'S_DATA_TABLE' => $data_table,
|
||||
'S_DATA_FORM' => $data_form,
|
||||
'SEASON' => $season,
|
||||
'LEAGUE' => $league,
|
||||
'TEXT_FORM' => $text_form,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
23
block/under_construction.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Football
|
||||
* @version $Id: under_construction.php 1 2010-05-17 22:09:43Z football $
|
||||
* @copyright (c) 2010 football (http://football.bplaced.net)
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if ( !defined('IN_PHPBB') OR !defined('IN_FOOTBALL') )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$sidename = sprintf($user->lang['UNDER_CONSTRUCTION']);
|
||||
$template->assign_vars(array(
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_DISPLAY_UNDER_CONSTRUCTION' => true,
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
297
block/viewplan_popup.php
Normal file
@@ -0,0 +1,297 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
// Can this user view Prediction Leagues pages?
|
||||
if (!$config['football_guest_view'])
|
||||
{
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
{
|
||||
trigger_error('NO_GUEST_VIEW');
|
||||
}
|
||||
}
|
||||
if (!$config['football_user_view'])
|
||||
{
|
||||
// Only Prediction League member should see this page
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
}
|
||||
|
||||
// Football disabled?
|
||||
if ($config['football_disable'])
|
||||
{
|
||||
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
$mode = $this->request->variable('mode', '');
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$team_id = $this->request->variable('tid', 0);
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case 'played':
|
||||
$mode_desc = sprintf($user->lang['PLAYED_MATCHES']);
|
||||
$where = ' AND m.status IN (3,6) ';
|
||||
$data_results = true;
|
||||
break;
|
||||
case 'rest':
|
||||
$mode_desc = sprintf($user->lang['REST_MATCHES']);
|
||||
$where = ' AND m.status IN (0,1,2,4,5) ';
|
||||
$data_results = false;
|
||||
break;
|
||||
case 'home':
|
||||
$mode_desc = sprintf($user->lang['HOME_MATCHES']);
|
||||
$where = " AND m.team_id_home = $team_id AND m.status IN (3,6) ";
|
||||
$data_results = true;
|
||||
break;
|
||||
case 'away':
|
||||
$mode_desc = sprintf($user->lang['AWAY_MATCHES']);
|
||||
$where = " AND m.team_id_guest = $team_id AND m.status IN (3,6) ";
|
||||
$data_results = true;
|
||||
break;
|
||||
// ALL is Default
|
||||
default:
|
||||
$mode_desc = sprintf($user->lang['ALL_MATCHES']);
|
||||
$where = '';
|
||||
$data_results = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check parms
|
||||
$error_message = '';
|
||||
if (!$season OR !$league OR !$team_id)
|
||||
{
|
||||
$data_plan = false;
|
||||
if (!$season)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||
}
|
||||
if (!$league)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||
}
|
||||
if (!$team_id)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_TEAM_ID']) . '<br />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_group = false;
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
|
||||
|
||||
// Calculate matches and bets of matchday
|
||||
$sql = "SELECT
|
||||
IF(m.team_id_home = $team_id, 'H', 'A') AS match_place,
|
||||
IF(((m.status=3) OR (m.status=6)),
|
||||
IF(m.team_id_home = $team_id,
|
||||
IF(m.goals_home + 0 > m.goals_guest, 'match_win', IF(m.goals_home = m.goals_guest, 'match_draw', 'match_lost')),
|
||||
IF(m.goals_home + 0 < m.goals_guest, 'match_win', IF(m.goals_home = m.goals_guest, 'match_draw', 'match_lost'))),
|
||||
'') AS match_style,
|
||||
m.match_no,
|
||||
m.matchday,
|
||||
m.status,
|
||||
m.group_id,
|
||||
t1.team_symbol AS home_symbol,
|
||||
t2.team_symbol AS guest_symbol,
|
||||
t1.team_id AS home_id,
|
||||
t2.team_id AS guest_id,
|
||||
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,
|
||||
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_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.season = $season
|
||||
AND m.league = $league
|
||||
AND (m.team_id_home = $team_id OR m.team_id_guest = $team_id)
|
||||
$where
|
||||
GROUP BY m.match_no
|
||||
ORDER BY m.match_datetime ASC, m.match_no ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$data_plan = true;
|
||||
$matchnumber = 0;
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
do
|
||||
{
|
||||
$matchnumber++ ;
|
||||
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
|
||||
$display_link = true;
|
||||
$homelogo = $row['home_symbol'];
|
||||
$guestlogo = $row['guest_symbol'];
|
||||
if ($homelogo <> '')
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
if ($guestlogo <> '')
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
|
||||
if ($row['group_id'] == '')
|
||||
{
|
||||
$group_id = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_group = true;
|
||||
$group_id = $row['group_id'];
|
||||
}
|
||||
|
||||
if ($row['match_place'] == 'H')
|
||||
{
|
||||
$color_home = $row['match_style'];
|
||||
$color_guest = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$color_home = '';
|
||||
$color_guest = $row['match_style'];
|
||||
}
|
||||
$color_goals = $row['match_style'];
|
||||
|
||||
$template->assign_block_vars('match', array(
|
||||
'ROW_CLASS' => $row_class,
|
||||
'MATCH_TIME' => $row['match_time'],
|
||||
'GROUP' => $group_id,
|
||||
'LOGO_HOME' => $logoH,
|
||||
'LOGO_GUEST' => $logoG,
|
||||
'HOME_NAME' => $row['home_short'],
|
||||
'GUEST_NAME' => $row['guest_short'],
|
||||
'GOALS_HOME' => ($row['goals_home'] == '') ? ' ' : $row['goals_home'],
|
||||
'GOALS_GUEST' => ($row['goals_guest'] == '') ? ' ' : $row['goals_guest'],
|
||||
'COLOR_HOME' => $color_home,
|
||||
'COLOR_GUEST' => $color_guest,
|
||||
'COLOR_GOALS' => $color_goals,
|
||||
)
|
||||
);
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_plan = false;
|
||||
}
|
||||
|
||||
$season_info = season_info($season);
|
||||
if (sizeof($season_info) == 0)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
|
||||
$season_name = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$season_name = $season_info["season_name"];
|
||||
|
||||
$league_info = league_info($season, $league);
|
||||
if (sizeof($league_info) == 0)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
|
||||
$league_name = '';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$league_name = $league_info["league_name"];
|
||||
|
||||
$team_info = team_info($season, $league, $team_id);
|
||||
if (sizeof($team_info) == 0)
|
||||
{
|
||||
$error_message .= sprintf($user->lang['NO_TEAM_ID']) . '<br />';
|
||||
$team_name = '';
|
||||
$logo = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$team_name = $team_info["team_name"];
|
||||
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $team_info["team_symbol"] . "\" alt=\"" . $team_info["team_symbol"] . "\" width=\"28\" height=\"28\"/>" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sidename = sprintf($user->lang['PLAN']);
|
||||
if ($data_plan)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_DATA_PLAN' => $data_plan,
|
||||
'S_DATA_GROUP' => $data_group,
|
||||
'S_ERROR_MESSAGE' => $error_message,
|
||||
'MODE_DESC' => $mode_desc,
|
||||
'LOGO' => $logo,
|
||||
'TEAM' => $team_name,
|
||||
'SEASON' => $season_name,
|
||||
'LEAGUE' => $league_name,
|
||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||
'S_DATA_RESULTS' => $data_results,
|
||||
)
|
||||
);
|
||||
|
||||
// output page
|
||||
page_header($mode_desc . ' ' . $team_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_SIDENAME' => $sidename,
|
||||
'S_DATA_PLAN' => $data_plan,
|
||||
'S_DATA_GROUP' => false,
|
||||
'S_ERROR_MESSAGE' => $error_message,
|
||||
'MODE_DESC' => $mode_desc,
|
||||
'LOGO' => '',
|
||||
'TEAM' => '',
|
||||
'SEASON' => '',
|
||||
'LEAGUE' => '',
|
||||
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
|
||||
'S_DATA_RESULTS' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// output page
|
||||
page_header($mode_desc);
|
||||
}
|
||||
$template->set_filenames(array(
|
||||
'body' => 'viewplan_popup.html')
|
||||
);
|
||||
|
||||
page_footer();
|
||||
|
||||
?>
|
||||
29
composer.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "football/football",
|
||||
"type": "phpbb-extension",
|
||||
"description": "Football Prediction League for phpBB 3.1",
|
||||
"homepage": "http://football.bplaced.net",
|
||||
"version": "0.9.5",
|
||||
"time": "2016-04-22",
|
||||
"license": "GPL-2.0",
|
||||
"authors": [{
|
||||
"name": "J. Helmke",
|
||||
"email": "phpBB3.football@gmx.de",
|
||||
"homepage": "http://football.bplaced.net",
|
||||
"role": "Lead Developer"
|
||||
}],
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"extra": {
|
||||
"display-name": "Football Prediction League",
|
||||
"soft-require": {
|
||||
"phpbb/phpbb": "3.1.*"
|
||||
},
|
||||
"version-check": {
|
||||
"host": "football.bplaced.net",
|
||||
"directory": "/updatecheck",
|
||||
"filename": "football_predictionleague.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
20
config/routing.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
football_main_controller:
|
||||
path: /football/{side}
|
||||
defaults: { _controller: football.football.controller:handle }
|
||||
|
||||
football_football_popup:
|
||||
path: /football/{popside}
|
||||
defaults: { _controller: football.football.controller_popup:handlepopup }
|
||||
|
||||
football_football_download:
|
||||
path: /football/{downside}
|
||||
defaults: { _controller: football.football.controller_download:handledownload }
|
||||
|
||||
football_football_xml:
|
||||
path: /football/xml/{xmlside}
|
||||
defaults: { _controller: football.football.controller_xml:handlexml }
|
||||
|
||||
# Redirect to football by default
|
||||
football_football_redirect_controller:
|
||||
path: /
|
||||
defaults: { _controller: football.football.main:handle }
|
||||
114
config/services.yml
Normal file
@@ -0,0 +1,114 @@
|
||||
parameters:
|
||||
football.version_data:
|
||||
author: football
|
||||
title: Football Prediction League
|
||||
version: football_version
|
||||
file:
|
||||
- football.bplaced.net
|
||||
- /updatecheck
|
||||
- football_predictionleague.json
|
||||
|
||||
services:
|
||||
football.football.controller:
|
||||
class: football\football\controller\main
|
||||
arguments:
|
||||
- @auth
|
||||
- @config
|
||||
- @ext.manager
|
||||
- @notification_manager
|
||||
- @log
|
||||
- @path_helper
|
||||
- @dbal.conn
|
||||
- @controller.helper
|
||||
- @template
|
||||
- @user
|
||||
- @pagination
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
|
||||
football.football.controller_popup:
|
||||
class: football\football\controller\popup
|
||||
arguments:
|
||||
- @auth
|
||||
- @config
|
||||
- @ext.manager
|
||||
- @path_helper
|
||||
- @dbal.conn
|
||||
- @controller.helper
|
||||
- @template
|
||||
- @user
|
||||
- @pagination
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
|
||||
football.football.controller_download:
|
||||
class: football\football\controller\download
|
||||
arguments:
|
||||
- @auth
|
||||
- @config
|
||||
- @ext.manager
|
||||
- @path_helper
|
||||
- @dbal.conn
|
||||
- @controller.helper
|
||||
- @template
|
||||
- @user
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
|
||||
football.football.version.check:
|
||||
class: football\football\includes\version_check
|
||||
scope: prototype
|
||||
arguments:
|
||||
- %football.version_data%
|
||||
- @config
|
||||
- @version_helper
|
||||
- @template
|
||||
- @user
|
||||
|
||||
football.football.controller_xml:
|
||||
class: football\football\controller\xmlplan
|
||||
arguments:
|
||||
- @config
|
||||
- @ext.manager
|
||||
- @path_helper
|
||||
- @dbal.conn
|
||||
- @user
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
|
||||
football.football.core.functions.points:
|
||||
class: football\football\core\functions_points
|
||||
arguments:
|
||||
- @user
|
||||
- @dbal.conn
|
||||
|
||||
football.football.listener:
|
||||
class: football\football\event\main_listener
|
||||
arguments:
|
||||
- @auth
|
||||
- @config
|
||||
- @controller.helper
|
||||
- @template
|
||||
- @path_helper
|
||||
- @ext.manager
|
||||
- @user
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
tags:
|
||||
- { name: event.listener }
|
||||
|
||||
football.football.cron.task.football_remember:
|
||||
class: football\football\cron\task\football_remember
|
||||
arguments:
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
- @ext.manager
|
||||
- @path_helper
|
||||
- @dbal.conn
|
||||
- @config
|
||||
- @log
|
||||
- @user
|
||||
calls:
|
||||
- [set_name, [football.football.cron.task.football_remember]]
|
||||
tags:
|
||||
- { name: cron.task }
|
||||
160
controller/download.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\controller;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
class download
|
||||
{
|
||||
/* @var \phpbb\auth\auth */
|
||||
protected $auth;
|
||||
|
||||
/* @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/* @var \phpbb\extension\manager */
|
||||
protected $phpbb_extension_manager;
|
||||
|
||||
/* @var \phpbb\path_helper */
|
||||
protected $phpbb_path_helper;
|
||||
|
||||
/* @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/* @var \phpbb\controller\helper */
|
||||
protected $helper;
|
||||
|
||||
/* @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/* @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/* @var phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/* @var PHP file extension */
|
||||
protected $php_ext;
|
||||
|
||||
/* @var football includes path */
|
||||
protected $football_includes_path;
|
||||
|
||||
/* @var football root path */
|
||||
protected $football_root_path;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\auth\auth $auth
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\extension\manager $phpbb_extension_manager
|
||||
* @param \phpbb\path_helper $phpbb_path_helper
|
||||
* @param \phpbb\db\driver\driver_interface $db
|
||||
* @param \phpbb\controller\helper $helper
|
||||
* @param \phpbb\template\template $template
|
||||
* @param \phpbb\user $user
|
||||
*/
|
||||
|
||||
public function __construct(\phpbb\auth\auth $auth,
|
||||
\phpbb\config\config $config,
|
||||
\phpbb\extension\manager $phpbb_extension_manager,
|
||||
\phpbb\path_helper $phpbb_path_helper,
|
||||
\phpbb\db\driver\driver_interface $db,
|
||||
\phpbb\controller\helper $helper,
|
||||
\phpbb\template\template $template,
|
||||
\phpbb\user $user,
|
||||
$phpbb_root_path,
|
||||
$php_ext)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->phpbb_extension_manager = $phpbb_extension_manager;
|
||||
$this->phpbb_path_helper = $phpbb_path_helper;
|
||||
$this->helper = $helper;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
||||
$this->football_includes_path = $phpbb_root_path . 'ext/football/football/includes/';
|
||||
$this->football_root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
}
|
||||
|
||||
public function handledownload($downside)
|
||||
{
|
||||
global $db, $user, $cache, $request, $template, $season, $league, $matchday;
|
||||
global $config, $phpbb_root_path, $phpbb_container, $phpEx, $league_info;
|
||||
|
||||
define('IN_FOOTBALL', true);
|
||||
|
||||
$this->db = $db;
|
||||
$this->user = $user;
|
||||
$this->cache = $cache;
|
||||
$this->template = $template;
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
|
||||
// Add football controller language file
|
||||
$this->user->add_lang_ext('football/football', 'football');
|
||||
|
||||
// required includes
|
||||
include($this->football_includes_path . 'constants.' . $this->php_ext);
|
||||
include($this->football_includes_path . 'functions.' . $this->php_ext);
|
||||
|
||||
if ($config['board_disable'] && !$this->auth->acl_gets('a_'))
|
||||
{
|
||||
$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
if ($config['football_disable'])
|
||||
{
|
||||
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
||||
trigger_error($message);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Can this user view Prediction Leagues pages?
|
||||
if (!$config['football_guest_view'])
|
||||
{
|
||||
// No guest view, call login for guest
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
{
|
||||
login_box('', ($user->lang['LOGIN_EXPLAIN_FOOTBALL']));
|
||||
}
|
||||
}
|
||||
if (!$config['football_user_view'])
|
||||
{
|
||||
// Only Prediction League member should see these pages
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
}
|
||||
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
|
||||
$league_info = array();
|
||||
$league_info = league_info($season, $league);
|
||||
|
||||
if ($config['football_override_style'])
|
||||
{
|
||||
$user->data['user_style'] = $config['football_style'];
|
||||
}
|
||||
|
||||
include($this->football_root_path . 'block/' . $downside . '.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
1008
controller/main.php
Normal file
170
controller/popup.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\controller;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
class popup
|
||||
{
|
||||
/* @var \phpbb\auth\auth */
|
||||
protected $auth;
|
||||
|
||||
/* @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/* @var \phpbb\extension\manager */
|
||||
protected $phpbb_extension_manager;
|
||||
|
||||
/* @var \phpbb\path_helper */
|
||||
protected $phpbb_path_helper;
|
||||
|
||||
/* @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/* @var \phpbb\controller\helper */
|
||||
protected $helper;
|
||||
|
||||
/* @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/* @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\pagination */
|
||||
protected $pagination;
|
||||
|
||||
/* @var phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/* @var PHP file extension */
|
||||
protected $php_ext;
|
||||
|
||||
/* @var football includes path */
|
||||
protected $football_includes_path;
|
||||
|
||||
/* @var football root path */
|
||||
protected $football_root_path;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\auth\auth $auth
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\extension\manager $phpbb_extension_manager
|
||||
* @param \phpbb\path_helper $phpbb_path_helper
|
||||
* @param \phpbb\db\driver\driver_interface $db
|
||||
* @param \phpbb\controller\helper $helper
|
||||
* @param \phpbb\template\template $template
|
||||
* @param \phpbb\user $user
|
||||
* @param \phpbb\pagination $pagination
|
||||
*/
|
||||
|
||||
public function __construct(\phpbb\auth\auth $auth,
|
||||
\phpbb\config\config $config,
|
||||
\phpbb\extension\manager $phpbb_extension_manager,
|
||||
\phpbb\path_helper $phpbb_path_helper,
|
||||
\phpbb\db\driver\driver_interface $db,
|
||||
\phpbb\controller\helper $helper,
|
||||
\phpbb\template\template $template,
|
||||
\phpbb\user $user,
|
||||
\phpbb\pagination $pagination,
|
||||
$phpbb_root_path,
|
||||
$php_ext)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->phpbb_extension_manager = $phpbb_extension_manager;
|
||||
$this->phpbb_path_helper = $phpbb_path_helper;
|
||||
$this->helper = $helper;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->pagination = $pagination;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
||||
$this->football_includes_path = $phpbb_root_path . 'ext/football/football/includes/';
|
||||
$this->football_root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
|
||||
}
|
||||
|
||||
public function handlepopup($popside)
|
||||
{
|
||||
global $db, $user, $cache, $request, $template, $season, $league, $matchday;
|
||||
global $config, $phpbb_root_path, $phpbb_container, $phpEx, $league_info;
|
||||
|
||||
define('IN_FOOTBALL', true);
|
||||
|
||||
$this->db = $db;
|
||||
$this->user = $user;
|
||||
$this->cache = $cache;
|
||||
$this->template = $template;
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
|
||||
// Add football controller language file
|
||||
$this->user->add_lang_ext('football/football', 'football');
|
||||
|
||||
// required includes
|
||||
include($this->football_includes_path . 'constants.' . $this->php_ext);
|
||||
include($this->football_includes_path . 'functions.' . $this->php_ext);
|
||||
|
||||
if ($config['board_disable'] && !$this->auth->acl_gets('a_'))
|
||||
{
|
||||
$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
if ($config['football_disable'])
|
||||
{
|
||||
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
||||
trigger_error($message);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Can this user view Prediction Leagues pages?
|
||||
if (!$config['football_guest_view'])
|
||||
{
|
||||
// No guest view, call login for guest
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
{
|
||||
login_box('', ($user->lang['LOGIN_EXPLAIN_FOOTBALL']));
|
||||
}
|
||||
}
|
||||
if (!$config['football_user_view'])
|
||||
{
|
||||
// Only Prediction League member should see these pages
|
||||
// Check Prediction League authorisation
|
||||
if ( !$this->auth->acl_get('u_use_football') )
|
||||
{
|
||||
trigger_error('NO_AUTH_VIEW');
|
||||
}
|
||||
}
|
||||
|
||||
$season = $this->request->variable('s', 0);
|
||||
$league = $this->request->variable('l', 0);
|
||||
$matchday = $this->request->variable('m', $curr_matchday);
|
||||
$league_info = array();
|
||||
$league_info = league_info($season, $league);
|
||||
|
||||
if ($config['football_override_style'])
|
||||
{
|
||||
$user->data['user_style'] = $config['football_style'];
|
||||
}
|
||||
|
||||
include($this->football_root_path . 'block/' . $popside . '.' . $this->php_ext);
|
||||
|
||||
|
||||
// Send data to the template file
|
||||
return $this->helper->render($popside . '.html', $this->user->lang['PREDICTION_LEAGUE']);
|
||||
}
|
||||
}
|
||||
114
controller/xmlplan.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\controller;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
class xmlplan
|
||||
{
|
||||
/* @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
|
||||
/* @var \phpbb\extension\manager */
|
||||
protected $phpbb_extension_manager;
|
||||
|
||||
/* @var \phpbb\path_helper */
|
||||
protected $phpbb_path_helper;
|
||||
|
||||
/* @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/* @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/* @var phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/* @var PHP file extension */
|
||||
protected $php_ext;
|
||||
|
||||
/* @var football includes path */
|
||||
protected $football_includes_path;
|
||||
|
||||
/* @var football root path */
|
||||
protected $football_root_path;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\extension\manager $phpbb_extension_manager
|
||||
* @param \phpbb\path_helper $phpbb_path_helper
|
||||
* @param \phpbb\db\driver\driver_interface $db
|
||||
* @param \phpbb\user $user
|
||||
*/
|
||||
|
||||
public function __construct(\phpbb\config\config $config,
|
||||
\phpbb\extension\manager $phpbb_extension_manager,
|
||||
\phpbb\path_helper $phpbb_path_helper,
|
||||
\phpbb\db\driver\driver_interface $db,
|
||||
\phpbb\user $user,
|
||||
$phpbb_root_path,
|
||||
$php_ext)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->phpbb_extension_manager = $phpbb_extension_manager;
|
||||
$this->phpbb_path_helper = $phpbb_path_helper;
|
||||
$this->db = $db;
|
||||
$this->user = $user;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
||||
$this->football_includes_path = $phpbb_root_path . 'ext/football/football/includes/';
|
||||
$this->football_root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
}
|
||||
|
||||
public function handlexml($xmlside)
|
||||
{
|
||||
global $db, $user, $cache, $request, $season, $league, $football_root_path;
|
||||
global $config, $phpbb_root_path, $phpEx, $table_prefix, $ext_path;
|
||||
|
||||
define('IN_FOOTBALL', true);
|
||||
|
||||
$this->db = $db;
|
||||
$this->user = $user;
|
||||
$this->cache = $cache;
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$football_root_path = $phpbb_root_path . 'ext/football/football/';
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
|
||||
// Add football controller language file
|
||||
$this->user->add_lang_ext('football/football', 'info_acp_update');
|
||||
|
||||
// required includes
|
||||
include($this->football_includes_path . 'constants.' . $this->php_ext);
|
||||
include($this->football_includes_path . 'functions.' . $this->php_ext);
|
||||
|
||||
if ($config['board_disable'])
|
||||
{
|
||||
$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
if ($config['football_disable'])
|
||||
{
|
||||
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
|
||||
trigger_error($message);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
include($this->football_root_path . 'xml/' . $xmlside . '.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
130
core/functions_points.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\core;
|
||||
|
||||
/**
|
||||
* @package football
|
||||
*/
|
||||
|
||||
class functions_points
|
||||
{
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\user $user
|
||||
* @param \phpbb\db\driver\driver_interface $db
|
||||
*
|
||||
*/
|
||||
|
||||
public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add points to user
|
||||
*/
|
||||
function add_points($user_id, $amount)
|
||||
{
|
||||
// Select users current points
|
||||
$sql_array = array(
|
||||
'SELECT' => 'user_points',
|
||||
'FROM' => array(
|
||||
USERS_TABLE => 'u',
|
||||
),
|
||||
'WHERE' => 'user_id = ' . (int) $user_id,
|
||||
);
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query($sql);
|
||||
$user_points = $this->db->sql_fetchfield('user_points');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
// Add the points
|
||||
$data = array(
|
||||
'user_points' => $user_points + $amount
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $data) . '
|
||||
WHERE user_id = ' . (int) $user_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Substract points from user
|
||||
*/
|
||||
function substract_points($user_id, $amount)
|
||||
{
|
||||
// Select users current points
|
||||
$sql_array = array(
|
||||
'SELECT' => 'user_points',
|
||||
'FROM' => array(
|
||||
USERS_TABLE => 'u',
|
||||
),
|
||||
'WHERE' => 'user_id = ' . (int) $user_id,
|
||||
);
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query($sql);
|
||||
$user_points = $this->db->sql_fetchfield('user_points');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
// Update the points
|
||||
$data = array(
|
||||
'user_points' => $user_points - $amount
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $data) . '
|
||||
WHERE user_id = ' . (int) $user_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount of points to user
|
||||
*/
|
||||
function set_points($user_id, $amount)
|
||||
{
|
||||
// Set users new points
|
||||
$data = array(
|
||||
'user_points' => $amount
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $data) . '
|
||||
WHERE user_id = ' . (int) $user_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Preformat numbers
|
||||
*/
|
||||
function number_format_points($num)
|
||||
{
|
||||
$decimals = 2;
|
||||
|
||||
return number_format($num, $decimals, $this->user->lang['FOOTBALL_SEPARATOR_DECIMAL'], $this->user->lang['FOOTBALL_SEPARATOR_THOUSANDS']);
|
||||
}
|
||||
|
||||
}
|
||||
325
cron/task/football_remember.php
Normal file
@@ -0,0 +1,325 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\cron\task;
|
||||
|
||||
class football_remember extends \phpbb\cron\task\base
|
||||
{
|
||||
/* @var string phpBB root path */
|
||||
protected $root_path;
|
||||
|
||||
/* @var string phpEx */
|
||||
protected $php_ext;
|
||||
|
||||
/* @var \phpbb\extension\manager */
|
||||
protected $phpbb_extension_manager;
|
||||
|
||||
/* @var \phpbb\path_helper */
|
||||
protected $phpbb_path_helper;
|
||||
|
||||
/* @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/* @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/* @var \phpbb\log\log_interface */
|
||||
protected $log;
|
||||
|
||||
/* @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $root_path
|
||||
* @param string $php_ext
|
||||
* @param \phpbb\extension\manager $phpbb_extension_manager
|
||||
* @param \phpbb\path_helper $phpbb_path_helper
|
||||
* @param \phpbb\db\driver\driver_interfacer $db
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\log\log_interface $log
|
||||
* @param \phpbb\user $user
|
||||
*/
|
||||
public function __construct($root_path, $php_ext, \phpbb\extension\manager $phpbb_extension_manager, \phpbb\path_helper $phpbb_path_helper, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\log\log_interface $log, \phpbb\user $user)
|
||||
{
|
||||
$this->root_path = $root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->phpbb_extension_manager = $phpbb_extension_manager;
|
||||
$this->phpbb_path_helper = $phpbb_path_helper;
|
||||
$this->db = $db;
|
||||
$this->config = $config;
|
||||
$this->phpbb_log = $log;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
global $request;
|
||||
|
||||
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
|
||||
include($ext_path . 'includes/functions.' . $this->php_ext);
|
||||
include($ext_path . 'includes/constants.' . $this->php_ext);
|
||||
|
||||
// Load extension language file
|
||||
$this->user->add_lang_ext('football/football', 'info_acp_football');
|
||||
|
||||
// mode=test ?
|
||||
$mode = $request->variable('mode', '');
|
||||
$days = $request->variable('days', 0);
|
||||
|
||||
//Mail Settings
|
||||
$use_queue = false;
|
||||
$used_method = NOTIFY_EMAIL;
|
||||
$priority = MAIL_NORMAL_PRIORITY;
|
||||
|
||||
|
||||
$season = curr_season();
|
||||
//Matchdays to close in 24 hours and 24 hours later
|
||||
$local_board_time = time() + (($this->config['board_timezone'] - $this->config['football_host_timezone']) * 3600);
|
||||
// shift days to test
|
||||
$local_board_time = $local_board_time + ($days * 86400);
|
||||
|
||||
if ($mode <> 'test')
|
||||
{
|
||||
// Update next run
|
||||
$run_time = getdate($this->config['football_remember_next_run']);
|
||||
$next_run = mktime($run_time['hours'], $run_time['minutes'], 0, date("n"), date("j") + 1, date("Y"));
|
||||
$this->config->set('football_remember_next_run', $next_run, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = sprintf($this->user->lang['LOG_FOOTBALL_MSG_TEST' . (($days == 0) ? '' : '_TRAVEL')], date("d.m.Y H:i", $local_board_time));
|
||||
$this->phpbb_log->add('admin', ANONYMOUS, '', 'LOG_FOOTBALL_REMEMBER_CRON_TEST', false, array($message));
|
||||
}
|
||||
|
||||
$sql = 'SELECT
|
||||
m.*,
|
||||
l.*
|
||||
FROM ' . FOOTB_MATCHDAYS . ' AS m
|
||||
LEFT JOIN ' . FOOTB_LEAGUES . " AS l ON (l.season = m.season AND l.league = m.league)
|
||||
WHERE m.season >= $season AND m.status = 0
|
||||
AND (DATE_SUB(m.delivery_date, INTERVAL '1 23:59' DAY_MINUTE) < FROM_UNIXTIME('$local_board_time'))
|
||||
AND (DATE_SUB(m.delivery_date, INTERVAL '1 00:00' DAY_MINUTE) > FROM_UNIXTIME('$local_board_time'))";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$toclose = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
// If we found matchdays to close, search missing bets and mail them
|
||||
foreach ($toclose as $close)
|
||||
{
|
||||
// prepare some variables
|
||||
$first_mail = true;
|
||||
$season = $close['season'];
|
||||
$league = $close['league'];
|
||||
$league_name = $close['league_name'];
|
||||
$league_short = $close['league_name_short'];
|
||||
$delivery = $close['delivery_date'];
|
||||
$matchday = $close['matchday'];
|
||||
$subject = sprintf($this->user->lang['FOOTBALL_REMEMBER_SUBJECT'], $league_short, $matchday);
|
||||
$usernames = '';
|
||||
|
||||
// find missing users
|
||||
$sql = 'SELECT
|
||||
u.user_email AS user_email,
|
||||
u.username AS username,
|
||||
u.user_id AS userid,
|
||||
u.user_lang
|
||||
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 ' . PROFILE_FIELDS_DATA_TABLE. ' AS p ON p.user_id = b.user_id
|
||||
LEFT JOIN ' . USERS_TABLE. " AS u ON u.user_id = b.user_id
|
||||
WHERE m.season = $season AND m.league = $league AND m.matchday = $matchday
|
||||
AND ((b.goals_home = '') OR (b.goals_guest = ''))
|
||||
AND m.status = 0 AND p.pf_footb_rem_f = 1
|
||||
GROUP BY b.user_id
|
||||
UNION
|
||||
SELECT
|
||||
p.pf_footb_email AS user_email,
|
||||
u.username AS username,
|
||||
u.user_id AS userid,
|
||||
u.user_lang
|
||||
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 ' . PROFILE_FIELDS_DATA_TABLE. ' AS p ON p.user_id = b.user_id
|
||||
LEFT JOIN ' . USERS_TABLE. " AS u ON u.user_id = b.user_id
|
||||
WHERE m.season = $season AND m.league = $league AND m.matchday = $matchday
|
||||
AND ((b.goals_home = '') OR (b.goals_guest = ''))
|
||||
AND m.status = 0 AND p.pf_footb_rem_s = 1
|
||||
GROUP BY b.user_id
|
||||
";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Send the messages
|
||||
include_once($this->root_path . 'includes/functions_messenger.' . $this->php_ext);
|
||||
$messenger = new \messenger($use_queue);
|
||||
include_once($this->root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
$errored = false;
|
||||
$messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
|
||||
$messenger->headers('X-AntiAbuse: User_id - ' . ANONYMOUS);
|
||||
$messenger->headers('X-AntiAbuse: Username - CRON TASK Football remember');
|
||||
$messenger->headers('X-AntiAbuse: User IP - ' . $this->user->ip);
|
||||
$messenger->subject(htmlspecialchars_decode($subject));
|
||||
$messenger->set_mail_priority($priority);
|
||||
|
||||
do
|
||||
{
|
||||
// Send the messages
|
||||
$used_lang = $row['user_lang'];
|
||||
$mail_template_path = $ext_path . 'language/' . $used_lang . '/email/';
|
||||
|
||||
if ($mode <> 'test')
|
||||
{
|
||||
$messenger->to($row['user_email'], $row['username']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// test send to board email
|
||||
$messenger->to($this->config['board_email'], $this->config['sitename']);
|
||||
}
|
||||
$messenger->template('footb_send_remember', $used_lang, $mail_template_path);
|
||||
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => $row['username'],
|
||||
'LEAGUE' => $league_name,
|
||||
'MATCHDAY' => $matchday,
|
||||
'DELIVERY' => $delivery,
|
||||
'CONTACT_EMAIL' => $this->config['board_contact'])
|
||||
);
|
||||
|
||||
if ($mode <> 'test')
|
||||
{
|
||||
if (!($messenger->send($used_method)))
|
||||
{
|
||||
$message = '<strong>' . sprintf($this->user->lang['FOOTBALL_REMEMBER_ERROR_EMAIL'], $league_short, $row['user_email']) . '</strong>';
|
||||
$this->phpbb_log->add('critical', ANONYMOUS, '', 'LOG_ERROR_EMAIL', false, array($message));
|
||||
$usernames .= (($usernames != '') ? ', ' : '') . $row['username']. '!';
|
||||
}
|
||||
else
|
||||
{
|
||||
$usernames .= (($usernames != '') ? ', ' : '') . $row['username'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Test mode
|
||||
if ($first_mail)
|
||||
{
|
||||
// only send one mail
|
||||
if (!($messenger->send($used_method)))
|
||||
{
|
||||
$message = '<strong>' . sprintf($this->user->lang['FOOTBALL_REMEMBER_ERROR_EMAIL'], $league_short, $row['user_email']) . '</strong>';
|
||||
$this->phpbb_log->add('critical', ANONYMOUS, '', 'LOG_ERROR_EMAIL', false, array($message));
|
||||
$usernames .= (($usernames != '') ? ', ' : '') . $row['username']. '!';
|
||||
}
|
||||
else
|
||||
{
|
||||
$usernames .= (($usernames != '') ? ', ' : '') . $row['username'];
|
||||
}
|
||||
$first_mail = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$usernames .= (($usernames != '') ? ', ' : '') . $row['username'];
|
||||
}
|
||||
}
|
||||
}
|
||||
while ($row = $this->db->sql_fetchrow($result));
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
// Only if mails have already been sent previously
|
||||
if ($usernames <> '')
|
||||
{
|
||||
// send mail to board administration
|
||||
$used_lang = $this->config['default_lang'];
|
||||
$mail_template_path = $ext_path . 'language/' . $used_lang . '/email/';
|
||||
$subject = sprintf($this->user->lang['FOOTBALL_REMEMBER_SUBJECT_BOARD'], $league_short, $matchday);
|
||||
$messenger->to($this->config['board_email'], $this->config['sitename']);
|
||||
$messenger->subject(htmlspecialchars_decode($subject));
|
||||
$messenger->template('footb_board_remember', $used_lang, $mail_template_path);
|
||||
$messenger->assign_vars(array(
|
||||
'CONTACT_EMAIL' => $this->config['board_contact'],
|
||||
'REMEMBER_LIST' => $usernames,
|
||||
)
|
||||
);
|
||||
|
||||
if (!($messenger->send($used_method)))
|
||||
{
|
||||
$message = '<strong>' . sprintf($this->user->lang['FOOTBALL_REMEMBER_ERROR_EMAIL_BOARD'], $league_short, $this->config['board_email']) . '</strong>';
|
||||
$this->phpbb_log->add('critical', ANONYMOUS, '', 'LOG_ERROR_EMAIL', false, array($message));
|
||||
}
|
||||
else
|
||||
{
|
||||
$log_subject = sprintf($this->user->lang['FOOTBALL_REMEMBER_SEND'], $league_short, $usernames) ;
|
||||
$this->phpbb_log->add('admin', ANONYMOUS, '', 'LOG_FOOTBALL_REMEMBER_CRON', false, array($log_subject));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Log the cronjob run
|
||||
$log_subject = sprintf($this->user->lang['FOOTBALL_REMEMBER_NOBODY']) ;
|
||||
$this->phpbb_log->add('admin', ANONYMOUS, '', 'LOG_FOOTBALL_REMEMBER_CRON', false, array($log_subject));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sizeof($toclose) == 0)
|
||||
{
|
||||
// Log the cronjob run
|
||||
$log_subject = sprintf($this->user->lang['FOOTBALL_REMEMBER_NO_DELIVERY']) ;
|
||||
$this->phpbb_log->add('admin', ANONYMOUS, '', 'LOG_FOOTBALL_REMEMBER_CRON', false, array($log_subject));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return (bool) $this->config['football_remember_enable'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because next run time
|
||||
* has passed.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
global $request;
|
||||
$mode = $request->variable('mode', '');
|
||||
|
||||
if ($mode <> 'test')
|
||||
{
|
||||
return $this->config['football_remember_next_run'] < time();
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
551
event/main_listener.php
Normal file
BIN
football.gif
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
images/arrow_down.gif
Normal file
|
After Width: | Height: | Size: 187 B |
BIN
images/arrow_up.gif
Normal file
|
After Width: | Height: | Size: 188 B |
BIN
images/flags/blank.gif
Normal file
|
After Width: | Height: | Size: 67 B |
BIN
images/football.gif
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
images/football.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
10
images/index.htm
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
images/no_change.gif
Normal file
|
After Width: | Height: | Size: 188 B |
BIN
images/site_logo.gif
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
images/spacer.gif
Normal file
|
After Width: | Height: | Size: 807 B |
BIN
images/under_construction.gif
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
66
includes/chart_hist.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Football
|
||||
* @version $Id: chart_hist.php 1 2010-05-17 22:09:43Z football $
|
||||
* @copyright (c) 2010 football (http://football.bplaced.net)
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
$values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
|
||||
$graphvalues1 = explode(",",$values1);
|
||||
$matchdays = sizeof($graphvalues1);
|
||||
|
||||
// Define .PNG image
|
||||
header("Content-type: image/png");
|
||||
$horz = 15;
|
||||
$vert = 9;
|
||||
$start = 25;
|
||||
$imgWidth= $matchdays * $vert + 20;
|
||||
$imgHeight=90;
|
||||
|
||||
// Create image and define colors
|
||||
$image = imagecreate($imgWidth, $imgHeight);
|
||||
$colorBackground = imagecolorallocate($image, 236, 240, 246);
|
||||
$colorWhite = imagecolorallocate($image, 255, 255, 255);
|
||||
$colorBlack = imagecolorallocate($image, 0, 0, 0);
|
||||
$colorGrey = imagecolorallocate($image, 106, 106, 106);
|
||||
$colorBlue = imagecolorallocate($image, 0, 0, 255);
|
||||
$colorRed = imagecolorallocate($image, 176, 0, 0);
|
||||
$colorGreen = imagecolorallocate($image, 0, 176, 0);
|
||||
|
||||
imagefill($image, 0, 0, $colorBackground);
|
||||
|
||||
imageline($image, 0, 45, $imgWidth, 45, $colorGrey);
|
||||
imagestring($image,4, 5, 15, 'H', $colorBlack);
|
||||
imagestring($image,4, 5, 60, 'A', $colorBlack);
|
||||
|
||||
imagesetthickness($image, 5);
|
||||
|
||||
$count_values=count($graphvalues1);
|
||||
// Create line graph
|
||||
for ($i = 0; $i < $count_values; $i++)
|
||||
{
|
||||
if (substr($graphvalues1[$i],0,1) == '-')
|
||||
{
|
||||
imageline($image, $start + ($i * $vert), 45, $start + ($i * $vert), substr($graphvalues1[$i], 1, strlen($graphvalues1[$i]) - 1), $colorRed);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($graphvalues1[$i],0,1) == ' ')
|
||||
{
|
||||
imageline($image, $start + ($i * $vert), 45, $start + ($i * $vert), substr($graphvalues1[$i], 1, strlen($graphvalues1[$i]) - 1), $colorGreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
imageline($image, $start + ($i * $vert), 45, $start + ($i * $vert), substr($graphvalues1[$i], 0, strlen($graphvalues1[$i])), $colorGrey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output graph and clear image from memory
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
||||
126
includes/chart_points.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Football
|
||||
* @version $Id: chart_points.php 1 2010-05-17 22:09:43Z football $
|
||||
* @copyright (c) 2010 football (http://football.bplaced.net)
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
$matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0;
|
||||
$values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
|
||||
$values2 = ( isset($_GET['v2']) ) ? $_GET['v2'] : 0;
|
||||
$values3 = ( isset($_GET['v3']) ) ? $_GET['v3'] : 0;
|
||||
$values4 = ( isset($_GET['v4']) ) ? $_GET['v4'] : 0;
|
||||
$valuesmin = ( isset($_GET['min']) ) ? $_GET['min'] : 0;
|
||||
$valuesmax = ( isset($_GET['max']) ) ? $_GET['max'] : 0;
|
||||
$caption = ( isset($_GET['c']) ) ? $_GET['c'] : '';
|
||||
|
||||
$graphvalues1 = explode(",", $values1);
|
||||
$graphvalues2 = explode(",", $values2);
|
||||
$graphvalues3 = explode(",", $values3);
|
||||
$graphvalues4 = explode(",", $values4);
|
||||
$graphvaluesmin = explode(",", $valuesmin);
|
||||
$graphvaluesmax = explode(",", $valuesmax);
|
||||
$caption_lang = explode(",", $caption);
|
||||
|
||||
// Define .PNG image
|
||||
header("Content-type: image/png");
|
||||
$horz = 20;
|
||||
$vert = 24;
|
||||
$horzp = 4;
|
||||
$maximum = max($graphvaluesmax);
|
||||
$rows = (int) ($maximum / 5) + 2;
|
||||
$maximum = ($rows - 1) * 5;
|
||||
$imgWidth = $matchdays * $vert + 10;
|
||||
$imgHeight = $rows * $horz + 50;
|
||||
|
||||
if ($imgWidth < 106)
|
||||
$imgWidth = 106;
|
||||
|
||||
// Create image and define colors
|
||||
$image=imagecreate($imgWidth, $imgHeight);
|
||||
$colorWhite=imagecolorallocate($image, 255, 255, 255);
|
||||
$colorBlack=imagecolorallocate($image, 0, 0, 0);
|
||||
$colorGrey=imagecolorallocate($image, 192, 192, 192);
|
||||
$colorBlue=imagecolorallocate($image, 0, 0, 255);
|
||||
$colorRed=imagecolorallocate($image, 255, 0, 0);
|
||||
$colorGreen=imagecolorallocate($image, 0, 255, 0);
|
||||
$colorAzur=imagecolorallocate($image, 0, 255, 255);
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $rows; $i++)
|
||||
{
|
||||
imageline($image, $vert, $i * $horz, $imgWidth - 10, $i * $horz, $colorGrey);
|
||||
if ($i > ($rows - 2))
|
||||
imagestring($image, 3, 10, $i * $horz - 6, $maximum - (($i - 1) * 5), $colorBlack);
|
||||
else
|
||||
imagestring($image, 3, 3,$i * $horz - 6, $maximum - (($i - 1) * 5), $colorBlack);
|
||||
}
|
||||
imagestring($image, 1, 0, 0, $caption_lang[0] , $colorBlack);
|
||||
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $matchdays; $i++)
|
||||
{
|
||||
$label = $i + 1;
|
||||
imageline($image, $i * $vert, $horz, $i * $vert, $imgHeight - 50, $colorGrey);
|
||||
if ($i < 10)
|
||||
imagestring($image,3,$i * $vert - 3, $imgHeight - 40, $i, $colorBlack);
|
||||
else
|
||||
imagestring($image, 3, $i * $vert - 6, $imgHeight - 40, $i, $colorBlack);
|
||||
}
|
||||
|
||||
imageline($image, 3, $imgHeight - $horz + 6, 15, $imgHeight - $horz + 6, $colorBlack);
|
||||
imagestring($image, 3, 20, $imgHeight - $horz, $caption_lang[1] , $colorBlack);
|
||||
|
||||
imagesetthickness($image, 2);
|
||||
|
||||
$count_values=count($graphvalues1);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues1[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues1[$i]) * $horzp + $horz), $colorBlue);
|
||||
}
|
||||
|
||||
$count_values=count($graphvalues2);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues2[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues2[$i]) * $horzp + $horz), $colorGreen);
|
||||
}
|
||||
|
||||
$count_values=count($graphvalues3);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues3[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues3[$i]) * $horzp + $horz), $colorAzur);
|
||||
}
|
||||
|
||||
$count_values=count($graphvalues4);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues4[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues4[$i]) * $horzp + $horz), $colorRed);
|
||||
}
|
||||
|
||||
$count_values=count($graphvaluesmin);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvaluesmin[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvaluesmin[$i]) * $horzp + $horz), $colorBlack);
|
||||
}
|
||||
|
||||
$count_values=count($graphvaluesmax);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvaluesmax[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvaluesmax[$i]) * $horzp + $horz), $colorBlack);
|
||||
}
|
||||
|
||||
// Output graph and clear image from memory
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
||||
97
includes/chart_rank.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Football
|
||||
* @version $Id: chart_rank.php 1 2010-05-17 22:09:43Z football $
|
||||
* @copyright (c) 2010 football (http://football.bplaced.net)
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
$numb_users = ( isset($_GET['t']) ) ? intval($_GET['t']) : 0;
|
||||
$matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0;
|
||||
$Values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
|
||||
$Values2 = ( isset($_GET['v2']) ) ? $_GET['v2'] : 0;
|
||||
$Values3 = ( isset($_GET['v3']) ) ? $_GET['v3'] : 0;
|
||||
$Values4 = ( isset($_GET['v4']) ) ? $_GET['v4'] : 0;
|
||||
$caption = ( isset($_GET['c']) ) ? $_GET['c'] : '';
|
||||
|
||||
$graphValues1 = explode(",",$Values1);
|
||||
$graphValues2 = explode(",",$Values2);
|
||||
$graphValues3 = explode(",",$Values3);
|
||||
$graphValues4 = explode(",",$Values4);
|
||||
|
||||
// Define .PNG image
|
||||
header("Content-type: image/png");
|
||||
$horz = 15;
|
||||
$vert = 24;
|
||||
$imgWidth=$matchdays * $vert + 10;
|
||||
$imgHeight=$numb_users * $horz + 20;
|
||||
|
||||
// Create image and define colors
|
||||
$image=imagecreate($imgWidth, $imgHeight);
|
||||
$colorWhite=imagecolorallocate($image, 255, 255, 255);
|
||||
$colorBlack=imagecolorallocate($image, 0, 0, 0);
|
||||
$colorGrey=imagecolorallocate($image, 192, 192, 192);
|
||||
$colorBlue=imagecolorallocate($image, 0, 0, 255);
|
||||
$colorRed=imagecolorallocate($image, 255, 0, 0);
|
||||
$colorGreen=imagecolorallocate($image, 0, 255, 0);
|
||||
$colorAzur=imagecolorallocate($image, 0, 255, 255);
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $numb_users; $i++)
|
||||
{
|
||||
imageline($image, $vert, $i * $horz, $imgWidth - 10, $i * $horz, $colorGrey);
|
||||
if ($i < 10)
|
||||
imagestring($image,3,10,$i * $horz - 6,$i,$colorBlack);
|
||||
else
|
||||
imagestring($image,3,3,$i * $horz - 6,$i,$colorBlack);
|
||||
}
|
||||
imagestring($image, 1, 0, 0, $caption, $colorBlack);
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $matchdays; $i++)
|
||||
{
|
||||
$label = $i + 1;
|
||||
imageline($image, $i * $vert, $horz, $i * $vert, $imgHeight - 20, $colorGrey);
|
||||
if ($i < 10)
|
||||
imagestring($image, 3,$i * $vert - 3,$imgHeight - $horz, $i, $colorBlack);
|
||||
else
|
||||
imagestring($image, 3,$i * $vert - 6,$imgHeight - $horz, $i, $colorBlack);
|
||||
}
|
||||
|
||||
imagesetthickness($image, 2);
|
||||
|
||||
$count_values=count($graphValues1);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues1[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues1[$i] * $horz), $colorBlue);
|
||||
}
|
||||
|
||||
$count_values=count($graphValues2);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues2[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues2[$i] * $horz), $colorGreen);
|
||||
}
|
||||
|
||||
$count_values=count($graphValues3);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues3[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues3[$i] * $horz), $colorAzur);
|
||||
}
|
||||
|
||||
$count_values=count($graphValues4);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues4[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues4[$i] * $horz), $colorRed);
|
||||
}
|
||||
|
||||
// Output graph and clear image from memory
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
||||
45
includes/constants.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
global $table_prefix;
|
||||
|
||||
// Config constants
|
||||
define('FOOTB_BETS', $table_prefix . 'footb_bets');
|
||||
define('FOOTB_EXTRA_BETS', $table_prefix . 'footb_extra_bets');
|
||||
define('FOOTB_EXTRA', $table_prefix . 'footb_extra');
|
||||
define('FOOTB_LEAGUES', $table_prefix . 'footb_leagues');
|
||||
define('FOOTB_MATCHDAYS', $table_prefix . 'footb_matchdays');
|
||||
define('FOOTB_MATCHES', $table_prefix . 'footb_matches');
|
||||
define('FOOTB_MATCHES_HIST', $table_prefix . 'footb_matches_hist');
|
||||
define('FOOTB_POINTS', $table_prefix . 'footb_points');
|
||||
define('FOOTB_RANKS', $table_prefix . 'footb_rank_matchdays');
|
||||
define('FOOTB_SEASONS', $table_prefix . 'footb_seasons');
|
||||
define('FOOTB_TEAMS', $table_prefix . 'footb_teams');
|
||||
define('FOOTB_TEAMS_HIST', $table_prefix . 'footb_teams_hist');
|
||||
define('BET_KO_90', 1);
|
||||
define('BET_KO_EXTRATIME', 2);
|
||||
define('BET_KO_PENALTY', 3);
|
||||
define('POINTS_BET', 1);
|
||||
define('POINTS_DEPOSITED', 2);
|
||||
define('POINTS_MATCHDAY', 3);
|
||||
define('POINTS_SEASON', 4);
|
||||
define('POINTS_MOST_HITS', 5);
|
||||
define('POINTS_MOST_HITS_AWAY', 6);
|
||||
define('POINTS_PAID', 7);
|
||||
define('UP_NONE', 0);
|
||||
define('UP_WINS', 1);
|
||||
define('UP_POINTS', 2);
|
||||
define('LEAGUE_CHAMP', 1);
|
||||
define('LEAGUE_KO', 2);
|
||||
?>
|
||||
271
includes/export.php
Normal file
@@ -0,0 +1,271 @@
|
||||
<?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'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
if( !$result = $db->sql_query($sql) )
|
||||
{
|
||||
trigger_error('NO_LEAGUE');
|
||||
}
|
||||
$league_short = $db->sql_fetchfield('league_name_short');
|
||||
$db->sql_freeresult($result);
|
||||
$export_file = $league_short . '_'. $season. '_Tipps.csv';
|
||||
$path_attachment = './../../files/' . $export_file;
|
||||
$newline = "\r\n";
|
||||
|
||||
if (!isset($_POST['send']))
|
||||
{
|
||||
header('Pragma: no-cache');
|
||||
header("Content-Type: text/csv; name=\"$export_file\"");
|
||||
header("Content-disposition: attachment; filename=$export_file");
|
||||
|
||||
// header('Content-Type: text/x-csv');
|
||||
// header('Expires: ' . gmdate('D, d M Y H:i:m') . ' GMT');
|
||||
// header('Content-Disposition: attachment; filename='. $export_file);
|
||||
$phpbb_root_path = './../';
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpbb_root_path = './../../';
|
||||
}
|
||||
|
||||
$sql_users = 'SELECT DISTINCT
|
||||
b.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE b.season = $season AND b.league = $league
|
||||
ORDER BY b.user_id ASC";
|
||||
|
||||
$sql_results = "SELECT
|
||||
m.match_no,
|
||||
DATE_FORMAT(m.match_datetime,'%d.%m.%Y') AS match_time,
|
||||
m.matchday,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_id AS hid,
|
||||
t2.team_id AS gid,
|
||||
t1.team_name_short AS team_home,
|
||||
t2.team_name_short AS team_guest,
|
||||
m.status,
|
||||
m.goals_home,
|
||||
m.goals_guest
|
||||
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 t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id=m.team_id_guest)
|
||||
WHERE m.season = $season AND m.league = $league
|
||||
ORDER BY m.match_no ASC";
|
||||
|
||||
$sql_bets = "SELECT
|
||||
m.matchday,
|
||||
m.match_no,
|
||||
b.user_id,
|
||||
IF(m.status > 0, b.goals_home, '') AS bet_home,
|
||||
IF(m.status > 0, b.goals_guest, '') AS bet_guest
|
||||
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 m.season = $season AND m.league = $league
|
||||
ORDER BY matchday ASC, match_no ASC, user_id ASC";
|
||||
|
||||
if(!$result_users = $db->sql_query($sql_users))
|
||||
{
|
||||
trigger_error('NO_USER');
|
||||
}
|
||||
$rows_users = $db->sql_fetchrowset($result_users);
|
||||
$count_user = sizeof($rows_users);
|
||||
$db->sql_freeresult($result_users);
|
||||
$j = 0;
|
||||
$column = array();
|
||||
foreach ($rows_users as $row_user)
|
||||
{
|
||||
$column[(8 + (3 * ($j)))] = str_replace("\"", "\"\"", $row_user['username']);
|
||||
$lastcolumn = 8 + (3 * ($j));
|
||||
$bet_column[$row_user['user_id']] = $lastcolumn;
|
||||
$j++;
|
||||
}
|
||||
$export_row_users = "\"\";\"\";\"\";\"\";\"\";\"\";";
|
||||
for($j = 8; $j <= $lastcolumn; $j = $j + 3)
|
||||
{
|
||||
$export_row_users .= "\"\";\"\";\"" . $column[$j] . "\"";
|
||||
if($j != $lastcolumn)
|
||||
{
|
||||
$export_row_users .= ';';
|
||||
}
|
||||
}
|
||||
$export_row_users .= $newline;
|
||||
|
||||
if( !$result_results = $db->sql_query($sql_results) )
|
||||
{
|
||||
trigger_error('NO_RESULTS');
|
||||
}
|
||||
$rows_results = $db->sql_fetchrowset($result_results);
|
||||
$count_results = sizeof($rows_results);
|
||||
$db->sql_freeresult($result_results);
|
||||
|
||||
if( !$result_bets = $db->sql_query($sql_bets) )
|
||||
{
|
||||
trigger_error('NO_BETS');
|
||||
}
|
||||
$rows_bets = $db->sql_fetchrowset($result_bets);
|
||||
$count_bets = sizeof($rows_bets);
|
||||
$db->sql_freeresult($result_results);
|
||||
$column = array();
|
||||
$lastcolumn = 0;
|
||||
$last_match_num = 0;
|
||||
foreach ($rows_bets as $row_bet)
|
||||
{
|
||||
if ($row_bet['match_no'] == $last_match_num)
|
||||
{
|
||||
$column[$bet_column[$row_bet['user_id']]] = str_replace("\"", "\"\"", $row_bet['bet_home']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 1] = str_replace("\"", "\"\"", $row_bet['bet_guest']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 2] = '';
|
||||
$lastcolumn = $bet_column[$row_bet['user_id']] + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($lastcolumn > 0)
|
||||
{
|
||||
$export_bets[$last_match_num] = '';
|
||||
for($j=8; $j<=$lastcolumn; $j++)
|
||||
{
|
||||
$export_bets[$last_match_num] .= "\"" . $column[$j] . "\"";
|
||||
if($j!=$lastcolumn)
|
||||
{
|
||||
$export_bets[$last_match_num] .= ';';
|
||||
}
|
||||
}
|
||||
$export_bets[$last_match_num] .= $newline;
|
||||
}
|
||||
$column = array();
|
||||
$last_match_num = $row_bet['match_no'];
|
||||
$column[$bet_column[$row_bet['user_id']]] = str_replace("\"", "\"\"", $row_bet['bet_home']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 1] = str_replace("\"", "\"\"", $row_bet['bet_guest']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 2] = '';
|
||||
$lastcolumn = $bet_column[$row_bet['user_id']] + 2;
|
||||
}
|
||||
}
|
||||
$export_bets[$last_match_num] = '';
|
||||
for($j = 8; $j <= $lastcolumn; $j++)
|
||||
{
|
||||
$export_bets[$last_match_num] .= "\"" . $column[$j] . "\"";
|
||||
if($j != $lastcolumn)
|
||||
{
|
||||
$export_bets[$last_match_num] .= ';';
|
||||
}
|
||||
}
|
||||
$export_bets[$last_match_num] .= $newline;
|
||||
|
||||
$last_matchday = 0;
|
||||
|
||||
$export= '';
|
||||
$export .= 'CSV;'. $league. ';'. $season. $newline;
|
||||
|
||||
$i = 0;
|
||||
foreach ($rows_results as $row_result)
|
||||
{
|
||||
if ($last_matchday != $row_result['matchday'])
|
||||
{
|
||||
if ($last_matchday != 0)
|
||||
{
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= ";;". str_replace("\"", "\"\"", $row_result['match_time']). $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
}
|
||||
else
|
||||
{
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= ";;". str_replace("\"", "\"\"", $row_result['match_time']). $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
}
|
||||
$export .= $export_row_users;
|
||||
$column = array();
|
||||
$last_matchday = $row_result['matchday'];
|
||||
}
|
||||
if (0 == $row_result['hid'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $row_result['match_no'], 'team_id_home', $row_result['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homename = $home_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homename = $row_result['team_home'];
|
||||
}
|
||||
if (0 == $row_result['gid'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $row_result['match_no'], 'team_id_guest', $row_result['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestname = $guest_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestname = $row_result['team_guest'];
|
||||
}
|
||||
$column[0] = str_replace("\"", "\"\"", $homename);
|
||||
$column[1] = str_replace("\"", "\"\"", $guestname);
|
||||
|
||||
if ($row_result['status'] == 3)
|
||||
{
|
||||
$column[2] = str_replace("\"", "\"\"", $row_result['goals_home']);
|
||||
$column[4] = str_replace("\"", "\"\"", $row_result['goals_guest']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$column[2] = '';
|
||||
$column[4] = '';
|
||||
}
|
||||
$export .= "\"" . $column[0] . "\";\"" . $column[1] . "\";\"" . $column[2] . "\";\"\";\"" . $column[4] . "\";\"\";\"\";\"\";";
|
||||
if ($export_bets[$row_result['match_no']] == '')
|
||||
{
|
||||
$export .= $newline;
|
||||
}
|
||||
else
|
||||
{
|
||||
$export .= $export_bets[$row_result['match_no']];
|
||||
}
|
||||
$column = array();
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (isset($_POST['send']))
|
||||
{
|
||||
$fp = fopen($path_attachment , "b");
|
||||
ftruncate ($fp, 0);
|
||||
rewind($fp);
|
||||
fwrite ($fp, $export);
|
||||
fclose($fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo utf8_decode($export);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
2310
includes/functions.php
Normal file
115
includes/version_check.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\includes;
|
||||
|
||||
class version_check
|
||||
{
|
||||
/**
|
||||
* @var array version_data
|
||||
*/
|
||||
protected $version_data;
|
||||
|
||||
/**
|
||||
* @var \phpbb\config\config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\version_helper $version_helper phpBB version helper
|
||||
*/
|
||||
protected $version_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\template\twig\twig
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @var \phpbb\user
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* @var string Current version
|
||||
*/
|
||||
protected $current_version;
|
||||
|
||||
/**
|
||||
* Construct a version_check object
|
||||
*
|
||||
* @param array $version_data Version data
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\version_helper $version_helper phpBB version helper
|
||||
* @param \phpbb\template\twig\twig $template phpBB template object
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($version_data, $config, $version_helper, $template, $user)
|
||||
{
|
||||
$this->version_data = $version_data;
|
||||
$this->config = $config;
|
||||
$this->version_helper = $version_helper;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->current_version = $this->config[str_replace(' ', '', $this->version_data['version'])];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Extension version and assign template variables for version info if not
|
||||
* returning current version
|
||||
*
|
||||
* @param bool $return_version Yes if current version should be returned
|
||||
* @return string Current version if $return_version is set to true
|
||||
*/
|
||||
public function check($return_version = false)
|
||||
{
|
||||
$allow_url_fopen = (int) @ini_get('allow_url_fopen');
|
||||
if ($allow_url_fopen)
|
||||
{
|
||||
|
||||
// Set file location
|
||||
$this->version_helper->set_file_location($this->version_data['file'][0], $this->version_data['file'][1], $this->version_data['file'][2]);
|
||||
// Set current version
|
||||
$this->version_helper->set_current_version($this->current_version);
|
||||
|
||||
$this->version_helper->force_stability(($this->config['extension_force_unstable'] || !$this->version_helper->is_stable($this->current_version)) ? 'unstable' : null);
|
||||
|
||||
$updates = $this->version_helper->get_suggested_updates(true);
|
||||
|
||||
// Return version if $return_version is set to true
|
||||
if ($return_version)
|
||||
{
|
||||
return $this->current_version;
|
||||
}
|
||||
|
||||
$version_up_to_date = empty($updates);
|
||||
|
||||
$template_data = array(
|
||||
'AUTHOR' => $this->version_data['author'],
|
||||
'CURRENT_VERSION' => $this->current_version,
|
||||
'UP_TO_DATE' => sprintf((!$version_up_to_date) ? $this->user->lang['NOT_UP_TO_DATE'] : $this->user->lang['UP_TO_DATE'], $this->version_data['title']),
|
||||
'S_UP_TO_DATE' => $version_up_to_date,
|
||||
'U_AUTHOR' => 'http://www.phpbb.com/community/memberlist.php?mode=viewprofile&un=' . $this->version_data['author'],
|
||||
'TITLE' => (string) $this->version_data['title'],
|
||||
'LATEST_VERSION' => $this->current_version,
|
||||
);
|
||||
|
||||
if (!$version_up_to_date)
|
||||
{
|
||||
$updates = array_shift($updates);
|
||||
$template_data = array_merge($template_data, array(
|
||||
'ANNOUNCEMENT' => (string) $updates['announcement'],
|
||||
'DOWNLOAD' => (string) $updates['download'],
|
||||
'LATEST_VERSION' => $updates['current'],
|
||||
));
|
||||
}
|
||||
$this->template->assign_block_vars('mods', $template_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
language/de/email/footb_board_remember.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
Hallo {SITENAME},
|
||||
Folgende Tipper haben eine Erinnerungs-Mail erhalten:
|
||||
|
||||
{REMEMBER_LIST}
|
||||
|
||||
|
||||
Hier geht es zur {SITENAME}: {U_BOARD}.
|
||||
|
||||
{EMAIL_SIG}
|
||||