1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 11:44:08 +02:00

Changes to group display #32155, #32145, #32085, #26675, #26265

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8755 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof
2008-08-14 12:36:06 +00:00
parent b0c45b18f1
commit bbf42daf34
6 changed files with 105 additions and 44 deletions

View File

@@ -1326,7 +1326,7 @@ switch ($mode)
$user_list[] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
$leaders_set = false;
// So, did we get any users?
if (sizeof($user_list))
{
@@ -1386,15 +1386,16 @@ switch ($mode)
// If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
if ($sort_key == 'l')
{
$lesser_than = ($sort_dir == 'a') ? -1 : 1;
// uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));"));
usort($user_list, create_function('$first, $second', "global \$id_cache; return (\$id_cache[\$first]['last_visit'] == \$id_cache[\$second]['last_visit']) ? 0 : ((\$id_cache[\$first]['last_visit'] < \$id_cache[\$second]['last_visit']) ? $lesser_than : ($lesser_than * -1));"));
usort($user_list, '_sort_last_active');
}
for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
{
$user_id = $user_list[$i];
$row =& $id_cache[$user_id];
$is_leader = (isset($row['group_leader']) && $row['group_leader']) ? true : false;
$leaders_set = ($leaders_set || $is_leader);
$cp_row = array();
if ($config['load_cpf_memberlist'])
@@ -1406,7 +1407,7 @@ switch ($mode)
'ROW_NUMBER' => $i + ($start + 1),
'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,
'S_GROUP_LEADER' => (isset($row['group_leader']) && $row['group_leader']) ? true : false,
'S_GROUP_LEADER' => $is_leader,
'U_VIEW_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $user_id))
);
@@ -1466,6 +1467,7 @@ switch ($mode)
'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
'S_VIEWONLINE' => $auth->acl_get('u_viewonline'),
'S_LEADERS_SET' => $leaders_set,
'S_MODE_SELECT' => $s_sort_key,
'S_ORDER_SELECT' => $s_sort_dir,
'S_CHAR_OPTIONS' => $s_char_options,
@@ -1596,4 +1598,24 @@ function show_profile($data)
);
}
function _sort_last_active($first, $second)
{
global $id_cache, $sort_dir;
$lesser_than = ($sort_dir === 'a') ? -1 : 1;
if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader']))
{
return 1;
}
else if (isset($id_cache[$second]['group_leader']) && (!isset($id_cache[$first]['group_leader']) || !$id_cache[$first]['group_leader']) && $id_cache[$second]['group_leader'])
{
return -1;
}
else
{
return $lesser_than * (int) ($id_cache[$first]['last_visit'] - $id_cache[$second]['last_visit']);
}
}
?>