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. */ ?> << ".i18n("Back to Administration")."\n"; echo "<< ".i18n("Back to Judges")."\n"; echo "
"; echo "
"; 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(!$_SESSION['viewstate']['judges_projects_list_show']) $_SESSION['viewstate']['judges_projects_list_show']='unassigned'; //now update the judges_teams_list_show viewstate if($_GET['judges_projects_list_show']) $_SESSION['viewstate']['judges_projects_list_show']=$_GET['judges_projects_list_show']; if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit']) { mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE id='".$_GET['delete']."'"); echo happy(i18n("Judging team project successfully removed")); $action="edit"; } if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id']) { 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")); } $q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)>1) $show_date=true; else $show_date=false; if( ($action=="edit" || $action=="assign" ) && $edit) { echo "Back to Judging Teams Projects List"; echo "
"; echo "\n"; echo "\n"; echo "\n"; $team=getJudgingTeam($edit); echo "".$team['name']." (#".$team['num'].")
"; $memberlist="  "; foreach($team['members'] AS $member) { if($member['captain']=="yes") $memberlist.=""; $memberlist.=$member['firstname']." ".$member['lastname']; if($member['captain']=="yes") $memberlist.=""; $memberlist.=", "; } $memberlist=substr($memberlist,0,-2); echo $memberlist; echo "
"; if($_SESSION['viewstate']['judges_projects_list_show']=='all') { $querystr="SELECT projects.id, projects.projectnumber, projects.title, registrations.status FROM projects, registrations WHERE projectnumber is not null AND registrations.status='complete' AND projects.registrations_id=registrations.id AND projects.year='".$config['FAIRYEAR']."' ORDER BY projectnumber"; } else { $querystr="SELECT projects.id, projects.projectnumber, projects.title, registrations.status FROM projects LEFT JOIN judges_teams_timeslots_projects_link ON projects.id = judges_teams_timeslots_projects_link.projects_id, registrations WHERE projectnumber is not null AND registrations.status='complete' AND projects.registrations_id=registrations.id AND judges_teams_timeslots_projects_link.projects_id IS NULL AND projects.year='".$config['FAIRYEAR']."' ORDER BY projectnumber"; } $q=mysql_query($querystr); echo mysql_error(); $numprojects=mysql_num_rows($q); echo "
"; echo ""; echo ""; if($_SESSION['viewstate']['judges_projects_list_show']=='all') { echo ""; echo ""; } else { echo ""; echo ""; } echo ""; echo ""; echo ""; echo "
".i18n("show unassigned")."".i18n("show all")."".i18n("show unassigned")."".i18n("show all")." 
"; echo ""; echo ""; echo "$numprojects projects listed"; echo "
"; //get the timeslots that this team has. $q=mysql_query("SELECT judges_timeslots.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); echo "
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; while($r=mysql_fetch_object($q)) { echo ""; } echo "
TimeslotProject
"; echo ""; if($show_date) echo "$r->date "; echo substr($r->starttime,0,-3); echo " - "; echo substr($r->endtime,0,-3); echo ""; echo ""; $projq=mysql_query("SELECT judges_teams_timeslots_projects_link.id AS link_id, projects.projectnumber, projects.id, projects.title FROM projects, judges_teams_timeslots_projects_link WHERE judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND judges_teams_timeslots_projects_link.projects_id=projects.id AND judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."' ORDER BY projectnumber "); echo mysql_Error(); while($proj=mysql_fetch_object($projq)) { echo "link_id."&edit=".$team['id']."\">"; echo "$proj->projectnumber - $proj->title
"; } echo "id]\" type=\"button\" onclick=\"assign('$r->id')\" value=\"Assign\">"; echo "
"; echo "
"; } else { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $teams=getJudgingTeams(); foreach($teams AS $team) { echo ""; echo ""; echo ""; echo ""; } echo "
".i18n("Team")."".i18n("Timeslots and Projects")."
"; echo "".$team['name']." (#".$team['num'].")
"; $memberlist=""; 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_timeslots.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); echo "Edit team project assignments"; echo ""; while($r=mysql_fetch_object($q)) { echo ""; } echo "
"; echo ""; if($show_date) echo "$r->date "; echo substr($r->starttime,0,-3); echo " - "; echo substr($r->endtime,0,-3); echo ""; echo ""; $projq=mysql_query("SELECT projects.projectnumber, projects.id, projects.title FROM projects, judges_teams_timeslots_projects_link WHERE judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND judges_teams_timeslots_projects_link.projects_id=projects.id AND judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."' ORDER BY projectnumber "); echo mysql_Error(); while($proj=mysql_fetch_object($projq)) { echo "$proj->projectnumber - $proj->title
"; } echo "
"; echo "
"; } send_footer(); ?>