diff --git a/admin/reports_emergencycontact.php b/admin/reports_emergencycontact.php index 5aac0d8..f39c778 100644 --- a/admin/reports_emergencycontact.php +++ b/admin/reports_emergencycontact.php @@ -73,19 +73,40 @@ $table=array(); - $table['header']=array(i18n("First Name"),i18n("Last Name"),i18n("Emerg First"),i18n("Emerg Last"), i18n("Relation"), i18n("Emerg Phone")); - $table['widths']=array( 1.25, 1.25, 1.25, 1.25, 1, 1.25); - $table['dataalign']=array("left","left","left","left","left","left"); + //if its a PDF we'll put each additional phone number on a new line, for CSV, we'll have a column for each + if($type=="pdf") + { + $table['header']=array(i18n("First Name"),i18n("Last Name"),i18n("Emerg First"),i18n("Emerg Last"), i18n("Relation"), i18n("Emerg Phone")); + $table['widths']=array( 1.25, 1.25, 1.25, 1.25, 1, 1.25); + $table['dataalign']=array("left","left","left","left","left","left"); + } + else if($type=="csv") + { + $table['header']=array(i18n("First Name"),i18n("Last Name"),i18n("Emerg First"),i18n("Emerg Last"), i18n("Relation"), i18n("Emerg Phone 1"),i18n("Emerg Phone 2"),i18n("Emerg Phone 3"),i18n("Emerg Phone 4")); + //.widths mean nothing for csv + $table['widths']=array( 1.25, 1.25, 1.25, 1.25, 1, 1.25,1.25,1.25,1.25); + $table['dataalign']=array("left","left","left","left","left","left","left","left","left"); + + } while($r=mysql_fetch_object($q)) { - $table['data'][]=array($r->firstname,$r->lastname,$r->emerg_firstname,$r->emerg_lastname,$r->relation,$r->phone1); - if($r->phone2) - $table['data'][]=array('','','','','',$r->phone2); - if($r->phone3) - $table['data'][]=array('','','','','',$r->phone3); - if($r->phone4) - $table['data'][]=array('','','','','',$r->phone4); + //put each phone number on a new line, if it exists + if($type=="pdf") + { + $table['data'][]=array($r->firstname,$r->lastname,$r->emerg_firstname,$r->emerg_lastname,$r->relation,$r->phone1); + if($r->phone2) + $table['data'][]=array('','','','','',$r->phone2); + if($r->phone3) + $table['data'][]=array('','','','','',$r->phone3); + if($r->phone4) + $table['data'][]=array('','','','','',$r->phone4); + } + //put all phone numbers on the same line, in their own columns + else if($type=="csv") + { + $table['data'][]=array($r->firstname,$r->lastname,$r->emerg_firstname,$r->emerg_lastname,$r->relation,$r->phone1,$r->phone2,$r->phone3,$r->phone4); + } }