Arcade Toolbar Block

Started by Chen Zhen, July 06, 2013, 03:19:22 PM

previous topic - next topic

Chen Zhen

SMF ARCADE v2.5 - PHP Portal Block - Toolbar


Create a php block titled: Arcade Toolbar

Put the following code in it:
Code Select

/*  SMF Arcade v2.5 Toolbar  */
/* c/o Underdog @askusaquestion.net */
/* For use with a php portal block or insert into your arcade template  */


global $boardurl, $scripturl, $context, $modSettings;
$id_of_game = !empty($_REQUEST['game']) ? (int) $_REQUEST['game'] : 0;
$image_width = 30;
$image_height = 30;

$tab='<td class="windowbg2" nowrap="nowrap" style="cursor: pointer; font-size: 11px; padding: 6px 10px 6px 10px;  border: solid 1px #ADADAD;border-top: 0px; border-bottom:0px; border-left:0px;text-align:center;vertical-align:top;" onmouseover="this.style.backgroundPosition=\'0 -5px\'" onmouseout="this.style.backgroundPosition=\'0 0px\'">';       
$viewit = '
<table  summary="arcade_toolbar" cellpadding="0" cellspacing="0" border="0" style="overflow:hidden; position: absolute;">
<tr valign="top" align="left">';
$viewit .=$tab.'<a href="'.$boardurl.'/index.php?action=arcade;sort=name;desc=DESC"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_home.jpg" width='.$image_width.' height='.$image_height.' title="Arcade Home" alt="" /></a></td>';
$viewit .=$tab.'<a href="'.$boardurl.'/index.php?action=arcade;sa=stats"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_stats.jpg" width='.$image_width.' height='.$image_height.'  title="Statistics" alt="" /></a></td>';
if (AllowedTo('arcade_admin'))
{
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=arcade;sa=main;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_admin.jpg" width='.$image_width.' height='.$image_height.'  title="Admin Arcade" alt="" /></a></td>';

$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=managegames;sa=main;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_edit.jpg" width='.$image_width.' height='.$image_height.'  title="Edit Games" alt="" /></a></td>';

$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=arcadecategory;sa=list;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/category.jpg"width='.$image_width.' height='.$image_height.'  title="Categories" alt="" /></a></td>';

$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=arcademaintenance;sa=main;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/maintain.jpg" width='.$image_width.' height='.$image_height.'  title="Maintenance" alt="" /></a></td>';
}
if (($context['user']['is_guest']) == false)
{
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;sa=arena;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arena.jpg" width='.$image_width.' height='.$image_height.'  title="Arena" alt="" /></a></td>';
if(empty($modSettings['arcadeEnableDownload'])) {$modSettings['arcadeEnableDownload'] = false;}
if ((AllowedTo('arcade_download')) && ($modSettings['arcadeEnableDownload'] == true))
{$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;sa=download;game='.$id_of_game.'"><img src="'.$boardurl.'/Themes/default/images/arc_icons/download.jpg" width='.$image_width.' height='.$image_height.'  title="Download" alt="" /></a></td>';}
}
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;sort=plays;desc=DESC"><img src="'.$boardurl.'/Themes/default/images/arc_icons/most_played.gif" width='.$image_width.' height='.$image_height.'  title="Most Popular" alt="" /></a></td>';

if (($context['user']['is_guest']) == false)
{
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;favorites"><img src="'.$boardurl.'/Themes/default/images/arc_icons/favorites.gif" width='.$image_width.' height='.$image_height.'  title="Favorites" alt="" /></a></td>';
}

$viewit .= '<td class="windowbg2" nowrap="nowrap" style="cursor: pointer; font-size: 11px; padding: 6px 10px 6px 10px;  border-top: 0px; border-bottom:0px; border-left:0px;text-align:center;vertical-align:top;"><a href="'.$boardurl.'/index.php?action=arcade;sort=age;desc=DESC"><img src="'.$boardurl.'/Themes/default/images/arc_icons/newgames.gif" width='.$image_width.' height='.$image_height.'  title="New Games" alt="" /></a></td>';

$viewit .= '</tr></table><br /><br /><br />';

echo $viewit;


-----------------------------------------------------------------------------------------------------------------


For 'Display Options' choose advanced and set custom display to:
~action|arcade

Download the attachment - unzip it on your pc/mac and upload all the images into:
/ Themes / default / images / arc_icons
(Create the folder if it doesn't exist)