508 |
richard |
1 |
<?php
|
509 |
richard |
2 |
// ticket d'impression (thank's to Geoffroy MUSITELLI)
|
508 |
richard |
3 |
//--recupération des variables provenant du formulaire
|
913 |
richard |
4 |
$langue_imp=utf8_decode($_POST["langue_imp"]);
|
584 |
richard |
5 |
$log_imp=utf8_decode($_POST["log_imp"]);
|
|
|
6 |
$passwd_imp=utf8_decode($_POST["passwd_imp"]);
|
|
|
7 |
$exp_imp=utf8_decode($_POST["exp_imp"]);
|
|
|
8 |
$sto_imp=utf8_decode($_POST["sto_imp"]);
|
901 |
richard |
9 |
$mas_imp=utf8_decode($_POST["mas_imp"]);
|
584 |
richard |
10 |
$mds_imp=utf8_decode($_POST["mds_imp"]);
|
|
|
11 |
$mms_imp=utf8_decode($_POST["mms_imp"]);
|
508 |
richard |
12 |
//--initialisation des classes FPDF
|
913 |
richard |
13 |
//Langue du Ticket d'impression en fonction de la liste déroulante
|
|
|
14 |
switch ($langue_imp){
|
|
|
15 |
case 'fr':
|
|
|
16 |
$l_title_imp = "TICKET ACCÈS INTERNET";
|
|
|
17 |
$l_login_imp = "Utilisateur :";
|
|
|
18 |
$l_password_imp = "Mot de passe :";
|
|
|
19 |
$l_max_all_session_imp="Durée totale autoriséee :";
|
|
|
20 |
$l_session_timeout_imp="Durée d'une session :";
|
|
|
21 |
$l_max_daily_session_imp="Durée journalière :";
|
|
|
22 |
$l_max_monthly_session_imp ="Durée mensuelle :";
|
|
|
23 |
$l_expiration_imp="Date d'expiration :";
|
|
|
24 |
$v_illimit="Illimitée";
|
|
|
25 |
$v_without="Aucune";
|
|
|
26 |
break;
|
|
|
27 |
case 'de':
|
|
|
28 |
$l_title_imp = "GUTSCHEIN SPRACHE";
|
|
|
29 |
$l_login_imp = "Login :";
|
|
|
30 |
$l_password_imp = "Passwort :";
|
|
|
31 |
$l_max_all_session_imp="Maximale erlaubt Dauer :";
|
|
|
32 |
$l_session_timeout_imp="Dauer der Sitzung :";
|
|
|
33 |
$l_max_daily_session_imp="Stunden täglich :";
|
|
|
34 |
$l_max_monthly_session_imp ="monatlich Dauer :";
|
|
|
35 |
$l_expiration_imp="Verfallsdatum :";
|
|
|
36 |
$v_illimit="Unbegrentz";
|
|
|
37 |
$v_without="Ohne";
|
|
|
38 |
break;
|
|
|
39 |
case 'nl':
|
|
|
40 |
$l_title_imp = "ONTVANGST INTERNET";
|
|
|
41 |
$l_login_imp = "Gebruikers :";
|
|
|
42 |
$l_password_imp = "Wachtwoord :";
|
|
|
43 |
$l_max_all_session_imp="Maximun all session time :"; // a traduire
|
|
|
44 |
$l_session_timeout_imp="Sessieduur :";
|
|
|
45 |
$l_max_daily_session_imp="Dagelijkse uren :";
|
|
|
46 |
$l_max_monthly_session_imp ="Maandelijkse duur :";
|
|
|
47 |
$l_expiration_imp="Vervaldatum :";
|
|
|
48 |
$v_illimit="Onbeperkte";
|
|
|
49 |
$v_without="Ohne";
|
|
|
50 |
break;
|
|
|
51 |
case 'es':
|
|
|
52 |
$l_title_imp = "BONO INTERNET";
|
|
|
53 |
$l_login_imp = "Usuario :";
|
|
|
54 |
$l_password_imp = "Contraseña :";
|
|
|
55 |
$l_max_all_session_imp="Maximun all session time :"; // a traduire
|
|
|
56 |
$l_session_timeout_imp="Duraciôn de Sesiôn :";
|
|
|
57 |
$l_max_daily_session_imp="Horas diarias :";
|
|
|
58 |
$l_max_monthly_session_imp ="Duraciôn mensual :";
|
|
|
59 |
$l_expiration_imp="Fecha de caducidad :";
|
|
|
60 |
$v_illimit="Ilimitado";
|
|
|
61 |
$v_without="Sin";
|
|
|
62 |
break;
|
|
|
63 |
case 'it':
|
|
|
64 |
$l_title_imp = "RICEVIMENTO INTERNET";
|
|
|
65 |
$l_login_imp = "Utenti :";
|
|
|
66 |
$l_password_imp = "Password :";
|
|
|
67 |
$l_max_all_session_imp="Maximun all session time :"; // a traduire
|
|
|
68 |
$l_session_timeout_imp="Durata della sessione :";
|
|
|
69 |
$l_max_daily_session_imp="Ore giornaliere :";
|
|
|
70 |
$l_max_monthly_session_imp ="Durata mensile :";
|
|
|
71 |
$l_expiration_imp="Data di scadenza :";
|
|
|
72 |
$v_illimit="Illimitato";
|
|
|
73 |
$v_without="Senza";
|
|
|
74 |
break;
|
|
|
75 |
default:
|
|
|
76 |
$l_title_imp = "INTERNET VOUCHER";
|
|
|
77 |
$l_login_imp = "Login :";
|
|
|
78 |
$l_password_imp = "Password :";
|
|
|
79 |
$l_max_all_session_imp="Maximun all session time :";
|
|
|
80 |
$l_session_timeout_imp="Session timeout :";
|
|
|
81 |
$l_max_daily_session_imp="Max daily session :";
|
|
|
82 |
$l_max_monthly_session_imp ="Max monthly session :";
|
|
|
83 |
$l_expiration_imp="Expiration date :";
|
|
|
84 |
$v_illimit="Unlimited";
|
|
|
85 |
$v_without="Without";
|
|
|
86 |
break;
|
|
|
87 |
}
|
|
|
88 |
//echo "$langue_imp - $l_login_imp - $exp_imp - $l_title_imp";
|
|
|
89 |
//exit;
|
508 |
richard |
90 |
//création de la classe PDF pour faire l'entête et pieds de page
|
913 |
richard |
91 |
require('../../lib/fpdf17/fpdf.php');
|
508 |
richard |
92 |
class PDF extends FPDF
|
|
|
93 |
{
|
|
|
94 |
//Entête
|
|
|
95 |
function Header()
|
|
|
96 |
{
|
913 |
richard |
97 |
global $l_title_imp;
|
|
|
98 |
//Logo coordonnées x , y, largeur de l'image
|
|
|
99 |
$this->Image('../../../images/logo-alcasar.png',25,5,25);
|
508 |
richard |
100 |
//Police Arial gras 15
|
|
|
101 |
$this->SetFont('Arial','B',18);
|
|
|
102 |
//couleur de l'écriture en rouge
|
|
|
103 |
$this->SetTextColor(250,1,10);
|
|
|
104 |
//Titre largeur cellule x , hauteur y, texte, bordure 0 , Indique où déplace la prochaine position courante 0 droite, centré C
|
|
|
105 |
$this->Cell(190,10,$l_title_imp,0,0,'C');
|
|
|
106 |
//Saut de ligne
|
|
|
107 |
$this->Ln(25);
|
|
|
108 |
}
|
|
|
109 |
//Pied de page
|
|
|
110 |
function Footer()
|
|
|
111 |
{
|
|
|
112 |
//Positionnement à 1,5 cm du bas
|
|
|
113 |
$this->SetY(-15);
|
|
|
114 |
//Police Arial italique 8
|
|
|
115 |
$this->SetFont('Arial','I',8);
|
|
|
116 |
//Produit par est volontairement resté en français
|
|
|
117 |
$this->Cell(200,20,'Produit par : ALCASAR',0,0,'C');
|
|
|
118 |
}
|
|
|
119 |
//fonction rectangle
|
913 |
richard |
120 |
//Rectangle : x, y : coin supérieur gauche du rectangle.w, h : largeur et hauteur. r : rayon des coins arrondis.
|
|
|
121 |
//style : comme celui de Rect() : F, D (défaut), FD ou DF.
|
508 |
richard |
122 |
function RoundedRect($x, $y, $w, $h, $r, $style = '')
|
|
|
123 |
{
|
|
|
124 |
$k = $this->k;
|
|
|
125 |
$hp = $this->h;
|
|
|
126 |
if($style=='F')
|
|
|
127 |
$op='f';
|
|
|
128 |
elseif($style=='FD' or $style=='DF')
|
|
|
129 |
$op='B';
|
|
|
130 |
else
|
|
|
131 |
$op='S';
|
|
|
132 |
$MyArc = 4/3 * (sqrt(2) - 1);
|
|
|
133 |
$this->_out(sprintf('%.2F %.2F m',($x+$r)*$k,($hp-$y)*$k ));
|
|
|
134 |
$xc = $x+$w-$r ;
|
|
|
135 |
$yc = $y+$r;
|
|
|
136 |
$this->_out(sprintf('%.2F %.2F l', $xc*$k,($hp-$y)*$k ));
|
|
|
137 |
|
|
|
138 |
$this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
|
|
|
139 |
$xc = $x+$w-$r ;
|
|
|
140 |
$yc = $y+$h-$r;
|
|
|
141 |
$this->_out(sprintf('%.2F %.2F l',($x+$w)*$k,($hp-$yc)*$k));
|
|
|
142 |
$this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
|
|
|
143 |
$xc = $x+$r ;
|
|
|
144 |
$yc = $y+$h-$r;
|
|
|
145 |
$this->_out(sprintf('%.2F %.2F l',$xc*$k,($hp-($y+$h))*$k));
|
|
|
146 |
$this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
|
|
|
147 |
$xc = $x+$r ;
|
|
|
148 |
$yc = $y+$r;
|
|
|
149 |
$this->_out(sprintf('%.2F %.2F l',($x)*$k,($hp-$yc)*$k ));
|
|
|
150 |
$this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
|
|
|
151 |
$this->_out($op);
|
|
|
152 |
}
|
|
|
153 |
//fonction arc de cercle
|
|
|
154 |
function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
|
|
|
155 |
{
|
|
|
156 |
$h = $this->h;
|
|
|
157 |
$this->_out(sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $x1*$this->k, ($h-$y1)*$this->k,
|
|
|
158 |
$x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
|
|
|
159 |
}
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
//création du constructeur pdf avec fpdf : portrait P sinon paysage L, unite mm, page A4
|
|
|
163 |
$pdf = new PDF('L','mm','A5');
|
|
|
164 |
$pdf->AliasNbPages();
|
|
|
165 |
//creation de la page
|
|
|
166 |
$pdf->Addpage();
|
|
|
167 |
//Couleur du texte en noir
|
|
|
168 |
$pdf->SetTextColor(0);
|
|
|
169 |
|
|
|
170 |
//création du cadre arrondi qui entoure le ticket d'impression
|
|
|
171 |
//x, y : coin supérieur gauche du rectangle.w, h : largeur et hauteur. r : rayon des coins arrondis.
|
|
|
172 |
//style : comme celui de Rect() : F, D (défaut), FD ou DF.
|
|
|
173 |
$pdf->RoundedRect(40, 32, 130, 80, 3.5, 'D');
|
|
|
174 |
//création utilisateur et mot de passe coordonnées x , y hauteur et largeur , texte
|
|
|
175 |
$pdf->Ln(5);
|
|
|
176 |
$pdf->SetFont('Arial','',12);
|
|
|
177 |
$pdf->cell(50);
|
|
|
178 |
$pdf->Cell(45,10,$l_login_imp,0,0,'R');
|
|
|
179 |
$pdf->SetFont('Arial','B',12);
|
|
|
180 |
$pdf->Cell(45,10,$log_imp,0,1,'L');
|
|
|
181 |
$pdf->cell(50);
|
|
|
182 |
$pdf->SetFont('Arial','',12);
|
|
|
183 |
$pdf->Cell(45,10,$l_password_imp,0,0,'R');
|
|
|
184 |
$pdf->SetFont('Arial','B',12);
|
|
|
185 |
$pdf->Cell(45,10,$passwd_imp,0,1,'L');
|
|
|
186 |
//saut de ligne
|
|
|
187 |
$pdf->Ln(7);
|
|
|
188 |
//création des attributs utilisateurs coordonnées x , y hauteur et largeur , texte
|
901 |
richard |
189 |
$pdf->cell(50);
|
508 |
richard |
190 |
$pdf->SetFont('Arial','',12);
|
901 |
richard |
191 |
$pdf->Cell(45,10,$l_max_all_session_imp,0,0,'R');
|
|
|
192 |
$pdf->SetFont('Arial','B',12);
|
|
|
193 |
$pdf->Cell(45,10,$mas_imp,0,1,'L');
|
508 |
richard |
194 |
$pdf->cell(50);
|
901 |
richard |
195 |
$pdf->SetFont('Arial','',12);
|
508 |
richard |
196 |
$pdf->Cell(45,10,$l_session_timeout_imp,0,0,'R');
|
|
|
197 |
$pdf->SetFont('Arial','B',12);
|
|
|
198 |
$pdf->Cell(45,10,$sto_imp,0,1,'L');
|
|
|
199 |
$pdf->cell(50);
|
|
|
200 |
$pdf->SetFont('Arial','',12);
|
|
|
201 |
$pdf->Cell(45,10,$l_max_daily_session_imp,0,0,'R');
|
|
|
202 |
$pdf->SetFont('Arial','B',12);
|
|
|
203 |
$pdf->Cell(45,10,$mds_imp,0,1,'L');
|
901 |
richard |
204 |
//$pdf->SetFont('Arial','',12);
|
|
|
205 |
//$pdf->cell(50);
|
|
|
206 |
//$pdf->Cell(45,10,$l_max_monthly_session_imp,0,0,'R');
|
|
|
207 |
//$pdf->SetFont('Arial','B',12);
|
|
|
208 |
//$pdf->Cell(45,10,$mms_imp,0,1,'L');
|
508 |
richard |
209 |
$pdf->cell(50);
|
|
|
210 |
$pdf->SetFont('Arial','',12);
|
|
|
211 |
$pdf->Cell(45,10,$l_expiration_imp,0,0,'R');
|
|
|
212 |
$pdf->SetFont('Arial','B',12);
|
|
|
213 |
$pdf->Cell(45,10,$exp_imp,0,1,'L');
|
|
|
214 |
|
|
|
215 |
//renvoie au navigateur du document
|
913 |
richard |
216 |
$ticket_name="ticket_".$log_imp.".pdf";
|
|
|
217 |
$pdf->Output($ticket_name,'D');
|
508 |
richard |
218 |
|
|
|
219 |
?>
|