From 21261a99af24614b2522cf30107c221980766a88 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 1 Nov 2010 15:24:59 +0000 Subject: [PATCH] Many updates of queries, switching from usage of FAIRYEAR to conference_id. --- admin/exhibithall_sa.php | 8 +-- admin/export_checkin.php | 6 +-- admin/judges_jdiv.php | 10 ++-- admin/judges_teams_projects.php | 12 ++--- admin/judging_score_edit.php | 7 ++- admin/judging_score_entry.php | 12 ++--- admin/project_editor.php | 20 +++---- admin/regfee_items_manager.php | 4 +- admin/registration_list.php | 34 ++++++------ admin/registration_receivedforms.php | 18 +++---- admin/registration_stats.php | 10 ++-- admin/registration_webconsent.php | 6 +-- admin/reports_awards.inc.php | 5 +- admin/reports_fairs.inc.php | 6 ++- admin/reports_fundraising.inc.php | 4 +- common.inc.functions.php | 14 ++--- db/db.code.version.txt | 2 +- db/db.update.217.php | 41 ++++++++++++++ judge_expertise.php | 6 +-- judge_main.php | 2 +- judge_project_summary.php | 2 +- judge_schedule.php | 2 +- projects.inc.php | 30 +++++------ register_participants.inc.php | 52 +++++++++--------- register_participants.php | 28 +++++----- register_participants_emergencycontact.php | 54 +++++++++---------- register_participants_isefforms.php | 4 +- register_participants_main.php | 8 +-- register_participants_mentor.php | 8 +-- register_participants_project.php | 18 +++---- ..._participants_project_divisionselector.php | 4 +- register_participants_safety.php | 12 ++--- register_participants_signature.php | 12 ++--- register_participants_signature_pdflib.php | 12 ++--- register_participants_spawards.php | 10 ++-- register_participants_students.php | 29 +++++----- register_participants_tours.php | 16 +++--- schoolaccess.php | 8 +-- schoolinvite.php | 20 +++---- tours.class.php | 8 +-- user_main.php | 4 +- user_new.php | 10 ++-- 42 files changed, 312 insertions(+), 266 deletions(-) create mode 100644 db/db.update.217.php diff --git a/admin/exhibithall_sa.php b/admin/exhibithall_sa.php index 48beb3d..7087511 100644 --- a/admin/exhibithall_sa.php +++ b/admin/exhibithall_sa.php @@ -215,7 +215,7 @@ TRACE("Grid size: {$grid_size}m\n"); $div = array(); TRACE("Loading Project Divisions...\n"); -$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY id"); while($r=mysql_fetch_object($q)) { $divshort[$r->id]=$r->division_shortform; @@ -225,7 +225,7 @@ while($r=mysql_fetch_object($q)) TRACE("Loading Project Age Categories...\n"); $cat = array(); -$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY id"); while($r=mysql_fetch_object($q)) { $catshort[$r->id]=$r->category_shortform; $cat[$r->id]=$r->category; @@ -236,7 +236,7 @@ TRACE("Loading Projects...\n"); $projects = array(); $q = mysql_query("SELECT projects.* FROM projects, registrations WHERE - projects.year='{$config['FAIRYEAR']}' + projects.conferences_id='{$conference['id']}' AND registrations.id = projects.registrations_id ".getJudgingEligibilityCode()); while($p = mysql_fetch_object($q)) { @@ -597,7 +597,7 @@ for($x=0;$x<$a->num_buckets; $x++) { print_r($projects); /* Assign floor numbers */ -mysql_query("UPDATE projects SET floornumber=0 WHERE year='{$config['FAIRYEAR']}'"); +mysql_query("UPDATE projects SET floornumber=0 WHERE conferences_id='{$conference['id']}'"); foreach($projects as $pid=>$p) { mysql_query("UPDATE projects SET floornumber='{$p['floornumber']}' WHERE id='$pid'"); diff --git a/admin/export_checkin.php b/admin/export_checkin.php index d972f16..d3065fc 100644 --- a/admin/export_checkin.php +++ b/admin/export_checkin.php @@ -27,7 +27,7 @@ user_auth_required('admin'); require("../lpdf.php"); -$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$_GET['cat']."'"); +$catq=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' AND id='".$_GET['cat']."'"); if($catr=mysql_fetch_object($catq)) { @@ -48,7 +48,7 @@ if($catr=mysql_fetch_object($catq)) registrations left outer join projects on projects.registrations_id=registrations.id WHERE - registrations.year='".$config['FAIRYEAR']."' + registrations.conferences_id='".$conference['id']."' AND ( registrations.status='complete' OR registrations.status='paymentpending' ) AND projects.projectcategories_id='$catr->id' ORDER BY @@ -74,7 +74,7 @@ if($catr=mysql_fetch_object($catq)) } while($r=mysql_fetch_object($q)) { - $divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'"); + $divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE conferences_id='".$conference['id']."' AND id='".$r->projectdivisions_id."'"); $divr=mysql_fetch_object($divq); $sq=mysql_query("SELECT students.firstname, diff --git a/admin/judges_jdiv.php b/admin/judges_jdiv.php index 537e530..902f64f 100644 --- a/admin/judges_jdiv.php +++ b/admin/judges_jdiv.php @@ -56,14 +56,14 @@ function newbuttonclicked(jdivs) $div = array(); $divshort = array(); - $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); + $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id"); while($r=mysql_fetch_object($q)) { $divshort[$r->id]=$r->division_shortform; $div[$r->id]=$r->division; } $cat = array(); - $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); + $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id"); while($r=mysql_fetch_object($q)) { $cat[$r->id]=$r->category; } @@ -72,7 +72,7 @@ function newbuttonclicked(jdivs) $ckeys = array_keys($cat); if($config['filterdivisionbycategory']=="yes") { - $q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id"); + $q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE conferences_id='".$conference['id']."' ORDER BY projectdivisions_id,projectcategories_id"); $divcat=array(); while($r=mysql_fetch_object($q)) { $divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id); @@ -97,7 +97,7 @@ function newbuttonclicked(jdivs) function get_all_divs() { - global $config; + global $config, $conference; global $divshort, $div,$cat, $langr; global $divcat; @@ -157,7 +157,7 @@ function get_all_divs() " projectdivisions_id='{$cdl[$id]['div']}' ". " AND projectcategories_id='{$cdl[$id]['cat']}' ". " AND language='{$cdl[$id]['lang']}' ". - " AND registrations.year='{$config['FAIRYEAR']}'". + " AND registrations.conferences_id='{$conference['id']}'". " AND projects.registrations_id=registrations.id". " AND (registrations.status='complete' OR registrations.status='paymentpending')"); diff --git a/admin/judges_teams_projects.php b/admin/judges_teams_projects.php index 108ecfc..db04012 100644 --- a/admin/judges_teams_projects.php +++ b/admin/judges_teams_projects.php @@ -87,11 +87,11 @@ if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit']) if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id']) { - mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,year) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$config['FAIRYEAR']."')"); + mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,conferences_id) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$conference['id']."')"); echo happy(i18n("Project assigned to team timeslot")); } -$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 @@ -212,7 +212,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit) projectnumber is not null " . getJudgingEligibilityCode(). " AND projects.registrations_id=registrations.id AND - projects.year='".$config['FAIRYEAR']."' + projects.conferences_id='".$conference['id']."' ORDER BY projectnumber"; } @@ -232,7 +232,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit) " . getJudgingEligibilityCode(). " AND projects.registrations_id=registrations.id AND judges_teams_timeslots_projects_link.projects_id IS NULL AND - projects.year='".$config['FAIRYEAR']."' + projects.conferences_id='".$conference['id']."' ORDER BY projectnumber"; } @@ -300,7 +300,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit) judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND judges_teams_timeslots_projects_link.projects_id=projects.id AND - judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."' + judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."' ORDER BY projectnumber "); @@ -407,7 +407,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit) judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND judges_teams_timeslots_projects_link.projects_id=projects.id AND - judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."' + judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."' ORDER BY projectnumber "); diff --git a/admin/judging_score_edit.php b/admin/judging_score_edit.php index 8bceaf2..fd064f8 100644 --- a/admin/judging_score_edit.php +++ b/admin/judging_score_edit.php @@ -32,7 +32,6 @@ 'Judging Score Entry' => 'admin/judging_score_entry.php') ); - $year=$config['FAIRYEAR']; $project_id = NULL; if($_GET['projectid']) { $project_id = $_GET['projectid']; @@ -50,7 +49,7 @@ mysql_query("UPDATE judges_teams_timeslots_projects_link SET score=" . $score . " WHERE judges_teams_id = " . mysql_real_escape_string($_POST["team_" . $curr_team . "_id"]) . - " and projects_id =$project_id and year=$year"); + " and projects_id =$project_id and conferences_id={$conference['id']}"); echo mysql_error(); } $curr_team--; @@ -60,11 +59,11 @@ ?> id]=$r->category; -$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']} ORDER BY id"); $q=mysql_query("SELECT judges_teams_timeslots_projects_link.judges_teams_id, diff --git a/admin/judging_score_entry.php b/admin/judging_score_entry.php index 9547408..20329af 100644 --- a/admin/judging_score_entry.php +++ b/admin/judging_score_entry.php @@ -27,8 +27,8 @@ require_once("judges.inc.php"); user_auth_required('admin'); - if($_GET['year']) $year=$_GET['year']; - else $year=$config['FAIRYEAR']; + if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id']; + else $conferences_id=$conference['id']; if($_GET['csv'] == 'yes') { header("Content-type: text/csv"); @@ -42,11 +42,11 @@ } ?> id]=$r->category; -$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id = '$conferences_id' ORDER BY id"); while($r=mysql_fetch_object($q)) $divs[$r->id]=$r->division; @@ -73,7 +73,7 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects. left outer join projects on projects.registrations_id=registrations.id left outer join judges_teams_timeslots_projects_link on projects.id=judges_teams_timeslots_projects_link.projects_id WHERE - registrations.year='$year' " + registrations.conferences_id='$conferences_id' " . getJudgingEligibilityCode() . " GROUP BY projectid ORDER BY @@ -163,7 +163,7 @@ $(document).ready(function() { } echo number_format($r->score_count, 0) . "/" . number_format($r->score_total_count, 0) . "\n"; echo ""; - if($year==$config['FAIRYEAR']) { + if($conferences_id == $conference['id']){ echo "projectid\">"; echo i18n("Edit Scores"); echo ""; diff --git a/admin/project_editor.php b/admin/project_editor.php index ac1716f..9e7aced 100644 --- a/admin/project_editor.php +++ b/admin/project_editor.php @@ -42,7 +42,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."; @@ -62,7 +62,7 @@ case 'project_regenerate_number': project_save(); /* Now generate */ - $q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'"); + $q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'"); $i=mysql_fetch_assoc($q); $id = $i['id']; @@ -89,10 +89,10 @@ exit; function project_save() { - global $registrations_id, $config; + global $registrations_id, $config, $conference; //first, lets make sure this project really does belong to them - $q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'"); + $q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'"); $projectinfo=mysql_fetch_object($q); if(!projectinfo) { echo error(i18n("Invalid project to update")); @@ -128,7 +128,7 @@ function project_save() //check if they changed the project number if($_POST['projectnumber']!=$projectinfo->projectnumber) { //check if hte new one is available - $q=mysql_query("SELECT * FROM projects WHERE year='".$config['FAIRYEAR']."' AND projectnumber='".$_POST['projectnumber']."'"); + $q=mysql_query("SELECT * FROM projects WHERE conferences_id='".$conference['id']."' AND projectnumber='".$_POST['projectnumber']."'"); if(mysql_num_rows($q)) { error_("Could not change project number. %1 is already in use",array($_POST['projectnumber'])); } else { @@ -143,14 +143,14 @@ function project_save() function project_load() { - global $registrations_id, $config; + global $registrations_id, $config, $conference; //now lets find out their MAX grade, so we can pre-set the Age Category $q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'"); $gradeinfo=mysql_fetch_object($q); //now lets grab all the age categories, so we can choose one based on the max grade - $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); + $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id"); while($r=mysql_fetch_object($q)) { //save these in an array, just incase we need them later (FIXME: remove this array if we dont need it) $agecategories[$r->id]['category']=$r->category; @@ -162,7 +162,7 @@ function project_load() } //now select their project info - $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND conferences_id='".$conference['id']."'"); //check if it exists, if we didnt find any record, lets insert one $projectinfo=mysql_fetch_object($q); @@ -229,11 +229,11 @@ function countwords() "; echo "\n"; diff --git a/admin/regfee_items_manager.php b/admin/regfee_items_manager.php index 5232fbd..304520e 100644 --- a/admin/regfee_items_manager.php +++ b/admin/regfee_items_manager.php @@ -38,7 +38,7 @@ 'cost' => 'Cost', 'per' => 'Cost Per', ), null, - array('year' => $config['FAIRYEAR']) + array('conference' => $conference['name']) ); $editor->setPrimaryKey("id"); @@ -48,7 +48,7 @@ array('key' => 'project', 'val' => "Project") ) ); $editor->setFieldInputType("per", 'select'); - $editor->filterList('year',$config['FAIRYEAR']); + $editor->filterList('conference',$conference['name']); $editor->execute(); diff --git a/admin/registration_list.php b/admin/registration_list.php index ae60f9a..33b1ef5 100644 --- a/admin/registration_list.php +++ b/admin/registration_list.php @@ -29,14 +29,14 @@ $auth_type = user_auth_required(array(), array('fair', 'admin')); //require_once('../register_participants.inc.php'); - if($_GET['year']) $year=$_GET['year']; - else $year=$config['FAIRYEAR']; + if($_GET['conference_id']) $conference_id=$_GET['conference_id']; + else $conference_id=$conference['id'] -$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']} ORDER BY id"); while($r=mysql_fetch_object($q)) $cats[$r->id]=$r->category; -$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']} ORDER BY id"); while($r=mysql_fetch_object($q)) $divs[$r->id]=$r->division; @@ -44,7 +44,7 @@ $action=$_GET['action']; switch($action) { case 'load_row': $id = intval($_GET['id']); - $q = list_query($year, '', $id); + $q = list_query($conference_id, '', $id); $r = mysql_fetch_object($q); print_row($r); exit; @@ -56,13 +56,13 @@ case 'delete': $p = mysql_fetch_assoc($q); mysql_query("DELETE FROM winners WHERE projects_id='{$p['id']}'"); } - mysql_query("DELETE FROM registrations WHERE id='$regid' AND year='".$config['FAIRYEAR']."'"); - mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); - mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); - mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); - mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); - mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); - mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); + mysql_query("DELETE FROM registrations WHERE id='$regid' AND conferences_id='".$conference['id']."'"); + mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'"); + mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'"); + mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'"); +// mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'"); + mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'"); + mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'"); happy_("Registration and all related data successfully deleted"); exit; } @@ -347,7 +347,7 @@ if($showstatus) { } else $wherestatus=""; -$q = list_query($year, $wherestatus, false); +$q = list_query($conference_id, $wherestatus, false); echo ""; echo ""; @@ -379,7 +379,7 @@ echo "

The statistics have moved here: status) { case "new": $status_text="New"; break; case "open": $status_text="Open"; break; @@ -469,7 +469,7 @@ function print_row($r) echo ""; echo ""; echo "\n"; @@ -425,7 +426,7 @@ if($config['participant_student_personal']=="yes") echo "
$schools$students"; - if($year==$config['FAIRYEAR']) { + if($conference_id==$conference['id']) { echo "reg_id});return false\" >"; echo ""; echo ""; diff --git a/admin/registration_receivedforms.php b/admin/registration_receivedforms.php index 0669cad..ffd32bc 100644 --- a/admin/registration_receivedforms.php +++ b/admin/registration_receivedforms.php @@ -37,7 +37,7 @@ $showformatbottom=true; if($_POST['action']=="received" && $_POST['registration_number']) { - $q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)==1) { $r=mysql_fetch_object($q); @@ -204,11 +204,11 @@ echo mysql_Error(); FROM projects, registrations WHERE projects.registrations_id = registrations.id AND num='$regnum' - AND registrations.year='{$config['FAIRYEAR']}'"); + AND registrations.conferences_id='{$conference['id']}'"); $checkNumResults=mysql_fetch_object($checkNumQuery); $projectnum=$checkNumResults->projectnumber; - $q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'"); + $q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND conferences_id='{$conference['id']}'"); $r=mysql_fetch_object($q); $reg_id = $r->id; @@ -217,7 +217,7 @@ echo mysql_Error(); list($projectnumber,$ps,$pns,$pss) = generateProjectNumber($reg_id); mysql_query("UPDATE projects SET projectnumber='$projectnumber', projectsort='$ps',projectnumber_seq='$pns',projectsort_seq='$pss' - WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'"); + WHERE registrations_id='$reg_id' AND conferences_id='{$conference['id']}'"); echo happy(i18n("Assigned Project Number: %1",array($projectnumber))); } else @@ -229,7 +229,7 @@ echo mysql_Error(); if($_POST['action']=="receivedyes") { //actually set it to 'complete' - mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'"); + mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND conferences_id='{$conference['id']}'"); foreach($recipients AS $recip) { $to=$recip['to']; @@ -251,7 +251,7 @@ echo mysql_Error(); else if($_POST['action']=="receivedyesnocash") { //actually set it to 'paymentpending' - mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'"); + mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND conferences_id='{$conference['id']}'"); foreach($recipients AS $recip) { $to=$recip['to']; @@ -278,10 +278,10 @@ echo mysql_Error(); } else if($_GET['action']=="unregister" && $_GET['registration_number']) { $reg_num=intval(trim($_GET['registration_number'])); - $q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.year='{$config['FAIRYEAR']}' AND registrations.num='$reg_num'"); + $q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.conferences_id='{$conference['id']}' AND registrations.num='$reg_num'"); $r=mysql_fetch_object($q); - mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND year='{$config['FAIRYEAR']}'"); - mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND year='{$config['FAIRYEAR']}'"); + mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND conferences_id='{$conference['id']}'"); + mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND conferences_id='{$conference['id']}'"); echo happy(i18n("Successfully unregistered project")); } diff --git a/admin/registration_stats.php b/admin/registration_stats.php index c32c251..db3a2a5 100644 --- a/admin/registration_stats.php +++ b/admin/registration_stats.php @@ -27,8 +27,8 @@ user_auth_required('admin'); require("../register_participants.inc.php"); - if($_GET['year']) $year=$_GET['year']; - else $year=$config['FAIRYEAR']; + if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id']; + else $conferences_id=$conference['id']; send_header("Registration Statistics", array('Committee Main' => 'committee_main.php', @@ -61,11 +61,11 @@ echo ""; echo ""; -$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='$conferences_id' ORDER BY id"); while($r=mysql_fetch_object($q)) $cats[$r->id]=$r->category; -$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); +$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='$conferences_id' ORDER BY id"); while($r=mysql_fetch_object($q)) $divs[$r->id]=$r->division; @@ -104,7 +104,7 @@ else $wherestatus=""; left outer join projects on projects.registrations_id=registrations.id WHERE 1 - AND registrations.year='$year' + AND registrations.conferences_id='$conferences_id' $wherestatus ORDER BY $ORDERBY diff --git a/admin/registration_webconsent.php b/admin/registration_webconsent.php index b720719..2f6b6a9 100644 --- a/admin/registration_webconsent.php +++ b/admin/registration_webconsent.php @@ -86,9 +86,9 @@ students.registrations_id=registrations.id AND ( registrations.status = 'complete' OR registrations.status='paymentpending' ) AND projects.registrations_id=registrations.id - AND registrations.year='".$config['FAIRYEAR']."' - AND projects.year='".$config['FAIRYEAR']."' - AND students.year='".$config['FAIRYEAR']."' + AND registrations.conferences_id='".$conference['id']."' + AND projects.conferences_id='".$conference['id']."' + AND students.conferences_id='".$conference['id']."' ORDER BY projectnumber "); echo mysql_error(); diff --git a/admin/reports_awards.inc.php b/admin/reports_awards.inc.php index 774c852..5fd9649 100644 --- a/admin/reports_awards.inc.php +++ b/admin/reports_awards.inc.php @@ -20,7 +20,8 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +$parts = explode('-', $config['dates']['fairdate']); +$fairYear = $parts[0]; $report_awards_fields = array( 'name' => array( 'start_option_group' => 'Award Information', @@ -355,7 +356,7 @@ $report_awards_fields = array( 'name' => 'Fair -- Year', 'header' => 'Year', 'width' => 12.7 /*mm*/, - 'table' => "{$config['FAIRYEAR']}"), + 'table' => $fairYear), 'fair_logo' => array( 'name' => 'Fair -- Logo (for Labels only)', diff --git a/admin/reports_fairs.inc.php b/admin/reports_fairs.inc.php index dcf8ca2..ca7b9c1 100644 --- a/admin/reports_fairs.inc.php +++ b/admin/reports_fairs.inc.php @@ -20,6 +20,8 @@ Boston, MA 02111-1307, USA. */ +$parts = explode('-', $config['dates']['fairdate']); +$fairYear = $parts[0]; $report_fairs_fields = array( 'fairinfo_name' => array( @@ -402,7 +404,7 @@ $report_fairs_fields = array( 'name' => 'Fair -- Year', 'header' => 'Year', 'width' => 12.7 /*mm*/, - 'table' => "{$config['FAIRYEAR']}"), + 'table' => $fairYear), 'fair_logo' => array( 'name' => 'Fair -- Logo (for Labels only)', @@ -418,7 +420,7 @@ $report_fairs_fields = array( ); - function report_fairs_fromwhere($report, $components) + function report_fairs_fromwhere($report, $components) /// FIXME - this isn't updated to use the conference['id'], but I don't see it used anywhere in the code anyway. Delete? { global $config, $report_fairs_fields; diff --git a/admin/reports_fundraising.inc.php b/admin/reports_fundraising.inc.php index ce0b892..1cb223d 100644 --- a/admin/reports_fundraising.inc.php +++ b/admin/reports_fundraising.inc.php @@ -30,6 +30,8 @@ function report_fundraisings_languages(&$report, $field, $text) return join(' ', $l); } +$parts = explode('-', $config['dates']['fairdate']); +$fairYear = $parts[0]; /* Components: */ @@ -164,7 +166,7 @@ $report_fundraisings_fields = array( 'name' => 'Fair -- Year', 'header' => 'Year', 'width' => 12.7 /*mm*/, - 'table' => "{$config['FAIRYEAR']}"), + 'table' => $fairYear), 'fair_logo' => array( 'name' => 'Fair -- Logo (for Labels only)', diff --git a/common.inc.functions.php b/common.inc.functions.php index d314e29..1f7d318 100644 --- a/common.inc.functions.php +++ b/common.inc.functions.php @@ -417,9 +417,9 @@ function email_send_new($to,$from,$subject,$body,$bodyhtml="") { */ function getEmailRecipientsForRegistration($reg_id) { - global $config; + global $config, $conference; //okay first grab the registration record, to see if we should email the kids, the teacher, and/or the parents - $q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'"); + $q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND conferences_id='{$conference['id']}'"); $registration=mysql_fetch_object($q); if($registration->emailcontact && isEmailAddress($registration->emailcontact)) { @@ -430,7 +430,7 @@ function getEmailRecipientsForRegistration($reg_id) ); } - $sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'"); + $sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND conferences_id='{$conference['id']}'"); $ret=array(); while($sr=mysql_fetch_object($sq)) { if($sr->email && isEmailAddress($sr->email)) { @@ -454,8 +454,8 @@ function getEmailRecipientsForRegistration($reg_id) } function output_page_text($textname) { - global $config; - $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='".$config['FAIRYEAR']."' AND lang='".$_SESSION['lang']."'"); + global $config, $conference; + $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND conferences_id='".$conference['id']."' AND lang='".$_SESSION['lang']."'"); if(mysql_num_rows($q)) $r=mysql_fetch_object($q); else { @@ -520,7 +520,7 @@ function admin_warnings() { //warnings to show to both config and/or admin people function committee_warnings() { - global $config; + global $config, $conference; //it is vital that each year the system be rolled over before we start it again //we should do this, say, 4 months after the FAIRDATE, so its soon enough that they should see //the message as soon as they login to start preparing for hte new year, but not too late to do it @@ -542,7 +542,7 @@ function committee_warnings() { $qq = mysql_query("SELECT * FROM award_awards LEFT JOIN fairs ON fairs.id=award_awards.award_source_fairs_id WHERE award_awards.id='{$p['award_awards_id']}' - AND year='{$config['FAIRYEAR']}' + AND conferences_id='{$conference['id']}' AND award_awards.award_source_fairs_id IS NOT NULL AND fairs.type='ysc' "); echo mysql_error(); diff --git a/db/db.code.version.txt b/db/db.code.version.txt index a817176..0ddd619 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -216 +217 diff --git a/db/db.update.217.php b/db/db.update.217.php new file mode 100644 index 0000000..33dc50f --- /dev/null +++ b/db/db.update.217.php @@ -0,0 +1,41 @@ + conference_id links + $q1 = mysql_query("SELECT year, id FROM conferences WHERE year > 0"); + + // add the conferences_id field to each table + while($r = mysql_fetch_assoc($q1)){ + foreach($tables as $tableName){ + $query = "UPDATE `$tableName` SET `conferences_id` = {$r['id']} WHERE `year` = {$r['year']}"; + mysql_query($query); + echo $query . ";\n"; + } + } +} +?> diff --git a/judge_expertise.php b/judge_expertise.php index 93af69c..624f019 100644 --- a/judge_expertise.php +++ b/judge_expertise.php @@ -131,7 +131,7 @@ echo "
\n"; echo "
\n"; echo "\n"; - $q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade"); + $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY mingrade"); echo "

