diff --git a/admin/reports_checkin.php b/admin/reports_checkin.php index 1b1e2e8..63c4548 100644 --- a/admin/reports_checkin.php +++ b/admin/reports_checkin.php @@ -2,14 +2,12 @@ require("../common.inc.php"); require("../lpdf.php"); - $pdf=new lpdf(i18n($config['fairname']),i18n("Checkin List")); - - -//lets split this up by age category, then sort each one by division... so first, just get the age categories - -$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); -while($catr=mysql_fetch_object($catq)) +$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$_GET['cat']."'"); +if($catr=mysql_fetch_object($catq)) { + + $pdf=new lpdf(i18n($config['fairname']),i18n("Checkin List")." - ".i18n($catr->category)); + $pdf->newPage(); $q=mysql_query("SELECT registrations.id AS reg_id, registrations.num AS reg_num, registrations.status, @@ -23,7 +21,6 @@ while($catr=mysql_fetch_object($catq)) AND ( registrations.status='complete' OR registrations.status='paymentpending' ) AND projects.projectcategories_id='$catr->id' ORDER BY - registrations.status DESC, projects.title "); echo mysql_error(); @@ -42,107 +39,31 @@ while($catr=mysql_fetch_object($catq)) } $status_text=i18n($status_text); - $divq=mysql_query("SELECT division FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'"); + $divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'"); $divr=mysql_fetch_object($divq); $sq=mysql_query("SELECT students.firstname, - students.lastname, - schools.school + students.lastname FROM - students,schools + students WHERE students.registrations_id='$r->reg_id' - AND - students.schools_id=schools.id "); - echo mysql_error(); - $schools=""; $students=""; + $studnum=0; while($studentinfo=mysql_fetch_object($sq)) { - $students.="$studentinfo->firstname $studentinfo->lastname\n"; - $schools.="$studentinfo->school\n"; + if($studnum>0) $students.=", "; + $students.="$studentinfo->firstname $studentinfo->lastname"; + $studnum++; } - $table['data'][]=array($status_text,$r->proj_num,$r->title,$students,i18n($divr->division_short)); + $table['data'][]=array($status_text,$r->proj_num,$r->title,$students,i18n($divr->division_shortform)); } $pdf->addTable($table); - $pdf->newPage(); -} -/* - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - $stats_totalprojects=0; - $stats_totalstudents=0; - $stats_divisions=array(); - $stats_categories=array(); - - while($r=mysql_fetch_object($q)) - { - $stats_totalprojects++; - $stats_divisions[$r->projectdivisions_id]++; - $stats_categories[$r->projectcategories_id]++; - - echo ""; - echo ""; - echo ""; - echo ""; - - - //now get thh category and division - $catq=mysql_query("SELECT category FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectcategories_id."'"); - $catr=mysql_fetch_object($catq); - $divq=mysql_query("SELECT division FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'"); - $divr=mysql_fetch_object($divq); - - - echo ""; - - echo ""; - - $sq=mysql_query("SELECT students.firstname, - students.lastname, - schools.school - FROM - students,schools - WHERE - students.registrations_id='$r->reg_id' - AND - students.schools_id=schools.id - "); - echo mysql_error(); - - $studnum=1; - $schools=""; - $students=""; - while($studentinfo=mysql_fetch_object($sq)) - { - $students.="$studentinfo->firstname $studentinfo->lastname
"; - $schools.="$studentinfo->school
"; - $stats_totalstudents++; - } - echo ""; - echo ""; - - echo ""; - } - echo "
".i18n("Status")."".i18n("Reg Num")."".i18n("Project Title")."".i18n("Age Category")."".i18n("Division")."".i18n("School(s)")."".i18n("Student(s)")."
$status_text$r->reg_num$r->title".i18n("$catr->category")."".i18n("$divr->division")."$schools$students
\n"; - - -*/ - - $pdf->output(); +} ?> diff --git a/config/divisions.php b/config/divisions.php index 6bd9d70..b4b9e06 100644 --- a/config/divisions.php +++ b/config/divisions.php @@ -16,7 +16,8 @@ { mysql_query("UPDATE projectdivisions SET ". "id='".$_POST['id']."', ". - "division='".mysql_escape_string(stripslashes($_POST['division']))."' ". + "division='".mysql_escape_string(stripslashes($_POST['division']))."', ". + "division_shortform='".mysql_escape_string(stripslashes($_POST['division_shortform']))."' ". "WHERE id='".$_POST['saveid']."'"); echo happy(i18n("Division successfully saved")); } @@ -38,9 +39,10 @@ } else { - mysql_query("INSERT INTO projectdivisions (id,division,year) VALUES ( ". + mysql_query("INSERT INTO projectdivisions (id,division,division_shortform,year) VALUES ( ". "'".$_POST['id']."', ". "'".mysql_escape_string(stripslashes($_POST['division']))."', ". + "'".mysql_escape_string(stripslashes($_POST['division_shortform']))."', ". "'".$config['FAIRYEAR']."') "); echo happy(i18n("Division successfully added")); } @@ -68,6 +70,7 @@ echo ""; echo "".i18n("Division ID")."\n"; echo "".i18n("Division Name")."\n"; + echo "".i18n("Short Form")."\n"; echo "".i18n("Actions")."\n"; echo ""; @@ -86,9 +89,10 @@ $buttontext="Add"; } echo ""; - echo " id\">"; - echo " division\">"; - echo " "; + echo " id\" />"; + echo " division\" />"; + echo " division_shortform\" />"; + echo " "; echo ""; } else @@ -99,6 +103,7 @@ echo ""; echo " $r->id"; echo " $r->division"; + echo " $r->division_shortform"; echo " "; echo "id\">"; echo "   "; diff --git a/lpdf.php b/lpdf.php index 73662d0..af7a8dd 100644 --- a/lpdf.php +++ b/lpdf.php @@ -49,10 +49,13 @@ class lpdf function newPage() { + if($this->pagenumber>0) + pdf_end_page($this->pdf); + $this->pagenumber++; - pdf_end_page($this->pdf); //Letter size (8.5 x 11) is 612,792 pdf_begin_page($this->pdf,612,792); + pdf_setlinewidth($this->pdf,0.3); $this->addHeaderAndFooterToPage(); } @@ -66,6 +69,7 @@ class lpdf $table_width=array_sum($table['widths']); $table_cols=count($table['header']); + $table_padding=0.03; //draw the top line of the table (above the table header) pdf_moveto($this->pdf,$this->loc($xpos_of_table),$this->loc($this->yloc+$height['tableheader'])); @@ -109,7 +113,7 @@ class lpdf { $width=$table['widths'][$c]; - pdf_show_boxed($this->pdf,$dataline[$c],$this->loc($xpos),$this->loc($this->yloc),$this->loc($width),$this->loc($height['tabledata']),$table['dataalign'][$c],null); + pdf_show_boxed($this->pdf,$dataline[$c],$this->loc($xpos+$table_padding),$this->loc($this->yloc),$this->loc($width-2*$table_padding),$this->loc($height['tabledata']),$table['dataalign'][$c],null); $xpos+=$width; } @@ -129,14 +133,14 @@ class lpdf $width=$table['widths'][$c]; //draw the line below the table data) pdf_moveto($this->pdf,$this->loc($xpos),$this->loc($top_of_table+$height['tableheader'])); - pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader'])); + pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader']-.02)); pdf_stroke($this->pdf); $xpos+=$width; } //and the final line on the right side of the table: pdf_moveto($this->pdf,$this->loc($xpos),$this->loc($top_of_table+$height['tableheader'])); - pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader'])); + pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader']-.02)); pdf_stroke($this->pdf); } @@ -160,7 +164,7 @@ class lpdf //open up the first page //Letter size (8.5 x 11) is 612,792 - pdf_begin_page($this->pdf,612,792); +// pdf_begin_page($this->pdf,612,792); // pdf_set_parameter($this->pdf, "FontOutline", "Arial=/home/sfiab/www.sfiab.ca/sfiab/arial.ttf"); //$arial=pdf_findfont($this->pdf,"Arial","host",1); $this->normalfont=pdf_findfont($this->pdf,"Times-Roman","host",0); @@ -171,13 +175,12 @@ class lpdf pdf_set_info($this->pdf,"Title","SFIAB - $subheader"); pdf_set_info($this->pdf,"Subject","$subheader"); - pdf_setlinewidth($this->pdf,0.3); - $this->page_header=$header; $this->page_subheader=$subheader; + $this->pagenumber=0; //add the stuff to the first page - $this->addHeaderAndFooterToPage(); +// $this->addHeaderAndFooterToPage(); } diff --git a/scripts/populate_fake.php b/scripts/populate_fake.php new file mode 100644 index 0000000..4512b36 --- /dev/null +++ b/scripts/populate_fake.php @@ -0,0 +1,72 @@ +