diff --git a/schedule.inc.php b/schedule.inc.php new file mode 100644 index 0000000..5950205 --- /dev/null +++ b/schedule.inc.php @@ -0,0 +1,44 @@ + + Copyright (C) 2010 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. +*/ + +function getTeamEventStatus($teamid,$scheduleid) { + global $conference; + $q=mysql_query("SELECT * FROM schedule_registrations WHERE so_teams_id='$teamid' AND schedule_id='$scheduleid' AND conferences_id='{$conference['id']}'"); + + //we use registered/notregistered insetad of true/false becuase we might haevf other statuses down the line, like "waitinglist" + if(mysql_num_rows($q)) { + return "registered"; + } + else + return "notregistered"; +} + +function getNumRegistrations($scheduleid) { + global $conference; + $q=mysql_query("SELECT COUNT(*) AS num FROM schedule_registrations WHERE schedule_id='$scheduleid' AND conferences_id='{$conference['id']}'"); + $r=mysql_fetch_object($q); + return $r->num; +} + + +?> diff --git a/schoolschedule.php b/schoolschedule.php index 283f30f..6755c2f 100644 --- a/schoolschedule.php +++ b/schoolschedule.php @@ -23,6 +23,7 @@ ?> eventtype=="scienceolympic") { echo "
"; echo i18n("Capacity").": "; - //FIXME: get # actually registered - $regteams=0; - + $regteams=getNumRegistrations($r->id); $maxteams=$r->somaxteams; echo i18n("%1 of %2",array($regteams,$maxteams)); @@ -154,6 +153,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){ buttons: { "": function() { $(this).dialog("close"); + changeDate(); } } }); diff --git a/schoolschedule_event_tab.php b/schoolschedule_event_tab.php index 9a316b4..f888f75 100644 --- a/schoolschedule_event_tab.php +++ b/schoolschedule_event_tab.php @@ -23,26 +23,7 @@ ?> num; -} - + require_once("schedule.inc.php"); if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){ // we're logged in, make sure the school is good