1<?php
2// This file is part of BOINC.
3// http://boinc.berkeley.edu
4// Copyright (C) 2014 University of California
5//
6// BOINC is free software; you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License
8// as published by the Free Software Foundation,
9// either version 3 of the License, or (at your option) any later version.
10//
11// BOINC is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19require_once("../inc/boinc_db.inc");
20require_once("../inc/util.inc");
21require_once("../inc/team.inc");
22
23if (DISABLE_TEAMS) error_page("Teams are disabled");
24
25check_get_args(array("teamid"));
26
27ini_set("memory_limit", "1024M");
28
29$logged_in_user = get_logged_in_user();
30$teamid = get_int("teamid");
31$team = BoincTeam::lookup_id($teamid);
32if (!$team) error_page("no such team");
33require_admin($logged_in_user, $team);
34page_head(tra("Remove members from %1", $team->name));
35echo "
36    <form method=\"post\" action=\"team_remove_inactive_action.php\">
37    <input type=\"hidden\" name=\"id\" value=\"".$team->id."\">
38";
39start_table();
40row_heading_array(
41    array(
42        tra("Remove?"),
43        tra("Name (ID)"),
44        tra("Total credit"),
45        tra("Recent average credit"),
46    )
47);
48
49$users = BoincUser::enum("teamid=$team->id");
50$ninactive_users = 0;
51foreach($users as $user) {
52    if ($user->id == $logged_in_user->id) continue;
53    if ($user->id == $team->userid) continue;
54    $user_total_credit = format_credit($user->total_credit);
55    $user_expavg_credit = format_credit($user->expavg_credit);
56    echo "
57        <tr>
58        <td><input type=checkbox name=remove_$ninactive_users value=$user->id>
59        <td>".user_links($user, BADGE_HEIGHT_MEDIUM)." ($user->id)</td>
60        <td>$user_total_credit</td>
61        <td>$user_expavg_credit</td>
62        </tr>
63    ";
64    $ninactive_users++;
65}
66end_table();
67if ($ninactive_users == 0) {
68    echo "<p>".tra("No members are eligible for removal.")."</p>";
69} else {
70    echo "<input type=hidden name=ninactive_users value=$ninactive_users>";
71    echo "<input class=\"btn btn-warning\" type=submit value=\"".tra("Remove users")."\">";
72}
73echo "</form>";
74page_tail();
75?>
76