3
require_once("../inc/boinc_db.inc");
4
require_once("../inc/util.inc");
5
require_once("../inc/team.inc");
7
function show_admin($user, $admin) {
8
$admin_user = BoincUser::lookup_id($admin->userid);
9
$tokens = url_tokens($user->authenticator);
10
$date = date_str($admin->create_time);
12
<td>".user_links($admin_user)."</td>
16
show_button("team_admins.php?teamid=$admin->teamid&action=remove&userid=$admin_user->id".$tokens, "Remove", "Remove Team Admin status from this member");
21
function show_admins($user, $teamid) {
22
page_head("Add or remove Team Admins");
24
You can select team members as 'Team Admins'.
27
<li> Edit team information (name, URL, description, country).
28
<li> View the team's join/quit history.
29
<li> Moderate the team forum, if any (admins get emails notification
30
of moderation events and red X reports).
34
<li> Change the team founder.
36
<li> Add or remove Team Admins.
38
If a Team Admin quits the team, they cease to be a Team Admin.
40
We recommend that you select only people
41
you know and trust very well as Team Admins.
43
$admins = BoincTeamAdmin::enum("teamid=$teamid");
45
if (count($admins)==0) {
46
row1("There are currently no Team Admins");
48
row1("Current Team Admins", 3);
49
table_header("Name", "Became Team Admin on", "");
50
foreach ($admins as $admin) {
51
show_admin($user, $admin);
58
<form action=team_admins.php>
59
<input type=hidden name=action value=add>
60
<input type=hidden name=teamid value=$teamid>
62
echo form_tokens($user->authenticator);
64
row1("Add Team Admin");
65
row2("Email address of team member:", "<input name=email_addr>");
66
row2("", "<input type=submit action value=\"Add\">");
73
function remove_admin($team) {
74
$userid = get_int('userid');
75
$ret = BoincTeamAdmin::delete("teamid=$team->id and userid=$userid");
77
error_page("failed to remove admin");
81
function add_admin($team) {
82
$email_addr = get_str('email_addr');
83
$user = BoincUser::lookup("email_addr='$email_addr'");
84
if (!$user) error_page("no such user");
85
if ($user->teamid != $team->id) error_page("User is not member of team");
86
if (is_team_admin($user, $team)) {
87
error_page("$email_addr is already an admin of $team->name");
90
$ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ($team->id, $user->id, $now)");
91
if (!$ret) error_page("Couldn't add admin");
94
$user = get_logged_in_user();
95
$teamid = get_int('teamid');
96
$team = BoincTeam::lookup_id($teamid);
97
if (!$team) error_page("No such team");
98
require_founder_login($user, $team);
100
$action = get_str('action', true);
103
check_tokens($user->authenticator);
105
Header("Location: team_admins.php?teamid=$teamid");
108
check_tokens($user->authenticator);
110
Header("Location: team_admins.php?teamid=$teamid");
113
show_admins($user, $teamid);