diff --git a/lpdf.php b/lpdf.php index ddecc30..2093e71 100644 --- a/lpdf.php +++ b/lpdf.php @@ -359,14 +359,22 @@ class lpdf function addTable($table,$align="center") { - $height['tableheader']=0.2; + if(is_array($table['header'])) + { + $table_cols=count($table['header']); + $height['tableheader']=0.2; + } + else + { + $table_cols=count($table['data']); + $height['tableheader']=0; + } $height['tabledata']=0.18; $this->yloc-=$height['tableheader']; $top_of_table=$this->yloc; $table_width=array_sum($table['widths']); - $table_cols=count($table['header']); $table_padding=0.03; switch($align) @@ -376,22 +384,21 @@ class lpdf case "right"; $xpos_of_table=$this->page_width-$this->page_margin-$table_width; break; } - //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); + //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); //do the header first - if($table['header']) + if(is_array($table['header'])) { - pdf_setfont($this->pdf,$this->headerfont,12); + //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); $xpos=$xpos_of_table; + pdf_setfont($this->pdf,$this->headerfont,12); for($c=0;$c<$table_cols;$c++) { @@ -416,7 +423,16 @@ class lpdf { $width=$table['widths'][$c]; - 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); + $notfit=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); + + //put a little "..." at the end of the field + if($notfit) + { + pdf_setfont($this->pdf,$this->normalfont,8); + pdf_show_boxed($this->pdf,"...",$this->loc($xpos+$width-0.10),$this->loc($this->yloc-0.05),$this->loc(0.10),$this->loc($height['tabledata']),$table['dataalign'][$c],null); + pdf_setfont($this->pdf,$this->normalfont,10); + } + $xpos+=$width; } diff --git a/register_participants.php b/register_participants.php index 0308785..a8dad41 100644 --- a/register_participants.php +++ b/register_participants.php @@ -70,7 +70,7 @@ } else { - send_header("Participant Registration"); + send_header("Participant Registration"); echo error(i18n("Invalid registration number (%1) for email address %2",array($_POST['regnum'],$_SESSION['email']))); $_POST['action']="login"; }