forked from science-ation/science-ation
Move some common schedule functions out
Properly show current capacity in schedule view
This commit is contained in:
parent
e5d9460d73
commit
a4ea7f6b1e
44
schedule.inc.php
Normal file
44
schedule.inc.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?
|
||||||
|
/*
|
||||||
|
This file is part of the 'Science Fair In A Box' project
|
||||||
|
SFIAB Website: http://www.sfiab.ca
|
||||||
|
|
||||||
|
Copyright (C) 2010 Youth Science Ontario <info@youthscienceontario.ca>
|
||||||
|
Copyright (C) 2010 James Grant <james@lightbox.org>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@ -23,6 +23,7 @@
|
|||||||
?>
|
?>
|
||||||
<?
|
<?
|
||||||
require("common.inc.php");
|
require("common.inc.php");
|
||||||
|
require_once("schedule.inc.php");
|
||||||
|
|
||||||
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
||||||
// we're logged in, make sure the school is good
|
// we're logged in, make sure the school is good
|
||||||
@ -112,9 +113,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
if($r->eventtype=="scienceolympic") {
|
if($r->eventtype=="scienceolympic") {
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo i18n("Capacity").": ";
|
echo i18n("Capacity").": ";
|
||||||
//FIXME: get # actually registered
|
$regteams=getNumRegistrations($r->id);
|
||||||
$regteams=0;
|
|
||||||
|
|
||||||
$maxteams=$r->somaxteams;
|
$maxteams=$r->somaxteams;
|
||||||
echo i18n("%1 of %2",array($regteams,$maxteams));
|
echo i18n("%1 of %2",array($regteams,$maxteams));
|
||||||
|
|
||||||
@ -154,6 +153,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
|||||||
buttons: {
|
buttons: {
|
||||||
"<?=i18n('Close')?>": function() {
|
"<?=i18n('Close')?>": function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
|
changeDate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -23,26 +23,7 @@
|
|||||||
?>
|
?>
|
||||||
<?
|
<?
|
||||||
require("common.inc.php");
|
require("common.inc.php");
|
||||||
|
require_once("schedule.inc.php");
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
|
||||||
// we're logged in, make sure the school is good
|
// we're logged in, make sure the school is good
|
||||||
|
Loading…
Reference in New Issue
Block a user