Copyright (C) 2005 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> "; if($fairs_id) echo "

".i18n('Winners from').": {$fairs[$fairs_id]['name']}

"; echo "{$r['type']} - {$r['name']}
"; echo "{$r['criteria']}
"; /* Print the award with editor */ print_award($r, $fairs_id, true, $editor_data); exit; case 'additional_materials': $fairs_id = intval($_GET['fairs_id']); $q = mysql_query("SELECT * FROM award_awards WHERE id='$award_awards_id'"); if($fairs_id == 0) { echo "Unsupported Action: Can't get additional materials for fairs_id=0. Edit the project and set it's fair to anything except 'Local/Unspecified'."; exit; } $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, $conference['id']); foreach($pdf['header'] as $h) header($h); echo $pdf['data']; exit; } if($auth_type == 'fair') { send_header("Enter Winning Projects", array('Science Fair Main' => 'fair_main.php'), "enter_winning_projects" ); } else { send_header("Enter Winning Projects", array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php'), "enter_winning_projects" ); } ?> "; echo i18n("Choose an award to assign winners"); echo "
"; echo "
"; $fairs_id = ($auth_type == 'fair') ? $_SESSION['fairs_id'] : 0; while($r=mysql_fetch_assoc($q)) { if($r['per_fair'] == 'yes' && $auth_type != 'fair') { ?> - ()
$f) { ?>
"; } } else { ?> - ()
"; } echo '
'; } function print_award(&$r, $fairs_id, $editor=false, $editor_data=array()) { global $config, $auth_type; // echo "fair=$fairs_id"; /* Setup the winner filter, we don't want to restrict this * to a specific fair for the 'fair' user */ $fairs_where = ''; if($r['per_fair'] == 'yes') { if($fairs_id == 0) { echo "blank fairs_id for per-fair award. bug.\n"; exit; } /* For per-fair awards, filter the results */ $fairs_where = "AND projects.fairs_id='$fairs_id'"; } /* Force the 'fair' user to only edit their own fair */ if($auth_type == 'fair') $fairs_id = $_SESSION['fairs_id']; /* Load prizes for this award */ $q=mysql_query("SELECT award_prizes.prize, award_prizes.number, award_prizes.id, award_prizes.cash, award_prizes.scholarship FROM award_prizes WHERE award_awards_id='{$r['id']}' AND award_prizes.conferences_id='{$conference['id']}' ORDER BY `order`"); echo mysql_error(); echo "
"; $has_winners = false; while($pr=mysql_fetch_object($q)) { if($editor == true) { echo '

'; } echo "  {$pr->prize}"; if($pr->cash || $pr->scholarship) { echo " ("; if($pr->cash && $pr->scholarship) echo "\${$pr->cash} cash / \${$pr->scholarship} scholarship"; else if($pr->cash) echo "\${$pr->cash} cash"; else if($pr->scholarship) echo "\${$pr->scholarship} scholarship"; echo ")"; } /* Load winners for this prize */ $cq=mysql_query("SELECT winners.projects_id, projects.projectnumber, projects.title, projects.fairs_id FROM winners LEFT JOIN projects ON projects.id=winners.projects_id WHERE winners.awards_prizes_id='{$pr->id}' $fairs_where "); echo mysql_error(); $count = mysql_num_rows($cq); // echo "winners=$count"; /* Print count */ $colour = ($count < $pr->number) ? 'red' : 'green'; echo " [$count/{$pr->number}]"; echo ""; echo "
"; /* List current winners for this prize */ $winners = array(); while($w = mysql_fetch_assoc($cq)) { if($w['projectnumber']) { echo "    "; if($editor == true) { /* Print the delete X before the project */ if($auth_type == 'fair' && $w['fairs_id'] != $fairs_id) { /* show a blank so everything lines up */ echo '    '; } else { echo "id},{$w['projects_id']});return false;\" href=\"#\" >"; echo ""; echo ' '; } $winners[] = $w['projects_id']; } $has_winners = true; echo "({$w['projectnumber']}) {$w['title']}"; echo "
"; } else { /* echo "    "; echo "No winner(s) specified"; */ } } /* Unlist all the winners we just printed from ALL lists */ if($editor == true) { echo ""; } /* Print the select box if we need it */ if($editor == true && $count < $pr->number) { $n_nom = 0; $n_eli = 0; ?>
   
    : -
"; if($r['external_additional_materials'] == 1 && $editor==false && $r['award_source_fairs_id'] == NULL) { $d = 'disabled="disabled"'; $a = ''; if($has_winners == true) { echo ""; $d = ''; $a = ''; } echo "$a
"; } echo "
"; } send_footer(); ?>