diff --git a/admin/judges_teams_timeslots.php b/admin/judges_teams_timeslots.php
index 811c6b23..88ed5823 100644
--- a/admin/judges_teams_timeslots.php
+++ b/admin/judges_teams_timeslots.php
@@ -22,22 +22,64 @@
*/
?>
- require("../common.inc.php");
- require_once("../user.inc.php");
+ require_once('../common.inc.php');
+ require_once('../user.inc.php');
user_auth_required('committee', 'admin');
- require("judges.inc.php");
+ require_once('judges.inc.php');
- send_header("Judging Teams Timeslots",
+ $round_str = array('timeslot' => 'Judging Timeslot',
+ 'divisional1' => 'Divisional Round 1',
+ 'divisional2' => 'Divisional Round 2',
+ 'grand' => 'Grand Awards',
+ 'special' => 'Special Awards' );
+ if(array_key_exists('action',$_GET))
+ $action = $_GET['action'];
+ if(array_key_exists('action',$_POST))
+ $action = $_POST['action'];
+
+
+ if($action == 'delete' && array_key_exists('delete', $_GET)) {
+ $id = intval($_GET['delete']);
+ mysql_query("DELETE FROM judges_teams_timeslots_link WHERE id='$id'");
+ message_push(happy(i18n("Judging team timeslot successfully removed")));
+ }
+
+ if($action == 'empty' && array_key_exists('empty',$_GET)) {
+ $id = intval($_GET['empty']);
+ mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$id'");
+ message_push(happy(i18n("Judging team timeslots successfully removed")));
+ }
+
+ if($action == 'assign') {
+ //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.
+ if(count($_POST['teams']) && count($_POST['timeslots'])) {
+ 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']}')");
+
+ }
+ }
+ message_push(happy(i18n("%1 Timeslots assigned to %2 teams",array(count($_POST['timeslots']),count($_POST['teams'])))));
+ } else {
+ message_push(error(i18n("You must select both team(s) and timeslot(s) to assign")));
+ }
+ }
+
+
+
+ send_header("Judging Teams Timeslots",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Judges' => 'admin/judges.php')
);
+
?>
-
-
echo "
";
- if($_GET['action']=="delete" && $_GET['delete'])
- {
- mysql_query("DELETE FROM judges_teams_timeslots_link WHERE id='".$_GET['delete']."'");
- echo happy(i18n("Judging team timeslot successfully removed"));
- }
-
- 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")
- {
- //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.
- if(count($_POST['teams']) && count($_POST['timeslots']))
- {
- 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']))));
- }
- else
- echo error(i18n("You must select both team(s) and timeslot(s) to assign"));
- }
-
echo "