1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
| <?php
//require('fpdf/fpdf.php');
require("fpdf/phpToPDF.php");
require("inc/dbConnect.php");
//PAGE 1//
$sel="SELECT * FROM `article_to_newsletter` WHERE `id_newsletter` = 1 AND `id_cat` = 1";
$req=mysql_query($sel) or die($sel);
$assoc=mysql_fetch_assoc($req) or die($sel);
$sel="SELECT * FROM `news_articles` WHERE `id` = ".$assoc['id_article'];
$req=mysql_query($sel) or die($sel);
$edito=mysql_fetch_assoc($req) or die($sel);
$sel="SELECT * FROM `article_to_newsletter` WHERE `id_newsletter` = 1 AND `id_cat` = 2";
$req=mysql_query($sel) or die($sel);
$assoc=mysql_fetch_assoc($req) or die($sel);
$sel="SELECT * FROM `news_articles` WHERE `id` = ".$assoc['id_article'];
$req=mysql_query($sel) or die($sel);
$marche=mysql_fetch_assoc($req) or die($req);
//Définition des propriétés du tableau
$proprietesTableau = array(
'BRD_COLOR' => array(255,255,255),
'BRD_SIZE' => '0.3',
'TB_ALIGN' => 'L',
'L_MARGIN' => 0,
);
//Définition des propriétés du header du tableau
$proprieteHeader = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 12,
'T_FONT' => 'Arial',
'T_ALIGN_COL0' => 'L',
'T_ALIGN' => 'C',
'V_ALIGN' => 'T',
'T_TYPE' => 'B',
'LN_SIZE' => 7,
'BG_COLOR_COL0' => array(255,255,255),
'BG_COLOR' => array(255,255,255),
'BRD_COLOR' => array(255,255,255),
'BRD_SIZE' => 0.3,
'BRD_TYPE' => 1,
'BRD_TYPE_NEW_PAGE' => '',
);
$contenuHeader = array(
70,140,
$marche['libelle'],$edito['libelle'],
);
//Définition des propriétés du reste du tableau
$proprieteContenu = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 10,
'T_FONT' => 'Arial',
'T_ALIGN_COL0' => 'L',
'T_ALIGN' => 'R',
'V_ALIGN' => 'M',
'T_TYPE' => '',
'LN_SIZE' => 6,
'BG_COLOR_COL0' => array(255,255,255),
'BG_COLOR' => array(255,255,255),
'BRD_COLOR' => array(255,255,255),
'BRD_SIZE' => 0.1,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
//Contenu du tableau
$contenuTableau = array(
$marche['txt'],$edito['txt'],
);
//echo "TEST 1";
class PDF extends phpToPDF
{
//En-tête
function Header()
{
//Logo
$this->Image('images/globe.jpg',30,80,140);
//Police Arial gras 15
$this->SetFont('Arial','B',15);
//Décalage à droite
$this->Cell(80);
//Titre
//$this->Cell(30,10,'Titre',1,0,'C');
//Saut de ligne
$this->Ln(80);
}
//Pied de page
function Footer()
{
//Positionnement à 1,5 cm du bas
$this->SetY(-20);
//Police Arial italique 8
$this->SetFont('Arial','',6);
//Numéro de page
/*$this->MultiCell(190, 6 ,"FOOTER",0,'C');*/
}
}
$pdf = new PDF;
$pdf->AliasNbPages();
$pdf->Header();
$pdf->Footer();
$pdf->AddPage();
$pdf->Image('images/Tetiere.jpg',0,0,240);
$pdf->drawTableau($pdf, $proprietesTableau, $proprieteHeader, $contenuHeader, $proprieteContenu, $contenuTableau);
//Détermination d'un nom de fichier temporaire dans le répertoire courant
$file = basename(tempnam('.', 'tmp'));
rename($file, $file.'.pdf');
$file .= '.pdf';
//Sauvegarde du PDF dans le fichier
$pdf->Output($file, 'F');
header('Location: '.$file);
?> |
Partager