- update the judge team editor. Not ideal, this shouldn't query the users

table directly, but it works.  This will be reworked later when I add support
  for judges to select which timeslots they're available.
This commit is contained in:
dave 2008-10-19 02:52:28 +00:00
parent 81c211c913
commit 7f1331d401
2 changed files with 47 additions and 49 deletions

View File

@ -28,16 +28,16 @@ function getJudgingTeams()
//get the members for this team
$mq=mysql_query("SELECT
judges.id AS judges_id,
judges.firstname,
judges.lastname,
users.id AS judges_id,
users.firstname,
users.lastname,
judges_teams_link.captain
FROM
judges,
users,
judges_teams_link
WHERE
judges_teams_link.judges_id=judges.id AND
judges_teams_link.users_id=users.id AND
judges_teams_link.judges_teams_id='$r->id'
ORDER BY
captain DESC,
@ -48,14 +48,9 @@ function getJudgingTeams()
while($mr=mysql_fetch_object($mq))
{
$lq=mysql_query("SELECT * FROM judges_languages WHERE judges_id='$mr->judges_id'");
$judgelangs="";
if(mysql_num_rows($lq)) {
while($lr=mysql_fetch_object($lq)) {
$judgelangs.="$lr->languages_lang/";
}
$judgelangs=substr($judgelangs,0,-1);
}
$u = user_load($mr->judges_id, true);
$judgelangs = join('/', $u['languages']);
$teams[$lastteamid]['members'][]=array(
"id"=>$mr->judges_id,
"firstname"=>$mr->firstname,
@ -126,16 +121,16 @@ function getJudgingTeam($teamid)
//get the members for this team
$mq=mysql_query("SELECT
judges.id AS judges_id,
judges.firstname,
judges.lastname,
users.id AS judges_id,
users.firstname,
users.lastname,
judges_teams_link.captain
FROM
judges,
users,
judges_teams_link
WHERE
judges_teams_link.judges_id=judges.id AND
judges_teams_link.users_id=users.id AND
judges_teams_link.judges_teams_id='$r->id'
ORDER BY
captain DESC,

View File

@ -27,23 +27,6 @@
user_auth_required('committee', 'admin');
include "judges.inc.php";
send_header("Manage Judging Teams",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Judges' => 'admin/judges.php')
);
?>
<script language="javascript" type="text/javascript">
function addclicked()
{
document.forms.judges.action.value="assign";
document.forms.judges.submit();
}
</script>
<?
if($_GET['edit']) $edit=$_GET['edit'];
if($_POST['edit']) $edit=$_POST['edit'];
if($_GET['action']) $action=$_GET['action'];
@ -57,7 +40,7 @@ function addclicked()
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams WHERE id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
echo happy(i18n("Judge team successfully removed, and all of its corresponding members, timeslots, projects and awards unlinked from team"));
message_push(happy(i18n("Judge team successfully removed, and all of its corresponding members, timeslots, projects and awards unlinked from team")));
}
if($action=="deletealldivisional")
@ -83,9 +66,9 @@ function addclicked()
$numdeleted++;
}
if($numdeleted)
echo happy(i18n("Successfully deleted %1 auto-created divisional team(s)",array($numdeleted)));
message_push(happy(i18n("Successfully deleted %1 auto-created divisional team(s)",array($numdeleted))));
else
echo error(i18n("There were no auto-created divisional teams to delete"));
message_push(error(i18n("There were no auto-created divisional teams to delete")));
}
if($action=="deleteall")
@ -108,9 +91,9 @@ function addclicked()
$numdeleted++;
}
if($numdeleted)
echo happy(i18n("Successfully deleted %1 team(s)",array($numdeleted)));
message_push(happy(i18n("Successfully deleted %1 team(s)",array($numdeleted))));
else
echo error(i18n("There were no teams to delete"));
message_push(error(i18n("There were no teams to delete")));
}
if(($action=="save" || $action=="assign") && $edit)
@ -123,7 +106,7 @@ function addclicked()
if(mysql_error())
{
$err=true;
echo error(mysql_error());
message_push(error(mysql_error()));
}
if($_POST['award'])
@ -154,7 +137,7 @@ function addclicked()
if($r->num)
{
$addaward=false;
echo error(i18n("Sorry, only one Special Award can be assigned to a judging team"));
message_push(error(i18n("Sorry, only one Special Award can be assigned to a judging team")));
}
else
{
@ -166,7 +149,7 @@ function addclicked()
{
//link up the award
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('".$_POST['award']."','$edit','".$config['FAIRYEAR']."')");
echo happy(i18n("Award assigned to team"));
message_push(happy(i18n("Award assigned to team")));
}
}
@ -179,7 +162,7 @@ function addclicked()
$action="edit";
else
{
echo happy(i18n("Team successfully saved"));
message_push(happy(i18n("Team successfully saved")));
unset($action);
unset($edit);
}
@ -189,7 +172,7 @@ function addclicked()
if($action=="unassign")
{
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$edit' AND award_awards_id='".$_GET['unassign']."' AND year='".$config['FAIRYEAR']."'");
echo happy(i18n("Award unassigned from judge team"));
message_push(happy(i18n("Award unassigned from judge team")));
//keep editing the same team
$action="edit";
}
@ -201,7 +184,7 @@ function addclicked()
$r=mysql_fetch_object($q);
if($r->c)
{
echo error(i18n("Cannot 'Create All' teams when any divisional teams currently exist. Try deleting all existing non-divisional teams first."));
message_push(error(i18n("Cannot 'Create All' teams when any divisional teams currently exist. Try deleting all existing non-divisional teams first.")));
}
else
{
@ -232,7 +215,7 @@ function addclicked()
$team_id=mysql_insert_id();
//now link the new team to the award
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$r->id','$team_id','".$config['FAIRYEAR']."')");
echo happy(i18n("Created team #%1: %2",array($num,$name)));
message_push(happy(i18n("Created team #%1: %2",array($num,$name))));
$num++;
}
}
@ -248,8 +231,24 @@ function addclicked()
if($action=="edit" && $edit)
{
echo "<a href=\"judges_teams.php\">&lt;&lt; ".i18n("Back to Judging Teams")."</a>\n";
echo "<br />";
send_header("Edit Judging Team",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Judges' => 'admin/judges.php',
'Manage Judging Teams' => 'admin/judges_teams.php'));
?>
<script language="javascript" type="text/javascript">
function addclicked()
{
document.forms.judges.action.value="assign";
document.forms.judges.submit();
}
</script>
<?
echo "<br />";
$team=getJudgingTeam($edit);
@ -359,6 +358,10 @@ function addclicked()
}
else
{
send_header("Manage Judging Teams",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Judges' => 'admin/judges.php'));
echo "<br />";
$teams=getJudgingTeams();