2004-12-16 20:52:27 +00:00
< ? php
2008-08-05 22:43:14 +00:00
// This file is part of BOINC.
// http://boinc.berkeley.edu
2014-04-18 06:31:51 +00:00
// Copyright (C) 2014 University of California
2008-08-05 22:43:14 +00:00
//
// 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/>.
2004-12-16 20:52:27 +00:00
2007-11-07 23:59:08 +00:00
// Let the founder assign foundership to someone else,
// or decline a foundership change request
2007-07-23 20:30:30 +00:00
2004-12-16 20:52:27 +00:00
require_once ( " ../inc/util.inc " );
require_once ( " ../inc/team.inc " );
2007-10-26 21:14:35 +00:00
require_once ( " ../inc/boinc_db.inc " );
2004-12-16 20:52:27 +00:00
2014-04-18 06:31:51 +00:00
if ( DISABLE_TEAMS ) error_page ( " Teams are disabled " );
2011-02-09 22:11:34 +00:00
check_get_args ( array ( " teamid " ));
2004-12-16 20:52:27 +00:00
$user = get_logged_in_user ();
2007-10-26 21:14:35 +00:00
$teamid = get_int ( " teamid " );
$team = BoincTeam :: lookup_id ( $teamid );
if ( ! $team ) {
2010-02-16 01:06:03 +00:00
error_page ( tra ( " no such team " ));
2007-10-26 21:14:35 +00:00
}
2004-12-16 20:52:27 +00:00
require_founder_login ( $user , $team );
2010-02-16 01:06:03 +00:00
page_head ( tra ( " Change founder of %1 " , $team -> name ));
2006-10-27 16:06:42 +00:00
2007-09-26 15:46:54 +00:00
if ( $team -> ping_user != 0 ) {
if ( $team -> ping_user < 0 ) {
2007-10-26 21:14:35 +00:00
$ping_user = BoincUser :: lookup_id ( - $team -> ping_user );
2007-11-07 23:59:08 +00:00
$x = date_str ( $team -> ping_time );
2010-02-16 01:06:03 +00:00
echo " <p> " . tra ( " Team member %1 requested this team's foundership on %2, but left the team, thus canceling the request. " , user_links ( $ping_user ), $x )
. " </p> " ;
2008-04-21 14:04:01 +00:00
$team -> update ( " ping_user=0, ping_time=0 " );
2007-09-26 15:46:54 +00:00
} else {
2007-10-26 21:14:35 +00:00
$ping_user = BoincUser :: lookup_id ( $team -> ping_user );
2007-11-07 23:59:08 +00:00
$x = date_str ( transfer_ok_time ( $team ));
2010-02-16 01:06:03 +00:00
echo " <p> " . tra ( " Team member %1 has requested this team's foundership. This may be because you left the team or haven't had contact with the team for a long time. " , user_links ( $ping_user ))
. " </p> " ;
2007-11-07 23:59:08 +00:00
echo " <p>
2007-09-26 15:46:54 +00:00
< form method = \ " post \" action= \" team_founder_transfer_action.php \" >
< input type = \ " hidden \" name= \" action \" value= \" decline \" >
< input type = \ " hidden \" name= \" teamid \" value= \" " . $team -> id . " \" >
2010-02-16 01:06:03 +00:00
< input type = \ " submit \" value= \" " . tra ( " decline request " ) . " \" >
2007-09-26 15:46:54 +00:00
</ form >
2007-11-07 23:59:08 +00:00
< p >
2010-02-16 01:06:03 +00:00
" .tra( " If you don ' t decline the request by % 1 , % 2 will have the option of assuming team foundership .< br />< br />
To accept the request , assign foundership to % 3 using the form below . " , $x , $ping_user->name , $ping_user->name ). "
</ p >
2007-11-07 23:59:08 +00:00
< hr >
< p >
2007-09-26 15:46:54 +00:00
" ;
}
2008-12-09 22:42:28 +00:00
} else {
2010-02-16 01:06:03 +00:00
echo tra ( " No transfer request is pending. " ) . " <br /><br /> " ;
2006-10-27 16:06:42 +00:00
}
2010-02-16 01:06:03 +00:00
echo tra ( " To assign foundership of this team to another member, check the box next to member name and click <strong>Change founder</strong> below. " )
. " <form method=post action=team_change_founder_action.php>
< input type = hidden name = teamid value = $team -> id > " ;
2007-11-07 23:59:08 +00:00
echo form_tokens ( $user -> authenticator );
2004-12-16 20:52:27 +00:00
start_table ();
echo " <tr>
2010-02-16 01:06:03 +00:00
< th > " .tra( " New founder ? " ). " </ th >
< th > " .tra( " Name " ). " </ th >
< th > " .tra( " Total credit " ). " </ th >
< th > " .tra( " Recent average credit " ). " </ th >
2004-12-16 20:52:27 +00:00
</ tr >
" ;
2007-10-26 21:14:35 +00:00
$users = BoincUser :: enum ( " teamid= $team->id " );
2004-12-16 20:52:27 +00:00
$navailable_users = 0 ;
2007-10-26 21:14:35 +00:00
foreach ( $users as $user ) {
if ( $user -> id != $team -> userid ) { //don't show current founder
2004-12-16 20:52:27 +00:00
$user_total_credit = format_credit ( $user -> total_credit );
$user_expavg_credit = format_credit ( $user -> expavg_credit );
2007-11-07 23:59:08 +00:00
$selected = ( $user -> id == $team -> ping_user ) ? " selected " : " " ;
2006-12-20 18:49:54 +00:00
echo '
2004-12-16 20:52:27 +00:00
< tr >
2007-11-07 23:59:08 +00:00
< td align = " center " >< input type = " radio " name = " userid " value = " '. $user->id .' " >
2006-12-20 18:49:54 +00:00
< td > '.$user->name.' </ td >
2008-12-09 22:42:28 +00:00
< td align = right > '.$user_total_credit.' </ td >
< td align = right > '.$user_expavg_credit.' </ td >
2006-12-20 18:49:54 +00:00
</ tr >
' ;
2004-12-16 20:52:27 +00:00
$navailable_users ++ ;
}
}
2006-12-20 18:49:54 +00:00
if ( $navailable_users > 0 ) {
echo " <input type=hidden name=navailable_users value= $navailable_users > " ;
end_table ();
2010-02-16 01:06:03 +00:00
echo " <input type=submit value= \" " . tra ( " Change founder " ) . " \" > " ;
2006-12-20 18:49:54 +00:00
} else {
2014-01-09 21:51:12 +00:00
echo " <tr>
< td colspan = '4' > " .tra( " There are no users to transfer team to . " ). " </ td >
2006-12-20 18:49:54 +00:00
</ tr >
2014-01-09 21:51:12 +00:00
" ;
2006-12-20 18:49:54 +00:00
end_table ();
}
2004-12-16 20:52:27 +00:00
echo " </form> " ;
page_tail ();
2007-11-07 23:59:08 +00:00
$cvs_version_tracker [] = " \$ Id $ " ; //Generated automatically - do not edit
2004-12-16 20:52:27 +00:00
?>