Okay I did it... and is cool...really wanted this block.
Will do my best to explain how but warn you I have not done any coding and work purely on logic...
If I make a mistake please point it out as it helps in the learning process...
lets start with arcade.php
create a new file in root/portal/block/ named arcade.php
Fill it with this code:
Code: Select all
<?php
if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
{
die('Hacking attempt');
exit;
}
if (file_exists($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx))
{
include($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx);
$arcade = new arcade(false);
// Start of Top 3 Arcade Players
$real_leaders_count = sizeof($arcade->leaders);
$leaders_count = ($real_leaders_count > 3) ? 3 : $real_leaders_count;
$arcade_leaders_img = array();
$arcade_leaders_img[0] = '';
$arcade_leaders_img[1] = $phpbb_root_path . $arcade->config['image_path'] . '1st.gif';
$arcade_leaders_img[2] = $phpbb_root_path . $arcade->config['image_path'] . '2nd.gif';
$arcade_leaders_img[3] = $phpbb_root_path . $arcade->config['image_path'] . '3rd.gif';
$arcade_leaders_img_alt = array();
$arcade_leaders_img_alt[0] = '';
$arcade_leaders_img_alt[1] = $user->lang['ARCADE_FIRST'];
$arcade_leaders_img_alt[2] = $user->lang['ARCADE_SECOND'];
$arcade_leaders_img_alt[3] = $user->lang['ARCADE_THIRD'];
if ($leaders_count > 0)
{
$rank = 0;
$actual_rank = 0;
$previous_wins = 0;
for ($i = 0; $i < $leaders_count; $i++)
{
//This code is used to calculate the actual rank.
//For example if there are ties...
$actual_rank++;
if ($previous_wins != $arcade->leaders[$i]['total_wins'])
{
$rank = $actual_rank;
}
$previous_wins = $arcade->leaders[$i]['total_wins'];
$user_link = $arcade->format_username('full', $arcade->leaders[$i]['user_id'], $arcade->leaders[$i]['username'], $arcade->leaders[$i]['user_colour']);
$template->assign_block_vars('arcade_leaders', array(
'ARCADE_LEADERS_RANK' => $rank,
'ARCADE_LEADERS' => $user_link,
'ARCADE_LEADERS_IMAGE' => (isset($arcade_leaders_img[$rank])) ? $arcade_leaders_img[$rank] : '',
'ARCADE_LEADERS_IMAGE_ALT' => (isset($arcade_leaders_img_alt[$rank])) ? $arcade_leaders_img_alt[$rank] : '',
'VICTORIES' => $arcade->leaders[$i]['total_wins']
));
}
}
// End of Top 3 Arcade Players
//Newest Game
if (sizeof($arcade->newest_games))
{
$template->assign_vars(array(
'S_HAS_NEWEST_GAME' => true,
'U_NEWEST_GAME_PLAY' => append_sid("{$phpbb_root_path}arcade.$phpEx", 'mode=play&g=' . $arcade->newest_games[0]['game_id']),
'NEWEST_GAME_IMAGE' => ($arcade->newest_games[0]['game_image'] != '') ? $phpbb_root_path . "arcade.$phpEx?img=" . $arcade->newest_games[0]['game_image'] : '',
'NEWEST_GAME_NAME' => $arcade->newest_games[0]['game_name'],
));
}
//Newest Game
//Total Games, Time and Plays
$total_games = sizeof($arcade->games);
if ($total_games > 1)
{
$total_games = sprintf($user->lang['ARCADE_TOTAL_GAMES'], $total_games);
}
else if ($total_games == 1)
{
$total_games = sprintf($user->lang['ARCADE_TOTAL_GAME'], $total_games);
}
$template->assign_vars(array(
'S_DISPLAY_ARCADE' => true,
'TOTAL_GAMES_PLAYED' => ($arcade->totals['games_played']) ? sprintf($user->lang['ARCADE_TOTAL_PLAYED'], $arcade->totals['games_played'], $arcade->format_time($arcade->totals['games_time'])) : '',
'TOTAL_GAMES' => $total_games,
));
//Total Games
}
?>
create a new file in root/styles/prosilver/template/portal/block/ named arcade.html
Fill it with this code:
Code: Select all
<h3>Arcade Stats</h3>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<!-- IF S_HAS_NEWEST_GAME -->
<p style="margin: 4px;"><!-- IF NEWEST_GAME_IMAGE --><a href="{U_NEWEST_GAME_PLAY}">Newest Game:<br /><img src="{NEWEST_GAME_IMAGE}" alt="{NEWEST_GAME_NAME}" width="20" height="20" style="vertical-align: middle;" /></a><!-- ENDIF --> {NEWEST_GAME_NAME}</p>
<!-- ENDIF -->
<!-- IF .arcade_leaders -->
<br />
<div>
<b>{L_ARCADE_LEADERS_HEADER}</b><br />
<!-- BEGIN arcade_leaders -->
<!-- IF arcade_leaders.S_ROW_COUNT > 0 --> <!-- ENDIF --><!-- IF arcade_leaders.ARCADE_LEADERS_IMAGE --><img src="{arcade_leaders.ARCADE_LEADERS_IMAGE}" alt="{arcade_leaders.ARCADE_LEADERS_IMAGE_ALT}" style="vertical-align: middle;" /><!-- ENDIF --> {arcade_leaders.ARCADE_LEADERS_RANK}: {arcade_leaders.ARCADE_LEADERS} ({arcade_leaders.VICTORIES})
<!-- END arcade_leaders -->
</div>
<!-- ENDIF -->
<!-- IF TOTAL_GAMES -->
<br />
<p style="font-size: 12px;">{TOTAL_GAMES}<br />{TOTAL_GAMES_PLAYED}</p>
<!-- ENDIF -->
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
Now go to styles/prosilver/template/portal/portal_body.html
and find
Code: Select all
<!-- IF not S_IS_BOT and S_USER_LOGGED_IN and S_ZEBRA_ENABLED and S_DISPLAY_FRIENDS -->
<!-- INCLUDE portal/block/online_friends.html -->
<!-- ENDIF -->
Add after on a new line
Code: Select all
<!-- IF S_DISPLAY_ARCADE -->
<!-- INCLUDE portal/block/arcade.html -->
<!-- ENDIF -->
Now this is the bit that I figured out
open up: includes/acp/acp_portal.php
and find
Code: Select all
'portal_clock' => array('lang' => 'PORTAL_CLOCK' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
Add before on a new line:
Code: Select all
'portal_arcade' => array('lang' => 'PORTAL_ARCADE' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
Open up: language/en/mods/lang_portal_acp.php
and find
Code: Select all
'PORTAL_LEADERS_EXPLAIN' => 'Display this block on portal.',
After on a new line add
Code: Select all
'PORTAL_ARCADE' => 'Arcade block',
'PORTAL_ARCADE_EXPLAIN' => 'Display this block on portal.',
Now open up portal.php
and find
Code: Select all
if ($portal_config['portal_change_style'])
{
include($phpbb_root_path . 'portal/block/change_style.'.$phpEx);
}
add after on a new line
Code: Select all
if ($portal_config['portal_arcade'])
{
include($phpbb_root_path . 'portal/block/arcade.'.$phpEx);
$template->assign_vars(array(
'S_DISPLAY_ARCADE' => true,
));
}
Okay thats the code part done.
now go to acp and refresh your styles template
then go to Admin control panel/mods/portal and enter portal general settings click box to display arcade... and submit
Thats it should work and is working on mine...
let me know ok
