2007-03-28 22:32:57 +00:00
< ?
2025-02-10 19:54:20 +00:00
require ( '../common.inc.php' );
require_once ( '../user.inc.php' );
2025-01-29 03:30:48 +00:00
user_auth_required ( 'committee' , 'admin' );
2025-02-10 19:54:20 +00:00
require ( '../lpdf.php' );
require ( '../lcsv.php' );
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
$type = $_GET [ 'type' ];
if ( ! $type )
$type = 'pdf' ;
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
if ( $type == 'pdf' ) {
2025-02-10 19:54:20 +00:00
$rep = new lpdf (
i18n ( $config [ 'fairname' ]),
2025-01-29 03:30:48 +00:00
i18n ( 'Program Awards' ),
2025-02-10 19:54:20 +00:00
$_SERVER [ 'DOCUMENT_ROOT' ] . $config [ 'SFIABDIRECTORY' ] . '/data/logo-200.gif'
);
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
$rep -> newPage ();
$rep -> setFontSize ( 11 );
} else if ( $type == 'csv' ) {
$rep = new lcsv ( i18n ( 'Program Awards' ));
}
$q = $pdo -> prepare ( " SELECT
2007-03-28 22:32:57 +00:00
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
2025-01-29 03:30:48 +00:00
award_awards . year = '" . $config[' FAIRYEAR '] . "'
AND \taward_types . year = '" . $config[' FAIRYEAR '] . "'
AND \taward_awards . award_types_id = award_types . id
AND \taward_awards . excludefromac = '0'
AND \t ( award_types . type = 'special' OR award_types . type = 'grand' )
2007-03-28 22:32:57 +00:00
ORDER BY awards_order " );
2025-01-29 03:30:48 +00:00
$q -> execute ();
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
show_pdo_errors_if_any ( $pdo );
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
if ( $q -> rowCount ()) {
while ( $r = $q -> fetch ( PDO :: FETCH_OBJ )) {
$rep -> heading ( i18n ( $r -> name ));
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
// get teh age categories
$acq = $pdo -> prepare ( " SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE projectcategories.year=' " . $config [ 'FAIRYEAR' ] . " ' AND award_awards_projectcategories.year=' " . $config [ 'FAIRYEAR' ] . " ' AND award_awards_projectcategories.award_awards_id=' $r->id ' AND award_awards_projectcategories.projectcategories_id=projectcategories.id ORDER BY projectcategories.id " );
$acq -> execute ();
show_pdo_errors_if_any ( $pdo );
$cats = '' ;
while ( $acr = $acq -> fetch ( PDO :: FETCH_OBJ )) {
$cats .= i18n ( $acr -> category ) . ', ' ;
}
$cats = substr ( $cats , 0 , - 2 );
$rep -> addText ( " $cats : " . i18n ( $r -> criteria ));
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
$pq = $pdo -> prepare ( " SELECT
2007-03-28 22:32:57 +00:00
award_prizes . prize ,
award_prizes . number ,
award_prizes . id ,
award_prizes . cash ,
award_prizes . scholarship
FROM
award_prizes
WHERE
award_awards_id = '$r->id'
2025-01-29 03:30:48 +00:00
AND award_prizes . year = '" . $config[' FAIRYEAR '] . "'
2007-03-28 22:32:57 +00:00
AND award_prizes . excludefromac = '0'
ORDER BY
`order` " );
2025-01-29 03:30:48 +00:00
$pq -> execute ();
show_pdo_errors_if_any ( $pdo );
$prevprizeid = - 1 ;
while ( $pr = $pq -> fetch ( PDO :: FETCH_OBJ )) {
if ( $prevprizeid != $pr -> id ) {
$prizetext = '' ;
if ( $pr -> number > 1 )
$prizetext .= i18n ( '%1 prizes of' , array ( $pr -> number )) . ' ' ;
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
if ( $pr -> prize )
$prizetext .= i18n ( $pr -> prize );
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
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' );
2007-03-28 22:32:57 +00:00
2025-01-29 03:30:48 +00:00
if ( $pr -> prize )
$prizetext .= ')' ;
2007-03-28 22:32:57 +00:00
}
2025-01-29 03:30:48 +00:00
$rep -> addText ( $prizetext );
$prevprizeid = $pr -> id ;
2007-03-28 22:32:57 +00:00
}
}
2025-01-29 03:30:48 +00:00
$rep -> nextLine ();
2007-03-28 22:32:57 +00:00
}
2025-01-29 03:30:48 +00:00
}
$rep -> output ();