Subversion Repositories ALCASAR

Rev

Rev 913 | Rev 922 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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