2005-01-24 18:00:03 +00:00
< ?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website : http :// www . sfiab . ca
Copyright ( C ) 2005 Sci - Tech Ontario Inc < info @ scitechontario . org >
Copyright ( C ) 2005 James Grant < james @ lightbox . org >
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 .
*/
?>
2005-01-13 22:00:34 +00:00
< ?
require ( " ../common.inc.php " );
2005-02-16 22:50:43 +00:00
auth_required ( 'admin' );
2005-01-13 22:00:34 +00:00
require ( " ../lpdf.php " );
2005-02-23 14:29:28 +00:00
require ( " ../lcsv.php " );
$type = $_GET [ 'type' ];
2005-01-13 22:00:34 +00:00
2005-01-13 23:59:22 +00:00
$catq = mysql_query ( " SELECT * FROM projectcategories WHERE year=' " . $config [ 'FAIRYEAR' ] . " ' AND id=' " . $_GET [ 'cat' ] . " ' " );
if ( $catr = mysql_fetch_object ( $catq ))
2005-01-13 22:00:34 +00:00
{
2005-02-23 14:29:28 +00:00
if ( $type == " pdf " )
{
2005-01-13 23:59:22 +00:00
2005-02-23 14:55:01 +00:00
$rep = new lpdf ( i18n ( $config [ 'fairname' ]),
2005-02-23 14:29:28 +00:00
i18n ( " Checkin List " ) . " - " . i18n ( $catr -> category ),
$_SERVER [ 'DOCUMENT_ROOT' ] . $config [ 'SFIABDIRECTORY' ] . " /data/logo-200.gif "
);
2005-01-14 20:41:22 +00:00
2005-02-23 14:55:01 +00:00
$rep -> newPage ();
$rep -> setFontSize ( 11 );
2005-02-23 14:29:28 +00:00
}
else if ( $type == " csv " )
{
2005-02-23 14:55:01 +00:00
$rep = new lcsv ( i18n ( " Checkin List " ) . " - " . i18n ( $catr -> category ));
2005-02-23 14:29:28 +00:00
}
2005-01-13 22:00:34 +00:00
$q = mysql_query ( " SELECT registrations.id AS reg_id,
registrations . num AS reg_num ,
registrations . status ,
projects . title ,
2005-01-21 19:27:28 +00:00
projects . projectnumber ,
2005-01-13 22:00:34 +00:00
projects . projectdivisions_id
FROM
registrations
left outer join projects on projects . registrations_id = registrations . id
WHERE
registrations . year = '".$config[' FAIRYEAR ']."'
AND ( registrations . status = 'complete' OR registrations . status = 'paymentpending' )
AND projects . projectcategories_id = '$catr->id'
ORDER BY
projects . title
" );
echo mysql_error ();
$table = array ();
2005-01-14 20:56:51 +00:00
//only show the 'paid' column if the regfee > 0. if registration is fee, then we dont care about the 'paid' column!
if ( $config [ 'regfee' ] > 0 )
2005-01-13 22:00:34 +00:00
{
2005-01-14 20:56:51 +00:00
$table [ 'header' ] = array ( i18n ( " Paid? " ), i18n ( " Proj # " ), i18n ( " Project Title " ), i18n ( " Student(s) " ), i18n ( " Div " ));
$table [ 'widths' ] = array ( 0.5 , 0.6 , 3.5 , 2.4 , 0.5 );
$table [ 'dataalign' ] = array ( " center " , " left " , " left " , " left " , " center " );
}
else
{
$table [ 'header' ] = array ( i18n ( " Proj # " ), i18n ( " Project Title " ), i18n ( " Student(s) " ), i18n ( " Div " ));
$table [ 'widths' ] = array ( 0.6 , 3.7 , 2.7 , 0.5 );
$table [ 'dataalign' ] = array ( " left " , " left " , " left " , " center " );
2005-01-13 22:00:34 +00:00
2005-01-14 20:56:51 +00:00
}
while ( $r = mysql_fetch_object ( $q ))
{
2005-01-13 23:59:22 +00:00
$divq = mysql_query ( " SELECT division,division_shortform FROM projectdivisions WHERE year=' " . $config [ 'FAIRYEAR' ] . " ' AND id=' " . $r -> projectdivisions_id . " ' " );
2005-01-13 22:00:34 +00:00
$divr = mysql_fetch_object ( $divq );
$sq = mysql_query ( " SELECT students.firstname,
2005-01-13 23:59:22 +00:00
students . lastname
2005-01-13 22:00:34 +00:00
FROM
2005-01-13 23:59:22 +00:00
students
2005-01-13 22:00:34 +00:00
WHERE
students . registrations_id = '$r->reg_id'
" );
$students = " " ;
2005-01-13 23:59:22 +00:00
$studnum = 0 ;
2005-01-13 22:00:34 +00:00
while ( $studentinfo = mysql_fetch_object ( $sq ))
{
2005-01-13 23:59:22 +00:00
if ( $studnum > 0 ) $students .= " , " ;
$students .= " $studentinfo->firstname $studentinfo->lastname " ;
$studnum ++ ;
2005-01-13 22:00:34 +00:00
}
2005-01-14 20:56:51 +00:00
//only show the paid column if regfee >0
if ( $config [ 'regfee' ] > 0 )
{
switch ( $r -> status )
{
case " paymentpending " : $status_text = " No " ; break ;
case " complete " : $status_text = " " ; break ;
}
$status_text = i18n ( $status_text );
2006-01-16 16:22:05 +00:00
$table [ 'data' ][] = array ( $status_text , $r -> projectnumber , $r -> title , $students , i18n ( $divr -> division_shortform ));
2005-01-14 20:56:51 +00:00
}
else
2005-01-21 19:27:28 +00:00
$table [ 'data' ][] = array ( $r -> projectnumber , $r -> title , $students , i18n ( $divr -> division_shortform ));
2005-01-14 20:56:51 +00:00
2005-01-13 22:00:34 +00:00
}
2005-02-23 14:55:01 +00:00
$rep -> addTable ( $table );
$rep -> output ();
2005-01-13 23:59:22 +00:00
}
2005-01-13 22:00:34 +00:00
?>