Work on FPDF replacement by TCPDF
This commit is contained in:
parent
43f0786afb
commit
e26bac8231
@ -35,7 +35,7 @@ $now = dol_now();
|
||||
$year=dol_print_date($now,'%Y');
|
||||
$month=dol_print_date($now,'%m');
|
||||
$day=dol_print_date($now,'%d');
|
||||
|
||||
$foruserid=GETPOST('foruserid');
|
||||
|
||||
$arrayofmembers=array();
|
||||
|
||||
@ -47,6 +47,7 @@ $sql.= " p.libelle as pays";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid";
|
||||
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||
if ($foruserid) $sql.=" AND d.rowid=".$foruserid;
|
||||
$sql.= " ORDER BY d.rowid ASC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -86,14 +87,29 @@ if ($result)
|
||||
$textfooter=make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray, $langs);
|
||||
$textright=make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray, $langs);
|
||||
|
||||
$arrayofmembers[]=array('textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
'id'=>$objp->rowid,
|
||||
'photo'=>$objp->photo);
|
||||
if ($foruserid)
|
||||
{
|
||||
for($j=0;$j<100;$j++)
|
||||
{
|
||||
$arrayofmembers[]=array('textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
'id'=>$objp->rowid,
|
||||
'photo'=>$objp->photo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$arrayofmembers[]=array('textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
'id'=>$objp->rowid,
|
||||
'photo'=>$objp->photo);
|
||||
}
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Build and output PDF
|
||||
|
||||
@ -148,9 +148,9 @@ class pdf_standard {
|
||||
|
||||
// Define photo
|
||||
$dir=$conf->adherent->dir_output;
|
||||
$file=get_exdir($idmember,2).$photomember;
|
||||
$file=get_exdir($idmember,2).'photos/'.$photomember;
|
||||
$photo=$dir.'/'.$file;
|
||||
if (! is_readable($photo)) $photo='';
|
||||
if (empty($photomember) || ! is_readable($photo)) $photo='';
|
||||
|
||||
// Define background image
|
||||
$backgroundimage='';
|
||||
@ -194,7 +194,7 @@ class pdf_standard {
|
||||
else
|
||||
{
|
||||
$pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
|
||||
$pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft));
|
||||
$pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
|
||||
}
|
||||
}
|
||||
else if ($textleft!='' && $textright!='') //
|
||||
@ -211,12 +211,12 @@ class pdf_standard {
|
||||
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20);
|
||||
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20);
|
||||
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
|
||||
$pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft));
|
||||
$pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
|
||||
$pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft));
|
||||
$pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
|
||||
$pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+3+$this->_Line_Height);
|
||||
$pdf->MultiCell(round($this->_Width/2)-2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
|
||||
}
|
||||
@ -277,16 +277,16 @@ class pdf_standard {
|
||||
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
|
||||
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
||||
if($j<=($x2-1)) {
|
||||
$pdf->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
|
||||
$pdf->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
|
||||
}
|
||||
}
|
||||
}
|
||||
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
|
||||
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
||||
if($j<=($y2-1)) {
|
||||
$pdf->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
|
||||
$pdf->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ if ( $resql=$db->query($sql) )
|
||||
if ($pagecount)
|
||||
{
|
||||
$file=$diroutputpdf.'/'.$filename.'.pdf';
|
||||
$pdf->Output($file);
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user