forked from science-ation/science-ation
Send trophy info to the client on a getaward
This commit is contained in:
parent
59942138d9
commit
eb7b4e1754
20
remote.php
20
remote.php
@ -91,6 +91,7 @@ function handle_getawards(&$u, $fair, &$data, &$response)
|
||||
$award['name_en'] = $a['name'];
|
||||
$award['criteria_en'] = $a['criteria'];
|
||||
$award['upload_winners'] = $ul[$a['id']];
|
||||
|
||||
if($a['sponsors_id']) {
|
||||
$sq = mysql_query("SELECT * FROM sponsors WHERE id='{$a['sponsors_id']}'");
|
||||
if(mysql_num_rows($sq)) {
|
||||
@ -102,14 +103,17 @@ function handle_getawards(&$u, $fair, &$data, &$response)
|
||||
$award['prizes'] = array();
|
||||
$pq = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='{$a['id']}'");
|
||||
while($p = mysql_fetch_assoc($pq)) {
|
||||
$prize = array();
|
||||
$prize['identifier'] = "";
|
||||
$prize['cash'] = $p['cash'];;
|
||||
$prize['scholarship'] = $p['scholarship'];
|
||||
$prize['value'] = $p['value'];
|
||||
$prize['prize_en'] = $p['prize'];
|
||||
$prize['number'] = $p['number'];
|
||||
$prize['ord'] = $p['order'];
|
||||
/* Map array keys -> local database field */
|
||||
$map = array( 'cash' => 'cash', 'scholarship' => 'scholarship',
|
||||
'value' => 'value', 'prize_en' => 'prize', 'number'=>'number',
|
||||
'ord'=>'order',
|
||||
'trophystudentkeeper'=>'trophystudentkeeper',
|
||||
'trophystudentreturn'=>'trophystudentreturn',
|
||||
'trophyschoolkeeper'=>'trophyschoolkeeper',
|
||||
'trophyschoolreturn'=>'trophyschoolreturn');
|
||||
$prize = array('identifier' => '');
|
||||
foreach($map as $k=>$field) $prize[$k] = $p[$field];
|
||||
|
||||
$award['prizes'][] = $prize;
|
||||
}
|
||||
$awards[] = $award;
|
||||
|
Loading…
Reference in New Issue
Block a user