2007-03-28 22:32:57 +00:00
< ?
require ( " ../common.inc.php " );
2007-11-21 17:02:09 +00:00
require_once ( " ../user.inc.php " );
2010-07-13 03:30:17 +00:00
user_auth_required ( 'admin' );
2007-03-28 22:32:57 +00:00
require ( " ../lpdf.php " );
require ( " ../lcsv.php " );
$type = $_GET [ 'type' ];
if ( ! $type ) $type = " pdf " ;
if ( $type == " pdf " )
{
$rep = new lpdf ( i18n ( $config [ 'fairname' ]),
i18n ( " Program Awards " ),
2010-11-03 17:18:02 +00:00
$_SERVER [ 'DOCUMENT_ROOT' ] . $config [ 'SFIABDIRECTORY' ] . " /data/ { $conference [ 'id' ] } -logo-200.gif "
2007-03-28 22:32:57 +00:00
);
$rep -> newPage ();
$rep -> setFontSize ( 11 );
}
else if ( $type == " csv " )
{
$rep = new lcsv ( i18n ( " Program Awards " ));
}
$q = mysql_query ( " SELECT
award_awards . id ,
award_awards . name ,
award_awards . criteria ,
award_awards . presenter ,
award_awards . order AS awards_order ,
award_types . type
FROM
award_awards ,
award_types
WHERE
2010-10-20 21:58:26 +00:00
award_awards . conferences_id = '".$conference[' id ']."'
AND award_types . conferences_id = '".$conference[' id ']."'
2007-03-28 22:32:57 +00:00
AND award_awards . award_types_id = award_types . id
AND award_awards . excludefromac = '0'
AND ( award_types . type = 'special' OR award_types . type = 'grand' )
ORDER BY awards_order " );
echo mysql_error ();
if ( mysql_num_rows ( $q ))
{
while ( $r = mysql_fetch_object ( $q ))
{
$rep -> heading ( i18n ( $r -> name ));
//get teh age categories
2010-10-20 21:58:26 +00:00
$acq = mysql_query ( " SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE projectcategories.conferences_id=' " . $conference [ 'id' ] . " ' AND award_awards_projectcategories.conferences_id=' " . $conference [ 'id' ] . " ' AND award_awards_projectcategories.award_awards_id=' $r->id ' AND award_awards_projectcategories.projectcategories_id=projectcategories.id ORDER BY projectcategories.id " );
2007-03-28 22:32:57 +00:00
echo mysql_error ();
$cats = " " ;
while ( $acr = mysql_fetch_object ( $acq ))
{
$cats .= i18n ( $acr -> category ) . " , " ;
}
$cats = substr ( $cats , 0 , - 2 );
$rep -> addText ( " $cats : " . i18n ( $r -> criteria ));
$pq = 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'
2010-10-20 21:58:26 +00:00
AND award_prizes . conferences_id = '".$conference[' id ']."'
2007-03-28 22:32:57 +00:00
AND award_prizes . excludefromac = '0'
ORDER BY
`order` " );
echo mysql_error ();
$prevprizeid =- 1 ;
while ( $pr = mysql_fetch_object ( $pq ))
{
if ( $prevprizeid != $pr -> id )
{
$prizetext = " " ;
if ( $pr -> number > 1 )
$prizetext .= i18n ( " %1 prizes of " , array ( $pr -> number )) . " " ;
if ( $pr -> prize )
$prizetext .= i18n ( $pr -> prize );
if ( $pr -> cash || $pr -> scholarship )
{
if ( $pr -> prize )
$prizetext .= " ( " ;
if ( $pr -> cash && $pr -> scholarship )
$prizetext .= " \$ $pr->cash / \$ $pr->scholarship " . i18n ( " scholarship " );
else if ( $pr -> cash )
$prizetext .= " \$ $pr->cash " ;
else if ( $pr -> scholarship )
$prizetext .= " \$ $pr->scholarship " . i18n ( " scholarship " );
if ( $pr -> prize )
$prizetext .= " ) " ;
}
$rep -> addText ( $prizetext );
$prevprizeid = $pr -> id ;
}
}
$rep -> nextLine ();
}
}
$rep -> output ();
?>