Copyright (C) 2005 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> '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,conferences_id) VALUES ('$tm','$ts','{$conference['id']}')"); } } 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 "
"; echo ""; echo "Choose timeslots to assign:
"; echo "select all"; echo " | "; echo "select none"; echo " | "; echo "invert selection"; $q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)>1) $show_date=true; else $show_date=false; echo ""; echo ""; echo ""; if($show_date) echo ""; echo ""; echo ""; echo "\n"; $q=mysql_query("SELECT * FROM judges_timeslots WHERE conferences_id='{$conference['id']}' AND round_id='0' ORDER BY date,starttime"); while($r=mysql_fetch_object($q)) { echo ""; $span = $show_date ? 4 : 3; echo ""; $qq = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='{$r->id}' ORDER BY date,starttime"); while($rr = mysql_fetch_object($qq)) { echo ""; echo ""; if($show_date) echo ""; echo ""; echo ""; echo "\n"; } } echo "
 ".i18n("Date")."".i18n("Start Time")."".i18n("End Time")."
{$r->name} (".$round_str[$r->type].")
id}\" />".format_date($r->date)."".format_time($rr->starttime)."".format_time($rr->endtime)."
"; echo "
"; echo "
"; echo "Choose teams to assign the above selected timeslots to:"; echo "
"; echo "select all"; echo " | "; echo "select none"; echo " | "; echo "invert selection"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $teams=getJudgingTeams(); foreach($teams AS $team) { echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
 ".i18n("Team")."".i18n("Timeslots")."
"; echo "".$team['name']." (#".$team['num'].")
"; $memberlist=""; if(count($team['members'])) { foreach($team['members'] AS $member) { echo "  "; if($member['captain']=="yes") echo ""; echo $member['firstname']." ".$member['lastname']."
"; if($member['captain']=="yes") echo "
"; } } echo "
"; //get the timeslots that this team has. $q=mysql_query("SELECT judges_teams_timeslots_link.id, judges_timeslots.date, judges_timeslots.starttime, judges_timeslots.endtime FROM judges_timeslots, judges_teams, judges_teams_timeslots_link WHERE judges_teams.id='".$team['id']."' AND judges_teams.id=judges_teams_timeslots_link.judges_teams_id AND judges_timeslots.id=judges_teams_timeslots_link.judges_timeslots_id ORDER BY date,starttime "); $numslots=mysql_num_rows($q); while($r=mysql_fetch_object($q)) { echo ""; if($show_date) echo format_date($r->date); echo format_time($r->starttime); echo " - "; echo format_time($r->endtime); echo "  id\">"; echo ""; echo "
"; } if($numslots) echo "  remove all"; echo "
"; echo "
"; echo "
"; echo ""; echo "
"; send_footer(); ?>