Fix a typo bug on a variable name which prevented the system from cutting off registrations when the maximum is reached

This commit is contained in:
james 2012-02-27 20:31:48 +00:00
parent a8e81cc84c
commit d30468326e

View File

@ -117,33 +117,25 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "<br />"; echo "<br />";
echo "<br />"; echo "<br />";
$okaygrades=array(); $okaygrades=array();
if($config['participant_registration_type']=="invite") if($config['participant_registration_type']=="invite") {
{ if($school->projectlimitper=="total") {
if($school->projectlimitper=="total") if($school->projectlimit) {
{
if($school->projectlimit)
{
echo i18n("You have invited %1 of %2 total projects for your school",array($currentinvited,$school->projectlimit)); echo i18n("You have invited %1 of %2 total projects for your school",array($currentinvited,$school->projectlimit));
if($currenteinvited<$school->projectlimit) if($currentinvited<$school->projectlimit) {
{
for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++) for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++)
$okaygrades[]=$a; $okaygrades[]=$a;
} }
} }
else else {
{
echo i18n("You have invited %1 project(s) for your school",array($currentinvited,$school->projectlimit)); echo i18n("You have invited %1 project(s) for your school",array($currentinvited,$school->projectlimit));
for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++) for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++)
$okaygrades[]=$a; $okaygrades[]=$a;
} }
} }
else if($school->projectlimitper=="agecategory") else if($school->projectlimitper=="agecategory") {
{
echo "<br />"; echo "<br />";
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); $catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
while($catr=mysql_fetch_object($catq)) while($catr=mysql_fetch_object($catq)) {
{
$q2=mysql_query("SELECT COUNT(students.id) AS num $q2=mysql_query("SELECT COUNT(students.id) AS num
FROM FROM
@ -160,8 +152,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
$r2=mysql_fetch_object($q2); $r2=mysql_fetch_object($q2);
$currentinvited=$r2->num; $currentinvited=$r2->num;
if($currentinvited<$school->projectlimit || $school->projectlimit==0) if($currentinvited<$school->projectlimit || $school->projectlimit==0) {
{
for($a=$catr->mingrade;$a<=$catr->maxgrade;$a++) for($a=$catr->mingrade;$a<=$catr->maxgrade;$a++)
$okaygrades[]=$a; $okaygrades[]=$a;
} }
@ -171,16 +162,14 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
} }
} }
else else {
{
//hmm projectlimitper has not been set //hmm projectlimitper has not been set
//so we have no limits, anyone can register or they can add as many as they want. //so we have no limits, anyone can register or they can add as many as they want.
for($x=$config['mingrade']; $x<=$config['maxgrade']; $x++) for($x=$config['mingrade']; $x<=$config['maxgrade']; $x++)
$okaygrades[]=$x; $okaygrades[]=$x;
} }
} }
else else {
{
// this could be an else if $config['participant_registration_type']=="openorinvite" ) // this could be an else if $config['participant_registration_type']=="openorinvite" )
//because openorinvite is the only other option //because openorinvite is the only other option
@ -194,8 +183,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
} }
echo "<br />"; echo "<br />";
if(count($okaygrades)) if(count($okaygrades)) {
{
echo "<form method=POST action=\"schoolinvite.php\">"; echo "<form method=POST action=\"schoolinvite.php\">";
echo "<input type=hidden name=action value=\"invite\">"; echo "<input type=hidden name=action value=\"invite\">";
@ -210,8 +198,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "<select name=\"grade\">\n"; echo "<select name=\"grade\">\n";
echo "<option value=\"\">".i18n("Select Grade")."</option>\n"; echo "<option value=\"\">".i18n("Select Grade")."</option>\n";
// for($gr=$config['mingrade'];$gr<=$config['maxgrade'];$gr++) // for($gr=$config['mingrade'];$gr<=$config['maxgrade'];$gr++)
foreach($okaygrades AS $gr) foreach($okaygrades AS $gr) {
{
echo "<option value=\"$gr\">$gr</option>\n"; echo "<option value=\"$gr\">$gr</option>\n";
} }
@ -221,8 +208,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "<input type=\"submit\" value=\"".i18n("Invite Participant")."\">"; echo "<input type=\"submit\" value=\"".i18n("Invite Participant")."\">";
echo "</form>"; echo "</form>";
} }
else else {
{
echo notice(i18n("You have invited the maximum number of participants for your school")); echo notice(i18n("You have invited the maximum number of participants for your school"));
} }
@ -230,16 +216,14 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "<br />"; echo "<br />";
echo "<h4>".i18n("Invited participants from your school")."</h4>"; echo "<h4>".i18n("Invited participants from your school")."</h4>";
if(mysql_num_rows($q)) if(mysql_num_rows($q)) {
{
echo "<table class=\"summarytable\">"; echo "<table class=\"summarytable\">";
echo "<tr><th>".i18n("Last Name")."</th><th>".i18n("First Name")."</th>"; echo "<tr><th>".i18n("Last Name")."</th><th>".i18n("First Name")."</th>";
echo "<th>".i18n("Email Address")."</th>"; echo "<th>".i18n("Email Address")."</th>";
echo "<th>".i18n("Grade")."</th>"; echo "<th>".i18n("Grade")."</th>";
echo "<th>".i18n("Registration Number")."</th>"; echo "<th>".i18n("Registration Number")."</th>";
echo "<th colspan=\"2\">".i18n("Actions")."</th></tr>"; echo "<th colspan=\"2\">".i18n("Actions")."</th></tr>";
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q)) {
{
echo "<tr><td>$r->lastname</td><td>$r->firstname</td>"; echo "<tr><td>$r->lastname</td><td>$r->firstname</td>";
echo "<td>$r->email"; echo "<td>$r->email";
if($r->emailcontact) if($r->emailcontact)
@ -262,21 +246,20 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
} }
echo "</table>"; echo "</table>";
} }
else else {
echo i18n("You have not yet invited any participants from your school"); echo i18n("You have not yet invited any participants from your school");
}
} }
} }
else else {
{
echo error(i18n("Invalid School ID or Access Code")); echo error(i18n("Invalid School ID or Access Code"));
echo "<br />"; echo "<br />";
echo "<a href=\"schoolaccess.php\">".i18n("Perhaps you should login first")."</a>"; echo "<a href=\"schoolaccess.php\">".i18n("Perhaps you should login first")."</a>";
} }
send_footer(); send_footer();
} }
else else {
{
header("Location: schoolaccess.php"); header("Location: schoolaccess.php");
exit; exit;
} }