Send trophy info to the client on a getaward

This commit is contained in:
james 2009-11-02 05:45:39 +00:00
parent 59942138d9
commit eb7b4e1754

View File

@ -91,6 +91,7 @@ function handle_getawards(&$u, $fair, &$data, &$response)
$award['name_en'] = $a['name']; $award['name_en'] = $a['name'];
$award['criteria_en'] = $a['criteria']; $award['criteria_en'] = $a['criteria'];
$award['upload_winners'] = $ul[$a['id']]; $award['upload_winners'] = $ul[$a['id']];
if($a['sponsors_id']) { if($a['sponsors_id']) {
$sq = mysql_query("SELECT * FROM sponsors WHERE id='{$a['sponsors_id']}'"); $sq = mysql_query("SELECT * FROM sponsors WHERE id='{$a['sponsors_id']}'");
if(mysql_num_rows($sq)) { if(mysql_num_rows($sq)) {
@ -102,14 +103,17 @@ function handle_getawards(&$u, $fair, &$data, &$response)
$award['prizes'] = array(); $award['prizes'] = array();
$pq = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='{$a['id']}'"); $pq = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='{$a['id']}'");
while($p = mysql_fetch_assoc($pq)) { while($p = mysql_fetch_assoc($pq)) {
$prize = array(); /* Map array keys -> local database field */
$prize['identifier'] = ""; $map = array( 'cash' => 'cash', 'scholarship' => 'scholarship',
$prize['cash'] = $p['cash'];; 'value' => 'value', 'prize_en' => 'prize', 'number'=>'number',
$prize['scholarship'] = $p['scholarship']; 'ord'=>'order',
$prize['value'] = $p['value']; 'trophystudentkeeper'=>'trophystudentkeeper',
$prize['prize_en'] = $p['prize']; 'trophystudentreturn'=>'trophystudentreturn',
$prize['number'] = $p['number']; 'trophyschoolkeeper'=>'trophyschoolkeeper',
$prize['ord'] = $p['order']; 'trophyschoolreturn'=>'trophyschoolreturn');
$prize = array('identifier' => '');
foreach($map as $k=>$field) $prize[$k] = $p[$field];
$award['prizes'][] = $prize; $award['prizes'][] = $prize;
} }
$awards[] = $award; $awards[] = $award;