# GPL v2.0 or later. See docs/COPYING.
##############################################################
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
##############################################################
/**
* Tournament Class
* This does all the complex calculations for generating brackets and displaying them.
*/
class tournament
{
/**
* Contains the tournament's information.
*
* @var array
*/
var $data;
/**
* Contains the tournament's table widths.
*
* @var array
*/
var $rounds_widths;
/**
* Contains the tournament's round names.
*
* @var array
*/
var $rounds_list;
/**
* Contains the tournament's round numbers.
*
* @var array
*/
var $rounds_array;
/**
* Inits the class, populating the data object.
*/
function tournament ( )
{
// Populate the data object.
$this->data = $this->data ( );
}
/**
* Populates the array of data based on information from the arguments.
*
* @param string $grab
* @param integer $tournament_id
* @return array
*/
function data ( $grab = '', $tournament_id = '' )
{
global $db;
global $http_vars;
// Are we dealing with a request or default request?
$type = ( !empty ( $tournament_id ) ) ? $tournament_id : $http_vars[ 'tournament_id' ];
// Get the tournament's information.
$sql = 'SELECT * FROM ' . TOURNAMENTS_TABLE . ' WHERE tournament_id = ' . $type;
$result = $db->sql_query ( $sql );
$row = $db->sql_fetchrow ( $result );
return ( !empty ( $grab ) ) ? $row[ $grab ] : $row;
}
/**
* This generates both the single and double elimination brackets.
*
* @param boolean $double_elimination
*/
function generate_brackets ( $double_elimination = false )
{
global $lang;
// If $double_elimination is true, then take 1 away from the total brackets.
$brackets = ( !empty ( $double_elimination ) ) ? $this->data[ 'tournament_brackets' ] - 1 : $this->data[ 'tournament_brackets' ];
$spots = ( $brackets * 2 - 1 );
$temp_rows = $brackets;
$rounds_widths = array ( );
// Keep counting until the rows/columes are filled.
while ( $temp_rows > 1 )
{
$row_count++;
if ( $row_count > 1 )
{
// Add a new colume.
$temp_rows = ( $temp_rows / 2 );
}
$rows = $row_count;
}
// Calculate the widths needed for the tables.
$row_widths = round ( 100 / $rows - 0.5 );
$counter = $brackets;
while ( $counter > 1 )
{
if ( !empty ( $round ) )
{
$counter = ( $counter / 2 );
}
// Label each round a number.
$round++;
$last_cb = $count_brackets;
$count_brackets = '';
$game = '';
$finals = ( $rows - 1 );
$winner = ( $rows );
$round_games = sprintf ( $lang[ 'rivals_tourr' ], $round );
if ( $round == $winner )
{
// This is the last round, don't give a number, give a name.
$round_games = $lang[ 'rivals_tourw' ];
}
else if ( $round == $finals )
{
// This is the second last round, don't give a number, give a name.
$round_games = $lang[ 'rivals_tourf' ];
}
// Add the widths, rounds and round names to the arrays for processing.
$rounds_widths[ $round_games ] = $row_widths;
$rounds_list[ ] = $round_games;
$rounds_array[ $round_games ] = array ( );
$space_setcount = '';
while ( $count_brackets < $counter )
{
$count_brackets++;
$spot++;
$space_setcount++;
if ( $space_setcount == '4' )
{
$space_setcount = '';
}
// Give each bracket a ID.
$bracket_id = $round . '_' . $count_brackets;
$rounds_array[ $round_games ][ ] = array ( $bracket_id );
if ( $count_brackets < $counter )
{
$space_counter++;
$space_counter = ( $space_counter + 1 );
if ( $space_counter == '2' )
{
$roundx2p1 = ( $last_roundx2p1 * 2 + 1 );
if ( $round == '1' )
{
$roundx2p1 = 1;
}
while ( $count_spaces < $roundx2p1 )
{
$count_spaces++;
$space_centercount++;
$space_centerword = '';
$spacecentercountcheck = ( $last_roundx2p1 + 1 );
if ( $space_centercount == $spacecentercountcheck )
{
$space_centerwordcount++;
if ( ( $space_centerwordcount == '1' ) || ( $space_centerwordcount == '3' ) )
{
$actual_gamecount++;
$space_centerword = sprintf ( $lang[ 'rivals_toura' ], $actual_gamecount );
if ( $space_centerwordcount == 3 )
{
$space_centerwordcount = '';
$space_centerwordcount++;
}
}
}
$rounds_array[ $round_games ][ ] = array ( $space_centerword );
}
$space_counter = '';
$count_spaces = '';
$space_centercount = '';
}
}
}
$space_centerwordcount = '';
$actual_gamecount = '';
$last_roundx2p1 = $roundx2p1;
}
$this->rounds_widths = $rounds_widths;
$this->rounds_list = $rounds_list;
$this->rounds_array = $rounds_array;
}
/**
* Because PHP starts with an index of 0
* and the rounds start with a index of 1,
* A reversal of the array is needed, then
* replace the index with the proper rounds.
*
*
* @param array $array
* @return array
*/
function tournament_arrayreverse ( $array )
{
// Reverse the keys to use in the reverse array.
$keys = array_reverse ( array_keys ( $array ) );
// Reverse the array.
$reversed = array_reverse ( $array );
$i = 0;
foreach ( $reversed AS $key => $value )
{
// Hold the data in the current array entry.
$temp = $reversed[ $key ];
// Remove the current array entry so we can fix the key.
unset ( $reversed[ $key ] );
$reversed[ $keys[ $i ] ] = $temp;
$i++;
}
// All fixed, return the new array.
return $reversed;
}
/**
* Gets a list of matchups. Checks if clan has a matchup.
* This is used for pass-ons and check-ups.
*
* @param array $clans
* @param string $clan
* @param boolean $type
* @return mixed
*/
function get_matchup ( $clans, $clan = '', $type = 0 )
{
// Loop though the array of clans ... format ('bracket_position' => 'clan name(clan id)').
$matches = array ( );
while ( list ( $key, $value ) = @each ( $clans ) )
{
// Split the bracket and position.
$round = explode ( '_', $key );
$matches[ $round[ 0 ] ][ ] = $value;
}
$matchups = array ( );
for ( $i = 1; $i <= count ( $matches ); $i++ )
{
for ( $x = 0; $x < count ( $matches[ $i ] ); $x += 2 )
{
// Assign the matchups to the array.
$matchups[ $i ][ ] = array ( $matches[ $i ][ $x ], $matches[ $i ][ $x + 1 ] );
}
}
if ( !empty ( $clan ) )
{
$opp = '';
$has_opp = false;
// We need to check for a specific clan.
$matchups = ( count ( $matchups ) > 1 ) ? $this->tournament_arrayreverse ( $matchups ) : $matchups;
while ( list ( $key, $value ) = @each ( $matchups ) )
{
while ( list ( $key_2, $value_2 ) = @each ( $value ) )
{
// Match the clan we provided ?
if ( $matchups[ $key ][ $key_2 ][ 0 ] == $clan )
{
// Yes. Does the clan have a matchup ?
if ( !empty ( $matchups[ $key ][ $key_2 ][ 1 ] ) )
{
// Yes. Set the opponent, break the loop.
$opp = $matchups[ $key ][ $key_2 ][ 1 ];
$has_opp = true;
break ( 2 );
}
else
{
// No. Null the opponent, break the loop.
$opp = '';
$has_opp = false;
break ( 2 );
}
}
else if ( $matchups[ $key ][ $key_2 ][ 1 ] == $clan )
{
if ( !empty ( $matchups[ $key ][ $key_2 ][ 0 ] ) )
{
// Yes. Set the opponent, break the loop.
$opp = $matchups[ $key ][ $key_2 ][ 0 ];
$has_opp = true;
break ( 2 );
}
else
{
// No. Null the opponent, break the loop.
$opp = '';
$has_opp = false;
break ( 2 );
}
}
else
{
// Nothing yet.
continue;
}
}
}
}
// Just return a list of matchups ?
if ( $type == 0 )
{
// Yes.
return ( !empty ( $clan ) ) ? array_reverse ( $matchups ) : $matchups;
}
else
{
// No.
return ( $type == 1 ) ? $opp : $has_opp;
}
}
/**
* This takes the data from generate_brackets and puts it into a graphical perspective.
*
* @param $admin boolean
* @return object
*/
function generate_tournament ( $admin = false )
{
global $db;
global $lang;
global $clan;
global $template;
// Do the calculations.
$this->generate_brackets ( );
// Admin mode ?
if ( $admin == true )
{
// Go though each clan in the tournament and get their position.
$matchup_array = array ( );
foreach ( explode ( '|', $this->data[ 'tournament_clans' ] ) AS $clans )
{
$stage = explode ( ':', $clans );
foreach ( $stage AS $eclan )
{
// Get their clan's name.
$matchup_array[ $stage[ 1 ] ] = $clan->data ( 'clan_name', $stage[ 0 ] );
}
}
}
// We are dealing with a single elimination, so do only one bracket.
if ( $this->data[ 'tournament_type' ] == 1 )
{
$i = 0;
$clans2 = array ( );
// Go though each clan in the tournament and get their position.
foreach ( explode ( '|', $this->data[ 'tournament_clans' ] ) AS $clans )
{
$stage = explode ( ':', $clans );
foreach ( $stage AS $eclan )
{
// Get their clan's name.
$clans2[ $stage[ 1 ] ] = $clan->data ( 'clan_name', $stage[ 0 ] );
$stages[ $clans2[ $stage[ 1 ] ] ] = $stage[ 0 ];
}
}
$in_bracket = array ( );
foreach ( $this->rounds_array AS $round )
{
// Tell the template system to add a new colume of rounds with the table widths and round name/number.
$template->assign_block_vars ( 'block_rounds', array (
'S_ROUNDWIDTH' => $this->rounds_array[ $rounds_list[ $i ] ],
'S_ROUND' => $this->rounds_list[ $i ] )
);
foreach ( $round AS $ids )
{
// Is this a clan or game?
if ( empty ( $ids[ 0 ] ) || strstr ( $ids[ 0 ], 'Game' ) )
{
// Game, italics it.
$template->assign_block_vars ( 'block_rounds.block_data', array (
'S_DATA' => '' . $ids[ 0 ] . '',
'S_COLOR' => 'row1' )
);
}
else
{
// Admin mode ?
if ( $admin == true )
{
// Test and see if they have a matchup.
$test = $this->get_matchup ( $matchup_array, $clans2[ $ids[ 0 ] ], 1 );
if ( strlen ( $test ) > 0 || $test == true )
{
$explode = explode ( '_', $ids[ 0 ] );
// Check for conflicting reports.
$sql = 'SELECT * FROM ' . TOURNAMENT_REPORTS . ' WHERE (clan_1 = "' . $clans2[ $ids[ 0 ] ] . '" OR clan_2 = "' . $clans2[ $ids[ 0 ] ] . '") AND (clan_1 = "' . $test . '" OR clan_2 = "' . $test . '") AND report_tournament = ' . $this->data[ 'tournament_id' ];
$result = $db->sql_query ( $sql );
$row = $db->sql_fetchrow ( $result );
// Have both clans reported ?
if ( !empty ( $row[ 'clan_r1' ] ) && !empty ( $row[ 'clan_r2' ] ) )
{
// Yes, check if they both reported the same thing.
if ( $row[ 'clan_r1' ] != $row[ 'clan_r2' ] )
{
// They did not, they are OK for processing.
$conflict = sprintf ( $lang[ 'no_conflict' ], ( $row[ 'clan_r1' ] == 'win' ) ? $row[ 'clan_1' ] : $row[ 'clan_2' ] );
}
else
{
// Uh oh!, a conflict in reports.
$conflict = $lang[ 'conflict' ];
}
}
else
{
// Who did not report ?
if ( empty ( $row[ 'clan_r1' ] ) && empty ( $row[ 'clan_r2' ] ) )
{
// No one has reported yet.
$who = $lang[ 'no_body' ];
}
else
{
// See who it is ...
$who = ( !empty ( $row[ 'clan_r1' ] ) ) ? $row[ 'clan_2' ] : $row[ 'clan_1' ];
}
$conflict = sprintf ( $lang[ 'conflict_who' ], $who );
}
$marker = append_sid ( 'rivals.php?module=acp&sub_module=acpeditbrackets&type=1&report_id=' . $row[ 'report_id' ] );
}
else
{
$marker = append_sid ( 'rivals.php?module=acp&sub_module=acpeditbrackets&type=2&report_id=' . $clans2[ $ids[ 0 ] ] );
}
}
if ( !empty ( $clans2[ $ids[ 0 ] ] ) )
{
if ( $lang[ 'conflict' ] == $conflict )
{
$marker_2 = '';
}
else
{
if ( $row[ 'clan_r1' ] == 'win' && $clans2[ $ids[ 0 ] ] == $row[ 'clan_1' ] )
{
$marker_2 = $lang[ '8csrsik' ];
}
else if ( $row[ 'clan_r2' ] == 'win' && $clans2[ $ids[ 0 ] ] == $row[ 'clan_2' ] )
{
$marker_2 = $lang[ '8csrsik' ];
}
else
{
$marker_2 = '';
}
}
}
else
{
$marker_2 = '';
}
// Clan. Bold it.
$template->assign_block_vars ( 'block_rounds.block_data', array (
'L_MARKER' => $marker_2,
'L_CONFLICT' => ( !empty ( $clans2[ $ids[ 0 ] ] ) ) ? $conflict : '',
'U_MARKER' => ( !empty ( $clans2[ $ids[ 0 ] ] ) ) ? $marker : '',
'S_DATA' => '' . $clans2[ $ids[ 0 ] ] . '',
'S_COLOR' => 'row2' )
);
}
}
$i++;
}
}
else
{
// We are now dealing with a double elimination, we need to do two sets of brackets. 1 Winner, 1 Looser bracket.
$i = 0;
$clans2 = array ( );
// Go though each clan in the tournament and get their position.
foreach ( explode ( '|', $this->data[ 'tournament_clans' ] ) AS $clans )
{
$stage = explode ( ':', $clans );
foreach ( $stage AS $eclan )
{
// Get their clan's name.
$clans2[ $stage[ 1 ] ] = $clan->data ( 'clan_name', $stage[ 0 ] );
$stages[ $clans2[ $stage[ 1 ] ] ] = $stage[ 0 ];
}
}
$in_bracket = array ( );
foreach ( $this->rounds_array AS $round )
{
// Tell the template system to add a new colume of rounds with the table widths and round name/number.
$template->assign_block_vars ( 'block_rounds', array (
'S_ROUNDWIDTH' => $this->rounds_widths[ $this->rounds_list[ $i ] ],
'S_ROUND' => $this->rounds_list[ $i ] )
);
foreach ( $round AS $ids )
{
// Is this a clan or game?
if ( empty ( $ids[ 0 ] ) || strstr ( $ids[ 0 ], 'Game' ) )
{
// Game, italics it.
$template->assign_block_vars ( 'block_rounds.block_data', array (
'S_DATA' => '' . $ids[ 0 ] . '',
'S_COLOR' => 'row1' )
);
}
else
{
// Admin mode ?
if ( $admin == true )
{
// Test and see if they have a matchup.
$test = $this->get_matchup ( $matchup_array, $clans2[ $ids[ 0 ] ], 1 );
if ( strlen ( $test ) > 0 || $test == true )
{
$explode = explode ( '_', $ids[ 0 ] );
// Check for conflicting reports.
$sql = 'SELECT * FROM ' . TOURNAMENT_REPORTS . ' WHERE (clan_1 = "' . $clans2[ $ids[ 0 ] ] . '" OR clan_2 = "' . $clans2[ $ids[ 0 ] ] . '") AND (clan_1 = "' . $test . '" OR clan_2 = "' . $test . '") AND report_tournament = ' . $this->data[ 'tournament_id' ];
$result = $db->sql_query ( $sql );
$row = $db->sql_fetchrow ( $result );
// Have both clans reported ?
if ( !empty ( $row[ 'clan_r1' ] ) && !empty ( $row[ 'clan_r2' ] ) )
{
// Yes, check if they both reported the same thing.
if ( $row[ 'clan_r1' ] != $row[ 'clan_r2' ] )
{
// They did not, they are OK for processing.
$conflict = sprintf ( $lang[ 'no_conflict' ], ( $row[ 'clan_r1' ] == 'win' ) ? $row[ 'clan_1' ] : $row[ 'clan_2' ] );
}
else
{
// Uh oh!, a conflict in reports.
$conflict = $lang[ 'conflict' ];
}
}
else
{
// Who did not report ?
if ( empty ( $row[ 'clan_r1' ] ) && empty ( $row[ 'clan_r2' ] ) )
{
// No one has reported yet.
$who = $lang[ 'no_body' ];
}
else
{
// See who it is ...
$who = ( !empty ( $row[ 'clan_r1' ] ) ) ? $row[ 'clan_2' ] : $row[ 'clan_1' ];
}
$conflict = sprintf ( $lang[ 'conflict_who' ], $who );
}
$marker = append_sid ( 'rivals.php?module=acp&sub_module=acpeditbrackets&type=1&report_id=' . $row[ 'report_id' ] );
}
else
{
$marker = append_sid ( 'rivals.php?module=acp&sub_module=acpeditbrackets&type=2&report_id=' . $clans2[ $ids[ 0 ] ] );
}
}
if ( !empty ( $clans2[ $ids[ 0 ] ] ) )
{
if ( $lang[ 'conflict' ] == $conflict )
{
$marker_2 = '';
}
else
{
if ( $row[ 'clan_r1' ] == 'win' && $clans2[ $ids[ 0 ] ] == $row[ 'clan_1' ] )
{
$marker_2 = $lang[ '8csrsik' ];
}
else if ( $row[ 'clan_r2' ] == 'win' && $clans2[ $ids[ 0 ] ] == $row[ 'clan_2' ] )
{
$marker_2 = $lang[ '8csrsik' ];
}
else
{
$marker_2 = '';
}
}
}
else
{
$marker_2 = '';
}
// Clan. Bold it.
$template->assign_block_vars ( 'block_rounds.block_data', array (
'L_MARKER' => $marker_2,
'L_CONFLICT' => ( !empty ( $clans2[ $ids[ 0 ] ] ) ) ? $conflict : '',
'U_MARKER' => ( !empty ( $clans2[ $ids[ 0 ] ] ) ) ? $marker : '',
'S_DATA' => '' . $clans2[ $ids[ 0 ] ] . '',
'S_COLOR' => 'row2' )
);
}
}
$i++;
}
// Generate the brackets again, but tell the function to subtract.
$this->generate_brackets ( true );
// Based on tournament direction, will this go from left to right or right to left?
$this->rounds_widths = ( $this->data[ 'tournament_direction' ] == 0 ) ? $this->rounds_widths : array_reverse ( $this->rounds_widths );
$this->rounds_list = ( $this->data[ 'tournament_direction' ] == 0 ) ? $this->rounds_list : array_reverse ( $this->rounds_list );
$this->rounds_array = ( $this->data[ 'tournament_direction' ] == 0 ) ? $this->rounds_array : array_reverse ( $this->rounds_array );
$i = 0;
$clans2 = array ( );
// Go though each clan in the tournament and get their position.
foreach ( explode ( '|', $this->data[ 'tournament_clans2' ] ) AS $clans )
{
$stage = explode ( ':', $clans );
foreach ( $stage AS $eclan )
{
// Get their clan's name.
$clans2[ $stage[ 1 ] ] = $clan->data ( 'clan_name', $stage[ 0 ] );
$stages[ $clans2[ $stage[ 1 ] ] ] = $stage[ 0 ];
}
}
$clans2 = ( $this->data[ 'tournament_direction' ] == 0 ) ? $clans2 : array_reverse ( $clans2 );
$in_bracket = array ( );
foreach ( $this->rounds_array AS $round )
{
// Tell the template system to add a new colume of rounds with the table widths and round name/number.
$template->assign_block_vars ( 'block_rounds2', array (
'S_ROUNDWIDTH' => $this->rounds_widths[ $this->rounds_list[ $i ] ],
'S_ROUND' => $this->rounds_list[ $i ] )
);
foreach ( $round AS $ids )
{
// Is this a clan or game?
if ( empty ( $ids[ 0 ] ) || strstr ( $ids[ 0 ], 'Game' ) )
{
// Game, italics it.
$template->assign_block_vars ( 'block_rounds2.block_data2', array (
'S_DATA' => '' . $ids[ 0 ] . '',
'S_COLOR' => 'row1' )
);
}
else
{
// Admin mode ?
if ( $admin == true )
{
// Test and see if they have a matchup.
$test = $this->get_matchup ( $matchup_array, $clans2[ $ids[ 0 ] ], 1 );
if ( strlen ( $test ) > 0 || $test == true )
{
$explode = explode ( '_', $ids[ 0 ] );
// Check for conflicting reports.
$sql = 'SELECT * FROM ' . TOURNAMENT_REPORTS . ' WHERE (clan_1 = "' . $clans2[ $ids[ 0 ] ] . '" OR clan_2 = "' . $clans2[ $ids[ 0 ] ] . '") AND (clan_1 = "' . $test . '" OR clan_2 = "' . $test . '") AND report_tournament = ' . $this->data[ 'tournament_id' ];
$result = $db->sql_query ( $sql );
$row = $db->sql_fetchrow ( $result );
// Have both clans reported ?
if ( !empty ( $row[ 'clan_r1' ] ) && !empty ( $row[ 'clan_r2' ] ) )
{
// Yes, check if they both reported the same thing.
if ( $row[ 'clan_r1' ] != $row[ 'clan_r2' ] )
{
// They did not, they are OK for processing.
$conflict = sprintf ( $lang[ 'no_conflict' ], ( $row[ 'clan_r1' ] == 'win' ) ? $row[ 'clan_1' ] : $row[ 'clan_2' ] );
}
else
{
// Uh oh!, a conflict in reports.
$conflict = $lang[ 'conflict' ];
}
}
else
{
// Who did not report ?
if ( empty ( $row[ 'clan_r1' ] ) && empty ( $row[ 'clan_r2' ] ) )
{
// No one has reported yet.
$who = $lang[ 'no_body' ];
}
else
{
// See who it is ...
$who = ( !empty ( $row[ 'clan_r1' ] ) ) ? $row[ 'clan_2' ] : $row[ 'clan_1' ];
}
$conflict = sprintf ( $lang[ 'conflict_who' ], $who );
}
$marker = append_sid ( 'rivals.php?module=acp&sub_module=acpeditbrackets&type=1&report_id=' . $row[ 'report_id' ] );
}
else
{
$marker = append_sid ( 'rivals.php?module=acp&sub_module=acpeditbrackets&type=2&report_id=' . $clans2[ $ids[ 0 ] ] );
}
}
if ( !empty ( $clans2[ $ids[ 0 ] ] ) )
{
if ( $lang[ 'conflict' ] == $conflict )
{
$marker_2 = '';
}
else
{
if ( $row[ 'clan_r1' ] == 'win' && $clans2[ $ids[ 0 ] ] == $row[ 'clan_1' ] )
{
$marker_2 = $lang[ '8csrsik' ];
}
else if ( $row[ 'clan_r2' ] == 'win' && $clans2[ $ids[ 0 ] ] == $row[ 'clan_2' ] )
{
$marker_2 = $lang[ '8csrsik' ];
}
else
{
$marker_2 = '';
}
}
}
else
{
$marker_2 = '';
}
// Clan. Bold it.
$template->assign_block_vars ( 'block_rounds2.block_data2', array (
'L_MARKER' => $marker_2,
'L_CONFLICT' => ( !empty ( $clans2[ $ids[ 0 ] ] ) ) ? $conflict : '',
'U_MARKER' => ( !empty ( $clans2[ $ids[ 0 ] ] ) ) ? $marker : '',
'S_DATA' => '' . $clans2[ $ids[ 0 ] ] . '',
'S_COLOR' => 'row2' )
);
}
}
$i++;
}
// Get the winners and losers.
$dblw = ( !empty ( $this->data[ 'tournament_dblw' ] ) ) ? $clan->data ( 'clan_name', $this->data[ 'tournament_dblw' ] ) : 'N/A';
$dbllw = ( !empty ( $this->data[ 'tournament_dbllw' ] ) ) ? $clan->data ( 'clan_name', $this->data[ 'tournament_dbllw' ] ) : 'N/A';
$winner = ( !empty ( $this->data[ 'tournament_winner' ] ) ) ? $clan->data ( 'clan_name', $this->data[ 'tournament_winner' ] ) : 'N/A';
// Assign them to the template.
$template->assign_block_vars ( 'block_winners', array (
'S_DBLW' => $dblw,
'S_DBLLW' => $dbllw,
'S_WINNER' => $winner,
'L_RESULTS' => $lang[ 'rivals_186' ] )
);
$template->assign_vars ( array (
'S_WINNERBRACKET' => $lang[ 'rivals_iwiom' ],
'S_LOOSERBRACKET' => $lang[ 'rivals_iwiop' ] )
);
}
}
}
?>