Several updates on migrating from fair years to conference id's

This commit is contained in:
jacob 2010-11-02 20:35:47 +00:00
parent 1c1a0673c3
commit 54070f1836
37 changed files with 468 additions and 526 deletions

@ -685,11 +685,8 @@ foreach($report_stock as $n=>$v) {
$order = implode(",", $order);
if(!isset($report['year'])) {
$report['year'] = $config['FAIRYEAR'];
}
if(!isset($report['conference_id'])){
$report['conference_id'] = $conference['id'];
if(!isset($report['conferences_id'])){
$report['conferences_id'] = $conference['id'];
}
$group_by = array_merge($group_by, $post_group_by);

@ -283,18 +283,6 @@ $(document).ready(function() {
</td>
</tr>
<?
/*
if($i->reports_id > 0) {
echo '<tr><td width=\"20px\"></td><td>';
echo '<span style=\"font-size: 0.75em;\">';
echo i18n('Format').": {$i->format}, ";
echo i18n('Paper').": {$report_stock[$i->stock]['name']}, ";
echo i18n('Year').": {$config['FAIRYEAR']}";
echo '</span>';
echo '</td></tr>';
}
*/
}
echo "</table>";

@ -20,8 +20,6 @@
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',
@ -344,22 +342,16 @@ $report_awards_fields = array(
)",
'components' => array('prizes')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'table' => "'".mysql_escape_string($conference['name'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => $fairYear),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),

@ -113,22 +113,16 @@ $report_committees_fields = array(
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'table' => "'".mysql_escape_string($conference['name'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -147,9 +141,10 @@ $report_committees_fields = array(
global $config, $report_committees_fields;
$fields = $report_committees_fields;
/*
// if this gets unremarked for future use, then the year references will need to be updated to use conferences instead
$year = $report['year'];
/*
$teams_from = '';
$teams_where = '';
if(in_array('teams', $components)) {

@ -392,22 +392,16 @@ $report_fairs_fields = array(
'table' => 'fairs_stats.delegate4_size',
'components' => array('fairs_stats')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Local Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Local Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => $fairYear),
'table' => "'".mysql_escape_string($conference['name'])."'"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -420,16 +414,16 @@ $report_fairs_fields = array(
);
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?
function report_fairs_fromwhere($report, $components)
{
global $config, $report_fairs_fields;
$fields = $report_fairs_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
if(in_array('fairs_stats', $components)) {
$fs_from = 'LEFT JOIN fairs_stats ON fairs_stats.fairs_id=fairs.id';
$fs_where = "fairs_stats.year='$year' AND";
$fs_where = "fairs_stats.conferences_id='$conferences_id' AND";
}

@ -30,10 +30,6 @@ function report_fundraisings_languages(&$report, $field, $text)
return join(' ', $l);
}
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
/* Components: */
/* Yes, fundraisings, the generator takes the report type (also the user.type in many cases) and
* just adds an 's' to find the fields and the functions. */
@ -131,45 +127,39 @@ $report_fundraisings_fields = array(
'width' => 38.1 /*mm*/,
'table' => "CONCAT(users.city, ', ', users.province)",
'components' => array('users') ),
/* // FIXME - not sure what to do with these options, converting from years to conferences
'year' => array(
'start_option_group' => 'Miscellaneous',
'name' => 'Contact -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'width' => 12.7 //mm,
'table' => 'users.year',
'components' => array('users') ),
'user_filter' => array(
'name' => 'User Filter by MAX(year)',
'header' => '',
'width' => 2.54 /*mm*/,
'width' => 2.54 //mm,
'table' => 'MAX(users.year)',
'group_by' => array('users.accounts_id'),
'components' => array('users') ),
*/
'static_text' => array(
'name' => 'Static Text (useful for labels)',
'header' => '',
'width' => 2.54 /*mm*/,
'table' => "CONCAT(' ')"),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => $fairYear),
'table' => "'".mysql_escape_string($conference['name'])."'"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -181,7 +171,7 @@ $report_fundraisings_fields = array(
global $config, $report_fundraisings_fields;
$fields = $report_fundraisings_fields;
$year = $report['year'];
// $conferences_id = $report['conferences_id'];
if(in_array('users', $components)) {
$users_from = 'LEFT JOIN fundraising_campaigns_users_link ON fundraising_campaigns.id=fundraising_campaigns_users_link.fundraising_campaigns_id
@ -191,6 +181,11 @@ $report_fundraisings_fields = array(
}
/*
// this chunk of code was already remarked when updating the system to use conferences
// instead of fair years. If it gets re-used however, then it will need to be updated
// accordingly. Not sure as I write this comment how the fundraising years will link
// to the conferences, rather than to the fair years that were previously used.
$teams_from = '';
$teams_where = '';
if(in_array('teams', $components)) {

@ -22,28 +22,33 @@
*/
?>
<?
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('admin');
require_once('reports.inc.php');
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('admin');
require_once('reports.inc.php');
$id = intval($_GET['id']);
$type = stripslashes($_GET['type']);
$stock = stripslashes($_GET['stock']);
$year = intval($_GET['year']);
$include_incomplete_registrations = ($_GET['include_incomplete_registrations'] == 'yes') ? 'yes' : '';
$show_options = array_key_exists('show_options', $_GET);
if($year < 1000) $year = $config['FAIRYEAR'];
/* If it's a system report, turn that into the actual report id */
if(array_key_exists('sid', $_GET)) {
$sid = intval($_GET['sid']);
$q = mysql_query("SELECT id FROM reports WHERE system_report_id='$sid'");
$id = intval($_GET['id']);
$type = stripslashes($_GET['type']);
$stock = stripslashes($_GET['stock']);
if(array_key_exists('conferences_id', $_GET)){
$conferences_id = intval($_GET['conferences_id']);
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM conferences WHERE id = $conferences_id"), 0);
if($result != 1) $conferences_id = $conference['id'];
}else{
$conferences_id = $conference['id'];
}
$include_incomplete_registrations = ($_GET['include_incomplete_registrations'] == 'yes') ? 'yes' : '';
$show_options = array_key_exists('show_options', $_GET);
/* If it's a system report, turn that into the actual report id */
if(array_key_exists('sid', $_GET)) {
$sid = intval($_GET['sid']);
$q = mysql_query("SELECT id FROM reports WHERE system_report_id='$sid'");
$r = mysql_fetch_assoc($q);
$id = $r['id'];
}
}
$report = report_load($id);
/* Add a custom filter if specified */
$filter_args = '';
@ -55,7 +60,7 @@ if(is_array($_GET['filter'])) {
}
switch($_GET['action']) {
case 'dialog_gen':
case 'dialog_gen':
if($id < 0) {
$u = "{$config['SFIABDIRECTORY']}/{$report_custom[-$id]['custom_url']}";
?>
@ -89,7 +94,7 @@ case 'dialog_gen':
<?
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['accounts_id']}'
WHERE users_id='{$_SESSION['accounts_id']}'
AND reports_id='{$report['id']}'");
if(mysql_num_rows($q) > 0) {
$i = mysql_fetch_assoc($q);
@ -109,12 +114,12 @@ case 'dialog_gen':
<?
$format = $report['options']['type'];
$stock = $report['options']['stock'];
$year = $config['FAIRYEAR'];
$conferences_id = $conference['id'];
/* Out of all the report optins, we really only want these ones */
$option_keys = array('type','stock');
foreach($report_options as $ok=>$o) {
if(!in_array($ok, $option_keys)) continue;
if(!in_array($ok, $option_keys)) continue;
echo "<tr><td class=\"label\"><b>{$o['desc']}</b>:</td>";
echo "<td class=\"input\"><select name=\"$ok\" id=\"$ok\">";
@ -124,14 +129,16 @@ case 'dialog_gen':
}
echo "</select></td></tr>\n";
}
/* Find all the years */
$q = mysql_query("SELECT DISTINCT year FROM config WHERE year>1000 ORDER BY year DESC");
echo "<tr><td class=\"label\"><b>".i18n('Year')."</b>:</td>";
echo "<td class=\"input\"><select name=\"year\" id=\"year\">";
while($i = mysql_fetch_assoc($q)) {
$y = $i['year'];
$sel = ($config['FAIRYEAR'] == $y) ? 'selected="selected"' : '';
echo "<option value=\"$y\" $sel>$y</option>";
// Find all conferences
$q = mysql_query("SELECT conferences.name, conferences.id, dates.date FROM conferences JOIN dates on dates.conferences_id = conferences.id WHERE dates.name='fairdate' ORDER BY dates.date DESC");
echo "<tr><td class=\"label\"><b>".i18n('Conference')."</b>:</td>";
echo "<td class=\"input\"><select name=\"conferences_id\" id=\"conferences_id\">";
while($row = mysql_fetch_assoc($q)){
$parts = explode(' ', $row['date']);
$date = $parts[0];
$sel = ($row['id'] == $conferences_id) ? 'selected="selected"' : '';
echo "<option value=\"{$row['id']}\" $sel>{$row['name']} ($date)</option>";
}
echo "</select></td></tr>\n";
?>
@ -180,93 +187,95 @@ case 'dialog_gen':
</script>
<?
exit;
}
}
if($show_options == false) {
if($id && $year) {
$report['year'] = $year;
if($show_options == false) {
if($id && $conferences_id) {
$report['conferences_id'] = $conferences_id;
if($type != '') $report['option']['type'] = $type;
if($stock != '') $report['option']['stock'] = $stock;
if($include_incomplete_registrations != '') $report['option']['include_incomplete_registrations'] = 'yes';
report_gen($report);
} else {
exit;
header("Location: reports.php");
header("Location: reports.php");
}
exit;
}
}
send_header('Report Options', array(
'Committee Main' => 'committee_main.php',
send_header('Report Options', array(
'Committee Main' => 'committee_main.php',
'My Reports' => 'admin/reports.php'));
echo '<form method=\"get\" action="reports_gen.php">';
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo '<form method=\"get\" action="reports_gen.php">';
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo '<table class="tableedit">';
echo "<tr><td><b>".i18n('Report&nbsp;Name')."</b>:</td>";
echo "<td>{$report['name']}</td></tr>";
echo "<tr><td><b>".i18n('Description')."</b>:</td>";
echo "<td>{$report['desc']}</td></tr>";
echo "<tr><td><b>".i18n('Created By')."</b>:</td>";
echo "<td>{$report['creator']}</td></tr>";
echo '<table class="tableedit">';
echo "<tr><td><b>".i18n('Report&nbsp;Name')."</b>:</td>";
echo "<td>{$report['name']}</td></tr>";
echo "<tr><td><b>".i18n('Description')."</b>:</td>";
echo "<td>{$report['desc']}</td></tr>";
echo "<tr><td><b>".i18n('Created By')."</b>:</td>";
echo "<td>{$report['creator']}</td></tr>";
echo '<tr><td colspan="2"><hr /></td></tr>';
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['accounts_id']}'
echo '<tr><td colspan="2"><hr /></td></tr>';
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['accounts_id']}'
AND reports_id='{$report['id']}'");
echo "<tr><td colspan=\"2\"><h3>".i18n('My Reports Info')."</h3></td></tr>";
if(mysql_num_rows($q) > 0) {
/* Yes, it is */
echo "<tr><td colspan=\"2\"><h3>".i18n('My Reports Info')."</h3></td></tr>";
if(mysql_num_rows($q) > 0) {
/* Yes, it is */
$i = mysql_fetch_object($q);
echo "<tr><td><b>".i18n('Category')."</b>:</td>";
echo "<td>{$i->category}</td></tr>";
echo "<tr><td><b>".i18n('Comment')."</b>:</td>";
echo "<td>{$i->comment}</td></tr>";
} else {
echo "<tr><td></td><td>".i18n('This report is NOT in your \'My Reports\' list.')."</td></tr>";
}
echo '<tr><td colspan="2"><hr /></td></tr>';
echo "<tr><td colspan=\"2\"><h3>".i18n('Report Options')."</h3></td></tr>";
} else {
echo "<tr><td></td><td>".i18n('This report is NOT in your \'My Reports\' list.')."</td></tr>";
}
echo '<tr><td colspan="2"><hr /></td></tr>';
echo "<tr><td colspan=\"2\"><h3>".i18n('Report Options')."</h3></td></tr>";
$format = $report['options']['type'];
$stock = $report['options']['stock'];
$year = $config['FAIRYEAR'];
$format = $report['options']['type'];
$stock = $report['options']['stock'];
$conferences_id = $conference['id'];
/* Out of all the report optoins, we really only want these ones */
$option_keys = array('type','stock');
foreach($report_options as $ok=>$o) {
if(!in_array($ok, $option_keys)) continue;
echo "<tr><td><b>{$o['desc']}</b>:</td>";
/* Out of all the report optoins, we really only want these ones */
$option_keys = array('type','stock');
foreach($report_options as $ok=>$o) {
if(!in_array($ok, $option_keys)) continue;
echo "<tr><td><b>{$o['desc']}</b>:</td>";
echo "<td><select name=\"$ok\" id=\"$ok\">";
foreach($o['values'] as $k=>$v) {
$sel = ($report['option'][$ok] == $k) ? 'selected="selected"' : '';
echo "<option value=\"$k\" $sel>$v</option>";
}
echo "</select></td></tr>";
}
/* Find all the years */
$q = mysql_query("SELECT DISTINCT year FROM config WHERE year>1000 ORDER BY year DESC");
echo "<tr><td><b>".i18n('Year')."</b>:</td>";
echo "<td><select name=\"year\" id=\"year\">";
while($i = mysql_fetch_assoc($q)) {
$y = $i['year'];
$sel = ($config['FAIRYEAR'] == $y) ? 'selected="selected"' : '';
echo "<option value=\"$y\" $sel>$y</option>";
}
echo "</select></td></tr>";
}
echo "</table>";
// Find all conferences
$q = mysql_query("SELECT conferences.name, conferences.id, dates.date FROM conferences JOIN dates on dates.conferences_id = conferences.id WHERE dates.name='fairdate' ORDER BY dates.date DESC");
echo "<tr><td class=\"label\"><b>".i18n('Conference')."</b>:</td>";
echo "<td class=\"input\"><select name=\"conferences_id\" id=\"conferences_id\">";
while($row = mysql_fetch_assoc($q)){
$parts = explode(' ', $row['date']);
$date = $parts[0];
$sel = ($row['id'] == $conferences_id) ? 'selected="selected"' : '';
echo "<option value=\"{$row['id']}\" $sel>{$row['name']} ($date)</option>";
}
echo "</select></td></tr>\n";
echo '<br />';
echo "<input type=\"submit\" value=\"".i18n('Generate Report')."\" />";
echo '</form>';
echo "</table>";
echo '<br />';
echo "<input type=\"submit\" value=\"".i18n('Generate Report')."\" />";
echo '</form>';
send_footer();
send_footer();
?>

@ -32,29 +32,29 @@ function report_judges_languages(&$report, $field, $text)
}
/* It's possible to get through this code and need to have access to more
* than one year, so we're going to index this array by year first */
* than one conference, so we're going to index this array by conferences_id first */
$report_judges_divs = array();
$report_judges_cats = array();
function report_judges_load_divs($year)
function report_judges_load_divs($conferences_id)
{
global $report_judges_divs;
/* Load divisions for this year, only once */
if(!array_key_exists($year, $report_judges_divs)) {
$report_judges_divs[$year] = array();
$q = mysql_query("SELECT * FROM projectdivisions WHERE year='$year'");
/* Load divisions for this conference, only once */
if(!array_key_exists($conferences_id, $report_judges_divs)) {
$report_judges_divs[$conferences_id] = array();
$q = mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='$conferences_id'");
while(($d = mysql_fetch_assoc($q))) {
$report_judges_divs[$year][$d['id']] = $d;
$report_judges_divs[$conferences_id][$d['id']] = $d;
}
}
}
function report_judges_load_cats($year)
function report_judges_load_cats($conferences_id)
{
global $report_judges_cats;
if(!array_key_exists($year, $report_judges_cats)) {
$q = mysql_query("SELECT * FROM projectcategories WHERE year='$year'");
if(!array_key_exists($conferences_id, $report_judges_cats)) {
$q = mysql_query("SELECT * FROM projectcategories WHERE conferences_id='$conferences_id'");
while(($c = mysql_fetch_assoc($q))) {
$report_judges_cats[$year][$c['id']] = $c;
$report_judges_cats[$conferences_id][$c['id']] = $c;
}
}
}
@ -70,19 +70,19 @@ function report_judges_divs_at_exp(&$report, $field, $text)
$long = (strlen($field) == 13) ? false : true;
/* Text is users.div_prefs */
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$divprefs = unserialize($text);
if(!is_array($divprefs)) return '';
report_judges_load_divs($year);
report_judges_load_divs($conferences_id);
/* Find all the requested selections, and add them to the return */
$ret = array();
$retl = array();
foreach($divprefs as $div_id=>$sel) {
if($sel != $exp) continue;
$ret[] = $report_judges_divs[$year][$div_id]['division_shortform'];
$retl[] = $report_judges_divs[$year][$div_id]['division'];
$ret[] = $report_judges_divs[$conferences_id][$div_id]['division_shortform'];
$retl[] = $report_judges_divs[$conferences_id][$div_id]['division'];
}
/* Join it all together with spaces */
if($long == false) return join(' ', $ret);
@ -99,19 +99,19 @@ function report_judges_cats_at_pref(&$report, $field, $text)
$long = (strlen($field) == 14) ? false : true;
/* Text is users.cat_prefs */
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$catprefs = unserialize($text);
if(!is_array($catprefs)) return '';
report_judges_load_cats($year);
report_judges_load_cats($conferences_id);
/* Find all 2-highest selections, and add them to the return */
$ret = array();
$retl = array();
foreach($catprefs as $cat_id=>$sel) {
if($sel != $pref) continue;
$ret[] = $report_judges_cats[$year][$cat_id]['category_shortform'];
$retl[] = $report_judges_cats[$year][$cat_id]['category'];
$ret[] = $report_judges_cats[$conferences_id][$cat_id]['category_shortform'];
$retl[] = $report_judges_cats[$conferences_id][$cat_id]['category'];
}
/* Join it all together with spaces */
if($long == false) return join(' ', $ret);
@ -122,11 +122,11 @@ function report_judges_custom_question(&$report, $field, $text)
{
/* Field is 'question_x', users_id is passed in $text */
$q_ord = substr($field, 9);
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$users_id = $text;
/* Find the actual question ID */
$q = mysql_query("SELECT * FROM questions WHERE year='$year' AND ord='$q_ord'");
$q = mysql_query("SELECT * FROM questions WHERE conferences_id='$conferences_id' AND ord='$q_ord'");
if(mysql_num_rows($q) != 1)
return 'Question not specified';
$question = mysql_fetch_assoc($q);
@ -142,7 +142,7 @@ function report_judges_div_exp(&$report, $field, $text)
{
/* Field is 'div_exp_x', users_id is passed in $text */
$div_id = substr($field, 8);
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$users_id = $text;
$divprefs = unserialize($text);
@ -157,7 +157,7 @@ function report_judges_cat_pref(&$report, $field, $text)
'1' => 'High', 2=>'Highest');
/* Field is 'div_pref_x', users_id is passed in $text */
$cat_id = substr($field, 9);
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$users_id = $text;
$catprefs = unserialize($text);
@ -168,11 +168,11 @@ function report_judges_cat_pref(&$report, $field, $text)
function report_judges_team_members(&$report, $field, $text)
{
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$judges_teams_id = $text;
$q = mysql_query("SELECT * FROM judges_teams_link
LEFT JOIN users ON judges_teams_link.users_id=users.id
WHERE judges_teams_link.year='$year'
WHERE judges_teams_link.conferences_id='$conferences_id'
AND judges_teams_link.judges_teams_id='$judges_teams_id'");
$ret = '';
while( ($m = mysql_fetch_assoc($q))) {
@ -207,12 +207,12 @@ function report_judges_team_members(&$report, $field, $text)
//$round_special_awards = array();
$report_judges_rounds = array();
function report_judges_load_rounds($year)
function report_judges_load_rounds($conferences_id)
{
global $config, $report_judges_rounds;
if(count($report_judges_rounds)) return ;
$q = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='0' AND `year`='$year'");
$q = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='0' AND `conferences_id`='$conferences_id'");
/* Loads judges_timeslots.id, .starttime, .endtime, .date, .name */
while($r = mysql_fetch_assoc($q)) {
$report_judges_rounds[] = $r;
@ -226,10 +226,10 @@ function report_judges_load_rounds($year)
function report_judges_time_availability(&$report, $field, $text)
{
global $config, $report_judges_rounds;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$users_id = $text;
report_judges_load_rounds($year);
report_judges_load_rounds($conferences_id);
switch($field) {
case 'available_in_divisional1':
@ -598,17 +598,17 @@ $report_judges_fields = array(
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
'active' => array(
'name' => 'Judge -- Registration Active for this year',
'name' => 'Judge -- Registration Active for this conference',
'header' => 'Act',
'width' => 10.16 /*mm*/,
'table' => 'ROLE_JUDGE.active',
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
'year' => array(
'name' => 'Judge -- Year',
'header' => 'Year',
'conferences_id' => array(
'name' => 'Judge -- Conference ID',
'header' => 'Conference ID',
'width' => 12.7 /*mm*/,
'table' => 'users.year'),
'table' => 'users.conferences_id'),
'users_id' => array(
'name' => 'Judge -- User ID',
@ -823,22 +823,16 @@ $report_judges_fields = array(
'editor_disabled' => true,
'exec_function' => 'report_judges_custom_question'),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'table' => "'".mysql_escape_string($conference['name'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -866,10 +860,10 @@ for($x=1;$x<=50;$x++) {
/* Overwrite the question_1 .. question_10 fields with the
* question name and header from the list of questions */
function report_judges_update_questions($year)
function report_judges_update_questions($conferences_id)
{
global $report_judges_fields;
$qs = questions_load_questions('judgereg', $year);
$qs = questions_load_questions('judgereg', $conferences_id);
if(count($qs) > 10) {
echo "Not enough judge question fields, please file a bug report at sfiab.ca and report that you have ".count($qs)." custom judge questions, but the system can handle a maximum of 10.";
exit;
@ -882,35 +876,35 @@ function report_judges_update_questions($year)
}
}
function report_judges_update_divs($year)
function report_judges_update_divs($conferences_id)
{
global $report_judges_fields, $report_judges_divs;
report_judges_load_divs($year);
report_judges_load_divs($conferences_id);
if(count($report_judges_divs[$year]) > 50) {
echo "Not enough judge division fields, please file a bug report at sfiab.ca and report that you have ".count($report_judges_divs[$year])." divisions, but the system can handle a maximum of 50.";
if(count($report_judges_divs[$conferences_id]) > 50) {
echo "Not enough judge division fields, please file a bug report at sfiab.ca and report that you have ".count($report_judges_divs[$conferences_id])." divisions, but the system can handle a maximum of 50.";
exit;
}
foreach($report_judges_divs[$year] as $div_id=>$d) {
foreach($report_judges_divs[$conferences_id] as $div_id=>$d) {
$f = "div_exp_$div_id";
$report_judges_fields[$f]['header'] = "{$d['division_shortform']} - {$d['division']}";
$report_judges_fields[$f]['name'] = 'Judge -- Expertise in Division: '.$d['division'];
$report_judges_fields[$f]['editor_disabled'] = false;
}
}
function report_judges_update_cats($year)
function report_judges_update_cats($conferences_id)
{
global $report_judges_fields, $report_judges_cats;
report_judges_load_cats($year);
report_judges_load_cats($conferences_id);
if(count($report_judges_cats[$year]) > 10) {
echo "Not enough judge age category fields, please file a bug report at sfiab.ca and report that you have ".count($report_judges_cats[$year])." age categories, but the system can handle a maximum of 10.";
if(count($report_judges_cats[$conferences_id]) > 10) {
echo "Not enough judge age category fields, please file a bug report at sfiab.ca and report that you have ".count($report_judges_cats[$conferences_id])." age categories, but the system can handle a maximum of 10.";
exit;
}
if(is_array($report_judges_cats[$year])){
foreach($report_judges_cats[$year] as $cat_id=>$d) {
if(is_array($report_judges_cats[$conferences_id])){
foreach($report_judges_cats[$conferences_id] as $cat_id=>$d) {
$f = "cat_pref_$cat_id";
$report_judges_fields[$f]['header'] = "{$d['category_shortform']} - {$d['category']}";
$report_judges_fields[$f]['name'] = 'Judge -- Preference for Age Category: '.$d['category'];
@ -920,23 +914,23 @@ function report_judges_update_cats($year)
}
$report_judges_questions_updated = false;
/* Do the overwrites for the current year, this is for the editor, because
/* Do the overwrites for the current conference id, this is for the editor, because
* it doesn't call a _fromwhere */
report_judges_update_questions($config['FAIRYEAR']);
report_judges_update_divs($config['FAIRYEAR']);
report_judges_update_cats($config['FAIRYEAR']);
report_judges_update_questions($conference['id']);
report_judges_update_divs($conference['id']);
report_judges_update_cats($conference['id']);
function report_judges_fromwhere($report, $components)
{
global $config, $report_judges_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
if($report_judges_questions_updated == false) {
/* Do overwrites for the report year, overwriting the previous
* overwrites for the current year, because the report year
/* Do overwrites for the report conferences_id, overwriting the previous
* overwrites for the current conferences_id, because the report conferences_id
* could be different, and the questions may have changed */
report_judges_update_questions($year);
report_judges_update_questions($conferences_id);
$report_judges_questions_updated = true;
}
@ -945,8 +939,8 @@ function report_judges_fromwhere($report, $components)
if(in_array('teams', $components)) {
$teams_from = "LEFT JOIN judges_teams_link ON judges_teams_link.users_id=users.id
LEFT JOIN judges_teams ON judges_teams.id=judges_teams_link.judges_teams_id";
$teams_where = "AND judges_teams_link.year='$year'
AND judges_teams.year='$year'";
$teams_where = "AND judges_teams_link.conferences_id='$conferences_id'
AND judges_teams.conferences_id='$conferences_id'";
}
$projects_from='';
@ -956,23 +950,23 @@ function report_judges_fromwhere($report, $components)
judges_teams_timeslots_projects_link.judges_teams_id=judges_teams.id
LEFT JOIN projects ON projects.id=judges_teams_timeslots_projects_link.projects_id
LEFT JOIN judges_timeslots ON judges_timeslots.id=judges_teams_timeslots_projects_link.judges_timeslots_id";
$projects_where = "AND judges_teams_timeslots_projects_link.year='$year'
AND projects.year='$year'";
$projects_where = "AND judges_teams_timeslots_projects_link.conferences_id='$conferences_id'
AND projects.conferences_id='$conferences_id'";
}
$students_from='';
$students_where='';
if(in_array('students', $components)) {
$students_from = "LEFT JOIN students ON students.registrations_id=projects.registrations_id";
$students_where = "AND students.year='$year'";
$students_where = "AND students.conferences_id='$conferences_id'";
}
/* Search the report for a filter based on judge year */
$year_where = "AND users.year='$year'";
/* Search the report for a filter based on judge conferences_id */
$conferences_id_where = "AND users.conferences_id='$conferences_id'";
foreach($report['filter'] as $d) {
if($d['field'] == 'year') {
/* Don't interally filter on year, we'll do it externally */
$year_where = '';
if($d['field'] == 'conferences_id') {
/* Don't interally filter on conferences_id, we'll do it externally */
$conferences_id_where = '';
}
}
@ -984,7 +978,7 @@ function report_judges_fromwhere($report, $components)
$students_from
WHERE
users.types LIKE '%judge%'
$year_where
$conferences_id_where
$teams_where
$projects_where
$students_where

@ -70,7 +70,7 @@ $table['header']=array(
i18n("Expertise Other"));
/* Append headers for all the custom questions */
$qs=questions_load_questions('judgereg', $config['FAIRYEAR']);
$qs=questions_load_questions('judgereg', $conference['id']);
$keys = array_keys($qs);
foreach($keys as $qid) {
$table['header'][] = i18n($qs[$qid]['db_heading']);
@ -78,7 +78,7 @@ foreach($keys as $qid) {
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$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");
$numcats=mysql_num_rows($q);
$catheadings=array();
while($r=mysql_fetch_object($q))
@ -87,7 +87,7 @@ while($r=mysql_fetch_object($q))
$catheadings[]="$r->category (out of 5)";
}
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$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");
$divheadings=array();
while($r=mysql_fetch_object($q))
{
@ -112,7 +112,7 @@ $q=mysql_query("SELECT
JOIN users_judge ON users.id=users_judge.users_id
WHERE
users.deleted='no' AND
users.year='".$config['FAIRYEAR']."'
users.conferences_id='".$conference['id']."'
AND users.types LIKE '%judge%'
ORDER BY
@ -145,7 +145,7 @@ while($r=mysql_fetch_object($q)) {
$languages=substr($languages,0,-1);
$qarray = array();
$qans = questions_load_answers('judgereg', $r->id, $config['FAIRYEAR']);
$qans = questions_load_answers('judgereg', $r->id, $conference['id']);
$keys = array_keys($qans);
foreach($keys as $qid) {
$qarray[] = $qans[$qid];

@ -49,7 +49,7 @@ if($report)
if($_GET['fontsize']) $fontsize=$_GET['fontsize'];
if($_GET['toppadding']) $toppadding=$_GET['toppadding'];
$rep=new lpdf( i18n($config['fairname']),
$rep=new lpdf( i18n($conference['name']),
"$reportname Mailing Labels",
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
);
@ -77,7 +77,7 @@ if($report)
FROM
schools
WHERE
year='{$config['FAIRYEAR']}'
conferences_id='{$conference['id']}'
ORDER BY
school
");
@ -107,25 +107,26 @@ if($report)
break;
case "judges":
$q=mysql_query("SELECT
CONCAT(judges.firstname,' ',judges.lastname) AS name,
IF(judges.address2=\"\",
judges.address,
CONCAT(judges.address,' ',judges.address2)
) AS address,
'' AS co,
judges.city AS city,
judges.province AS province,
judges.postalcode AS postalcode
FROM
judges,
judges_years
WHERE
judges_years.judges_id=judges.id
AND judges_years.year='{$config['FAIRYEAR']}'
ORDER BY
lastname,firstname
");
$q = mysql_query("
SELECT
CONCAT(users.firstname, ' ', users.lastname) AS name,
IF(users.address2=\"\",
users.address,
CONCAT(users.address,' ',users.address2)
) AS address,
'' AS co,
users.city AS city,
users.province AS province,
users.postalcode AS postalcode
FROM users
JOIN user_roles ON users.id = user_roles.users_id
JOIN roles ON roles.id = user_roles.roles_id
WHERE
roles.type = 'judge'
AND users.conferences_id='{$conference['id']}'
ORDER BY
firstname, lastname
");
break;
}

@ -69,9 +69,9 @@
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
WHERE
projects.year='".$config['FAIRYEAR']."'
AND projectdivisions.year='".$config['FAIRYEAR']."'
AND projectcategories.year='".$config['FAIRYEAR']."'
projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
AND ( registrations.status='complete'
OR registrations.status='paymentpending' )
ORDER BY

@ -49,7 +49,7 @@
$teams=getJudgingTeams();
$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
@ -73,9 +73,9 @@
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
WHERE
projects.year='".$config['FAIRYEAR']."'
AND projectdivisions.year='".$config['FAIRYEAR']."'
AND projectcategories.year='".$config['FAIRYEAR']."'
projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
AND ( registrations.status='complete'
OR registrations.status='paymentpending' )
ORDER BY
@ -128,7 +128,7 @@
LEFT JOIN judges_teams ON judges_teams_timeslots_projects_link.judges_teams_id=judges_teams.id
WHERE
judges_teams_timeslots_projects_link.projects_id='$proj->id'
AND judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
AND judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY
date,starttime
");

@ -24,18 +24,16 @@
function reports_schools_principal(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['name'];
}
return '';
}
function reports_schools_sciencehead(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['name'];
}
return '';
@ -43,9 +41,8 @@ function reports_schools_sciencehead(&$report, $field, $text)
function reports_schools_shphone(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['phonework'];
}
return '';
@ -53,9 +50,8 @@ function reports_schools_shphone(&$report, $field, $text)
function reports_schools_shemail(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['email'];
}
return '';
@ -201,22 +197,16 @@ $report_schools_fields = array(
'width' => 25.4 /*mm*/,
'table' => 'schools.projectlimitper' ),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'table' => "'".mysql_escape_string($conference['name'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -229,12 +219,12 @@ $report_schools_fields = array(
global $config, $report_schools_fields;
$fields = $report_schools_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$q = " FROM
schools
WHERE
schools.year='$year'
schools.conferences_id='$conferences_id'
";
return $q;

@ -28,23 +28,23 @@ function report_students_i18n_fr(&$report, $field, $text)
function reports_students_numstudents(&$report, $field, $text)
{
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$q = mysql_query("SELECT students.id FROM students
WHERE students.registrations_id='$text'
AND students.year='$year'");
AND students.conferences_id='$conferences_id'");
return mysql_num_rows($q);
}
function reports_students_award_selfnom_num(&$report, $field, $text, $n)
{
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$q = mysql_query("SELECT award_awards.name FROM
projects
LEFT JOIN project_specialawards_link ON project_specialawards_link.projects_id=projects.id
LEFT JOIN award_awards ON award_awards.id=project_specialawards_link.award_awards_id
WHERE projects.id='$text'
AND projects.year='$year'
AND project_specialawards_link.year='$year'
AND projects.conferences_id='$conferences_id'
AND project_specialawards_link.conferences_id='$conferences_id'
LIMIT $n,1");
echo mysql_error();
$i = mysql_fetch_assoc($q);
@ -72,9 +72,8 @@ function reports_students_award_selfnom_5(&$report, $field, $text)
}
function reports_students_school_principal(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['name'];
}
return '';
@ -795,21 +794,14 @@ $report_students_fields = array(
'table' => 'fairs.abbrv',
'components' => array('fairs')),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_name' => array (
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'conference_name' => array (
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'table' => "'".mysql_real_escape_string($conference['name'])."'"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -851,7 +843,7 @@ $report_students_fields = array(
global $config, $report_students_fields;
$fields = $report_students_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$awards_join = '';
$awards_where = '';
@ -863,10 +855,10 @@ $report_students_fields = array(
LEFT JOIN award_prizes ON award_prizes.id = winners.awards_prizes_id
LEFT JOIN award_awards ON award_awards.id = award_prizes.award_awards_id
LEFT JOIN award_types ON award_types.id=award_awards.award_types_id";
$awards_where = " AND winners.year='$year'
AND award_awards.year='$year'
AND award_prizes.year='$year'
AND award_types.year='$year' ";
$awards_where = " AND winners.conferences_id='$conferences_id'
AND award_awards.conferences_id='$conferences_id'
AND award_prizes.conferences_id='$conferences_id'
AND award_types.conferences_id='$conferences_id' ";
}
if(in_array('awards_nominations', $components)) {
@ -875,8 +867,8 @@ $report_students_fields = array(
award_awards,award_types";
$awards_where = " AND project_specialawards_link.award_awards_id=award_awards.id
AND award_types.id=award_awards.award_types_id
AND award_awards.year='$year'
AND award_types.year='$year' ";
AND award_awards.conferences_id='$conferences_id'
AND award_types.conferences_id='$conferences_id' ";
}
$partner_join = '';
@ -890,7 +882,7 @@ $report_students_fields = array(
$tour_where = '';
if(in_array('tours', $components)) {
$tour_join = "LEFT JOIN tours_choice ON (students.id=tours_choice.students_id AND tours_choice.rank=0), tours";
$tour_where = "AND tours.year='$year'
$tour_where = "AND tours.conferences_id='$conferences_id'
AND tours.id=tours_choice.tour_id";
}
@ -906,7 +898,7 @@ $report_students_fields = array(
if(in_array('mentors', $components)) {
$mentor_join = "LEFT JOIN mentors ON
mentors.registrations_id=students.registrations_id";
$mentor_where = "AND mentors.year='$year'";
$mentor_where = "AND mentors.conferences_id='$conferences_id'";
}
$fairs_join = '';
@ -933,11 +925,11 @@ $report_students_fields = array(
$awards_join
$fairs_join
WHERE
students.year='$year'
AND projects.year='$year'
AND registrations.year='$year'
AND projectcategories.year='$year'
AND projectdivisions.year='$year'
students.conferences_id='$conferences_id'
AND projects.conferences_id='$conferences_id'
AND registrations.conferences_id='$conferences_id'
AND projectcategories.conferences_id='$conferences_id'
AND projectdivisions.conferences_id='$conferences_id'
$reg_where
$mentor_where
$awards_where

@ -77,22 +77,16 @@ $report_tours_fields = array(
'width' => 10.16 /*mm*/,
'table' => 'tours.id' ),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'table' => "'".mysql_real_escape_string($conference['name'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -105,12 +99,12 @@ $report_tours_fields = array(
global $config, $report_tours_fields;
$fields = $report_tours_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$q = " FROM
tours
WHERE
tours.year='$year'
tours.conferences_id='$conferences_id'
";
return $q;

@ -104,22 +104,16 @@ $report_volunteers_fields = array(
'table' => 'volunteer_positions.name',
'components' => array('signup')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'table' => "'".mysql_real_escape_string($conference['name'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
@ -137,7 +131,7 @@ $report_volunteers_fields = array(
{
global $config;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$signup_join = '';
$signup_where = '';
@ -147,7 +141,7 @@ $report_volunteers_fields = array(
ON (users.id=volunteer_positions_signup.users_id)
LEFT JOIN volunteer_positions
ON (volunteer_positions_signup.volunteer_positions_id=volunteer_positions.id)";
$signup_where = "AND (volunteer_positions_signup.year = '$year' OR volunteer_positions_signup.year IS NULL)";
$signup_where = "AND (volunteer_positions_signup.conferences_id = '$conferences_id' OR volunteer_positions_signup.conferences_id IS NULL)";
}
$q = " FROM users
@ -157,7 +151,7 @@ $report_volunteers_fields = array(
$uv_from
WHEE
user_roles.type='volunteer'
AND users.year='$year'
AND users.conferences_id='$conferences_id'
$signup_where
";

@ -210,7 +210,7 @@ case 'additional_materials':
$a = mysql_fetch_assoc($q);
$q = mysql_query("SELECT * FROM fairs WHERE id='$fairs_id'");
$fair = mysql_fetch_assoc($q);
$pdf = fair_additional_materials($fair, $a, $config['FAIRYEAR']); // FIXME - this needs to be modified to go by conferences_id rather than the fair year
$pdf = fair_additional_materials($fair, $a, $conference['id']);
foreach($pdf['header'] as $h) header($h);
echo $pdf['data'];
exit;

@ -849,3 +849,21 @@ function get_schools($conferenceId){
}
return $returnval;
}
// a convenience function for grabbing information about the specified conference (id, name, type, status)
// returns an array containging the data on success, null on failure
function get_conference_info($conferenceId){
$query = mysql_query("SELECT * FROM conferences WHERE id = '" . mysql_real_escape_string($conferenceId) . "'");
$row = mysql_fetch_assoc($query);
if(is_array($row)){
$returnval = array(
'id' => $conferenceId,
'name' => $row['name'],
'type' => $row['type'],
'status' => $row['status']
);
}else{
$returnval = null;
}
return $returnval;
}

@ -35,7 +35,7 @@
{
foreach($_POST['cwsfdivision'] AS $k=>$v)
{
mysql_query("UPDATE projectdivisions SET cwsfdivisionid='$v' WHERE id='$k' AND year='".$config['FAIRYEAR']."'");
mysql_query("UPDATE projectdivisions SET cwsfdivisionid='$v' WHERE id='$k' AND conferences_id='".$conference['id']."'");
}
echo happy(i18n("Corresponding CWSF divisions saved"));
}
@ -53,7 +53,7 @@ echo "<br />";
echo "<th>".i18n("Corresponding CWSF Division")."</th>\n";
echo "</tr>";
$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))
{
echo "<tr>";

@ -32,7 +32,7 @@
,"judge_registration_questions"
);
questions_editor('judgereg', $config['FAIRYEAR'], 'question',
questions_editor('judgereg', $conference['id'], 'question',
$_SERVER['PHP_SELF']);

@ -37,15 +37,15 @@
,"page_texts"
);
$q=mysql_query("SELECT * FROM pagetext WHERE year='-1' ORDER BY textname");
$q=mysql_query("SELECT * FROM pagetext WHERE conferences_id='-1' ORDER BY textname");
while($r=mysql_fetch_object($q))
{
foreach($config['languages'] AS $lang=>$langname) {
mysql_query("INSERT INTO pagetext (textname,textdescription,text,year,lang) VALUES (
mysql_query("INSERT INTO pagetext (textname,textdescription,text,conferences_id,lang) VALUES (
'".mysql_escape_string($r->textname)."',
'".mysql_escape_string($r->textdescription)."',
'".mysql_escape_string($r->text)."',
'".$config['FAIRYEAR']."',
'".$conference['id']."',
'".mysql_escape_string($lang)."')");
}
}
@ -63,7 +63,7 @@
text='$text'
WHERE
textname='".mysql_escape_string($_POST['textname'])."'
AND year='".$config['FAIRYEAR']."'
AND conferences_id='".$conference['id']."'
AND lang='$lang'");
}
echo happy(i18n("Page texts successfully saved"));
@ -72,7 +72,7 @@
if($_GET['textname'])
{
$q=mysql_query("SELECT * FROM pagetext WHERE textname='".mysql_escape_string($_GET['textname'])."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM pagetext WHERE textname='".mysql_escape_string($_GET['textname'])."' AND conferences_id='".$conference['id']."'");
//needs to be at least one entry in any languages
if($r=mysql_fetch_object($q))
{
@ -82,12 +82,12 @@
foreach($config['languages'] AS $lang=>$langname) {
$q=mysql_query("SELECT * FROM pagetext WHERE textname='".mysql_escape_string($_GET['textname'])."' AND year='".$config['FAIRYEAR']."' AND lang='$lang'");
$q=mysql_query("SELECT * FROM pagetext WHERE textname='".mysql_escape_string($_GET['textname'])."' AND conferences_id='".$conference['id']."' AND lang='$lang'");
$r=mysql_fetch_object($q);
if(!$r)
{
mysql_query("INSERT INTO pagetext (textname,year,lang) VALUES ('".mysql_escape_string($_GET['textname'])."','".$config['FAIRYEAR']."','$lang')");
mysql_query("INSERT INTO pagetext (textname,conferences_id,lang) VALUES ('".mysql_escape_string($_GET['textname'])."','".$conference['id']."','$lang')");
echo mysql_error();
}
@ -127,7 +127,7 @@
echo i18n("Choose a page text to edit");
echo "<table class=\"summarytable\">";
$q=mysql_query("SELECT * FROM pagetext WHERE year='".$config['FAIRYEAR']."' AND lang='".$config['default_language']."' ORDER BY textname");
$q=mysql_query("SELECT * FROM pagetext WHERE conferences_id='".$conference['id']."' AND lang='".$config['default_language']."' ORDER BY textname");
echo "<tr><th>".i18n("Page Text Description")."</th><th>".i18n("Last Update")."</th></tr>";
while($r=mysql_fetch_object($q))
{

@ -42,7 +42,7 @@
`type`='".mysql_escape_string(stripslashes($_POST['type']))."',
`required`='".mysql_escape_string(stripslashes($_POST['required']))."',
ord='".mysql_escape_string(stripslashes($_POST['ord']))."'
WHERE id='".$_POST['save']."' AND year='".$config['FAIRYEAR']."'");
WHERE id='".$_POST['save']."' AND conferences_id='".$conference['id']."'");
echo mysql_error();
echo happy(i18n("Safety question successfully saved"));
@ -55,12 +55,12 @@
{
if($_POST['question'])
{
mysql_query("INSERT INTO safetyquestions (question,type,required,ord,year) VALUES (
mysql_query("INSERT INTO safetyquestions (question,type,required,ord,conferences_id) VALUES (
'".mysql_escape_string(stripslashes($_POST['question']))."',
'".mysql_escape_string(stripslashes($_POST['type']))."',
'".mysql_escape_string(stripslashes($_POST['required']))."',
'".mysql_escape_string(stripslashes($_POST['ord']))."',
'".$config['FAIRYEAR']."'
'".$conference['id']."'
)");
echo mysql_error();
@ -72,7 +72,7 @@
if($_GET['action']=="remove" && $_GET['remove'])
{
mysql_query("DELETE FROM safetyquestions WHERE id='".$_GET['remove']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM safetyquestions WHERE id='".$_GET['remove']."' AND conferences_id='".$conference['id']."'");
echo happy(i18n("Safety question successfully removed"));
}
@ -91,7 +91,7 @@
{
$buttontext="Save safety question";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
$q=mysql_query("SELECT * FROM safetyquestions WHERE id='".$_GET['edit']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM safetyquestions WHERE id='".$_GET['edit']."' AND conferences_id='".$conference['id']."'");
echo "<input type=\"hidden\" name=\"save\" value=\"".$_GET['edit']."\">\n";
if(!$r=mysql_fetch_object($q))
{
@ -142,7 +142,7 @@
echo "<a href=\"safetyquestions.php?action=new\">".i18n("Add new safety question")."</a>";
echo "<table class=\"summarytable\">";
$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");
echo "<tr><th>".i18n("Ord")."</th><th>".i18n("Question")."</th><th>".i18n("Type")."</th><th>".i18n("Required")."</th><th>".i18n("Actions")."</th></tr>";
while($r=mysql_fetch_object($q))
{

@ -53,9 +53,9 @@
LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
WHERE
1
AND registrations.year='".$config['FAIRYEAR']."'
AND projectcategories.year='".$config['FAIRYEAR']."'
AND projectdivisions.year='".$config['FAIRYEAR']."'
AND registrations.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND (status='complete' OR status='paymentpending')
ORDER BY
projectcategories.id,

@ -34,7 +34,7 @@
/*
if($u['fair_active'] == 'no') {
message_push(notice(i18n("Your fair role is not active. If you would like to participate as a fair for the %1 %2 please click the '<b>Activate Role</b>' button in the Volunteer section below",array($config['FAIRYEAR'],$config['fairname']))));
message_push(notice(i18n("Your fair role is not active. If you would like to participate as a fair for the %1 %2 please click the '<b>Activate Role</b>' button in the Volunteer section below",array($conference['name'],$config['fairname']))));
header('Location: user_activate.php');
exit;
}

@ -24,11 +24,7 @@
<?
include "common.inc.php";
if($conference['id']) {
$q=mysql_query("SELECT *,UNIX_TIMESTAMP(date) AS udate FROM dates WHERE conferences_id='{$conference['id']}' ORDER BY date");
} else {
$q=mysql_query("SELECT *,UNIX_TIMESTAMP(date) AS udate FROM dates WHERE year='{$config['FAIRYEAR']}' ORDER BY date");
}
$q = mysql_query("SELECT *,UNIX_TIMESTAMP(date) AS udate FROM dates WHERE conferences_id='{$conference['id']}' ORDER BY date");
if($_GET['display']=="box") {
echo "<h3>".i18n("Important Dates")."</h3>\n";

@ -34,7 +34,7 @@ $preferencechoices=array(
function judge_status_expertise(&$u)
{
global $config;
global $config, $conference;
/* If the judging special awards are active, and the judge has
* selected "I am a special awards judge", then disable
@ -45,12 +45,12 @@ function judge_status_expertise(&$u)
}
/* Check to see if they have ranked all project age categories, and all divisions */
$q=mysql_query("SELECT COUNT(id) AS num FROM projectcategories WHERE year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT COUNT(id) AS num FROM projectcategories WHERE conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
$numcats=$r->num;
if($numcats != count($u['cat_prefs'])) return 'incomplete';
$q=mysql_query("SELECT COUNT(id) AS num FROM projectdivisions WHERE year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT COUNT(id) AS num FROM projectdivisions WHERE conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
$numdivisions=$r->num;
if($numdivisions != count($u['div_prefs'])) return 'incomplete';
@ -114,8 +114,6 @@ function judge_status_special_awards(&$u)
function judge_status_update(&$u)
{
global $config;
if( user_personal_info_status($u) == 'complete'
&& judge_status_expertise($u) == 'complete'
&& judge_status_other($u) == 'complete'

@ -32,7 +32,7 @@
$u = user_load($_SESSION['users_id']);
if($u['judge_active'] == 'no') {
message_push(notice(i18n("Your judge role is not active. If you would like to participate as a judge for the %1 %2 please click the '<b>Activate Role</b>' button in the Judge section below",array($config['FAIRYEAR'],$config['fairname']))));
message_push(notice(i18n("Your judge role is not active. If you would like to participate as a judge for the %2 please click the '<b>Activate Role</b>' button in the Judge section below",$config['fairname'])));
header('Location: user_activate.php');
exit;
}
@ -58,7 +58,7 @@
}
if($scheduleok) {
/* Check for any judging team assignment this year for this judge,
/* Check for any judging team assignment this conference for this judge,
* 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
@ -74,10 +74,6 @@
//first, we need to see if they havec the current FAIRYEAR activated, if not, we'll keep their acocunt 'dormant' and it wont
//be used for anything, but will still be available for them to login in the following years.
echo i18n("Please use the checklist below to complete your data. Click on an item in the table to edit that information. When you have entered all information, the <b>Status</b> field will change to <b>Complete</b>");
echo "<br />";
echo "<br />";

@ -33,7 +33,7 @@ $pn = mysql_escape_string(stripslashes($_GET['pn']));
$q=mysql_query("SELECT * FROM projects WHERE
projectnumber='$pn'
AND year='{$config['FAIRYEAR']}'");
AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q)==0) {
echo "not found";
exit;

@ -26,11 +26,10 @@
function questions_load_answers($section, $users_id)
{
global $config;
$yearq=mysql_query("SELECT `year` FROM users WHERE id='$users_id'");
$yearr=mysql_fetch_object($yearq);
$cidq=mysql_query("SELECT `conferences_id` FROM users WHERE id='$users_id'");
$cidr=mysql_fetch_object($cidq);
$ans=array();
$qs=questions_load_questions($section,$yearr->year);
$qs=questions_load_questions($section,$cidr->conferences_id);
foreach($qs AS $id=>$question) {
$q=mysql_query("SELECT * FROM question_answers WHERE users_id='$users_id' AND questions_id='$id'");
$r=mysql_fetch_object($q);
@ -39,10 +38,10 @@ function questions_load_answers($section, $users_id)
return $ans;
}
function questions_load_questions($section, $year)
function questions_load_questions($section, $conferences_id)
{
$q = mysql_query('SELECT * FROM questions '.
"WHERE year='$year' ".
"WHERE conferences_id='$conferences_id' ".
" AND section='$section' ".
'ORDER BY ord ASC');
print(mysql_error());
@ -62,14 +61,14 @@ function questions_load_questions($section, $year)
function questions_save_answers($section, $id, $answers)
{
global $config;
$qs = questions_load_questions($section,$config['FAIRYEAR']);
global $conference;
$qs = questions_load_questions($section,$conference['id']);
$keys = array_keys($answers);
$q=mysql_query("SELECT * FROM questions WHERE year='{$config['FAIRYEAR']}'");
while($r=mysql_fetch_object($q)) {
mysql_query("DELETE FROM question_answers WHERE users_id='$id' AND questions_id='$r->id'");
echo mysql_error();
}
$q = mysql_query("SELECT * FROM questions WHERE conferences_id='{$conference['id']}'");
while($r=mysql_fetch_object($q)) {
mysql_query("DELETE FROM question_answers WHERE users_id='$id' AND questions_id='$r->id'");
echo mysql_error();
}
$keys = array_keys($answers);
foreach($keys as $qid) {
@ -97,7 +96,7 @@ function questions_find_question_id($section, $dbheading)
function questions_print_answer_editor($section, &$u, $array_name)
{
$ans = questions_load_answers($section, $u['id']);
$qs = questions_load_questions($section, $u['year']);
$qs = questions_load_questions($section, $u['conferences_id']);
$keys = array_keys($qs);
foreach($keys as $qid) {
$iname = "{$array_name}[{$qid}]";
@ -134,9 +133,9 @@ function questions_print_answer_editor($section, &$u, $array_name)
function questions_print_answers($section, $id)
{
global $config;
global $conference;
$ans = questions_load_answers($section, $id);
$qs = questions_load_questions($section,$config['FAIRYEAR']);
$qs = questions_load_questions($section, $conference['id']);
$keys = array_keys($qs);
foreach($keys as $qid) {
echo "<tr>\n";
@ -170,30 +169,30 @@ function questions_update_question($qs)
echo mysql_error();
}
function questions_save_new_question($qs, $year)
function questions_save_new_question($qs, $conferences_id)
{
mysql_query("INSERT INTO questions ".
"(question,type,section,db_heading,required,ord,year) VALUES (".
"(question,type,section,db_heading,required,ord,conferences_id) VALUES (".
"'".mysql_escape_string($qs['question'])."',".
"'".mysql_escape_string($qs['type'])."',".
"'".mysql_escape_string($qs['section'])."',".
"'".mysql_escape_string($qs['db_heading'])."',".
"'".mysql_escape_string($qs['required'])."',".
"'".mysql_escape_string($qs['ord'])."',".
"'$year' )");
"'$conferences_id' )");
echo mysql_error();
}
/* A complete question editor. Just call it with the
* section you want to edit, a year, the array_name to use for
* section you want to edit, a conference id, the array_name to use for
* POSTing and GETting the questions (so you can put more than one
* edtior on a single page), and give it $_SERVER['PHP_SELF'], because
* php_self inside this function is this file.
* FUTURE WORK: it would be nice to hide the order, and just implement
* a bunch of up/down arrows, and dynamically compute the order for
* all elements */
function questions_editor($section, $year, $array_name, $self)
function questions_editor($section, $conferences_id, $array_name, $self)
{
global $config;
@ -203,7 +202,7 @@ function questions_editor($section, $year, $array_name, $self)
$qs['section'] = $section;
if($qs['question']) {
$qs['id'] = intval($_POST['save']);
questions_update_question($qs, $year);
questions_update_question($qs, $conferences_id);
echo happy(i18n("Question successfully saved"));
} else {
echo error(i18n("Question is required"));
@ -211,12 +210,12 @@ function questions_editor($section, $year, $array_name, $self)
}
if($_POST['action']=="new") {
$q = questions_load_questions($section, $year);
$q = questions_load_questions($section, $conferences_id);
$qs = questions_parse_from_http_headers('question');
$qs['section'] = $section;
$qs['ord'] = count($q) + 1;
if($qs['question']) {
questions_save_new_question($qs, $year);
questions_save_new_question($qs, $conferences_id);
echo happy(i18n("Question successfully added"));
} else {
echo error(i18n("Question is required"));
@ -226,7 +225,7 @@ function questions_editor($section, $year, $array_name, $self)
if($_GET['action']=="remove" && $_GET['remove'])
{
$qid = $_GET['remove'];
$qs = questions_load_questions($section, $year);
$qs = questions_load_questions($section, $conferences_id);
/* Delete this question */
mysql_query("DELETE FROM questions WHERE id='$qid'");
@ -243,15 +242,15 @@ function questions_editor($section, $year, $array_name, $self)
echo happy(i18n("Question successfully removed"));
}
if($_GET['action']=="import" && $_GET['impyear'])
if($_GET['action']=="import" && $_GET['impconf'])
{
$x=0;
$q = mysql_query("SELECT * FROM questions WHERE year='{$_GET['impyear']}'");
$q = mysql_query("SELECT * FROM questions WHERE conferences_id='{$_GET['impconf']}'");
while($r=mysql_fetch_object($q)) {
$x++;
mysql_query("INSERT INTO questions (id,year,section,db_heading,question,type,required,ord)
mysql_query("INSERT INTO questions (id,conferences_id,section,db_heading,question,type,required,ord)
VALUES (
'', '$year',
'', '$conferences_id',
'".mysql_escape_string($r->section)."',
'".mysql_escape_string($r->db_heading)."',
'".mysql_escape_string($r->question)."',
@ -266,7 +265,7 @@ function questions_editor($section, $year, $array_name, $self)
/* Load questions, then handle up and down, because with up and down we
* have to modify 2 questions to maintain the order */
$qs = questions_load_questions($section, $year);
$qs = questions_load_questions($section, $conferences_id);
/* Sanity check the order DG -- This is there to fix a bug in the .22
* database full import, anyone with a fresh install will see duplicate
@ -280,7 +279,7 @@ function questions_editor($section, $year, $array_name, $self)
foreach($keys as $qid) {
if($qs[$qid]['ord'] != $x) {
$qs[$qid]['ord'] = $x;
questions_update_question($qs[$qid], $year);
questions_update_question($qs[$qid], $conferences_id);
}
$x++;
}
@ -325,7 +324,7 @@ function questions_editor($section, $year, $array_name, $self)
}
/* Reload the questions */
$qs = questions_load_questions($section, $year);
$qs = questions_load_questions($section, $conferences_id);
}
@ -436,10 +435,11 @@ function questions_editor($section, $year, $array_name, $self)
if(count($keys) == 0) {
$default_qs = questions_load_questions($section, -1);
if(count($default_qs) != 0) {
$confTitle = mysql_result(mysql_query("SELECT name FROM conferences WHERE id = $conferences_id"), 0);
print("<br>");
print(i18n("There are no questions for year %1, but there are %2 default questions. To import the default questions to year %1 click on the link below.", array($year, count($default_qs))));
print(i18n("There are no questions for '%1', but there are %2 default questions. To import the default questions to '%1' click on the link below.", array($confTitle, count($default_qs))));
print("<br>");
print("<a title=\"Import\" href=\"$self?action=import&amp;impyear=-1\">".i18n("Import default questions")."</a><br>");
print("<a title=\"Import\" href=\"$self?action=import&amp;impconf=-1\">".i18n("Import default questions")."</a><br>");
}
}

@ -27,7 +27,7 @@ exit;
include "../common.inc.php";
$projq=mysql_query("SELECT id FROM registrations WHERE status='complete' OR status='paymentpending' AND year='2008'");
$projq=mysql_query("SELECT id FROM registrations WHERE status='complete' OR status='paymentpending' AND conferences_id='{$conference['id']}'");
while($projr=mysql_fetch_object($projq))
{
$reg_id=$projr->id;
@ -41,8 +41,8 @@ include "../common.inc.php";
//now change the N to a % so we can use it as a wildcard
$querynum=str_replace('N','%',$projectnumber);
$searchq=mysql_query("SELECT projectnumber FROM projects WHERE year='".$config['FAIRYEAR']."' AND projectnumber LIKE '$querynum'");
print("SELECT projectnumber FROM projects WHERE year='".$config['FAIRYEAR']."' AND projectnumber LIKE '$querynum'\n");
$searchq=mysql_query("SELECT projectnumber FROM projects WHERE conferences_id='".$conference['id']."' AND projectnumber LIKE '$querynum'");
print("SELECT projectnumber FROM projects WHERE conferences_id='".$conference['id']."' AND projectnumber LIKE '$querynum'\n");
$searchnum=mysql_num_rows($searchq);
echo "searchnum=$searchnum \n";
if(mysql_num_rows($searchq))
@ -77,7 +77,7 @@ include "../common.inc.php";
}
$projectnumber=str_replace('N',$Nnum,$projectnumber);
mysql_query("UPDATE projects SET projectnumber='$projectnumber' WHERE registrations_id='$reg_id' AND year='".$config['FAIRYEAR']."'");
mysql_query("UPDATE projects SET projectnumber='$projectnumber' WHERE registrations_id='$reg_id' AND conferences_id='".$conference['id']."'");
if($projectnumber)
{
echo "Assigned new project number $projectnumber\n";

@ -7,7 +7,7 @@ $tours_fields = array( 'name' => 'Tour Name',
'capacity' => 'Capacity',
'grade_min' => 'Minimum Grade',
'grade_max' => 'Maximum Grade',
'year' => 'Year',
'conferences_id' => 'Conference ID',
'contact' => 'Contact',
'location' => 'Location');
@ -17,7 +17,7 @@ class tours {
function tableEditorSetup($editor)
{
global $tours_fields;
global $config;
global $config, $conference;
/* Setup the table editor with the fields we want to display
* when displaying a list of tours, and also the type of each
@ -27,7 +27,7 @@ function tableEditorSetup($editor)
'capacity' => 'Capacity',
'grade_min' => 'Minimum Grade',
'grade_max' => 'Maximum Grade',
'year' => 'Year',
'conferences_id' => 'Conference ID',
);
/* Most of these should be moved to the base class, as they
@ -39,9 +39,9 @@ function tableEditorSetup($editor)
$editor->setPrimaryKey('id');
$editor->setEditFields($tours_fields);
$editor->setFieldOptions('year', array(
$editor->setFieldOptions('conferences_id', array(
array('key' => 'NULL', 'val' => 'Inactive'),
array('key' => $config['FAIRYEAR'], 'val' => $config['FAIRYEAR'])));
array('key' => $conference['id'], 'val' => $conference['name'])));
// print_r($e);
print("<br>\n");
@ -108,8 +108,6 @@ function tableEditorSave($data)
$this->id = mysql_insert_id();
}
/* Give it a proper year when saving */
/* Now just update the record */
$query="UPDATE `tours` SET ";
@ -122,7 +120,6 @@ function tableEditorSave($data)
$query .= " WHERE id='{$this->id}'";
// echo $query;
mysql_query($query);
}

@ -31,7 +31,7 @@
/* AJAX query */
if(intval($_GET['ajax']) == 1) {
/* Do ajax processing for this file */
$email = mysql_escape_string(stripslashes($_GET['email']));
$email = mysql_real_escape_string(stripslashes($_GET['email']));
$type = $_GET['type'];
/* Sanity check type */
@ -40,7 +40,7 @@
exit;
}
$q = mysql_query("SELECT id FROM users WHERE email='$email' ORDER BY year DESC");
$q = mysql_query("SELECT id FROM users WHERE email='$email' ORDER BY conferences_id DESC");
if(mysql_num_rows($q) == 0) {
/* User doesn't exist */
echo "notexist\n";
@ -59,8 +59,8 @@
exit;
}
if($u['year'] != $config['FAIRYEAR']) {
echo "noyear\n";
if($u['conferences_id'] != $conference['id']) {
echo "noconference\n";
exit;
}
@ -131,11 +131,11 @@
document.invite.button.value = "<?=i18n('Invite User to Role')?>";
document.invite.action.value = "norole";
break;
case "noyear":
update_status("<?=i18n('This user and role already exist, but the user has not yet activated their account for this year. Choose the \"Send Activation Reminder\" button below to send this user an email reminder to login (which activates their account for this year).')?>");
case "noconference":
update_status("<?=i18n('This user and role already exist, but the user has not yet activated their account for this conference. Choose the \"Send Activation Reminder\" button below to send this user an email reminder to login (which activates their account for this conference).')?>");
document.invite.button.disabled = false;
document.invite.button.value = "<?=i18n('Send Activation Reminder')?>";
document.invite.action.value = "noyear";
document.invite.action.value = "noconference";
break;
case "exist":
update_status("<?=i18n('This user and role already exist. They cannot be invited.')?>");
@ -167,14 +167,14 @@
}
if($_POST['action']!="" && $_POST['email'] && $type != '') {
$allowed_actions = array('notexist','norole','noyear');
$allowed_actions = array('notexist','norole','noconference');
$email = stripslashes($_POST['email']);
$action = $_POST['action'];
if(!in_array($action, $allowed_actions))
exit;
$q = mysql_query("SELECT id FROM users WHERE email='$email' ORDER BY year DESC");
$q = mysql_query("SELECT id FROM users WHERE email='$email' ORDER BY conferences_id DESC");
if(mysql_num_rows($q) > 0) {
$u = mysql_fetch_assoc($q);
$u = user_load($u['id']);
@ -188,8 +188,8 @@
$u['email'] = $email;
user_save($u);
email_send("{$type}_new_invite",$u['email'],
array("FAIRNAME"=>$config['fairname']),
array("FAIRNAME"=>$config['fairname'],
array("FAIRNAME"=>$conference['name']),
array("FAIRNAME"=>$conference['name'],
"EMAIL"=>$u['email'],
"PASSWORD"=>$u['password']));
echo happy(i18n('%1 has been invited to be a %2', array($u['email'], $user_what[$type])));
@ -199,16 +199,16 @@
case 'norole': /* Add role to the existing user */
user_create($type, $u['username'], $u);
email_send("{$type}_add_invite",$u['email'],
array("FAIRNAME"=>$config['fairname']),
array("FAIRNAME"=>$config['fairname']));
array("FAIRNAME"=>$conference['name']),
array("FAIRNAME"=>$conference['name']));
echo happy(i18n('%1 is now also a %2', array($u['email'], $user_what[$type])));
echo happy(i18n('An email has been sent to %1', array($u['email'])));
break;
case 'noyear': /* Send a reminder email */
case 'noconference': /* Send a reminder email */
email_send("{$type}_activate_reminder",$u['email'],
array("FAIRNAME"=>$config['fairname']),
array("FAIRNAME"=>$config['fairname'],
array("FAIRNAME"=>$conference['name']),
array("FAIRNAME"=>$conference['name'],
"EMAIL"=>$u['email']));
echo happy(i18n('An email has been sent to %1', array($u['email'])));
break;

@ -198,7 +198,7 @@ if(isset($_SESSION['accounts_id'])) {
committee_recover_password */
email_send("account_recover_password",
$email,
array("FAIRNAME"=>i18n($config['fairname'])),
array("FAIRNAME"=>i18n($conference['name'])),
array( "PASSWORD"=>$r->password,
"USERNAME"=>$r->username)
);
@ -239,10 +239,9 @@ if(isset($_SESSION['accounts_id'])) {
<?
switch($reg_open) {
case 'notopenyet':
echo i18n("Registration for the %1 %2 has not yet opened",
array( $config['FAIRYEAR'],
$config['fairname']),
array("Fair year","Fair name")
echo i18n("Registration for %1 has not yet opened",
array($conference['name']),
array("Fair name")
);
break;
case 'open':
@ -250,10 +249,9 @@ if(isset($_SESSION['accounts_id'])) {
break;
case 'closed':
echo i18n("Registration for the %1 %2 is now closed",
array( $config['FAIRYEAR'],
$config['fairname']),
array("Fair year","Fair name")
echo i18n("Registration for the %1 is now closed",
array($conference['name']),
array("Fair name")
);
break;
case 'notpermitted':

@ -68,7 +68,7 @@ if($u && array_key_exists('action', $_GET)){
}
$u['roles'][$role]['active'] = 'yes';
user_save($u);
happy_("{$roles[$role]['name']} role for %1 successfully activated",array($config['FAIRYEAR']));
happy_("{$roles[$role]['name']} role for %1 successfully activated",array($conference['name']));
echo i18n("Active");
break;
@ -80,7 +80,7 @@ if($u && array_key_exists('action', $_GET)){
}
$u['roles'][$role]['active'] = 'no';
user_save($u);
happy_("{$roles[$role]['name']} role for %1 successfully deactivated",array($config['FAIRYEAR']));
happy_("{$roles[$role]['name']} role for %1 successfully deactivated",array($conference['name']));
echo i18n("Deactivated");
break;

@ -82,7 +82,7 @@ case 'remove':
}
$u['roles'][$role]['active'] = 'yes';
user_save($u);
happy_("{$roles[$role]['name']} role for %1 successfully activated",array($config['FAIRYEAR']));
happy_("{$roles[$role]['name']} role for %1 successfully activated",array($conference['name']));
echo i18n("Active");
exit;
@ -94,7 +94,7 @@ case 'remove':
}
$u['roles'][$role]['active'] = 'no';
user_save($u);
happy_("{$roles[$role]['name']} role for %1 successfully deactivated",array($config['FAIRYEAR']));
happy_("{$roles[$role]['name']} role for %1 successfully deactivated",array($conference['name']));
echo i18n("Deactivated");
exit;
case 'add':
@ -110,8 +110,8 @@ case 'remove':
<?
echo '<ul>';
echo '<li>'.i18n("An <b>Active Role</b> indicates you would like to participate in the %1 %2 as that role (Judge, Volunteer, etc.)",array($config['FAIRYEAR'],$config['fairname']));
echo '</li><li>'.i18n("A <b>Deactivated Role</b> indicates you cannot participate in the deactivated roles this year, but would like remain on the mailing lists for future years. You can activate your deactivated role at any time.");
echo '<li>'.i18n("An <b>Active Role</b> indicates you would like to participate in the %1 as that role (Judge, Volunteer, etc.)",array($conference['name']));
echo '</li><li>'.i18n("A <b>Deactivated Role</b> indicates you cannot participate in the specified role for this conference, but would like remain on the mailing lists for future conferences. You can activate your deactivated role at any time.");
echo '</li><li>'.i18n("The <b>Remove Role</b> button completely deletes the role from your account. You will not receive future emails for the removed role. This action cannot be undone.");
echo '</ul>';
?>
@ -210,7 +210,7 @@ if(!in_array('judge', $u['roles'])){
<br/>
<form method="post" action="<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=delete&users_id=<?=$u['id']?>" >
<input style="width: 300px;" onclick="return confirmClick('<?=i18n("Are you sure you want to completely delete your account?\\nDoing so will remove you from our mailing list for future years and you will never hear from us again.\\nThis action cannot be undone.")?>');"
<input style="width: 300px;" onclick="return confirmClick('<?=i18n("Are you sure you want to completely delete your account?\\nDoing so will remove you from our mailing list for future conferences and you will never hear from us again.\\nThis action cannot be undone.")?>');"
type="submit" value="<?=i18n("Delete Entire Account")?>">
</form>
<div id="testoutput"></div>

@ -33,7 +33,7 @@
$u = user_load($_SESSION['users_id']);
if($u['volunteer_active'] == 'no') {
message_push(notice(i18n("Your volunteer role is not active. If you would like to participate as a volunteer for the %1 %2 please click the '<b>Activate Role</b>' button in the Volunteer section below",array($config['FAIRYEAR'],$config['fairname']))));
message_push(notice(i18n("Your volunteer role is not active. If you would like to participate as a volunteer for the %1 please click the '<b>Activate Role</b>' button in the Volunteer section below",array($conference['name']))));
header('Location: user_activate.php');
exit;
}

@ -39,35 +39,40 @@ if($_POST['edit']) $edit=$_POST['edit'];
if($_GET['action']) $action=$_GET['action'];
if($_POST['action']) $action=$_POST['action'];
if($_GET['year'] && $_GET['type']) {
$year=intval($_GET['year']);
if($_GET['conferences_id'] && $_GET['type']) {
$conferences_id=intval($_GET['conferences_id']);
$type=$_GET['type'];
$show_unawarded_awards="no";
$show_unawarded_prizes="no";
$typeq=mysql_query("SELECT * FROM award_types WHERE type='".mysql_real_escape_string($type)."' AND year=$year");
$typeq=mysql_query("SELECT * FROM award_types WHERE type='".mysql_real_escape_string($type)."' AND conferences_id=$conferences_id");
if(!mysql_num_rows($typeq)) {
echo error(i18n("Invalid award type"));
send_footer();
exit;
}
$ok = true;
echo "<h2>".i18n("%1 %2 Award Winners",array($year,$type))."</h2>";
$ok=true;
//first, lets make sure someone isnt tryint to see something that they arent allowed to!
//but only if the year they want is the FAIRYEAR. If they want a past year, thats cool
if($year>=$config['FAIRYEAR']) {
$q=mysql_query("SELECT (NOW()>'".$config['dates']['postwinners']."') AS test");
$r=mysql_fetch_object($q);
if($r->test!=1)
{
$conferenceInfo = get_conference_info($conferences_id);
if($conferenceInfo == null){
echo error(i18n("Invalid conference id"));
$ok = false;
}else if($conferenceInfo['status'] == 'pending'){
echo error(i18n("Crystal ball says future is very hard to see!"));
$ok = false;
}else if($conferenceInfo['status'] == 'running'){
$q = mysql_query("SELECT NOW() > `date` AS test FROM `dates` WHERE conferences_id = $conferences_id AND name = 'postwinners'");
$r = mysql_fetch_object($q);
if($r->test != 1){
echo error(i18n("Crystal ball says future is very hard to see!"));
$ok=false;
$ok = false;
}
}else{
echo "<h2>".i18n("%1 %2 Award Winners",array($conferenceInfo['name'],$type))."</h2>";
}
if($ok) {
$q=mysql_query("SELECT
@ -79,10 +84,10 @@ if($_GET['year'] && $_GET['type']) {
award_awards,
award_types
WHERE
award_awards.year='$year'
award_awards.conferences_id='$conferences_id'
AND award_awards.award_types_id=award_types.id
AND award_types.type='".$type."'
AND award_types.year='$year'
AND award_types.conferences_id='$conferences_id'
ORDER BY
awards_order");
@ -108,7 +113,7 @@ if($_GET['year'] && $_GET['type']) {
LEFT JOIN projects ON projects.id=winners.projects_id
WHERE
award_awards_id='$r->id'
AND award_prizes.year='$year'
AND award_prizes.conferences_id='$conferences_id'
ORDER BY
`order`");
echo mysql_error();
@ -230,33 +235,32 @@ if($_GET['year'] && $_GET['type']) {
else
{
$q=mysql_query("SELECT
DISTINCT(winners.year) AS year,
DISTINCT(winners.conferences_id) AS conferences_id,
dates.date
FROM
winners,
dates
WHERE
winners.year=dates.year
winners.conferences_id=dates.conferences_id
AND dates.name='postwinners'
AND dates.date<=NOW()
ORDER BY
year DESC");
conferences_id DESC");
$first=true;
if(mysql_num_rows($q)) {
while($r=mysql_fetch_object($q)) {
if($first && $r->year != $config['FAIRYEAR']) {
if($first && $r->conferences_id != $conference['id']) {
list($d,$t)=explode(" ",$config['dates']['postwinners']);
echo "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],format_date($d),format_time($t)));
echo "<h2>".i18n("%1 Winners",array($conference['name']))."</h2>";
echo i18n("Winners of %1 will be posted here on %2 at %3",array($conference['name'],format_date($d),format_time($t)));
echo "<br />\n";
echo "<br />\n";
$first=false;
}
//get the "winnersposted" date for the year, and make
echo "<h2>".i18n("%1 Winners",array($r->year))."</h2>";
//get the "winnersposted" date for the conference, and make
echo "<h2>".i18n("%1 Winners",array($r->conferences_id))."</h2>";
//do this each time, because each year the names of the award types could change, along with what is actually given out.
//
//do this each time, because for each conference the names of the award types could change, along with what is actually given out.
$tq=mysql_query("SELECT
DISTINCT(award_types.type) AS type
FROM
@ -268,13 +272,13 @@ else
award_awards.award_types_id=award_types.id
AND winners.awards_prizes_id=award_prizes.id
AND award_prizes.award_awards_id=award_awards.id
AND winners.year='$r->year'
AND winners.conferences_id='$r->conferences_id'
ORDER BY
award_types.order
");
echo mysql_error();
while($tr=mysql_fetch_object($tq)) {
echo "&nbsp;&nbsp;<a href=\"winners.php?year=$r->year&type=$tr->type\">".i18n("%1 %2 award winners",array($r->year,$tr->type))."</a><br />";
echo "&nbsp;&nbsp;<a href=\"winners.php?conferences_id=$r->conferences_id&type=$tr->type\">".i18n("%1 %2 award winners",array($r->conferences_id,$tr->type))."</a><br />";
}
echo "<br />";
$first=false;
@ -282,8 +286,8 @@ else
}
else {
list($d,$t)=explode(" ",$config['dates']['postwinners']);
echo "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],format_date($d),format_time($t)));
echo "<h2>".i18n("%1 Winners",array($conference['name']))."</h2>";
echo i18n("Winners of %1 will be posted here on %2 at %3",array($conference['name'],format_date($d),format_time($t)));
}
}