forked from science-ation/science-ation
Add judge team captains, bump db version
This commit is contained in:
parent
c632070d6e
commit
3f471bde41
3
TODO
3
TODO
@ -1,6 +1,3 @@
|
|||||||
- Make auto-logout on email address change work properly on the FIRST submit, not on first action after the submit
|
- Make auto-logout on email address change work properly on the FIRST submit, not on first action after the submit
|
||||||
- same for judges changing email address
|
- same for judges changing email address
|
||||||
|
|
||||||
- Judges CSV contain categories and sub-categories info
|
|
||||||
- Judge 'info' button on judge teams page to view allt he judge info
|
|
||||||
-
|
|
||||||
|
@ -95,6 +95,7 @@ function switchjudgeinfo()
|
|||||||
$r=mysql_fetch_object($q);
|
$r=mysql_fetch_object($q);
|
||||||
$team_id=$r->id;
|
$team_id=$r->id;
|
||||||
$team_name=$r->name;
|
$team_name=$r->name;
|
||||||
|
$captain='no';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -102,14 +103,31 @@ function switchjudgeinfo()
|
|||||||
mysql_query("INSERT INTO judges_teams (num,name,year) VALUES ('".$_POST['team_num']."','".$_POST['new_team_name']."','".$config['FAIRYEAR']."')");
|
mysql_query("INSERT INTO judges_teams (num,name,year) VALUES ('".$_POST['team_num']."','".$_POST['new_team_name']."','".$config['FAIRYEAR']."')");
|
||||||
$team_id=mysql_insert_id();
|
$team_id=mysql_insert_id();
|
||||||
$team_name=$_POST['new_team_name'];
|
$team_name=$_POST['new_team_name'];
|
||||||
|
$captain='yes';
|
||||||
}
|
}
|
||||||
|
|
||||||
$added=0;
|
$added=0;
|
||||||
|
|
||||||
foreach($_POST['judgelist'] AS $selectedjudge)
|
foreach($_POST['judgelist'] AS $selectedjudge)
|
||||||
{
|
{
|
||||||
mysql_query("INSERT INTO judges_teams_link (judges_id,judges_teams_id,year) VALUES ('$selectedjudge','$team_id','".$config['FAIRYEAR']."')");
|
//before we insert them, we need to make sure they dont already belong to this team. We can not have the same judge assigned to the same team multiple times.
|
||||||
$added++;
|
|
||||||
|
$q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_id='$selectedjudge' AND judges_teams_id='$team_id'");
|
||||||
|
if(mysql_num_rows($q))
|
||||||
|
{
|
||||||
|
echo notice(i18n("Judge (%1) already belongs to judging team: %2",array($selectedjudge,$team_name)));
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//lets make the first one we add a captain, the rest, non-captains :)
|
||||||
|
mysql_query("INSERT INTO judges_teams_link (judges_id,judges_teams_id,captain,year) VALUES ('$selectedjudge','$team_id','$captain','".$config['FAIRYEAR']."')");
|
||||||
|
$added++;
|
||||||
|
}
|
||||||
|
//if this is alreayd no, then who cares, but if its the first one that is going into the new team, then
|
||||||
|
//captain will be yes, and we only want the first one assigned to a new team to be the captain
|
||||||
|
//sno now we can set this back to no
|
||||||
|
$captain='no';
|
||||||
|
|
||||||
}
|
}
|
||||||
if($added==1) $j=i18n("judge");
|
if($added==1) $j=i18n("judge");
|
||||||
@ -147,6 +165,35 @@ function switchjudgeinfo()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($_GET['action']=="addcaptain")
|
||||||
|
{
|
||||||
|
|
||||||
|
//teams can have as many captains as they want, so just add it.
|
||||||
|
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='".$_GET['judge_id']."'");
|
||||||
|
echo happy(i18n("Team captain assigned"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_GET['action']=="removecaptain")
|
||||||
|
{
|
||||||
|
//teams must always have at least one captain, so if we only have one, and we are trying to remove it, dont let them!
|
||||||
|
$q=mysql_query("SELECT * FROM judges_teams_link WHERE captain='yes' AND judges_teams_id='".$_GET['team_id']."'");
|
||||||
|
if(mysql_num_rows($q)<2)
|
||||||
|
{
|
||||||
|
echo error(i18n("A judge team must always have at least one captain"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mysql_query("UPDATE judges_teams_link SET captain='no' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='".$_GET['judge_id']."'");
|
||||||
|
echo happy(i18n("Team captain removed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$_SESSION['viewstate']['judges_teams_list_show'])
|
||||||
|
$_SESSION['viewstate']['judges_teams_list_show']='unassigned';
|
||||||
|
//now update the judges_teams_list_show viewstate
|
||||||
|
if($_GET['judges_teams_list_show'])
|
||||||
|
$_SESSION['viewstate']['judges_teams_list_show']=$_GET['judges_teams_list_show'];
|
||||||
|
|
||||||
echo "<form name=\"judges\" method=\"post\" action=\"judges_teams.php\">";
|
echo "<form name=\"judges\" method=\"post\" action=\"judges_teams.php\">";
|
||||||
echo "<input type=\"hidden\" name=\"action\">";
|
echo "<input type=\"hidden\" name=\"action\">";
|
||||||
echo "<input type=\"hidden\" name=\"team_id\">";
|
echo "<input type=\"hidden\" name=\"team_id\">";
|
||||||
@ -162,6 +209,19 @@ function switchjudgeinfo()
|
|||||||
echo "<th>".i18n("Judge Teams")."</th>";
|
echo "<th>".i18n("Judge Teams")."</th>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
echo "<tr><td valign=\"top\">";
|
echo "<tr><td valign=\"top\">";
|
||||||
|
echo "<table width=\"100%\"><tr>";
|
||||||
|
if($_SESSION['viewstate']['judges_teams_list_show']=='all')
|
||||||
|
{
|
||||||
|
echo "<td align=left><a href=\"judges_teams.php?judges_teams_list_show=unassigned\">".i18n("show unassigned")."</a></td>";
|
||||||
|
echo "<td align=right><b>".i18n("show all")."</b></td>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<td align=left><b>".i18n("show unassigned")."</b></td>";
|
||||||
|
echo "<td align=right><a href=\"judges_teams.php?judges_teams_list_show=all\">".i18n("show all")."</a></td>";
|
||||||
|
|
||||||
|
}
|
||||||
|
echo "</tr></table>";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -184,7 +244,26 @@ function switchjudgeinfo()
|
|||||||
lastname,
|
lastname,
|
||||||
firstname";
|
firstname";
|
||||||
*/
|
*/
|
||||||
$querystr="SELECT
|
if($_SESSION['viewstate']['judges_teams_list_show']=='all')
|
||||||
|
{
|
||||||
|
$querystr="SELECT
|
||||||
|
judges.id,
|
||||||
|
judges.firstname,
|
||||||
|
judges.lastname
|
||||||
|
FROM
|
||||||
|
judges,
|
||||||
|
judges_years
|
||||||
|
WHERE
|
||||||
|
judges_years.year='".$config['FAIRYEAR']."' AND
|
||||||
|
judges.id=judges_years.judges_id AND
|
||||||
|
judges.complete='yes'
|
||||||
|
ORDER BY
|
||||||
|
lastname,
|
||||||
|
firstname";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$querystr="SELECT
|
||||||
judges.id,
|
judges.id,
|
||||||
judges.firstname,
|
judges.firstname,
|
||||||
judges.lastname,
|
judges.lastname,
|
||||||
@ -201,6 +280,7 @@ function switchjudgeinfo()
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
lastname,
|
lastname,
|
||||||
firstname";
|
firstname";
|
||||||
|
}
|
||||||
|
|
||||||
$q=mysql_query($querystr);
|
$q=mysql_query($querystr);
|
||||||
|
|
||||||
@ -222,7 +302,8 @@ function switchjudgeinfo()
|
|||||||
judges_teams.name,
|
judges_teams.name,
|
||||||
judges.id AS judges_id,
|
judges.id AS judges_id,
|
||||||
judges.firstname,
|
judges.firstname,
|
||||||
judges.lastname
|
judges.lastname,
|
||||||
|
judges_teams_link.captain
|
||||||
|
|
||||||
FROM
|
FROM
|
||||||
judges,
|
judges,
|
||||||
@ -235,6 +316,7 @@ function switchjudgeinfo()
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
name,
|
name,
|
||||||
num,
|
num,
|
||||||
|
captain DESC,
|
||||||
lastname,
|
lastname,
|
||||||
firstname");
|
firstname");
|
||||||
|
|
||||||
@ -252,7 +334,12 @@ function switchjudgeinfo()
|
|||||||
$lastteamid=$r->id;
|
$lastteamid=$r->id;
|
||||||
$lastteamnum=$r->num;
|
$lastteamnum=$r->num;
|
||||||
}
|
}
|
||||||
$teams[$lastteamid]['members'][]=array("id"=>$r->judges_id,"firstname"=>$r->firstname,"lastname"=>$r->lastname);
|
$teams[$lastteamid]['members'][]=array(
|
||||||
|
"id"=>$r->judges_id,
|
||||||
|
"firstname"=>$r->firstname,
|
||||||
|
"lastname"=>$r->lastname,
|
||||||
|
"captain"=>$r->captain
|
||||||
|
);
|
||||||
}
|
}
|
||||||
//echo nl2br(print_r($teams,true));
|
//echo nl2br(print_r($teams,true));
|
||||||
|
|
||||||
@ -292,6 +379,20 @@ function switchjudgeinfo()
|
|||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
echo "<input onclick=\"delbuttonclicked('".$team['id']."','".$team['num']."','".htmlspecialchars($team['name'])."','".$member['id']."')\" type=\"button\" value=\"<<\">";
|
echo "<input onclick=\"delbuttonclicked('".$team['id']."','".$team['num']."','".htmlspecialchars($team['name'])."','".$member['id']."')\" type=\"button\" value=\"<<\">";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
|
if($member['captain']=="yes")
|
||||||
|
{
|
||||||
|
echo "<a title=\"Captain - Click to remove captain status\" href=\"judges_teams.php?action=removecaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">";
|
||||||
|
echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark.".$config['icon_extension']."\">";
|
||||||
|
echo "</a> ";
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<a title=\"Non-Captain - Click to make a team captain\" href=\"judges_teams.php?action=addcaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">";
|
||||||
|
echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark_disabled.".$config['icon_extension']."\">";
|
||||||
|
echo "</a> ";
|
||||||
|
|
||||||
|
}
|
||||||
echo "<a href=\"\" onclick=\"return openjudgeinfo(".$member['id'].");\">";
|
echo "<a href=\"\" onclick=\"return openjudgeinfo(".$member['id'].");\">";
|
||||||
echo $member['firstname']." ".$member['lastname'];
|
echo $member['firstname']." ".$member['lastname'];
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
|
@ -1 +1 @@
|
|||||||
3
|
4
|
||||||
|
BIN
images/16/bookmark.gif
Normal file
BIN
images/16/bookmark.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 553 B |
BIN
images/16/bookmark.png
Normal file
BIN
images/16/bookmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 690 B |
BIN
images/16/bookmark_disabled.gif
Normal file
BIN
images/16/bookmark_disabled.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 576 B |
BIN
images/16/bookmark_disabled.png
Normal file
BIN
images/16/bookmark_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 416 B |
Loading…
x
Reference in New Issue
Block a user