function show_teams_html($list, $params) { page_head(tra("Team search results")); if (sizeof($list) == 0) { echo tra("No teams were found matching your criteria. Try another search.") . "<p>" . tra("Or you can %1create a new team%2.", "<a href=team_create_form.php>", "</a>") . "</p>\n"; team_search_form($params); } else { echo tra("The following teams match one or more of your search criteria.\n To join a team, click its name to go to the team page,\n then click %1Join this team%2.", "<strong>", "</strong>") . "<p>\n "; sort_list($list); show_list($list); echo "<h2>" . tra("Change your search") . "</h2>"; team_search_form($params); } page_tail(); }
<?php // This file is part of BOINC. // http://boinc.berkeley.edu // Copyright (C) 2008 University of California // // BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation, // either version 3 of the License, or (at your option) any later version. // // BOINC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. include_once "../inc/db.inc"; include_once "../inc/util.inc"; include_once "../inc/team.inc"; check_get_args(array()); page_head(tra("Teams")); echo "<p>" . tra("%1 participants may form %2teams%3.", PROJECT, "<b>", "</b>") . "\n <p>\n " . tra("You may belong to only one team. You can join or quit a team at any time.") . "\n <p>" . tra("Each team has a %1founder%2 who may:", "<b>", "</b>") . "\n <ul>\n <li> " . tra("access team members' email addresses") . "\n <li> " . tra("edit the team's name and description") . "\n <li> " . tra("add or remove team admins") . "\n <li> " . tra("remove members from the team") . "\n <li> " . tra("disband a team if it has no members") . "\n </ul>\n <p>" . tra("To join a team, visit its team page and click %1Join this team%2.", "<b>", "</b>") . "\n <h3>" . tra("Find a team") . "</h3>\n"; team_search_form(null); echo "\n\n <h3>" . tra("Top teams") . "</h3>\n <ul>\n <li> <a href=\"top_teams.php\">" . tra("All teams") . "</a>\n"; for ($i = 1; $i < 8; $i++) { echo "<li> <a href=\"top_teams.php?type=" . $i . "\">" . tra("%1 teams", team_type_name($i)) . "</a>\n "; } echo "\n </ul>\n <h3>" . tra("Create a new team") . "</h3>\n " . tra("If you cannot find a team that is right for you, you can %1create a team%2.", "<a href=\"team_create_form.php\">", "</a>"); page_tail();
function search($params) { $list = array(); $tried = false; if (strlen($params->keywords)) { $kw = BoincDb::escape_string($params->keywords); $name_lc = strtolower($kw); $name_lc = escape_pattern($name_lc); $list2 = get_teams("name='{$name_lc}'", $params->active); merge_lists($list2, $list, 20); $list2 = get_teams("name like '" . $name_lc . "%'", $params->active); merge_lists($list2, $list, 5); $list2 = get_teams("match(name) against ('{$kw}')", $params->active); merge_lists($list2, $list, 5); $list2 = get_teams("match(name, description) against ('{$kw}')", $params->active); //echo "<br>keyword matches: ",sizeof($list2); merge_lists($list2, $list, 3); $tried = true; } if (strlen($params->country) && $params->country != 'None') { $list2 = get_teams("country = '{$params->country}'", $params->active); //echo "<br>country matches: ",sizeof($list2); merge_lists($list2, $list, 1); $tried = true; } if ($params->type and $params->type > 1) { $list2 = get_teams("type={$params->type}", $params->active); //echo "<br>type matches: ",sizeof($list2); merge_lists($list2, $list, 2); $tried = true; } if (!$tried) { $list = get_teams("id>0", $params->active); } if (sizeof($list) == 0) { echo 'No teams were found matching your criteria. Try another search. <p>Or you can <a href="team_create_form.php">create a new team</a>.</p> <p>'; team_search_form($params); } else { echo "The following teams match one or more of your search criteria.\n\t\t\tTo join a team, click its name to go to the team page, then click <strong>Join this team</strong>.</p>\n\t\t\t<p>"; sort_list($list); show_list($list); echo "<h2>Change your search</h2>"; team_search_form($params); } }