forked from science-ation/science-ation
Make registration list sortable
Make links in summarytable header be white (something in pdf?)
This commit is contained in:
parent
43cf64ee89
commit
d3b1223e92
@ -28,6 +28,16 @@
|
|||||||
|
|
||||||
if($_GET['showstatus']) $wherestatus="AND status='".$_GET['showstatus']."' ";
|
if($_GET['showstatus']) $wherestatus="AND status='".$_GET['showstatus']."' ";
|
||||||
else $wherestatus="";
|
else $wherestatus="";
|
||||||
|
switch($_GET['sort'])
|
||||||
|
{
|
||||||
|
case 'status': $ORDERBY="registrations.status DESC, projects.title"; break;
|
||||||
|
case 'num': $ORDERBY="registrations.num"; break;
|
||||||
|
case 'title': $ORDERBY="projects.title, registrations.status DESC"; break;
|
||||||
|
case 'cat': $ORDERBY="projects.projectcategories_id, projects.title"; break;
|
||||||
|
case 'div': $ORDERBY="projects.projectdivisions_id, projects.title"; break;
|
||||||
|
default: $ORDERBY="registrations.status DESC, projects.title"; break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$q=mysql_query("SELECT registrations.id AS reg_id,
|
$q=mysql_query("SELECT registrations.id AS reg_id,
|
||||||
registrations.num AS reg_num,
|
registrations.num AS reg_num,
|
||||||
@ -43,18 +53,18 @@ else $wherestatus="";
|
|||||||
AND registrations.year='".$config['FAIRYEAR']."'
|
AND registrations.year='".$config['FAIRYEAR']."'
|
||||||
$wherestatus
|
$wherestatus
|
||||||
ORDER BY
|
ORDER BY
|
||||||
registrations.status DESC,
|
$ORDERBY
|
||||||
projects.title
|
|
||||||
");
|
");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
||||||
echo "<table class=\"summarytable\">";
|
echo "<table class=\"summarytable\">";
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<th>".i18n("Status")."</th>";
|
if($_GET['showstatus']) $stat="&showstatus=".$_GET['showstatus'];
|
||||||
echo "<th>".i18n("Reg Num")."</th>";
|
echo "<th><a href=\"registration_list.php?sort=status$stat\">".i18n("Status")."</a></th>";
|
||||||
echo "<th>".i18n("Project Title")."</th>";
|
echo "<th><a href=\"registration_list.php?sort=num$stat\">".i18n("Reg Num")."</a></th>";
|
||||||
echo "<th>".i18n("Age Category")."</th>";
|
echo "<th><a href=\"registration_list.php?sort=title$stat\">".i18n("Project Title")."</a></th>";
|
||||||
echo "<th>".i18n("Division")."</th>";
|
echo "<th><a href=\"registration_list.php?sort=cat$stat\">".i18n("Age Category")."</a></th>";
|
||||||
|
echo "<th><a href=\"registration_list.php?sort=div$stat\">".i18n("Division")."</a></th>";
|
||||||
echo "<th>".i18n("School(s)")."</th>";
|
echo "<th>".i18n("School(s)")."</th>";
|
||||||
echo "<th>".i18n("Student(s)")."</th>";
|
echo "<th>".i18n("Student(s)")."</th>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
53
lpdf.php
53
lpdf.php
@ -104,8 +104,6 @@ class lpdf
|
|||||||
if($table['data'])
|
if($table['data'])
|
||||||
{
|
{
|
||||||
pdf_setfont($this->pdf,$this->normalfont,10);
|
pdf_setfont($this->pdf,$this->normalfont,10);
|
||||||
|
|
||||||
|
|
||||||
foreach($table['data'] AS $dataline)
|
foreach($table['data'] AS $dataline)
|
||||||
{
|
{
|
||||||
$xpos=$xpos_of_table;
|
$xpos=$xpos_of_table;
|
||||||
@ -123,6 +121,57 @@ class lpdf
|
|||||||
pdf_stroke($this->pdf);
|
pdf_stroke($this->pdf);
|
||||||
|
|
||||||
$this->yloc-=$height['tabledata'];
|
$this->yloc-=$height['tabledata'];
|
||||||
|
if($this->yloc<1)
|
||||||
|
{
|
||||||
|
//now draw all the vertical lines
|
||||||
|
$xpos=$xpos_of_table;
|
||||||
|
for($c=0;$c<$table_cols;$c++)
|
||||||
|
{
|
||||||
|
$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']-.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']-.02));
|
||||||
|
pdf_stroke($this->pdf);
|
||||||
|
|
||||||
|
$this->newPage();
|
||||||
|
|
||||||
|
//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']));
|
||||||
|
pdf_lineto($this->pdf,$this->loc($xpos_of_table+$table_width),$this->loc($this->yloc+$height['tableheader']));
|
||||||
|
pdf_stroke($this->pdf);
|
||||||
|
|
||||||
|
//draw the top line of the table (below the table header)
|
||||||
|
pdf_moveto($this->pdf,$this->loc($xpos_of_table),$this->loc($this->yloc));
|
||||||
|
pdf_lineto($this->pdf,$this->loc($xpos_of_table+$table_width),$this->loc($this->yloc));
|
||||||
|
pdf_stroke($this->pdf);
|
||||||
|
|
||||||
|
//do the header first
|
||||||
|
if($table['header'])
|
||||||
|
{
|
||||||
|
pdf_setfont($this->pdf,$this->headerfont,12);
|
||||||
|
|
||||||
|
$xpos=$xpos_of_table;
|
||||||
|
|
||||||
|
for($c=0;$c<$table_cols;$c++)
|
||||||
|
{
|
||||||
|
$head=$table['header'][$c];
|
||||||
|
$width=$table['widths'][$c];
|
||||||
|
|
||||||
|
pdf_show_boxed($this->pdf,$head,$this->loc($xpos),$this->loc($this->yloc),$this->loc($width),$this->loc($height['tableheader']),"center",null);
|
||||||
|
$xpos+=$width;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->yloc-=$height['tableheader'];
|
||||||
|
}
|
||||||
|
pdf_setfont($this->pdf,$this->normalfont,10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user