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 " $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 @@
+
+include "../common.inc.php";
+
+$numprojects=150;
+
+
+function getrand($ar)
+{
+ return $ar[rand(0,count($ar)-1)];
+}
+
+//the following work as one in x where x is the number below
+$prob_dual=3;
+$prob_unpaid=10;
+
+
+$firstnames=array("James","Bob","Ali","Erin","Julia","Dave","Steve","Bryan","Jane","Elizabeth","Norm","Sue","Eric","Terry","Arthur","Angel","Allison","Jeremy","Jacqueline","Derek","Kristen","Greg","Cheryl","Debbie","Heather","Donald","Linda","George","Patrica","Carmel","Dawn","Scott","Brad","Bruce","Paul","Guillaume");
+
+$lastnames=array("Grant","Browning","Mehdi","Borque","Temple","Culhane","Sargent","Sing","Belanger","Desjardin","Jones","Smith","Brown","Johnson","Williams","White","Thompson","Baker");
+
+$domains=array("lightbox.org","microsoft.com","yahoo.com","msn.com","gmail.com","reach.net","slicer.ca","cwsf.ca"."sfiab.ca");
+
+$nouns=array("age","animal","arm","baby","ball","bat","bear","boat","camp","car","child","circle","city","cotton","design","dog","dress","duck","ear","egg","enemy");
+$starters=array("effects of","study of","analysis of");
+$joiners=array("on","combined with","broken apart by","burned with","attacked by","left alone with");
+
+for($x=0;$x<$numprojects;$x++)
+{
+ $id=0;
+ $regnum=rand(100000,999999);
+ $email=strtolower(getrand($firstnames)."@".getrand($domains));
+ $pd=rand(1,$prob_unpaid);
+ if($pd==1) $status='paymentpending'; else $status='complete';
+
+ $q=mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES ('$regnum','$email',NOW(),'$status',2005)");
+ if($id=mysql_insert_id())
+ {
+
+ $peeps=rand(1,$prob_dual);
+ if($peeps==1) $num=2; else $num=1;
+
+ $gradenum=rand(1,10);
+ if($gradenum<6) { $grade=rand(7,8); $cat=1;}
+ else if($gradenum<8) { $grade=rand(9,10); $cat=2; }
+ else if($gradenum<10) { $grade=rand(11,12); $cat=3; }
+ $schools_id=rand(1,2);
+
+ for($a=1;$a<=$num;$a++)
+ {
+ $sexnum=rand(1,3);
+ if($sexnum<3) $sex="male"; else $sex="female";
+
+ mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,grade,year,schools_id) VALUES ('$id','".getrand($firstnames)."','".getrand($lastnames)."','$sex','$grade',2005,'$schools_id')");
+
+ }
+
+ $div=rand(1,6);
+ $title=ucwords(getrand($starters)." ".getrand($nouns)." ".getrand($joiners)." ".getrand($nouns));
+
+ $req_enum=rand(1,4);
+ if($req_enum==1) $req_e="yes"; else $req_e="no";
+
+ $req_tnum=rand(1,30);
+ if($req_tnum==1) $req_t="no"; else $req_t="yes";
+
+
+ mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,projectdivisions_id,title,year,req_electricity,req_table) VALUES ('$id','$cat','$div','$title',2005,'$req_e','$req_t')");
+
+ }
+}
+
+?>
|