forked from science-ation/science-ation
Add new participnt registration type: openorinvite - allows you to use the system as if it was OPEN or INVITE however limits cannot be imposed in the inviter since when its reached in the inviter it could easily be bypassed by registering through the 'open' way.
This commit is contained in:
parent
0dd2da7145
commit
2d17c8c21a
@ -1,3 +1,3 @@
|
||||
INSERT INTO `config` (category,ord,var,val,description,year) VALUES ('Participant Registration','1160','participant_project_table','yes','Ask if the project requires a table (yes/no)',-1);
|
||||
INSERT INTO `config` (category,ord,var,val,description,year) VALUES ('Participant Registration','1170','participant_project_electricity','yes','Ask if the project requires electricity (yes/no)',-1);
|
||||
|
||||
UPDATE `config` SET description = 'The type of Participant Registration to use: open | singlepassword | schoolpassword | invite | openorinvite' WHERE `var` = 'participant_registration_type'
|
||||
|
@ -285,7 +285,10 @@
|
||||
else if($config['participant_registration_type']=="open")
|
||||
{
|
||||
//thats fine, continue on and create them the account.
|
||||
|
||||
}
|
||||
else if($config['participant_registration_type']=="openorinvite")
|
||||
{
|
||||
//thats fine too, continue on and create them the account.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ if($config['participant_student_personal']=="yes")
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td>".i18n("School")."</td><td colspan=\"3\">";
|
||||
if( $config['participant_registration_type']=="open" || $config['participant_registration_type']=="singlepassword" || ($studentinfo && !$studentinfo->schools_id) )
|
||||
if( $config['participant_registration_type']=="open" || $config['participant_registration_type']=="singlepassword" || $config['participant_registration_type']=="openorinvite" || ($studentinfo && !$studentinfo->schools_id) )
|
||||
{
|
||||
$schoolq=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER by school");
|
||||
echo "<select name=\"schools_id[$x]\">\n";
|
||||
|
@ -123,7 +123,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
}
|
||||
else if($config['participant_registration_type']=="invite")
|
||||
else if($config['participant_registration_type']=="invite" || $config['participant_registration_type']=="openorinvite" )
|
||||
{
|
||||
|
||||
echo "<h4>".i18n("Participant Registration Invitations")."</h4>";
|
||||
|
102
schoolinvite.php
102
schoolinvite.php
@ -12,7 +12,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
|
||||
$school=mysql_fetch_object($q);
|
||||
if($school)
|
||||
{
|
||||
if($config['participant_registration_type']=="invite")
|
||||
if($config['participant_registration_type']=="invite" || $config['participant_registration_type']=="openorinvite" )
|
||||
{
|
||||
if($_POST['action']=="invite")
|
||||
{
|
||||
@ -105,64 +105,88 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
|
||||
ORDER BY
|
||||
lastname,
|
||||
firstname");
|
||||
if($datecheck!=0)
|
||||
$currentinvited=mysql_num_rows($q);
|
||||
|
||||
if($datecheck!=0)
|
||||
{
|
||||
echo i18n("In order for your school's students to register for the fair, you will need to invite them to register. Simply enter their email address below to invite them to register. <b>Important</b>: for group projects, only add one of the participants, that participant will then add the other group member(s) to the project");
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
$okaygrades=array();
|
||||
if($school->projectlimitper=="total")
|
||||
if($config['participant_registration_type']=="invite")
|
||||
{
|
||||
if($school->projectlimit)
|
||||
if($school->projectlimitper=="total")
|
||||
{
|
||||
echo i18n("You have invited %1 of %2 total projects for your school",array($currentinvited,$school->projectlimit));
|
||||
if($currenteinvited<$school->projectlimit)
|
||||
if($school->projectlimit)
|
||||
{
|
||||
echo i18n("You have invited %1 of %2 total projects for your school",array($currentinvited,$school->projectlimit));
|
||||
if($currenteinvited<$school->projectlimit)
|
||||
{
|
||||
for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++)
|
||||
$okaygrades[]=$a;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo i18n("You have invited %1 project(s) for your school",array($currentinvited,$school->projectlimit));
|
||||
for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++)
|
||||
$okaygrades[]=$a;
|
||||
|
||||
}
|
||||
}
|
||||
else if($school->projectlimitper=="agecategory")
|
||||
{
|
||||
echo "<br />";
|
||||
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($catr=mysql_fetch_object($catq))
|
||||
{
|
||||
|
||||
$q2=mysql_query("SELECT COUNT(students.id) AS num
|
||||
FROM
|
||||
students,
|
||||
registrations
|
||||
WHERE
|
||||
students.schools_id='".$school->id."'
|
||||
AND students.grade>='$catr->mingrade'
|
||||
AND students.grade<='$catr->maxgrade'
|
||||
AND students.year='".$config['FAIRYEAR']."'
|
||||
AND students.registrations_id=registrations.id
|
||||
");
|
||||
echo mysql_error();
|
||||
$r2=mysql_fetch_object($q2);
|
||||
$currentinvited=$r2->num;
|
||||
|
||||
if($currentinvited<$school->projectlimit || $school->projectlimit==0)
|
||||
{
|
||||
for($a=$catr->mingrade;$a<=$catr->maxgrade;$a++)
|
||||
$okaygrades[]=$a;
|
||||
}
|
||||
|
||||
echo i18n("You have invited %1 of %2 total projects for for the %3 age category",array($currentinvited,$school->projectlimit,i18n($catr->category)));
|
||||
echo "<br />";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo i18n("You have invited %1 project(s) for your school",array($currentinvited,$school->projectlimit));
|
||||
for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++)
|
||||
$okaygrades[]=$a;
|
||||
|
||||
//hmm projectlimitper has not been set
|
||||
//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++)
|
||||
$okaygrades[]=$x;
|
||||
}
|
||||
}
|
||||
else if($school->projectlimitper=="agecategory")
|
||||
else
|
||||
{
|
||||
echo "<br />";
|
||||
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($catr=mysql_fetch_object($catq))
|
||||
{
|
||||
// this could be an else if $config['participant_registration_type']=="openorinvite" )
|
||||
//because openorinvite is the only other option
|
||||
|
||||
$q2=mysql_query("SELECT COUNT(students.id) AS num
|
||||
FROM
|
||||
students,
|
||||
registrations
|
||||
WHERE
|
||||
students.schools_id='".$school->id."'
|
||||
AND students.grade>='$catr->mingrade'
|
||||
AND students.grade<='$catr->maxgrade'
|
||||
AND students.year='".$config['FAIRYEAR']."'
|
||||
AND students.registrations_id=registrations.id
|
||||
");
|
||||
echo mysql_error();
|
||||
$r2=mysql_fetch_object($q2);
|
||||
$currentinvited=$r2->num;
|
||||
//so we have no limits, anyone can register or they can add as many as they want.
|
||||
//you cannot enforce limits when the system is 'open' because anyone can choose any school
|
||||
//and if its openorinvite then whatever happens in the inviter still morepeople can be added
|
||||
//by themselves, so there's no point in having limits.
|
||||
for($x=$config['mingrade']; $x<=$config['maxgrade']; $x++)
|
||||
$okaygrades[]=$x;
|
||||
|
||||
if($currentinvited<$school->projectlimit)
|
||||
{
|
||||
for($a=$catr->mingrade;$a<=$catr->maxgrade;$a++)
|
||||
$okaygrades[]=$a;
|
||||
}
|
||||
|
||||
echo i18n("You have invited %1 of %2 total projects for for the %3 age category",array($currentinvited,$school->projectlimit,i18n($catr->category)));
|
||||
echo "<br />";
|
||||
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user