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. */ ?> title!=$r->name) { $name="($r->name)"; } echo "

$r->title $name

"; switch($_GET['tab']) { case "summary": echo ""; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
".i18n("Time")."".i18n("Duration")."".i18n("Location")."
".format_time(strtotime($r->hour.":".$r->minute))."$r->duration minutes$r->location
\n"; echo "
"; echo "

".i18n("Summary")."

\n"; echo nl2br(trim($r->summary)); echo "
\n"; echo "
\n"; if($r->website) { echo "website\">".i18n("Click here for the full event description")."
\n"; } break; case "register": $regteams=getNumRegistrations($r->id); echo i18n("Current capacity: %1 of %2 Teams",array($regteams,$r->somaxteams)); echo "
"; echo "
"; echo i18n("Your school's teams").":
"; echo ""; echo ""; echo " "; echo " "; echo " "; echo ""; $query="SELECT * FROM so_teams WHERE schools_id='{$school->id}' AND conferences_id='{$conference['id']}'"; $tq=mysql_query($query); echo mysql_error(); while($team=mysql_fetch_object($tq)) { $status=getTeamEventStatus($team->id,$r->id); if($status=="registered") { $cl="class=\"happy\""; $statusmsg=i18n("Registered"); $buttonmsg=i18n("Un-Register"); $action="unregister"; } else { $cl="class=\"error\""; $statusmsg=i18n("Not Registered"); $buttonmsg=i18n("Register"); $action="register"; } echo ""; echo ""; echo ""; echo "\n"; } echo "
".i18n("Team Name")."".i18n("Current Status")."".i18n("Action")."
$team->name$statusmsgid,$r->id,'$action')\">
\n"; break; } break; case "register": $teamid=intval($_POST['teamid']); $scheduleid=intval($_POST['scheduleid']); $conferenceid=$conference['id']; $q=mysql_query("SELECT schedule.*, events.eventtype, events.website, events.summary, events.name, locations.name AS location FROM schedule JOIN events ON schedule.events_id=events.id JOIN locations ON schedule.locations_id=locations.id WHERE schedule.conferences_id='{$conference['id']}' AND schedule.id='{$scheduleid}'"); $schedule=mysql_fetch_object($q); echo mysql_error(); switch($_POST['regaction']) { case "register": $q=mysql_query("SELECT * FROM schedule_registrations WHERE so_teams_id=$teamid AND schedule_id=$scheduleid AND conferences_id=$conferenceid"); if(mysql_num_rows($q)) { error_("This team is already registered for this scheduled event"); } else { $regteams=getNumRegistrations($scheduleid); if($regteams<$schedule->somaxteams) { mysql_query("INSERT INTO schedule_registrations (schedule_id, so_teams_id, conferences_id, dt) VALUES ('$scheduleid','$teamid','$conferenceid',NOW())"); happy_("Successfully registered the team for this scheduled event"); } else { error_("This event has reached its capacity and can no longer be registered for"); } } break; case "unregister": $q=mysql_query("SELECT * FROM schedule_registrations WHERE so_teams_id=$teamid AND schedule_id=$scheduleid AND conferences_id=$conferenceid"); if(mysql_num_rows($q)) { // delete any links between students and this registrationa $q = mysql_query( " SELECT users_uid, schedule_registrations_id" . " FROM schedule_registrations_users_link srul" . " JOIN schedule_registrations sr ON sr.id = srul.schedule_registrations_id" . " WHERE sr.so_teams_id = '$teamid'" . " AND sr.schedule_id='$scheduleid'" . " AND sr.conferences_id='$conferenceid'" ); while($r = mysql_fetch_array($q)){ $idSet[] = $r['users_uid']; $srid = $r['schedule_registrations_id']; } if(is_array($idSet)){ $query = " DELETE FROM schedule_registrations_users_link" . " WHERE schedule_registrations_id = $srid" . " AND users_uid IN(" . implode(',', $idSet) . ")"; $q = mysql_query($query); } // delete the registrations themselves mysql_query("DELETE FROM schedule_registrations WHERE so_teams_id='$teamid' AND schedule_id='$scheduleid' AND conferences_id='$conferenceid'"); happy_("Successfully unregistered the team from this scheduled event"); } else { error_("This team is not registered for this scheduled event, and thus, cannot be unregistered"); } break; } break; } } else { echo "Invalid school"; } } else { echo "Invalid school id or access code"; } ?>