Habe mir einen Overview Block geschrieben mit Bezug auf den phpBB3-MOD Point MOD 3.0.1
---> http://phpbb3hacks.com/modifications.php?name=Points (Hoffe es macht nichts, das ich zur veranschaulischung meines Problems den MOD verlinkt hab.
Jetzt hab ich nen Simplen Blockgeschrieben, der keine Configurationen haben soll (Pseydo-Config) und im Portal in einer Box eine Liste der Member mit den jeweiligen Punkten ausgeben soll. Den Quelltext habe ich von dem MOD-Forum.
Hier meine block-codes:
point_3_0_1_block.html
Code: Select all
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
<!-- START POINT BLOCK -->
<span>
{user_points.USERNAME} - {user_points.POINTS}
</span>
<!-- END POINT BLOCK -->
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
Code: Select all
<?php
/**
*
* @package Board3 Portal v2 - Default
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @block by Annô - hardware4gamer.de
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package Point MOD board3 block
*/
class point_1_0_3_block_module
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
* top 1
* left 2
* center 4
* right 8
* bottom 16
*/
public $columns = 10;
/**
* Default Point MOD board3 block
*/
public $name = 'Point MOD';
/**
* Default module-image:
* file must be in "{T_THEME_PATH}/images/portal/"
*/
public $image_src = '';
/**
* module-language file
* file must be in "language/{$user->lang}/mods/portal/"
*/
public $language = 'point_1_0_3_block';
/**
* custom acp template
* file must be in "adm/style/portal/"
*/
public $custom_acp_tpl = '';
/**
* hide module name in ACP configuration page
*/
public $hide_name = true;
public function get_template_center($module_id)
{
global $sql_array, $template, $sql, $result, $row, $db;
// Load the user points
$sql_array = array(
'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_points',
'FROM' => array(
USERS_TABLE => 'u',
),
'WHERE' => 'u.user_points > 0 AND u.user_type <> 2',
'ORDER_BY' => 'u.user_points DESC',
);
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql);
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('user_points', array(
'USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'POINTS' => $row['user_points'],
));
}
$db->sql_freeresult($result);
return 'point_1_0_3_block.html';
}
public function get_template_side($module_id)
{
global $sql_array, $template, $sql, $result, $row, $db;
// Load the user points
$sql_array = array(
'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_points',
'FROM' => array(
USERS_TABLE => 'u',
),
'WHERE' => 'u.user_points > 0 AND u.user_type <> 2',
'ORDER_BY' => 'u.user_points DESC',
);
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql);
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('user_points', array(
'USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'POINTS' => $row['user_points'],
));
}
return 'point_1_0_3_block.html';
}
public function get_template_acp($module_id)
{
return array(
'title' => 'ACP_CONFIG_MODULENAME',
'vars' => array(
'legend1' => 'ACP_MODULENAME_CONFIGLEGEND',
'board3_configname_' . $module_id => array('lang' => 'MODULENAME_CONFIGNAME', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => false),
'board3_configname2_' . $module_id => array('lang' => 'MODULENAME_CONFIGNAME2', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
),
);
}
/**
* API functions
*/
public function install($module_id)
{
set_config('board3_configname_' . $module_id, 'point_1_0_3_block');
set_config('board3_configname2_' . $module_id, 1.0);
return true;
}
public function uninstall($module_id)
{
global $db;
$del_config = array(
'board3_configname_' . $module_id,
'board3_configname2_' . $module_id,
);
$sql = 'DELETE FROM ' . CONFIG_TABLE . '
WHERE ' . $db->sql_in_set('config_name', $del_config);
return $db->sql_query($sql);
}
}
Habe auch die HTML in mein template unter den gegebenen Ordnern gezogen.