".i18n("Age Category Preferences")."


"; echo ""; while($r=mysql_fetch_object($q)) @@ -171,7 +171,7 @@ echo "\n"; echo "
\n"; //query all of the categories - $q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY division"); + $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY division"); $first = true; while($r=mysql_fetch_object($q)) { @@ -199,7 +199,7 @@ echo "\n"; //only show the sub-divisions if the 'main' division is scored >=3 if($u['div_prefs'][$r->id]>=3) { - $subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' AND year='".$config['FAIRYEAR']."' ORDER BY subdivision"); + $subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' AND conferences_id='".$conference['id']."' ORDER BY subdivision"); while($subr=mysql_fetch_object($subq)) { echo ""; echo ""; diff --git a/judge_main.php b/judge_main.php index c0cd7dc..766dd74 100644 --- a/judge_main.php +++ b/judge_main.php @@ -62,7 +62,7 @@ * if there is one, print the judge scheule link in an obvious place, * it's less obvious below */ $q = mysql_query("SELECT id FROM judges_teams_link WHERE - users_id='{$u['id']}' AND year='{$config['FAIRYEAR']}'"); + users_id='{$u['id']}' AND conferences_id='{$conference['id']}'"); if(mysql_num_rows($q) > 0) { echo ''; echo i18n("You have been assigned to a judging team. %1Click here%2 to view the judging schedule", diff --git a/judge_project_summary.php b/judge_project_summary.php index e8f07d9..ada32ee 100644 --- a/judge_project_summary.php +++ b/judge_project_summary.php @@ -46,7 +46,7 @@ $sq = mysql_query("SELECT firstname,lastname,school FROM students LEFT JOIN schools ON schools.id = students.schools_id WHERE registrations_id='{$pi->registrations_id}' - AND students.year='{$config['FAIRYEAR']}'"); + AND students.conferences_id='{$conference['id']}'"); $student = array(); while($si = mysql_fetch_object($sq)) { diff --git a/judge_schedule.php b/judge_schedule.php index d11bf13..651009d 100644 --- a/judge_schedule.php +++ b/judge_schedule.php @@ -75,7 +75,7 @@ if(!$scheduleok) { $q = mysql_query("SELECT * FROM judges_teams_link LEFT JOIN judges_teams ON judges_teams.id=judges_teams_link.judges_teams_id WHERE judges_teams_link.users_id='{$u['id']}' - AND judges_teams_link.year='{$config['FAIRYEAR']}'"); + AND judges_teams_link.conferences_id='{$conference['id']}'"); $teams = array(); while($t = mysql_fetch_assoc($q)) { /* Load timeslot data for this team (team -> judges_timeslots_link -> timeslot -> parent timeslot */ diff --git a/projects.inc.php b/projects.inc.php index 3fca08b..b19e498 100644 --- a/projects.inc.php +++ b/projects.inc.php @@ -24,7 +24,7 @@ id'"); + $q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."' AND students_id='$sr->id'"); $r=mysql_fetch_object($q); @@ -119,7 +119,7 @@ function emergencycontactStatus($reg_id="") function projectStatus($reg_id="") { - global $config; + global $config, $conference; $required_fields=array("title","projectcategories_id","projectdivisions_id","language","req_table","req_electricity","summarycountok"); if($config['participant_short_title_enable'] == 'yes') @@ -131,7 +131,7 @@ function projectStatus($reg_id="") if($reg_id) $rid=$reg_id; else $rid=$_SESSION['registration_id']; - $q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'"); //if we dont have a project entry yet, return empty if(!mysql_num_rows($q)) @@ -154,19 +154,19 @@ function projectStatus($reg_id="") function mentorStatus($reg_id="") { - global $config; + global $config, $conference; $required_fields=array("firstname","lastname","phone","email","organization","description"); if($reg_id) $rid=$reg_id; else $rid=$_SESSION['registration_id']; //first check the registrations table to see if 'nummentors' is set, or if its null - $q=mysql_query("SELECT nummentors FROM registrations WHERE id='$rid' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT nummentors FROM registrations WHERE id='$rid' AND conferences_id='".$conference['id']."'"); $r=mysql_fetch_object($q); if($r->nummentors==null) return "incomplete"; - $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'"); //if we dont have the minimum, return incomplete if(mysql_num_rows($q)<$config['minmentorserproject']) @@ -190,7 +190,7 @@ function mentorStatus($reg_id="") function safetyStatus($reg_id="") { - global $config; + global $conference; if($reg_id) $rid=$reg_id; else $rid=$_SESSION['registration_id']; @@ -203,7 +203,7 @@ function safetyStatus($reg_id="") } //now grab all the questions - $q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord"); + $q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord"); while($r=mysql_fetch_object($q)) { if($r->required=="yes" && !$safetyanswers[$r->id]) @@ -217,7 +217,7 @@ function safetyStatus($reg_id="") function spawardStatus($reg_id="") { - global $config; + global $conference; if($reg_id) $rid=$reg_id; else $rid=$_SESSION['registration_id']; @@ -232,7 +232,7 @@ function spawardStatus($reg_id="") projects WHERE project_specialawards_link.projects_id='".$project->id."' - AND projects.year='".$config['FAIRYEAR']."' + AND projects.conferences_id='".$conference['id']."' "); if(mysql_num_rows($awardsq)) @@ -243,20 +243,20 @@ function spawardStatus($reg_id="") function tourStatus($reg_id="") { - global $config; + global $config, $conference; if($reg_id) $rid=$reg_id; else $rid=$_SESSION['registration_id']; /* Get the students for this project */ - $q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'"); $num_found = mysql_num_rows($q); $ret = "complete"; while($s=mysql_fetch_object($q)) { //grab all of their tour prefs $sid = $s->id; - $qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and year='{$config['FAIRYEAR']}' ORDER BY rank"); + $qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and conferences_id='{$conference['id']}' ORDER BY rank"); $n_tours = mysql_num_rows($qq); if($n_tours > 0) { @@ -281,12 +281,12 @@ function tourStatus($reg_id="") } function namecheckStatus($reg_id="") { - global $config; + global $conference; if($reg_id) { $q=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' - AND year='".$config['FAIRYEAR']."'"); + AND conferences_id='".$conference['id']."'"); } else { $q=mysql_query("SELECT * FROM students WHERE id='{$_SESSION['students_id']}'"); @@ -304,7 +304,7 @@ function namecheckStatus($reg_id="") function generateProjectNumber($registration_id) { - global $config; + global $config, $conference; $reg_id = $registration_id; @@ -320,8 +320,8 @@ function generateProjectNumber($registration_id) registrations_id='$reg_id' AND projects.projectdivisions_id=projectdivisions.id AND projects.projectcategories_id=projectcategories.id - AND projectcategories.year='{$config['FAIRYEAR']}' - AND projectdivisions.year='{$config['FAIRYEAR']}' + AND projectcategories.conferences_id='{$conference['id']}' + AND projectdivisions.conferences_id='{$conference['id']}' "); echo mysql_error(); $r=mysql_fetch_object($q); @@ -357,7 +357,7 @@ function generateProjectNumber($registration_id) $q = mysql_query("SELECT projectnumber_seq,projectsort_seq, projectdivisions_id,projectcategories_id FROM projects - WHERE year='{$config['FAIRYEAR']}' + WHERE conferences_id='{$conference['id']}' AND projectnumber_seq!='0' AND projectnumber IS NOT NULL"); echo mysql_error(); @@ -430,15 +430,15 @@ function generateProjectNumber($registration_id) function computeRegistrationFee($regid) { - global $config; + global $config, $conference; $ret = array(); $regfee_items = array(); $q = mysql_query("SELECT * FROM regfee_items - WHERE year='{$config['FAIRYEAR']}'"); + WHERE conferences_id='{$conference['id']}'"); while($i = mysql_fetch_assoc($q)) $regfee_items[] = $i; - $q=mysql_query("SELECT * FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM students WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'"); $n_students = mysql_num_rows($q); $n_tshirts = 0; $sel = array(); diff --git a/register_participants.php b/register_participants.php index 61bd8a1..05278d2 100644 --- a/register_participants.php +++ b/register_participants.php @@ -30,12 +30,12 @@ $datecheck=mysql_fetch_object($q); if($_POST['action']=="new") { - $q=mysql_query("SELECT email,num,id,schools_id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND year=".$config['FAIRYEAR']); + $q=mysql_query("SELECT email,num,id,schools_id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND conferences_id=".$conference['id']); if(mysql_num_rows($q)) { $r=mysql_fetch_object($q); $_SESSION['registration_number']=$r->num; $_SESSION['registration_id']=$r->id; - mysql_query("INSERT INTO students (registrations_id,email,schools_id,year) VALUES ('$r->id','".mysql_escape_string($_SESSION['email'])."','".$r->schools_id."','".$config['FAIRYEAR']."')"); + mysql_query("INSERT INTO students (registrations_id,email,schools_id,conferences_id) VALUES ('$r->id','".mysql_escape_string($_SESSION['email'])."','".$r->schools_id."','".$conference['id']."')"); mysql_query("UPDATE registrations SET status='open' WHERE id='$r->id'"); header("Location: register_participants_main.php"); @@ -57,8 +57,8 @@ "WHERE students.email='".$_SESSION['email']."' ". "AND registrations.num='".intval($_POST['regnum'])."' ". "AND students.registrations_id=registrations.id ". - "AND registrations.year=".$config['FAIRYEAR']." ". - "AND students.year=".$config['FAIRYEAR']); + "AND registrations.conferences_id=".$conference['id']." ". + "AND students.conferences_id=".$conference['id']); if(mysql_num_rows($q)) { $r=mysql_fetch_object($q); @@ -81,7 +81,7 @@ registrations WHERE registrations.email='".$_SESSION['email']."' - AND registrations.year='".$config['FAIRYEAR']."'"); + AND registrations.conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)) $r=mysql_fetch_object($q); else { @@ -93,7 +93,7 @@ WHERE students.email='".$_SESSION['email']."' AND students.registrations_id=registrations.id - AND registrations.year='".$config['FAIRYEAR']."'"); + AND registrations.conferences_id='".$conference['id']."'"); $r=mysql_fetch_object($q); } @@ -137,7 +137,7 @@ //first, check if they have any registrations waiting to be opened - $q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)>0) { echo i18n("Please enter your registration number that you received in your email, in order to begin your new registration"); echo ""; @@ -154,8 +154,8 @@ registrations WHERE students.email='".$_SESSION['email']."' - AND students.year=".$config['FAIRYEAR']." - AND registrations.year=".$config['FAIRYEAR']." + AND students.conferences_id=".$conference['id']." + AND registrations.conferences_id=".$conference['id']." AND ( registrations.status='open' OR registrations.status='paymentpending' @@ -216,7 +216,7 @@ else if($config['participant_registration_type']=="schoolpassword") { $showschoolpasswordform=true; if($_POST['schoolpassword'] && $_POST['schoolid']) { - $q=mysql_query("SELECT registration_password FROM schools WHERE id='".$_POST['schoolid']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT registration_password FROM schools WHERE id='".$_POST['schoolid']."' AND conferences_id='".$conference['id']."'"); $r=mysql_fetch_object($q); if($_POST['schoolpassword']==$r->registration_password) { @@ -239,7 +239,7 @@ echo ""; echo i18n("Email Address:")." ".$_SESSION['email']."
"; echo i18n("School: "); - $q=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school"); + $q=mysql_query("SELECT id,school FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school"); echo "\n"; while($sr=mysql_fetch_object($sq)) { - $q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."' AND students_id='$sr->id'"); + $q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."' AND students_id='$sr->id'"); if(mysql_num_rows($q)==0) { - mysql_query("INSERT INTO emergencycontact (registrations_id,students_id,year) VALUES ('".$_SESSION['registration_id']."','".$sr->id."','".$config['FAIRYEAR']."')"); + mysql_query("INSERT INTO emergencycontact (registrations_id,students_id,conferences_id) VALUES ('".$_SESSION['registration_id']."','".$sr->id."','".$conference['id']."')"); $id=mysql_insert_id(); unset($r); } diff --git a/register_participants_isefforms.php b/register_participants_isefforms.php index 1133f81..fb18826 100644 --- a/register_participants_isefforms.php +++ b/register_participants_isefforms.php @@ -41,8 +41,8 @@ "AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ". "AND students.registrations_id=registrations.id ". - "AND registrations.year=".$config['FAIRYEAR']." ". - "AND students.year=".$config['FAIRYEAR']); + "AND registrations.conferences_id=".$conference['id']." ". + "AND students.conferences_id=".$conference['id']); echo mysql_error(); if(mysql_num_rows($q)==0) diff --git a/register_participants_main.php b/register_participants_main.php index fcf2c35..41c23a2 100644 --- a/register_participants_main.php +++ b/register_participants_main.php @@ -43,8 +43,8 @@ "AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ". "AND students.registrations_id=registrations.id ". - "AND registrations.year=".$config['FAIRYEAR']." ". - "AND students.year=".$config['FAIRYEAR']); + "AND registrations.conferences_id=".$conference['id']." ". + "AND students.conferences_id=".$conference['id']); echo mysql_error(); if(mysql_num_rows($q)==0) @@ -68,7 +68,7 @@ echo mysql_error(); { //now select their project number - $q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); $projectinfo=mysql_fetch_object($q); if($r->status=="complete") @@ -280,7 +280,7 @@ echo "
 
"; } } - $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='{$config['FAIRYEAR']}'"); + $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='{$conference['id']}'"); $project=mysql_fetch_object($q); $nominatedawards=getSpecialAwardsNominatedForProject($project->id); $num=count($nominatedawards); diff --git a/register_participants_mentor.php b/register_participants_mentor.php index 885da5d..2c046ea 100644 --- a/register_participants_mentor.php +++ b/register_participants_mentor.php @@ -42,8 +42,8 @@ "AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ". "AND students.registrations_id=registrations.id ". - "AND registrations.year=".$config['FAIRYEAR']." ". - "AND students.year=".$config['FAIRYEAR']); + "AND registrations.conferences_id=".$conference['id']." ". + "AND students.conferences_id=".$conference['id']); echo mysql_error(); if(mysql_num_rows($q)==0) @@ -145,11 +145,11 @@ if($_GET['action']=="removementor") //now query and display - $q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); $r=mysql_fetch_object($q); $registrations_nummentors=$r->nummentors; - $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); $numfound=mysql_num_rows($q); diff --git a/register_participants_project.php b/register_participants_project.php index 3e6f73f..c0618d3 100644 --- a/register_participants_project.php +++ b/register_participants_project.php @@ -42,8 +42,8 @@ "AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ". "AND students.registrations_id=registrations.id ". - "AND registrations.year=".$config['FAIRYEAR']." ". - "AND students.year=".$config['FAIRYEAR']); + "AND registrations.conferences_id=".$conference['id']." ". + "AND students.conferences_id=".$conference['id']); echo mysql_error(); if(mysql_num_rows($q)==0) @@ -82,7 +82,7 @@ echo mysql_error(); else { //first, lets make sure this project really does belong to them - $q=mysql_query("SELECT * FROM projects WHERE id='".$_POST['id']."' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM projects WHERE id='".$_POST['id']."' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)==1) { $summarywords=preg_split("/[\s,]+/",$_POST['summary']); @@ -137,7 +137,7 @@ echo mysql_error(); $gradeinfo=mysql_fetch_object($q); //now lets grab all the age categories, so we can choose one based on the max grade - $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); + $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id"); while($r=mysql_fetch_object($q)) { //save these in an array, just incase we need them later (FIXME: remove this array if we dont need it) @@ -151,13 +151,13 @@ echo mysql_error(); } } //now select their project info - $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); //check if it exists, if we didnt find any record, lets insert one if(mysql_num_rows($q)==0) { - mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,year) VALUES ('".$_SESSION['registration_id']."','$projectcategories_id','".$config['FAIRYEAR']."')"); + mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,conferences_id) VALUES ('".$_SESSION['registration_id']."','$projectcategories_id','".$conference['id']."')"); //now query the one we just inserted - $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); } $projectinfo=mysql_fetch_object($q); @@ -228,11 +228,11 @@ function countwords() //###### Feature Specific - filtering divisions by category if($config['filterdivisionbycategory']=="yes"){ - $q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY division"); + $q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.conferences_id='".$conference['id']."' AND projectcategoriesdivisions_link.conferences_id='".$conference['id']."' ORDER BY division"); echo mysql_error(); //### }else - $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division"); + $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY division"); echo "\n"; //the year selector should be based on the min/max ages possible (as set in $config) - $minyearselect=$config['FAIRYEAR'] - $config['maxage']; - $maxyearselect=$config['FAIRYEAR'] - $config['minage']; + // FIXME - this should be converted to use the year in which the conference occurs + $minyearselect = $config['FAIRYEAR'] - $config['maxage']; + $maxyearselect = $config['FAIRYEAR'] - $config['minage']; emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect); echo "".REQUIREDFIELD."
\n"; echo "
".i18n("School").""; 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,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 "\n"; - $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); $num_found = mysql_num_rows($q); $print_submit = false; diff --git a/schoolaccess.php b/schoolaccess.php index ff752cb..27a23aa 100644 --- a/schoolaccess.php +++ b/schoolaccess.php @@ -5,7 +5,7 @@ require_once('user.inc.php'); // authenticate the login if($_POST['schoolid'] && $_POST['accesscode']) { - $q=mysql_query("SELECT * FROM schools WHERE id='".$_POST['schoolid']."' AND accesscode='".$_POST['accesscode']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM schools WHERE id='".$_POST['schoolid']."' AND accesscode='".$_POST['accesscode']."' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)==1) { $_SESSION['schoolid']=$_POST['schoolid']; @@ -28,7 +28,7 @@ if($_GET['action']=="logout") if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){ // we're logged in, draw the dashboard - $q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND conferences_id='".$conference['id']."'"); echo mysql_error(); $school=mysql_fetch_object($q); if($school) { @@ -72,7 +72,7 @@ function draw_dashboard(){ function draw_login(){ send_header("School Home"); - global $errormsg, $happymsg, $config; + global $errormsg, $happymsg, $config, $conference; if($errormsg) echo "$errormsg"; if($happymsg) echo happy($happymsg); @@ -98,7 +98,7 @@ function draw_login(){