Added Extended Leaders Block
This commit is contained in:
@@ -35,6 +35,12 @@ $lang = array_merge($lang, array(
|
|||||||
'NO_MODERATORS_P' => 'No Moderators',
|
'NO_MODERATORS_P' => 'No Moderators',
|
||||||
'NO_GROUPS_P' => 'No Groups',
|
'NO_GROUPS_P' => 'No Groups',
|
||||||
'ACP_PORTAL_LEADERS' => 'The Team',
|
'ACP_PORTAL_LEADERS' => 'The Team',
|
||||||
|
|
||||||
|
// ACP
|
||||||
|
'ACP_PORTAL_LEADERS' => 'Team Settings',
|
||||||
|
'ACP_PORTAL_LEADERS_EXP' => 'This is where you customize the team block',
|
||||||
|
'PORTAL_LEADERS_EXT' => 'Extended Leaders / Team',
|
||||||
|
'PORTAL_LEADERS_EXT_EXP' => 'The standard block lists all admins/mods, while the extended block includes all non-hidden groups with a legend.',
|
||||||
));
|
));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @package Portal - User Menu
|
* @package Portal - Leaders
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) 2009, 2010 Board3 Portal Team
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
@@ -15,7 +15,7 @@ if (!defined('IN_PHPBB'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package Modulname
|
* @package Leaders
|
||||||
*/
|
*/
|
||||||
class portal_leaders_module
|
class portal_leaders_module
|
||||||
{
|
{
|
||||||
@@ -46,26 +46,108 @@ class portal_leaders_module
|
|||||||
*/
|
*/
|
||||||
var $language = 'portal_leaders_module';
|
var $language = 'portal_leaders_module';
|
||||||
|
|
||||||
function get_template_center($module_id)
|
|
||||||
{
|
|
||||||
global $config, $template;
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'EXAMPLE' => $config['portal_configname'],
|
|
||||||
));
|
|
||||||
|
|
||||||
return 'modulename_center.html';
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_template_side($module_id)
|
function get_template_side($module_id)
|
||||||
{
|
{
|
||||||
global $config, $template, $user, $auth, $db, $phpEx;
|
global $config, $template, $user, $auth, $db, $phpEx, $phpbb_root_path;
|
||||||
|
|
||||||
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
|
|
||||||
|
|
||||||
// Display a listing of board admins, moderators
|
// Display a listing of board admins, moderators
|
||||||
$user->add_lang('groups');
|
$user->add_lang('groups');
|
||||||
|
|
||||||
|
if($config['board3_leaders_ext'])
|
||||||
|
{
|
||||||
|
$legends = array();
|
||||||
|
$groups = array();
|
||||||
|
|
||||||
|
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||||
|
{
|
||||||
|
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
||||||
|
FROM ' . GROUPS_TABLE . '
|
||||||
|
WHERE group_legend = 1
|
||||||
|
ORDER BY group_name ASC';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
|
||||||
|
FROM ' . GROUPS_TABLE . ' g
|
||||||
|
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
||||||
|
ON (
|
||||||
|
g.group_id = ug.group_id
|
||||||
|
AND ug.user_id = ' . $user->data['user_id'] . '
|
||||||
|
AND ug.user_pending = 0
|
||||||
|
)
|
||||||
|
WHERE g.group_legend = 1
|
||||||
|
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
|
||||||
|
ORDER BY g.group_name ASC';
|
||||||
|
}
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$groups[$row['group_id']] = array(
|
||||||
|
'group_name' => $row['group_name'],
|
||||||
|
'group_colour' => $row['group_colour'],
|
||||||
|
'group_type' => $row['group_type'],
|
||||||
|
'group_users' => array(),
|
||||||
|
);
|
||||||
|
$legends[] = $row['group_id'];
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if(sizeof($legends))
|
||||||
|
{
|
||||||
|
$sql = 'SELECT
|
||||||
|
u.user_id AS user_id, u.username AS username, u.user_colour AS user_colour, ug.group_id AS group_id
|
||||||
|
FROM
|
||||||
|
' . USERS_TABLE . ' AS u,
|
||||||
|
' . USER_GROUP_TABLE . ' AS ug
|
||||||
|
WHERE
|
||||||
|
ug.user_id = u.user_id
|
||||||
|
AND '. $db->sql_in_set('ug.group_id', $legends) . '
|
||||||
|
ORDER BY u.username ASC';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$groups[$row['group_id']]['group_users'][] = array(
|
||||||
|
'user_id' => $row['user_id'],
|
||||||
|
'username' => $row['username'],
|
||||||
|
'user_colour' => $row['user_colour'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sizeof($groups))
|
||||||
|
{
|
||||||
|
foreach($groups as $group_id => $group)
|
||||||
|
{
|
||||||
|
if(sizeof($group['group_users']))
|
||||||
|
{
|
||||||
|
$group_name = ($group['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group['group_name']] : $group['group_name'];
|
||||||
|
$u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $group_id);
|
||||||
|
|
||||||
|
$template->assign_block_vars('group', array(
|
||||||
|
'GROUP_NAME' => $group_name,
|
||||||
|
'GROUP_COLOUR' => $group['group_colour'],
|
||||||
|
'U_GROUP' => $u_group,
|
||||||
|
));
|
||||||
|
|
||||||
|
foreach($group['group_users'] as $group_user)
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('group.member', array(
|
||||||
|
'USER_ID' => $group_user['user_id'],
|
||||||
|
'USERNAME_FULL' => get_username_string('full', $group_user['user_id'], $group_user['username'], $group_user['user_colour']),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'leaders_ext_side.html';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
|
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
|
||||||
|
|
||||||
$admin_id_ary = $mod_id_ary = $forum_id_ary = array();
|
$admin_id_ary = $mod_id_ary = $forum_id_ary = array();
|
||||||
@@ -182,18 +264,17 @@ class portal_leaders_module
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
return 'leaders_side.html';
|
return 'leaders_side.html';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function get_template_acp($module_id)
|
function get_template_acp($module_id)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'title' => 'ACP_PORTAL_LEADERS',
|
'title' => 'ACP_PORTAL_LEADERS',
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
/*'legend1' => 'ACP_MODULENAME_CONFIGLEGEND',
|
'legend1' => 'ACP_PORTAL_LEADERS',
|
||||||
'portal_configname' => array('lang' => 'MODULENAME_CONFIGNAME', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => false),
|
'board3_leaders_ext' => array('lang' => 'PORTAL_LEADERS_EXT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'portal_configname2' => array('lang' => 'MODULENAME_CONFIGNAME2', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),*/
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -203,7 +284,8 @@ class portal_leaders_module
|
|||||||
*/
|
*/
|
||||||
function install($module_id)
|
function install($module_id)
|
||||||
{
|
{
|
||||||
// nothing
|
// Show normal team block by default
|
||||||
|
set_config('board3_leaders_ext', 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,8 +293,11 @@ class portal_leaders_module
|
|||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
// nothing
|
$del_config = array(
|
||||||
|
'board3_leaders_ext',
|
||||||
|
);
|
||||||
|
$sql = 'DELETE FROM ' . CONFIG_TABLE . '
|
||||||
|
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||||
return $db->sql_query($sql);
|
return $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<!--version $Id$ //-->
|
||||||
|
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_THEME_PATH}/images/portal/portal_team.png" width="16" height="16" alt="" /> <!-- ENDIF -->{L_THE_TEAM}{$LR_BLOCK_H_R}
|
||||||
|
<!-- BEGIN group -->
|
||||||
|
<strong><a href="{group.U_GROUP}" style="color: #{group.GROUP_COLOUR};" class="username-coloured">{group.GROUP_NAME}</a></strong><br />
|
||||||
|
<!-- BEGIN member -->
|
||||||
|
<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><br style="clear:both" />
|
||||||
|
<!-- END member -->
|
||||||
|
<br style="clear:both" />
|
||||||
|
<!-- BEGINELSE -->
|
||||||
|
{L_NO_GROUPS_P}
|
||||||
|
<!-- END group -->
|
||||||
|
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||||
Reference in New Issue
Block a user