Added latest bots block
This commit is contained in:
44
root/language/en/mods/portal/portal_latest_bots_module.php
Normal file
44
root/language/en/mods/portal/portal_latest_bots_module.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Portal - Latest Bots
|
||||
* @version $Id$
|
||||
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*/
|
||||
|
||||
/**
|
||||
* DO NOT CHANGE
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($lang) || !is_array($lang))
|
||||
{
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
// DEVELOPERS PLEASE NOTE
|
||||
//
|
||||
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
|
||||
//
|
||||
// Placeholders can now contain order information, e.g. instead of
|
||||
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
|
||||
// translators to re-order the output of data while ensuring it remains correct
|
||||
//
|
||||
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
|
||||
// equally where a string contains only two placeholders which are used to wrap text
|
||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||
$lang = array_merge($lang, array(
|
||||
'LATEST_BOTS' => 'Latest Bots',
|
||||
'LAST_VISITED_BOTS' => 'Last %s visited bots',
|
||||
|
||||
// ACP
|
||||
'ACP_PORTAL_BOTS_SETTINGS' => 'Visiting bots settings',
|
||||
'ACP_PORTAL_BOTS_SETTINGS_EXP' => 'This is where you customize the visiting bots block.',
|
||||
'PORTAL_LAST_VISITED_BOTS_NUMBER' => 'How many bots to display',
|
||||
'PORTAL_LAST_VISITED_BOTS_NUMBER_EXP' => '0 means infinite',
|
||||
));
|
||||
|
||||
?>
|
||||
125
root/portal/modules/portal_latest_bots.php
Normal file
125
root/portal/modules/portal_latest_bots.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Portal - Latest Bots
|
||||
* @version $Id$
|
||||
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @package Latest Bots
|
||||
*/
|
||||
class portal_latest_bots_module
|
||||
{
|
||||
/**
|
||||
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||
* top 1
|
||||
* left 2
|
||||
* center 4
|
||||
* right 8
|
||||
* bottom 16
|
||||
*/
|
||||
var $columns = 10;
|
||||
|
||||
/**
|
||||
* Default modulename
|
||||
*/
|
||||
var $name = 'LATEST_BOTS';
|
||||
|
||||
/**
|
||||
* Default module-image:
|
||||
* file must be in "{T_THEME_PATH}/images/portal/"
|
||||
*/
|
||||
var $image_src = 'portal_bots.png';
|
||||
|
||||
/**
|
||||
* module-language file
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
var $language = 'portal_latest_bots_module';
|
||||
|
||||
function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template, $db, $user;
|
||||
|
||||
// Last x visited bots
|
||||
$sql = 'SELECT username, user_colour, user_lastvisit
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type = ' . USER_IGNORE . '
|
||||
ORDER BY user_lastvisit DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['board3_last_visited_bots_number']);
|
||||
$first = true;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!$row['user_lastvisit'] && $first == true)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LAST_BOTS' => false,
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_var('S_DISPLAY_LAST_BOTS', true);
|
||||
|
||||
if($row['user_lastvisit'] > 0)
|
||||
{
|
||||
$template->assign_block_vars('last_visited_bots', array(
|
||||
'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']),
|
||||
'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']),
|
||||
));
|
||||
}
|
||||
}
|
||||
$first = false;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'LAST_VISITED_BOTS' => sprintf($user->lang['LAST_VISITED_BOTS'], $config['board3_last_visited_bots_number']),
|
||||
));
|
||||
|
||||
return 'latest_bots_side.html';
|
||||
}
|
||||
|
||||
function get_template_acp($module_id)
|
||||
{
|
||||
return array(
|
||||
'title' => 'ACP_PORTAL_BOTS_SETTINGS',
|
||||
'vars' => array(
|
||||
'legend1' => 'ACP_PORTAL_BOTS_SETTINGS',
|
||||
'board3_last_visited_bots_number' => array('lang' => 'PORTAL_LAST_VISITED_BOTS_NUMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* API functions
|
||||
*/
|
||||
function install($module_id)
|
||||
{
|
||||
set_config('board3_last_visited_bots_number', 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
function uninstall($module_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$del_config = array(
|
||||
'board3_last_visited_bots_number',
|
||||
);
|
||||
$sql = 'DELETE FROM ' . CONFIG_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,7 @@
|
||||
<!--version $Id$ //-->
|
||||
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_THEME_PATH}/images/portal/portal_bots.png" width="16" height="16" alt="" /> <!-- ENDIF -->{LAST_VISITED_BOTS}{$LR_BLOCK_H_R}
|
||||
<!-- BEGIN last_visited_bots -->
|
||||
<span class="genmed">{last_visited_bots.BOT_NAME}</span> <br /> <span class="gensmall">{last_visited_bots.LAST_VISIT_DATE}</span>
|
||||
<!-- IF not last_visited_bots.S_LAST_ROW --><hr /><!-- ENDIF -->
|
||||
<!-- END last_visited_bots -->
|
||||
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||
BIN
root/styles/prosilver/theme/images/portal/portal_bots.png
Normal file
BIN
root/styles/prosilver/theme/images/portal/portal_bots.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 964 B |
Reference in New Issue
Block a user