From 7dc179826d1f11f1030a2d4ad7799e6c8fcbfac2 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 29 Nov 2001 00:47:51 +0000 Subject: Enable pagination for usergroup listing, a little crude but never mind git-svn-id: file:///svn/phpbb/trunk@1469 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/groupcp.php | 201 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 139 insertions(+), 62 deletions(-) (limited to 'phpBB') diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php index c5c1bf29c5..c4fc66c90f 100644 --- a/phpBB/groupcp.php +++ b/phpBB/groupcp.php @@ -553,6 +553,19 @@ else if( $group_id ) } $group_info = $db->sql_fetchrow($result); + // + // Get moderator details for this group + // + $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm + FROM " . USERS_TABLE . " + WHERE user_id = " . $group_info['group_moderator']; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Error getting user list for group", "", __LINE__, __FILE__, $sql); + } + + $group_moderator = $db->sql_fetchrow($result); + // // Get user information for this group // @@ -560,9 +573,9 @@ else if( $group_id ) FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND u.user_id = ug.user_id - AND ug.user_pending = 0 - ORDER BY u.user_regdate - LIMIT $start, " . $board_config['topics_per_page']; + AND ug.user_pending = 0 + AND ug.user_id <> " . $group_moderator['user_id'] . " + ORDER BY u.username"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Error getting user list for group", "", __LINE__, __FILE__, $sql); @@ -579,7 +592,7 @@ else if( $group_id ) AND g.group_id = ug.group_id AND ug.user_pending = 1 AND u.user_id = ug.user_id - ORDER BY u.user_regdate"; + ORDER BY u.username"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Error getting user pending information", "", __LINE__, __FILE__, $sql); @@ -684,6 +697,67 @@ else if( $group_id ) ); $template->assign_var_from_handle("JUMPBOX", "jumpbox"); + // + // Add the moderator + // + $username = $group_moderator['username']; + $user_id = $group_moderator['user_id']; + $from = $group_moderator['user_from']; + + $joined = create_date($board_config['default_dateformat'], $group_moderator['user_regdate'], $board_config['board_timezone']); + + $posts = ($group_moderator['user_posts']) ? $group_moderator['user_posts'] : 0; + + $profile_img = "\"""; + + $pm_img = "\"""; + + if( !empty($group_moderator['user_viewemail']) ) + { + $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL ."=" . $group_moderator['user_id']) : "mailto:" . $group_moderator['user_email']; + + $email_img = "\"""; + } + else + { + $email_img = ""; + } + + $www_img = ( $group_moderator['user_website'] ) ? "\""" : " "; + + if( !empty($group_moderator['user_icq']) ) + { + $icq_status_img = ""; + + // + // This cannot stay like this, it needs a 'proper' solution, eg a separate + // template for overlaying the ICQ icon, or we just do away with the icq status + // display (which is after all somewhat a pain in the rear :D + // + if( $theme['template_name'] == "subSilver" ) + { + $icq_add_img = '
' . $icq_status_img . '' . $lang['ICQ'] . '
'; + $icq_status_img = ""; + } + else + { + $icq_add_img = "\"""; + } + } + else + { + $icq_status_img = ""; + $icq_add_img = ""; + } + + $aim_img = ( $group_moderator['user_aim'] ) ? "\""" : ""; + + $msn_img = ( $group_moderator['user_msnm'] ) ? "\""" : ""; + + $yim_img = ( $group_moderator['user_yim'] ) ? "\""" : ""; + + $search_img = "\"""; + $template->assign_vars(array( "L_GROUP_INFORMATION" => $lang['Group_Information'], "L_GROUP_NAME" => $lang['Group_name'], @@ -736,6 +810,23 @@ else if( $group_id ) "L_ADD_MEMBER" => $lang['Add_member'], "L_FIND_USERNAME" => $lang['Find_username'], + "MOD_ROW_COLOR" => "#" . $theme['td_color1'], + "MOD_ROW_CLASS" => $theme['td_class1'], + "MOD_USERNAME" => $username, + "MOD_FROM" => $from, + "MOD_JOINED" => $joined, + "MOD_POSTS" => $posts, + "MOD_EMAIL_IMG" => $email_img, + "MOD_PM_IMG" => $pm_img, + "MOD_WWW_IMG" => $www_img, + "MOD_ICQ_STATUS_IMG" => $icq_status_img, + "MOD_ICQ_ADD_IMG" => $icq_add_img, + "MOD_AIM_IMG" => $aim_img, + "MOD_YIM_IMG" => $yim_img, + "MOD_MSN_IMG" => $msn_img, + "MOD_SEARCH_IMG" => $search, + + "U_MOD_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id), "U_SEARCH_USER" => append_sid("search.$phpEx?mode=searchuser"), "S_MODE_SELECT" => $select_sort_mode, @@ -743,7 +834,10 @@ else if( $group_id ) "S_GROUPCP_ACTION" => append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id")) ); - for($i = 0; $i < $members_count; $i++) + // + // Dump out the remaining users + // + for($i = $start; $i < min($board_config['topics_per_page'] + $start, $members_count); $i++) { $username = $group_members[$i]['username']; $user_id = $group_members[$i]['user_id']; @@ -771,7 +865,7 @@ else if( $group_id ) $www_img = ( $group_members[$i]['user_website'] ) ? "\""" : " "; - if( !empty($postrow[$i]['user_icq']) ) + if( !empty($group_members[$i]['user_icq']) ) { $icq_status_img = ""; @@ -803,64 +897,38 @@ else if( $group_id ) $yim_img = ( $group_members[$i]['user_yim'] ) ? "\""" : ""; $search_img = "\"""; - - if( $user_id == $group_info['group_moderator'] ) + + if( $group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator ) { - $template->assign_vars(array( - "U_MOD_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id), - - "MOD_ROW_COLOR" => "#" . $theme['td_color1'], - "MOD_ROW_CLASS" => $theme['td_class1'], - "MOD_USERNAME" => $username, - "MOD_FROM" => $from, - "MOD_JOINED" => $joined, - "MOD_POSTS" => $posts, - - "MOD_EMAIL_IMG" => $email_img, - "MOD_PM_IMG" => $pm_img, - "MOD_WWW_IMG" => $www_img, - "MOD_ICQ_STATUS_IMG" => $icq_status_img, - "MOD_ICQ_ADD_IMG" => $icq_add_img, - "MOD_AIM_IMG" => $aim_img, - "MOD_YIM_IMG" => $yim_img, - "MOD_MSN_IMG" => $msn_img, - "MOD_SEARCH_IMG" => $search) + $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; + $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; + + $template->assign_block_vars("member_row", array( + "ROW_COLOR" => "#" . $row_color, + "ROW_CLASS" => $row_class, + "USERNAME" => $username, + "FROM" => $from, + "JOINED" => $joined, + "POSTS" => $posts, + + "USER_ID" => $user_id, + + "EMAIL_IMG" => $email_img, + "PM_IMG" => $pm_img, + "WWW_IMG" => $www_img, + "ICQ_STATUS_IMG" => $icq_status_img, + "ICQ_ADD_IMG" => $icq_add_img, + "AIM_IMG" => $aim_img, + "YIM_IMG" => $yim_img, + "MSN_IMG" => $msn_img, + "SEARCH_IMG" => $search, + + "U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id)) ); - } - else - { - if( $group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator ) - { - $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $template->assign_block_vars("member_row", array( - "ROW_COLOR" => "#" . $row_color, - "ROW_CLASS" => $row_class, - "USERNAME" => $username, - "FROM" => $from, - "JOINED" => $joined, - "POSTS" => $posts, - - "USER_ID" => $user_id, - "EMAIL_IMG" => $email_img, - "PM_IMG" => $pm_img, - "WWW_IMG" => $www_img, - "ICQ_STATUS_IMG" => $icq_status_img, - "ICQ_ADD_IMG" => $icq_add_img, - "AIM_IMG" => $aim_img, - "YIM_IMG" => $yim_img, - "MSN_IMG" => $msn_img, - "SEARCH_IMG" => $search, - - "U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_id)) - ); - - if( $is_moderator ) - { - $template->assign_block_vars("member_row.switch_mod_option", array()); - } + if( $is_moderator ) + { + $template->assign_block_vars("member_row.switch_mod_option", array()); } } } @@ -877,6 +945,13 @@ else if( $group_id ) ); } + $template->assign_vars(array( + "PAGINATION" => generate_pagination("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id", $members_count, $board_config['topics_per_page'], $start), + "PAGE_NUMBER" => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $members_count / $board_config['topics_per_page'] )), + + "L_GOTO_PAGE" => $lang['Goto_page']) + ); + if( $group_info['group_type'] == GROUP_HIDDEN && !$is_group_member && !$is_moderator ) { // @@ -928,7 +1003,7 @@ else if( $group_id ) $www_img = ( $modgroup_pending_list[$i]['user_website'] ) ? "\""" : ""; - if( !empty($postrow[$i]['user_icq']) ) + if( !empty($modgroup_pending_list[$i]['user_icq']) ) { $icq_status_img = ""; @@ -1009,6 +1084,8 @@ else if( $group_id ) $template->assign_block_vars("switch_add_member", array()); } + + // // Parse group info output // -- cgit v1.2.1