diff --git a/admin/judges_teams_members.php b/admin/judges_teams_members.php index 514bdcf..304970c 100644 --- a/admin/judges_teams_members.php +++ b/admin/judges_teams_members.php @@ -35,15 +35,6 @@ function addbuttonclicked(team) document.forms.judges.team_num.value=team; document.forms.judges.submit(); } -function delbuttonclicked(team_id,team_num,team_name,judge) -{ - document.forms.judges.action.value="del"; - document.forms.judges.team_id.value=team_id; - document.forms.judges.team_num.value=team_num; - document.forms.judges.team_name.value=team_name; - document.forms.judges.judges_id.value=judge; - document.forms.judges.submit(); -} function openjudgeinfo(id) { @@ -128,13 +119,13 @@ function switchjudgeinfo() echo happy(i18n("%1 %2 added to team #%3 (%4)",array($added,$j,$_POST['team_num'],$team_name))); } - if($_POST['action']=="del" && $_POST['team_num'] && $_POST['team_id'] && $_POST['judges_id']) + if($_GET['action']=="del" && $_GET['team_num'] && $_GET['team_id'] && $_GET['judges_id']) { - mysql_query("DELETE FROM judges_teams_link WHERE judges_id='".$_POST['judges_id']."' AND judges_teams_id='".$_POST['team_id']."' AND year='".$config['FAIRYEAR']."'"); - echo happy(i18n("Removed judge from team #%1 (%2)",array($_POST['team_num'],$_POST['team_name']))); + mysql_query("DELETE FROM judges_teams_link WHERE judges_id='".$_GET['judges_id']."' AND judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'"); + echo happy(i18n("Removed judge from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name']))); //if there is still members left in the team, make sure we have a captain still - $q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_POST['team_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)) { //make sure the team still has a captain! @@ -158,12 +149,18 @@ function switchjudgeinfo() if(!$gotcaptain) { //make the first judge the captain - mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_POST['team_id']."' AND judges_id='$firstjudge' AND year='".$config['FAIRYEAR']."'"); + mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='$firstjudge' AND year='".$config['FAIRYEAR']."'"); echo notice(i18n("Team captain was removed. A new team captain has been automatically assigned")); } } } + if($_GET['action']=="empty" && $_GET['team_num'] && $_GET['team_id']) + { + mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'"); + echo happy(i18n("Emptied all judges from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name']))); + } + if($_POST['action']=="saveteamnames") { if(count($_POST['team_names'])) @@ -325,31 +322,46 @@ function switchjudgeinfo() echo $team['name']; echo "\n"; - foreach($team['members'] AS $member) + if(count($team['members'])) { - echo ""; -// echo ""; - echo ""; - echo ""; - if($member['captain']=="yes") + foreach($team['members'] AS $member) { - echo ""; - echo ""; - echo " "; + echo ""; + echo ""; + echo ""; + if($member['captain']=="yes") + { + echo ""; + echo ""; + echo " "; - } - else - { - echo ""; - echo ""; - echo " "; + } + else + { + echo ""; + echo ""; + echo " "; + } + echo ""; + echo $member['firstname']." ".$member['lastname']; + echo ""; + echo ""; } - echo ""; - echo $member['firstname']." ".$member['lastname']; + + echo ""; + echo ""; + echo " ".i18n("Empty All Members")." "; + echo ""; echo ""; echo ""; } + else + { + echo ""; + echo error(i18n("Team has no members"),"inline"); + echo ""; + } echo "";