diff --git a/admin/judges_teams_projects.php b/admin/judges_teams_projects.php
index 0602ab8..00d5b16 100644
--- a/admin/judges_teams_projects.php
+++ b/admin/judges_teams_projects.php
@@ -29,45 +29,13 @@
send_header("Judging Teams Projects");
?>
-
-
echo "<< ".i18n("Back to Administration")."\n";
@@ -75,38 +43,43 @@ function checkinvert(what)
echo "
";
echo "
";
- if($_GET['action']=="delete" && $_GET['delete'])
+ if($_GET['action']) $action=$_GET['action'];
+ else if($_POST['action']) $action=$_POST['action'];
+
+ if($_GET['edit']) $edit=$_GET['edit'];
+ else if($_POST['edit']) $edit=$_POST['edit'];
+
+
+ if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit'])
{
- mysql_query("DELETE FROM judges_teams_timeslots_link WHERE id='".$_GET['delete']."'");
- echo happy(i18n("Judging team timeslot successfully removed"));
+ mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE id='".$_GET['delete']."'");
+ echo happy(i18n("Judging team project successfully removed"));
+ $action="edit";
}
+/*
if($_GET['action']=="empty" && $_GET['empty'])
{
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='".$_GET['empty']."'");
echo happy(i18n("Judging team timeslots successfully removed"));
}
+*/
- if($_POST['action']=="assign")
+ if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id'])
{
- //the db handles the uniqueness (to ensure the same timeslot isnt assigned to the same team more than once)
- //so all we'll do here is just mass insert without regards for whats already there.
- foreach($_POST['teams'] AS $tm)
- {
- foreach($_POST['timeslots'] AS $ts)
- {
- mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year) VALUES ('$tm','$ts','".$config['FAIRYEAR']."')");
-
- }
- }
- echo happy(i18n("%1 Timeslots assigned to %2 teams",array(count($_POST['timeslots']),count($_POST['teams']))));
+ mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,year) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$config['FAIRYEAR']."')");
+ echo happy(i18n("Project assigned to team timeslot"));
}
- if($_GET['action']=="edit" && $_GET['edit'])
+ if( ($action=="edit" || $action=="assign" ) && $edit)
{
- echo "