forked from science-ation/science-ation
More conversions from fair year to conference id
This commit is contained in:
parent
d8df2be109
commit
ca0e700952
@ -156,7 +156,7 @@ $catPreferenceText .= "</ul>";
|
||||
<tr><td>
|
||||
<ul>
|
||||
|
||||
<li><strong><?="Complete for {$config['FAIRYEAR']}";?>: </strong>
|
||||
<li><strong><?="Complete for {$conference['year']}";?>: </strong>
|
||||
<?=$completeText;?></li>
|
||||
|
||||
<li><strong><?=i18n("Special awards");?>: </strong>
|
||||
|
@ -30,7 +30,7 @@ ogram; see the file COPYING. If not, write to
|
||||
require("judges.inc.php");
|
||||
require("judges_schedulerconfig_check.inc.php");
|
||||
|
||||
$action = config_editor_handle_actions("Judge Scheduler", $config['FAIRYEAR'], "var");
|
||||
$action = config_editor_handle_actions("Judge Scheduler", $conference['id'], "var");
|
||||
if($action == 'update') {
|
||||
header("Location: judges_schedulerconfig.php");
|
||||
exit;
|
||||
@ -43,7 +43,7 @@ ogram; see the file COPYING. If not, write to
|
||||
'Judges' => 'admin/judges.php')
|
||||
);
|
||||
|
||||
config_editor("Judge Scheduler", $config['FAIRYEAR'], "var", $_SERVER['PHP_SELF']);
|
||||
config_editor("Judge Scheduler", $conference['id'], "var", $_SERVER['PHP_SELF']);
|
||||
echo "<hr />";
|
||||
|
||||
if($_GET['action']=="reset")
|
||||
|
@ -109,7 +109,7 @@ jQuery(document).ready(function(){
|
||||
if($_POST['action']=="add" && $_POST['team_num'] && count($_POST['judgelist'])>0)
|
||||
{
|
||||
//first check if this team exists.
|
||||
$q=mysql_query("SELECT id,name FROM judges_teams WHERE num='".$_POST['team_num']."' AND year='".$config['FAIRYEAR']."'");
|
||||
$q=mysql_query("SELECT id,name FROM judges_teams WHERE num='".$_POST['team_num']."' AND conferences_id='".$conference['id']."'");
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
$r=mysql_fetch_object($q);
|
||||
@ -138,7 +138,7 @@ jQuery(document).ready(function(){
|
||||
else
|
||||
{
|
||||
//lets make the first one we add a captain, the rest, non-captains :)
|
||||
mysql_query("INSERT INTO judges_teams_link (users_id,judges_teams_id,captain,year) VALUES ('$selectedjudge','$team_id','$captain','".$config['FAIRYEAR']."')");
|
||||
mysql_query("INSERT INTO judges_teams_link (users_id,judges_teams_id,captain,conferences_id) VALUES ('$selectedjudge','$team_id','$captain','".$conference['id']."')");
|
||||
$added++;
|
||||
}
|
||||
//if this is alreayd no, then who cares, but if its the first one that is going into the new team, then
|
||||
@ -155,11 +155,11 @@ jQuery(document).ready(function(){
|
||||
|
||||
if($_GET['action']=="del" && $_GET['team_num'] && $_GET['team_id'] && $_GET['users_id'])
|
||||
{
|
||||
mysql_query("DELETE FROM judges_teams_link WHERE users_id='".$_GET['users_id']."' AND judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_link WHERE users_id='".$_GET['users_id']."' AND judges_teams_id='".$_GET['team_id']."' AND conferences_id='".$conference['id']."'");
|
||||
echo happy(i18n("Removed judge from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name'])));
|
||||
|
||||
//if there is still members left in the team, make sure we have a captain still
|
||||
$q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
$q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND conferences_id='".$conference['id']."'");
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
//make sure the team still has a captain!
|
||||
@ -183,7 +183,7 @@ jQuery(document).ready(function(){
|
||||
if(!$gotcaptain)
|
||||
{
|
||||
//make the first judge the captain
|
||||
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND users_id='$firstjudge' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND users_id='$firstjudge' AND conferences_id='".$conference['id']."'");
|
||||
echo notice(i18n("Team captain was removed. A new team captain has been automatically assigned"));
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ jQuery(document).ready(function(){
|
||||
|
||||
if($_GET['action']=="empty" && $_GET['team_num'] && $_GET['team_id'])
|
||||
{
|
||||
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND conferences_id='".$conference['id']."'");
|
||||
echo happy(i18n("Emptied all judges from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name'])));
|
||||
}
|
||||
|
||||
@ -272,14 +272,14 @@ jQuery(document).ready(function(){
|
||||
|
||||
/* Load all the teams */
|
||||
$teams = array();
|
||||
$q = mysql_query("SELECT * FROM judges_teams WHERE year='{$config['FAIRYEAR']}'");
|
||||
$q = mysql_query("SELECT * FROM judges_teams WHERE conferences_id='{$conference['id']}'");
|
||||
while($i = mysql_fetch_assoc($q)) {
|
||||
$teams[$i['id']] = $i;
|
||||
}
|
||||
|
||||
/* And the links */
|
||||
$links = array();
|
||||
$q = mysql_query("SELECT * FROM judges_teams_link WHERE year='{$config['FAIRYEAR']}'");
|
||||
$q = mysql_query("SELECT * FROM judges_teams_link WHERE conferences_id='{$conference['id']}'");
|
||||
while($i = mysql_fetch_assoc($q)) {
|
||||
$judgelist[$i['users_id']]['teams_links'][] = $i;
|
||||
}
|
||||
|
@ -56,8 +56,8 @@
|
||||
if(count($_POST['teams']) && count($_POST['timeslots'])) {
|
||||
foreach($_POST['teams'] AS $tm) {
|
||||
foreach($_POST['timeslots'] AS $ts) {
|
||||
mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year)
|
||||
VALUES ('$tm','$ts','{$config['FAIRYEAR']}')");
|
||||
mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,conferences_id)
|
||||
VALUES ('$tm','$ts','{$conference['id']}')");
|
||||
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,7 @@ function checkinvert(what)
|
||||
echo "<a href=\"\" onclick=\"return checkinvert('timeslots')\">invert selection</a>";
|
||||
|
||||
|
||||
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'");
|
||||
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'");
|
||||
if(mysql_num_rows($q)>1)
|
||||
$show_date=true;
|
||||
else
|
||||
@ -141,7 +141,7 @@ function checkinvert(what)
|
||||
echo "</tr>\n";
|
||||
|
||||
$q=mysql_query("SELECT * FROM judges_timeslots
|
||||
WHERE year='{$config['FAIRYEAR']}'
|
||||
WHERE conferences_id='{$conference['id']}'
|
||||
AND round_id='0' ORDER BY date,starttime");
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
echo "<tr>";
|
||||
|
@ -81,7 +81,7 @@
|
||||
if($save == true) {
|
||||
if($round_id == 0) {
|
||||
/* New entry */
|
||||
mysql_query("INSERT INTO judges_timeslots (round_id,year) VALUES('0','{$config['FAIRYEAR']}')");
|
||||
mysql_query("INSERT INTO judges_timeslots (round_id,conferences_id) VALUES('0','{$conference['id']}')");
|
||||
$round_id = mysql_insert_id();
|
||||
}
|
||||
|
||||
@ -135,8 +135,8 @@
|
||||
if($save == true) {
|
||||
if($timeslot_id == 0) {
|
||||
/* New entry */
|
||||
mysql_query("INSERT INTO judges_timeslots (round_id,date,type,year) VALUES('$round_id',
|
||||
'$date','timeslot','{$config['FAIRYEAR']}')");
|
||||
mysql_query("INSERT INTO judges_timeslots (round_id,date,type,conferences_id) VALUES('$round_id',
|
||||
'$date','timeslot','{$conference['id']}')");
|
||||
$timeslot_id = mysql_insert_id();
|
||||
}
|
||||
|
||||
@ -178,10 +178,10 @@
|
||||
|
||||
$starttime = sprintf("%02d:%02d:00", $hr, $min);
|
||||
|
||||
mysql_query("INSERT INTO judges_timeslots (date,type,round_id,starttime,endtime,year) VALUES (
|
||||
mysql_query("INSERT INTO judges_timeslots (date,type,round_id,starttime,endtime,conferences_id) VALUES (
|
||||
'$date','timeslot','{$round_data['id']}',
|
||||
'$starttime', '$et',
|
||||
'{$config['FAIRYEAR']}')");
|
||||
'{$conference['id']}')");
|
||||
echo mysql_error();
|
||||
$date=$nd;
|
||||
list($s_h,$s_m,$s_s)=explode(":",$nt);
|
||||
@ -353,7 +353,7 @@
|
||||
echo "<th>".i18n("Actions")."</th>";
|
||||
echo "</tr>";
|
||||
|
||||
$q=mysql_query("SELECT * FROM judges_timeslots WHERE year='{$config['FAIRYEAR']}' AND `type`!='timeslot' ORDER BY date,starttime");
|
||||
$q=mysql_query("SELECT * FROM judges_timeslots WHERE conferences_id='{$conference['id']}' AND `type`!='timeslot' ORDER BY date,starttime");
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
echo "<tr>";
|
||||
$qq = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='{$r->id}' ORDER BY `date`,`starttime`");
|
||||
|
@ -31,7 +31,7 @@
|
||||
{
|
||||
if($_POST['save']=="add")
|
||||
{
|
||||
$q=mysql_query("INSERT INTO schools (year) VALUES ('".$config['FAIRYEAR']."')");
|
||||
$q=mysql_query("INSERT INTO schools (conferences_id) VALUES ('".$conference['id']."')");
|
||||
$id=mysql_insert_id();
|
||||
}
|
||||
else
|
||||
@ -176,17 +176,17 @@
|
||||
|
||||
if($_GET['action']=="clearaccesscodes")
|
||||
{
|
||||
mysql_query("UPDATE schools SET accesscode=NULL WHERE year='{$config['FAIRYEAR']}'");
|
||||
mysql_query("UPDATE schools SET accesscode=NULL WHERE conferences_id='{$conference['id']}'");
|
||||
$notice = 'clearaccess';
|
||||
}
|
||||
|
||||
if($_GET['action']=="makeaccesscodes")
|
||||
{
|
||||
$q=mysql_query("SELECT id FROM schools WHERE year='{$config['FAIRYEAR']}' AND (accesscode IS NULL OR accesscode='')");
|
||||
$q=mysql_query("SELECT id FROM schools WHERE conferences_id='{$conference['id']}' AND (accesscode IS NULL OR accesscode='')");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$ac=generatePassword(5);
|
||||
mysql_query("UPDATE schools SET accesscode='$ac' WHERE id='$r->id' AND year='{$config['FAIRYEAR']}'");
|
||||
mysql_query("UPDATE schools SET accesscode='$ac' WHERE id='$r->id' AND conferences_id='{$conference['id']}'");
|
||||
|
||||
}
|
||||
$notice = 'makeaccess';
|
||||
@ -333,7 +333,7 @@
|
||||
echo " <th>".i18n("Participation")."</th>";
|
||||
echo "</tr></thead>\n";
|
||||
|
||||
$query = mysql_query("SELECT id, school, include_fairs, include_olympics FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school");
|
||||
$query = mysql_query("SELECT id, school, include_fairs, include_olympics FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
|
||||
while($record = mysql_fetch_array($query)){
|
||||
echo "<tr><td>" . $record['school'] . "</td>";
|
||||
echo "<td><label style=\"margin-right: 2em\">";
|
||||
@ -406,7 +406,7 @@
|
||||
echo " <th>".i18n("Action")."</th>";
|
||||
echo "</tr></thead>\n";
|
||||
|
||||
$q=mysql_query("SELECT * FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school");
|
||||
$q=mysql_query("SELECT * FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr>\n";
|
||||
|
@ -49,13 +49,13 @@
|
||||
if($_POST['emptycurrent']==1)
|
||||
{
|
||||
echo happy(i18n("Old school data erased"));
|
||||
mysql_query("DELETE FROM schools WHERE year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM schools WHERE conferences_id='".$conference['id']."'");
|
||||
}
|
||||
|
||||
$loaded=0;
|
||||
foreach($CSVP->data AS $row)
|
||||
{
|
||||
mysql_query("INSERT INTO schools (school,schoollang,schoollevel,board,district,phone,fax,address,city,province_code,postalcode,principal,schoolemail,sciencehead,scienceheademail,scienceheadphone,accesscode,registration_password,projectlimit,projectlimitper,year) VALUES (
|
||||
mysql_query("INSERT INTO schools (school,schoollang,schoollevel,board,district,phone,fax,address,city,province_code,postalcode,principal,schoolemail,sciencehead,scienceheademail,scienceheadphone,accesscode,registration_password,projectlimit,projectlimitper,conferences_id) VALUES (
|
||||
'".mysql_escape_string(stripslashes($row[0]))."',
|
||||
'".mysql_escape_string(stripslashes($row[1]))."',
|
||||
'".mysql_escape_string(stripslashes($row[2]))."',
|
||||
@ -76,7 +76,7 @@
|
||||
'".mysql_escape_string(stripslashes($row[17]))."',
|
||||
'".mysql_escape_string(stripslashes($row[18]))."',
|
||||
'".mysql_escape_string(stripslashes($row[19]))."',
|
||||
'".$config['FAIRYEAR']."')");
|
||||
'".$conference['id']."')");
|
||||
if(!mysql_Error())
|
||||
$loaded++;
|
||||
else
|
||||
|
@ -79,7 +79,7 @@
|
||||
users_sponsor.users_id=users.id
|
||||
AND sponsors_id='$sponsors_id'
|
||||
AND `primary`='yes'
|
||||
AND year='".$config['FAIRYEAR']."'
|
||||
AND conferences_id='".$conference['id']."'
|
||||
AND users_id!='$id'");
|
||||
if(mysql_num_rows($q) == 0) {
|
||||
/* This must be the primary */
|
||||
@ -172,7 +172,7 @@
|
||||
echo "<br />";
|
||||
|
||||
$q=mysql_query("SELECT * FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
|
||||
WHERE year='".$config['FAIRYEAR']."'
|
||||
WHERE conferences_id='".$conference['id']."'
|
||||
AND sponsors_id='$sponsors_id'
|
||||
AND deleted='no'
|
||||
ORDER BY lastname,firstname");
|
||||
|
@ -40,7 +40,7 @@ if($auth_type == 'fair') {
|
||||
the master copy of the fairs_id in the project */
|
||||
$q=mysql_query("SELECT * FROM projects WHERE
|
||||
registrations_id='$registrations_id'
|
||||
AND year='{$config['FAIRYEAR']}'
|
||||
AND conferences_id='{$conference['id']}'
|
||||
AND fairs_id=$fairs_id");
|
||||
if(mysql_num_rows($q) != 1) {
|
||||
echo "permission denied.";
|
||||
@ -79,10 +79,10 @@ case 'student_remove':
|
||||
mysql_query("DELETE FROM students WHERE id='$remove_id' AND registrations_id='$registrations_id'");
|
||||
|
||||
//now see if they have an emergency contact that also needs to be removed
|
||||
$q=mysql_query("SELECT id FROM emergencycontact WHERE students_id='$remove_id' AND registrations_id='$registrations_id' AND year='{$config['FAIRYEAR']}'");
|
||||
$q=mysql_query("SELECT id FROM emergencycontact WHERE students_id='$remove_id' AND registrations_id='$registrations_id' AND conferences_id='{$conference['id']}'");
|
||||
//no need to error message if this doesnt exist
|
||||
if(mysql_num_rows($q)==1)
|
||||
mysql_query("DELETE FROM emergencycontact WHERE students_id='$remove_id' AND registrations_id='$registrations_id' AND year='{$config['FAIRYEAR']}'");
|
||||
mysql_query("DELETE FROM emergencycontact WHERE students_id='$remove_id' AND registrations_id='$registrations_id' AND conferences_id='{$conference['id']}'");
|
||||
|
||||
happy_("Student successfully removed");
|
||||
exit;
|
||||
@ -98,14 +98,14 @@ exit;
|
||||
//now do any data saves
|
||||
function students_save()
|
||||
{
|
||||
global $registrations_id, $config;
|
||||
global $registrations_id, $config, $conference;
|
||||
|
||||
$x=1;
|
||||
while($_POST["num"][$x]) {
|
||||
if($_POST['id'][$x]==0) {
|
||||
//if they use schoolpassword or singlepassword, then we need to set the school based on the school stored in the registration record. for anything else they can school the school on their own.
|
||||
if($config['participant_registration_type']=="schoolpassword" || $config['participant_registration_type']=="invite") {
|
||||
$q=mysql_query("SELECT schools_id FROM registrations WHERE id='$registrations_id' AND YEAR='{$config['FAIRYEAR']}'");
|
||||
$q=mysql_query("SELECT schools_id FROM registrations WHERE id='$registrations_id' AND conferences_id='{$conference['id']}'");
|
||||
$r=mysql_fetch_object($q);
|
||||
$schools_id=$r->schools_id;
|
||||
$schoolvalue="'$schools_id', ";
|
||||
@ -114,7 +114,7 @@ function students_save()
|
||||
}
|
||||
//INSERT new record
|
||||
$dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x];
|
||||
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,year) VALUES (".
|
||||
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,conferences_id) VALUES (".
|
||||
"'".$registrations_id."', ".
|
||||
"'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ".
|
||||
"'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ".
|
||||
@ -133,7 +133,7 @@ function students_save()
|
||||
"'".mysql_escape_string(stripslashes($_POST['foodreq'][$x]))."', ".
|
||||
"'".mysql_escape_string(stripslashes($_POST['teachername'][$x]))."', ".
|
||||
"'".mysql_escape_string(stripslashes($_POST['teacheremail'][$x]))."', ".
|
||||
"'".$config['FAIRYEAR']."')");
|
||||
"'".$conference['id']."')");
|
||||
|
||||
happy_("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x]));
|
||||
|
||||
@ -178,12 +178,12 @@ function students_save()
|
||||
|
||||
function students_load()
|
||||
{
|
||||
global $registrations_id, $config;
|
||||
global $registrations_id, $config, $conference;
|
||||
|
||||
//now query and display
|
||||
$q=mysql_query("SELECT * FROM students WHERE
|
||||
registrations_id='$registrations_id'
|
||||
AND year='{$config['FAIRYEAR']}'");
|
||||
AND conferences_id='{$conference['id']}'");
|
||||
echo mysql_error();
|
||||
|
||||
$numfound=mysql_num_rows($q);
|
||||
@ -279,8 +279,8 @@ function students_load()
|
||||
//the year selector should be based on the min/max grades possible
|
||||
//assume min age of 3 for grade=0 (kindergarden)
|
||||
//assume max age of 18 for grade=12
|
||||
$minyearselect=$config['FAIRYEAR'] - 6 - $config['maxgrade'];
|
||||
$maxyearselect=$config['FAIRYEAR'] - 3 - $config['mingrade'];
|
||||
$minyearselect = $conference['year'] - 6 - $config['maxgrade'];
|
||||
$maxyearselect = $conference['year'] - 3 - $config['mingrade'];
|
||||
emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect);
|
||||
echo "</td><td>".REQUIREDFIELD."</td></tr></table>\n";
|
||||
echo "</td>\n";
|
||||
@ -347,7 +347,7 @@ function students_load()
|
||||
echo " <td>".i18n("School")."</td><td colspan=\"3\">";
|
||||
if( $config['participant_registration_type']=="open" || $config['participant_registration_type']=="singlepassword" || ($studentinfo && !$studentinfo->schools_id) )
|
||||
{
|
||||
$schoolq=mysql_query("SELECT id,school,city FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER by city,school");
|
||||
$schoolq=mysql_query("SELECT id,school,city FROM schools WHERE conferences_id='".$conference['id']."' ORDER by city,school");
|
||||
echo "<select name=\"schools_id[$x]\">\n";
|
||||
echo "<option value=\"\">".i18n("Choose School")."</option>\n";
|
||||
while($r=mysql_fetch_object($schoolq))
|
||||
@ -360,7 +360,7 @@ function students_load()
|
||||
}
|
||||
else
|
||||
{
|
||||
$schoolq=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' AND id='$studentinfo->schools_id'");
|
||||
$schoolq=mysql_query("SELECT id,school FROM schools WHERE conferences_id='".$conference['id']."' AND id='$studentinfo->schools_id'");
|
||||
$r=mysql_fetch_object($schoolq);
|
||||
echo $r->school;
|
||||
}
|
||||
@ -407,7 +407,7 @@ function students_load()
|
||||
|
||||
function registration_load()
|
||||
{
|
||||
global $registrations_id, $config, $auth_type;
|
||||
global $registrations_id, $config, $auth_type, $conference;
|
||||
|
||||
/* Load reg data */
|
||||
if($registrations_id == -1) {
|
||||
@ -415,7 +415,7 @@ function registration_load()
|
||||
/* Find a reg num */
|
||||
do {
|
||||
$regnum=rand(100000,999999);
|
||||
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year={$config['FAIRYEAR']}");
|
||||
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND conferences_id={$conference['id']}");
|
||||
} while(mysql_num_rows($q)>0);
|
||||
|
||||
$r['num'] = $regnum;
|
||||
@ -499,22 +499,22 @@ else {
|
||||
|
||||
function registration_save()
|
||||
{
|
||||
global $registrations_id, $config, $auth_type;
|
||||
global $registrations_id, $config, $auth_type, $conference;
|
||||
$registration_num = intval($_POST['registration_num']);
|
||||
$registration_status = mysql_real_escape_string(stripslashes($_POST['registration_status']));
|
||||
$registration_email = mysql_real_escape_string(stripslashes($_POST['registration_email']));
|
||||
$fairs_id = intval($_POST['registration_fair']);
|
||||
|
||||
if($registrations_id == -1) {
|
||||
mysql_query("INSERT INTO registrations (start,schools_id,year) VALUES (
|
||||
NOW(), NULL, '{$config['FAIRYEAR']}')");
|
||||
mysql_query("INSERT INTO registrations (start,schools_id,conferences_id) VALUES (
|
||||
NOW(), NULL, '{$conference['id']}')");
|
||||
$registrations_id = mysql_insert_id();
|
||||
|
||||
/* Create one student and a project */
|
||||
mysql_query("INSERT INTO students (registrations_id,email,year) VALUES (
|
||||
$registrations_id, '$registration_email', '{$config['FAIRYEAR']}')");
|
||||
mysql_query("INSERT INTO projects (registrations_id,year) VALUES (
|
||||
$registrations_id, '{$config['FAIRYEAR']}')");
|
||||
mysql_query("INSERT INTO students (registrations_id,email,conferences_id) VALUES (
|
||||
$registrations_id, '$registration_email', '{$conference['id']}')");
|
||||
mysql_query("INSERT INTO projects (registrations_id,conferences_id) VALUES (
|
||||
$registrations_id, '{$conference['id']}')");
|
||||
happy_('Created student and project record');
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
/* Load Tours */
|
||||
$query = "SELECT * FROM tours WHERE
|
||||
year='{$config['FAIRYEAR']}'";
|
||||
conferences_id='{$conference['id']}'";
|
||||
$r = mysql_query($query);
|
||||
$tours = array();
|
||||
while($i = mysql_fetch_object($r)) {
|
||||
@ -41,7 +41,7 @@
|
||||
$sid = intval($_GET['id']);
|
||||
|
||||
$query="SELECT * FROM students WHERE id='$sid'
|
||||
AND year='{$config['FAIRYEAR']}'";
|
||||
AND conferences_id='{$conference['id']}'";
|
||||
$r = mysql_query($query);
|
||||
$i = mysql_fetch_object($r);
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
array($i->firstname, $i->lastname)));
|
||||
$query="SELECT * FROM tours_choice
|
||||
WHERE students_id='$sid'
|
||||
AND year='{$config['FAIRYEAR']}'
|
||||
AND conferences_id='{$conference['id']}'
|
||||
ORDER BY rank";
|
||||
$r = mysql_query($query);
|
||||
echo '<table>';
|
||||
@ -160,15 +160,15 @@ function switchinfo()
|
||||
/* Delete any old linking */
|
||||
mysql_query("DELETE FROM tours_choice WHERE
|
||||
students_id='$sid' AND
|
||||
year='{$config['FAIRYEAR']}' AND
|
||||
conferences_id='{$conference['id']}' AND
|
||||
rank='0'");
|
||||
/* Connect this student to this tour */
|
||||
mysql_query("INSERT INTO tours_choice
|
||||
(`students_id`,`registrations_id`,
|
||||
`tour_id`,`year`,`rank`)
|
||||
`tour_id`,`conferences_id`,`rank`)
|
||||
VALUES (
|
||||
'$sid', '$rid', '$tours_id',
|
||||
'{$config['FAIRYEAR']}','0')");
|
||||
'{$conference['id']}','0')");
|
||||
$added++;
|
||||
}
|
||||
if($added==1) $j=i18n("student");
|
||||
@ -184,7 +184,7 @@ function switchinfo()
|
||||
if($_GET['action']=='del' && $tours_id>0 && $students_id>0) {
|
||||
mysql_query("DELETE FROM tours_choice
|
||||
WHERE students_id='$students_id'
|
||||
AND year='{$config['FAIRYEAR']}'
|
||||
AND conferences_id='{$conference['id']}'
|
||||
AND rank='0'");
|
||||
|
||||
echo happy(i18n("Removed student from tour #%1 (%2)",array($tours[$tours_id]['num'],$tours[$tours_id]['name'])));
|
||||
@ -195,7 +195,7 @@ function switchinfo()
|
||||
{
|
||||
mysql_query("DELETE FROM tours_choice WHERE
|
||||
tour_id='$tours_id'
|
||||
AND year='{$config['FAIRYEAR']}'
|
||||
AND conferences_id='{$conference['id']}'
|
||||
AND rank='0'");
|
||||
echo happy(i18n("Emptied all students from tour #%1 (%2)",array($tours[$tours_id]['num'],$tours[$tours_id]['name'])));
|
||||
}
|
||||
@ -232,8 +232,8 @@ function switchinfo()
|
||||
LEFT JOIN tours_choice ON (tours_choice.students_id=students.id AND tours_choice.rank=0)
|
||||
LEFT JOIN registrations ON registrations.id=students.registrations_id
|
||||
WHERE
|
||||
students.year='{$config['FAIRYEAR']}' AND
|
||||
(tours_choice.year='{$config['FAIRYEAR']}' OR
|
||||
students.conferences_id='{$conference['id']}' AND
|
||||
(tours_choice.conferences_id='{$conference['id']}' OR
|
||||
tours_choice.year IS NULL) AND
|
||||
registrations.status='complete'
|
||||
ORDER BY
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
if($_GET['action'] == 'renumber') {
|
||||
$q = mysql_query("SELECT id FROM tours WHERE year='{$config['FAIRYEAR']}'");
|
||||
$q = mysql_query("SELECT id FROM tours WHERE conferences_id='{$conference['id']}'");
|
||||
$x = 1;
|
||||
while($i = mysql_fetch_object($q)) {
|
||||
mysql_query("UPDATE tours SET num='$x' WHERE id='{$i->id}'");
|
||||
@ -73,7 +73,7 @@ function opentoursinfo(id)
|
||||
$editor = new TableEditor('tours');
|
||||
|
||||
// $editor->setDebug(true);
|
||||
$editor->filterList("(tours.year={$config['FAIRYEAR']} OR tours.year IS NULL)");
|
||||
$editor->filterList("(tours.conferences_id={$conference['id']} OR tours.conferences_id IS NULL)"); // FIXME -- Not sure if this IS NULL condition is still relevant. Converted the query from years to conferences_id's
|
||||
|
||||
$editor->execute();
|
||||
|
||||
|
@ -181,14 +181,14 @@ function tour_cost_function($annealer, $bucket_id, $ids)
|
||||
set_status("Cleaning existing tour assignments...");
|
||||
TRACE("\n\n");
|
||||
$q=mysql_query("DELETE FROM tours_choice
|
||||
WHERE year='{$config['FAIRYEAR']}'
|
||||
WHERE conferences_id='{$conference['id']}'
|
||||
AND rank='0'");
|
||||
|
||||
set_status("Loading Data From Database...");
|
||||
TRACE("\n\n");
|
||||
TRACE("Tours...\n");
|
||||
$tours = array();
|
||||
$q=mysql_query("SELECT * FROM tours WHERE year='{$config['FAIRYEAR']}'");
|
||||
$q=mysql_query("SELECT * FROM tours WHERE conferences_id='{$conference['id']}'");
|
||||
$x=0;
|
||||
/* Index with $x here, because these need to match up with the bucket ids of
|
||||
* the annealer */
|
||||
@ -211,7 +211,7 @@ $q=mysql_query("SELECT students.id,students.grade,
|
||||
FROM students
|
||||
LEFT JOIN registrations ON registrations.id=students.registrations_id
|
||||
WHERE
|
||||
students.year='{$config['FAIRYEAR']}'
|
||||
students.conferences_id='{$conference['id']}'
|
||||
AND ( registrations.status='complete'
|
||||
OR registrations.status='paymentpending' )
|
||||
ORDER BY
|
||||
@ -232,7 +232,7 @@ TRACE(" ".(count($student_ids))." students loaded\n");
|
||||
|
||||
TRACE("Loading Tour Selection Preferences...\n");
|
||||
$q=mysql_query("SELECT * FROM tours_choice WHERE
|
||||
tours_choice.year='{$config['FAIRYEAR']}'
|
||||
tours_choice.conferences_id='{$conference['id']}'
|
||||
ORDER BY rank ");
|
||||
TRACE(mysql_error());
|
||||
$x=0;
|
||||
@ -271,10 +271,10 @@ foreach($tours as $x=>$t) {
|
||||
TRACE(" - {$s['name']} ($tids) (g:{$s['grade']} sid:{$sid} sch:{$s['schools_id']})\n");
|
||||
mysql_query("INSERT INTO tours_choice
|
||||
(`students_id`,`registrations_id`,
|
||||
`tour_id`,`year`,`rank`)
|
||||
`tour_id`,`conferences_id`,`rank`)
|
||||
VALUES (
|
||||
'$sid', '{$s['registrations_id']}',
|
||||
'{$t['id']}', '{$config['FAIRYEAR']}',
|
||||
'{$t['id']}', '{$conference['id']}',
|
||||
'0')");
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ ogram; see the file COPYING. If not, write to
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = config_editor_handle_actions("Tour Assigner", $config['FAIRYEAR'], "var");
|
||||
$action = config_editor_handle_actions("Tour Assigner", $conference['id'], "var");
|
||||
if($action == 'update') {
|
||||
header('Location: tours_sa_config.php');
|
||||
exit;
|
||||
@ -47,27 +47,27 @@ ogram; see the file COPYING. If not, write to
|
||||
'Tours' => 'admin/tours.php')
|
||||
);
|
||||
|
||||
config_editor("Tour Assigner", $config['FAIRYEAR'], "var", $_SERVER['PHP_SELF']);
|
||||
config_editor("Tour Assigner", $conference['id'], "var", $_SERVER['PHP_SELF']);
|
||||
|
||||
echo "<hr />";
|
||||
|
||||
function tours_check_tours()
|
||||
{
|
||||
global $config;
|
||||
$q = mysql_query("SELECT * FROM tours WHERE year='{$config['FAIRYEAR']}'");
|
||||
global $conference;
|
||||
$q = mysql_query("SELECT * FROM tours WHERE conferences_id='{$conference['id']}'");
|
||||
return mysql_num_rows($q);
|
||||
}
|
||||
|
||||
function tours_check_students()
|
||||
{
|
||||
global $config;
|
||||
global $conference;
|
||||
$q=mysql_query("SELECT students.id
|
||||
FROM students
|
||||
LEFT JOIN tours_choice ON (tours_choice.students_id=students.id)
|
||||
LEFT JOIN registrations ON (registrations.id=students.registrations_id)
|
||||
WHERE
|
||||
students.year='{$config['FAIRYEAR']}'
|
||||
AND tours_choice.year='{$config['FAIRYEAR']}'
|
||||
students.conferences_id='{$conference['id']}'
|
||||
AND tours_choice.conferences_id='{$conference['id']}'
|
||||
AND registrations.status='complete'
|
||||
ORDER BY
|
||||
students.id, tours_choice.rank
|
||||
|
Loading…
Reference in New Issue
Block a user