. require_once("../inc/boinc_db.inc"); require_once("../inc/util.inc"); require_once("../inc/user.inc"); function show_user($user) { echo " ", user_links($user, BADGE_HEIGHT_MEDIUM), " (ID $user->id) "; if ($user->teamid) { $team = BoincTeam::lookup_id($user->teamid); echo " id>$team->name "; } else { echo "
"; } echo " ", format_credit($user->expavg_credit), " ", format_credit_large($user->total_credit), " ", $user->country, " ", time_str($user->create_time)," "; } function search_form() { page_head("User search"); echo "
"; start_table(); row1(tra("Filters"), 2, "heading"); row2(tra("User name starts with"), ""); row2_init(tra("Country"), ""; row2(tra("With profile?"), " ".tra("Either")." ".tra("No")." ".tra("Yes")." "); row2(tra("On a team?"), " ".tra("Either")." ".tra("No")." ".tra("Yes")." "); row1(tra("Ordering"), 2, "heading"); row2(tra("Decreasing sign-up time"), ""); row2(tra("Decreasing average credit"), ""); row2(tra("Decreasing total credit"), ""); row2("", ""); end_table(); echo " "; page_tail(); } function search_action() { $where = "true"; $search_string = get_str('search_string'); if (strlen($search_string)) { if (strlen($search_string)<3) { error_page(tra("search string must be at least 3 characters")); } $s = BoincDb::escape_string($search_string); $s = escape_pattern($s); $where .= " and name like '$s%'"; } $country = get_str('country'); if ($country != 'any') { $s = BoincDb::escape_string($country); $where .= " and country='$s'"; } $t = get_str('team'); if ($t == 'yes') { $where .= " and teamid<>0"; } else if ($t == 'no') { $where .= " and teamid=0"; } $t = get_str('profile'); if ($t == 'yes') { $where .= " and has_profile<>0"; } else if ($t == 'no') { $where .= " and has_profile=0"; } $search_type = get_str('search_type', true); $order_clause = "id desc"; if ($search_type == 'rac') { $order_clause ="expavg_credit desc"; } else if ($search_type == 'total') { $order_clause ="total_credit desc"; } $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated"; $users = BoincUser::enum_fields($fields, $where, "order by $order_clause limit 100"); page_head(tra("User search results")); $n=0; foreach ($users as $user) { if ($n==0) { start_table(); table_header( tra("Name"), tra("Team"), tra("Average credit"), tra("Total credit"), tra("Country"), tra("Joined") ); } show_user($user); $n++; } end_table(); if (!$n) { echo tra("No users match your search criteria."); } page_tail(); } $action = get_str('action', true); if ($action) { search_action(); } else { search_form(); } $cvs_version_tracker[]="\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $"; //Generated automatically - do not edit ?>