1 |
fraynaud |
88 |
<?php |
2 |
|
|
/** |
3 |
|
|
* |
4 |
|
|
* |
5 |
|
|
* @package openmairie_exemple |
6 |
|
|
* @version SVN : $Id: pdflettretype.php 278 2010-11-30 07:12:41Z fmichon $ |
7 |
|
|
*/ |
8 |
|
|
// fpdf ne traite pas UTF8 |
9 |
|
|
// donc il faut utiliser decode |
10 |
|
|
include ("../dyn/locales.inc.php"); |
11 |
|
|
require_once "../obj/utils.class.php"; |
12 |
|
|
$f = new utils("nohtml"); |
13 |
|
|
|
14 |
|
|
/** |
15 |
|
|
* |
16 |
|
|
*/ |
17 |
|
|
// Nom de l'objet metier |
18 |
|
|
(isset($_GET['obj']) ? $obj = $_GET['obj'] : $obj = ""); |
19 |
|
|
(isset($_GET['idx']) ? $idx = $_GET['idx'] : $idx = ""); |
20 |
|
|
|
21 |
|
|
/** |
22 |
|
|
* en utilisant une table courrier (par exemple) |
23 |
|
|
* on peut typer les courriers |
24 |
|
|
* par destinataire |
25 |
|
|
* suivant une date |
26 |
|
|
* avec un complement |
27 |
|
|
* voir openfoncier ou openpersonnalite |
28 |
|
|
* |
29 |
|
|
* cette table est desactivee dans l exemple |
30 |
|
|
* |
31 |
|
|
*/ |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
$sql_courrier="select * from instruction where instruction=".$idx; |
35 |
|
|
$res = $f->db->query($sql_courrier); |
36 |
|
|
$f->isDatabaseError($res); |
37 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
38 |
|
|
$obj=$row['lettretype']; |
39 |
|
|
//if(CHARSET=='UTF8'){ |
40 |
|
|
// $titre= utf8_decode($lettretype["titre"]); |
41 |
|
|
$destinataire=$row['destinataire']; // *** |
42 |
|
|
$datecourrier=$row['datecourrier']; |
43 |
|
|
$complement=$row['complement']; |
44 |
|
|
$complement2=$row['complement2']; |
45 |
|
|
$complement3=$row['complement3']; |
46 |
|
|
$complement4=$row['complement4']; |
47 |
|
|
$complement5=$row['complement5']; |
48 |
|
|
$complement6=$row['complement6']; |
49 |
|
|
$complement7=$row['complement7']; |
50 |
|
|
$complement8=$row['complement8']; |
51 |
|
|
$complement9=$row['complement9']; |
52 |
|
|
$complement10=$row['complement10']; |
53 |
|
|
$complement11=$row['complement11']; |
54 |
|
|
$complement12=$row['complement12']; |
55 |
|
|
$complement13=$row['complement13']; |
56 |
|
|
$complement14=$row['complement14']; |
57 |
|
|
$complement15=$row['complement15']; |
58 |
|
|
} |
59 |
|
|
|
60 |
|
|
// ligne a desactiver ========================================================================== |
61 |
|
|
//$destinataire =""; |
62 |
|
|
//$datecourrier=date('d/m/Y'); |
63 |
|
|
//$complement="<-Ici le complement->"; |
64 |
|
|
// ============================================================================================= |
65 |
|
|
|
66 |
|
|
/* format a voir |
67 |
|
|
if ($f->formatDate=="AAAA-MM-JJ"){ |
68 |
|
|
$valTemp=explode("-",$datecourrier); |
69 |
|
|
$datecourrier = $valTemp[2]."/".$valTemp[1]."/".$valTemp[0]; |
70 |
|
|
} |
71 |
|
|
*/ |
72 |
|
|
|
73 |
|
|
/** |
74 |
|
|
* acces table om_lettretype |
75 |
|
|
*/ |
76 |
|
|
$niveau=''; |
77 |
|
|
// requete SQL |
78 |
|
|
$sql= "select * from ".DB_PREFIXE."om_lettretype where id='".$obj."'"; // select obj |
79 |
|
|
$sql.= " and actif ='Oui'"; |
80 |
|
|
$sql.= " and om_collectivite ='".$_SESSION['collectivite']."'"; |
81 |
|
|
$res1 = $f->db->query($sql); |
82 |
|
|
$f->isDatabaseError($res1); |
83 |
|
|
if ($res1->numrows()==0){ |
84 |
|
|
$sql="select om_collectivite from ".DB_PREFIXE."om_collectivite where niveau ='2'"; |
85 |
|
|
$niveau=$f->db->getOne($sql); |
86 |
|
|
//$res1->free(); |
87 |
|
|
$sql= "select * from ".DB_PREFIXE."om_lettretype where id='".$obj."'"; // select obj |
88 |
|
|
$sql.= " and actif ='Oui'"; |
89 |
|
|
$sql.= " and om_collectivite ='".$niveau."'"; |
90 |
|
|
$res1 = $f->db->query($sql); |
91 |
|
|
$f->isDatabaseError($res1); |
92 |
|
|
} |
93 |
|
|
|
94 |
|
|
if ($res1->numrows()==0){ |
95 |
|
|
//$res1->free(); |
96 |
|
|
$sql= "select * from ".DB_PREFIXE."om_lettretype where id='".$obj."'"; // select obj |
97 |
|
|
$sql.= " and om_collectivite ='".$niveau."'"; |
98 |
|
|
$res1 = $f->db->query($sql); |
99 |
|
|
$f->isDatabaseError($res1); |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
set_time_limit(180); |
103 |
|
|
//require_once PATH_FPDF."fpdf.php"; |
104 |
|
|
require_once "../php/fpdf/fpdf.php"; // *** mettre le path FPDF |
105 |
|
|
$collectivite = $f->collectivite; // bug array vide |
106 |
|
|
|
107 |
|
|
|
108 |
|
|
class PDF extends FPDF { |
109 |
|
|
/** |
110 |
|
|
* Pied de page |
111 |
|
|
*/ |
112 |
|
|
function Footer() { |
113 |
|
|
// NUMERO DE PAGE |
114 |
|
|
//Positionnement à 1,5 cm du bas |
115 |
|
|
$this->SetY(-15); |
116 |
|
|
// Police Arial italique 8 |
117 |
|
|
$this->SetFont('Arial','I',8); |
118 |
|
|
// Numero de page |
119 |
|
|
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); |
120 |
|
|
} |
121 |
|
|
|
122 |
|
|
} |
123 |
|
|
|
124 |
|
|
|
125 |
|
|
// INSTANCE PDF ================================================ |
126 |
|
|
// orientation P= portrait L=paysage |
127 |
|
|
// unite mm (milimetre) |
128 |
|
|
// format A4 A3 |
129 |
|
|
// ============================================================= |
130 |
|
|
$unite="mm"; |
131 |
|
|
|
132 |
|
|
while ($lettretype =& $res1->fetchRow(DB_FETCHMODE_ASSOC)) { |
133 |
|
|
|
134 |
|
|
$pdf=new PDF($lettretype["orientation"],$unite,$lettretype["format"]); |
135 |
|
|
// methode fpdf calcul nombre de page |
136 |
|
|
$pdf->AliasNbPages(); |
137 |
|
|
// methode de creation de page |
138 |
|
|
$pdf->AddPage(); |
139 |
|
|
// police ====================================================== |
140 |
|
|
// setFont 0 = times, arial |
141 |
|
|
// 1 = I B ou '' |
142 |
|
|
// 2 = 8 .... |
143 |
|
|
// affichage image ============================================= |
144 |
|
|
// image 0 = nom |
145 |
|
|
// 1 = left |
146 |
|
|
// 2 = top |
147 |
|
|
// 3 = width 0=calcul auto |
148 |
|
|
// 4 = hauteur 0=calcul auto |
149 |
|
|
// 5 = type image rien=exetension du fichier |
150 |
|
|
// 6 = lien |
151 |
|
|
// setXY (left,top) ============================================= |
152 |
|
|
// affichage multicell ========================================== |
153 |
|
|
// multicell 0 = width =0 left->droite |
154 |
|
|
// 1 = hauteur de la cellule |
155 |
|
|
// 2 = texte |
156 |
|
|
// 3 = bordure (0 ou 1) |
157 |
|
|
// 4 = align (L C R J) |
158 |
|
|
// 5 = 0 fd transparent |
159 |
|
|
// 1 couleur (parametre à rajouter) |
160 |
|
|
// ============================================================== |
161 |
|
|
$pdf->Image($f->getPathFolderTrs().$lettretype["logo"], |
162 |
|
|
$lettretype["logoleft"], |
163 |
|
|
$lettretype["logotop"], |
164 |
|
|
0, |
165 |
|
|
0, |
166 |
|
|
'', |
167 |
|
|
''); |
168 |
|
|
// variables statiques |
169 |
|
|
$sql = $lettretype['om_sql']; |
170 |
|
|
$titre= $lettretype["titre"]; |
171 |
|
|
$corps= $lettretype["corps"]; |
172 |
|
|
|
173 |
|
|
|
174 |
|
|
// |
175 |
|
|
include("../dyn/varlettretypepdf.inc"); |
176 |
|
|
// |
177 |
|
|
$res = $f->db->query($sql); |
178 |
|
|
$f->isDatabaseError($res); |
179 |
|
|
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
180 |
|
|
// titre |
181 |
|
|
$temp = explode("[",$lettretype["titre"]); |
182 |
|
|
for($i=1;$i<sizeof($temp);$i++){ |
183 |
|
|
$temp1 = explode("]",$temp[$i]); |
184 |
|
|
$titre=str_replace("[".$temp1[0]."]",$row[$temp1[0]],$titre); |
185 |
|
|
} |
186 |
|
|
// |
187 |
|
|
//************************************************ |
188 |
|
|
// traitement attribut affichage <b> dans titre * |
189 |
|
|
// aout 2008 * |
190 |
|
|
//************************************************ |
191 |
|
|
$pos_t=""; |
192 |
|
|
$pos_t = strpos($titre, "<b>"); |
193 |
|
|
if(CHARSET=='UTF8') |
194 |
|
|
$titre= utf8_decode($titre); |
195 |
|
|
if ($pos_t === false) { |
196 |
|
|
// compatibilite :aucun attribut affichage <b> dans corps |
197 |
|
|
//*************************************************************************** |
198 |
|
|
if(trim($titre)!="") { |
199 |
|
|
$pdf->SetFont($lettretype["titrefont"], |
200 |
|
|
$lettretype["titreattribut"], |
201 |
|
|
$lettretype["titretaille"]); |
202 |
|
|
$pdf->SetXY($lettretype["titreleft"], |
203 |
|
|
$lettretype["titretop"]); |
204 |
|
|
$pdf->MultiCell($lettretype["titrelargeur"], |
205 |
|
|
$lettretype["titrehauteur"], |
206 |
|
|
$titre, |
207 |
|
|
$lettretype["titrebordure"], |
208 |
|
|
$lettretype["titrealign"], |
209 |
|
|
0); |
210 |
|
|
} |
211 |
|
|
//**************************************************************************** |
212 |
|
|
// attribut affichage <b> present dans titre |
213 |
|
|
}else{ |
214 |
|
|
$pdf->SetY($lettretype["titretop"]); |
215 |
|
|
$tmptitre=""; |
216 |
|
|
$tmptitre=explode('<b>', $titre); |
217 |
|
|
// |
218 |
|
|
for($y=0;$y<sizeof($tmptitre);$y++){ |
219 |
|
|
$pos1=""; |
220 |
|
|
$pos1 = strpos($tmptitre[$y], "</b>"); |
221 |
|
|
// |
222 |
|
|
if ($pos1 === false) { |
223 |
|
|
if(trim($tmptitre[$y])!="") { |
224 |
|
|
$pdf->SetFont($lettretype["titrefont"],$lettretype["titreattribut"],$lettretype["titretaille"]); |
225 |
|
|
$pdf->SetX($lettretype["titreleft"]); |
226 |
|
|
$pdf->MultiCell($lettretype["titrelargeur"],$lettretype["titrehauteur"],$tmptitre[$y],$lettretype["titrebordure"],$lettretype["titrealign"],0); |
227 |
|
|
} |
228 |
|
|
}else{ |
229 |
|
|
$ctrl_fin_b=0; |
230 |
|
|
$ctrl_fin_b=substr_count($tmptitre[$y],"</b>"); |
231 |
|
|
$lettretype["titreattribut"] = str_replace("B","",$lettretype["titreattribut"]); |
232 |
|
|
$lettretype["titreattribut"] = str_replace("b","",$lettretype["titreattribut"]); |
233 |
|
|
if ($ctrl_fin_b>1){ |
234 |
|
|
// nbr </b> superieur a 1 |
235 |
|
|
if(trim($tmptitre[$y])!="") { |
236 |
|
|
$pdf->SetFont($lettretype["titrefont"],"B".$lettretype["titreattribut"],$lettretype["titretaille"]); |
237 |
|
|
$pdf->SetX($lettretype["titreleft"]); |
238 |
|
|
$pdf->MultiCell($lettretype["titrelargeur"],$lettretype["titrehauteur"],$tmptitre[$y],$lettretype["titrebordure"],$lettretype["titrealign"],0); |
239 |
|
|
} |
240 |
|
|
}else{ |
241 |
|
|
$tmptitre1 = explode("</b>",$tmptitre[$y]); |
242 |
|
|
// |
243 |
|
|
if(trim($tmptitre1[0])!="") { |
244 |
|
|
$pdf->SetFont($lettretype["titrefont"],"B".$lettretype["titreattribut"],$lettretype["titretaille"]); |
245 |
|
|
$pdf->SetX($lettretype["titreleft"]); |
246 |
|
|
$pdf->MultiCell($lettretype["titrelargeur"],$lettretype["titrehauteur"],$tmptitre1[0],$lettretype["titrebordure"],$lettretype["titrealign"],0); |
247 |
|
|
} |
248 |
|
|
if(trim($tmptitre1[1])!=""){ |
249 |
|
|
$pdf->SetFont($lettretype["titrefont"],$lettretype["titreattribut"],$lettretype["titretaille"]); |
250 |
|
|
$pdf->SetX($lettretype["titreleft"]); |
251 |
|
|
$pdf->MultiCell($lettretype["titrelargeur"],$lettretype["titrehauteur"],$tmptitre1[1],$lettretype["titrebordure"],$lettretype["titrealign"],0); |
252 |
|
|
} |
253 |
|
|
} |
254 |
|
|
// |
255 |
|
|
} |
256 |
|
|
} |
257 |
|
|
} |
258 |
|
|
// corps |
259 |
|
|
|
260 |
|
|
$temp = explode("[",$lettretype["corps"]); |
261 |
|
|
for($i=1;$i<sizeof($temp);$i++){ |
262 |
|
|
$temp1 = explode("]",$temp[$i]); |
263 |
jbastide |
210 |
$corps=str_replace("[".$temp1[0]."]",$row[$temp1[0]],$corps); |
264 |
|
|
//18//11/2011 + |
265 |
|
|
$temp1[0]=""; |
266 |
|
|
//FIN + |
267 |
fraynaud |
88 |
} |
268 |
jbastide |
210 |
//18//11/2011++ |
269 |
|
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
270 |
|
|
$pdf->SetXY($lettretype["corpsleft"],$lettretype["corpstop"]); |
271 |
|
|
//FIN++ |
272 |
|
|
//18//11/2011 AJOUT \p |
273 |
|
|
if (strstr($corps,'\p')){ |
274 |
|
|
$temp=""; |
275 |
|
|
$temp = explode("\p",$corps); |
276 |
|
|
//////////////////////// |
277 |
|
|
// image en fond de page |
278 |
|
|
if (file_exists("../trs/bg_".$obj."1.png")) { |
279 |
|
|
$pdf->Image("../trs/bg_".$obj."1.png", 0, 0, 210, 0, '', ''); |
280 |
|
|
} |
281 |
|
|
//////////////////////// |
282 |
|
|
//************************************************ |
283 |
|
|
//traitement attribut affichage <b> dans $temp[0]* |
284 |
|
|
// aout 2008 * |
285 |
|
|
//************************************************ |
286 |
|
|
$pos=""; |
287 |
|
|
$pos = strpos($temp[0], "<b>"); |
288 |
|
|
if ($pos === false) { |
289 |
|
|
// compatibilite :aucun attribut affichage dans corps |
290 |
|
|
//*************************************************************************** |
291 |
|
|
$pdf->MultiCell($lettretype["corpslargeur"],$lettretype["corpshauteur"],$temp[0],$lettretype["corpsbordure"],$lettretype["corpsalign"],0); |
292 |
|
|
}else{ |
293 |
|
|
$tmp=""; |
294 |
|
|
$tmp=explode('<b>', $temp[0]); |
295 |
|
|
// |
296 |
|
|
for($x=0;$x<sizeof($tmp);$x++){ |
297 |
|
|
$pos1=""; |
298 |
|
|
$pos1 = strpos($tmp[$x], "</b>"); |
299 |
|
|
// |
300 |
|
|
if ($pos1 === false) { |
301 |
|
|
if(trim($tmp[$x])!=""){ |
302 |
|
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
303 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
304 |
|
|
} |
305 |
|
|
}else{ |
306 |
|
|
$ctrl_fin_b=0; |
307 |
|
|
$ctrl_fin_b=substr_count($tmp[$x],"</b>"); |
308 |
|
|
$lettretype["corpsattribut"] = str_replace("B","",$lettretype["corpsattribut"]); |
309 |
|
|
$lettretype["corpsattribut"] = str_replace("b","",$lettretype["corpsattribut"]); |
310 |
|
|
if ($ctrl_fin_b>1){ |
311 |
|
|
// nbr </b> superieur a 1 |
312 |
|
|
if(trim($tmp[$x])!=""){ |
313 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
314 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
315 |
|
|
} |
316 |
|
|
}else{ |
317 |
|
|
$tmp1 = explode("</b>",$tmp[$x]); |
318 |
|
|
// |
319 |
|
|
if(trim($tmp1[0])!=""){ |
320 |
|
|
// |
321 |
|
|
$nbcar=0; |
322 |
|
|
$nbcar=$tmp1[0]; |
323 |
|
|
if( strlen($nbcar)==1) { |
324 |
|
|
// ??????bug fpdf write si affichage 1 seul caractere -> ajout 2 blancs |
325 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
326 |
|
|
$pdf->write($lettretype["corpshauteur"]," ".$tmp1[0]." "); |
327 |
|
|
}else{ |
328 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
329 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp1[0]); |
330 |
|
|
} |
331 |
|
|
} |
332 |
|
|
if(trim($tmp1[1])!=""){ |
333 |
|
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
334 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp1[1]); |
335 |
|
|
} |
336 |
|
|
} |
337 |
|
|
// |
338 |
|
|
} |
339 |
|
|
} |
340 |
|
|
} |
341 |
|
|
for($i=1;$i<sizeof($temp);$i++){ |
342 |
|
|
$pdf->AddPage(); |
343 |
|
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
344 |
|
|
$pdf->SetXY($lettretype["corpsleft"],$lettretype["titretop"]); |
345 |
|
|
//////////////////////// |
346 |
|
|
// image en fond de page |
347 |
|
|
if (file_exists("../trs/bg_".$obj.($i+1).".png")) { |
348 |
|
|
$pdf->Image("../trs/bg_".$obj.($i+1).".png", 0, 0, 210, 0, '', ''); |
349 |
|
|
} |
350 |
|
|
//************************************************ |
351 |
|
|
//traitement attribut affichage <b> dans $temp[$i]* |
352 |
|
|
// aout 2008 * |
353 |
|
|
//************************************************ |
354 |
|
|
$pos=""; |
355 |
|
|
$pos = strpos($temp[$i], "<b>"); |
356 |
|
|
if ($pos === false) { |
357 |
|
|
// compatibilite :aucun attribut affichage dans corps |
358 |
|
|
//*************************************************************************** |
359 |
|
|
$pdf->MultiCell($lettretype["corpslargeur"],$lettretype["corpshauteur"],$temp[$i],$lettretype["corpsbordure"],$lettretype["corpsalign"],0); |
360 |
|
|
}else{ |
361 |
|
|
$tmp=""; |
362 |
|
|
$tmp=explode('<b>', $temp[$i]); |
363 |
|
|
// |
364 |
|
|
for($x=0;$x<sizeof($tmp);$x++){ |
365 |
|
|
$pos1=""; |
366 |
|
|
$pos1 = strpos($tmp[$x], "</b>"); |
367 |
|
|
// |
368 |
|
|
if ($pos1 === false) { |
369 |
|
|
if(trim($tmp[$x])!=""){ |
370 |
|
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
371 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
372 |
|
|
} |
373 |
|
|
}else{ |
374 |
|
|
$ctrl_fin_b=0; |
375 |
|
|
$ctrl_fin_b=substr_count($tmp[$x],"</b>"); |
376 |
|
|
$lettretype["corpsattribut"] = str_replace("B","",$lettretype["corpsattribut"]); |
377 |
|
|
$lettretype["corpsattribut"] = str_replace("b","",$lettretype["corpsattribut"]); |
378 |
|
|
if ($ctrl_fin_b>1){ |
379 |
|
|
// nbr </b> superieur a 1 |
380 |
|
|
if(trim($tmp[$x])!=""){ |
381 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
382 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
383 |
|
|
} |
384 |
|
|
}else{ |
385 |
|
|
$tmp1 = explode("</b>",$tmp[$x]); |
386 |
|
|
// |
387 |
|
|
if(trim($tmp1[0])!=""){ |
388 |
|
|
// |
389 |
|
|
$nbcar=0; |
390 |
|
|
$nbcar=$tmp1[0]; |
391 |
|
|
if( strlen($nbcar)==1) { |
392 |
|
|
// ??????bug fpdf write si affichage 1 seul caractere -> ajout 2 blancs |
393 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
394 |
|
|
$pdf->write($lettretype["corpshauteur"]," ".$tmp1[0]." "); |
395 |
|
|
}else{ |
396 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
397 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp1[0]); |
398 |
|
|
} |
399 |
|
|
} |
400 |
|
|
if(trim($tmp1[1])!=""){ |
401 |
|
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
402 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp1[1]); |
403 |
|
|
} |
404 |
|
|
} |
405 |
|
|
// |
406 |
|
|
} |
407 |
|
|
} |
408 |
|
|
} |
409 |
|
|
} |
410 |
|
|
}else{ //18/11/2011 fin ajout \p |
411 |
|
|
//************************************************ |
412 |
|
|
// traitement attribut affichage <b> dans corps * |
413 |
|
|
// aout 2008 * |
414 |
|
|
//************************************************ |
415 |
|
|
$pos=""; |
416 |
|
|
$pos = strpos($corps, "<b>"); |
417 |
|
|
if(CHARSET=='UTF8') |
418 |
|
|
$corps= utf8_decode($corps); |
419 |
|
|
if ($pos === false) { |
420 |
|
|
// compatibilite :aucun attribut affichage dans corps |
421 |
|
|
//*************************************************************************** |
422 |
|
|
if(trim($corps)!="") { |
423 |
|
|
$pdf->SetFont($lettretype["corpsfont"], |
424 |
|
|
$lettretype["corpsattribut"], |
425 |
|
|
$lettretype["corpstaille"]); |
426 |
|
|
$pdf->SetXY($lettretype["corpsleft"], |
427 |
|
|
$lettretype["corpstop"]); |
428 |
|
|
$pdf->MultiCell($lettretype["corpslargeur"], |
429 |
|
|
$lettretype["corpshauteur"] , |
430 |
|
|
$corps."vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv", |
431 |
|
|
$lettretype["corpsbordure"], |
432 |
|
|
$lettretype["corpsalign"], |
433 |
|
|
0); |
434 |
|
|
} |
435 |
|
|
//**************************************************************************** |
436 |
|
|
// attribut affichage <b> present dans corps |
437 |
|
|
}else{ |
438 |
|
|
$pdf->SetXY($lettretype["corpsleft"],$lettretype["corpstop"]); |
439 |
|
|
$tmp=""; |
440 |
|
|
$tmp=explode('<b>', $corps); |
441 |
fraynaud |
88 |
// |
442 |
jbastide |
210 |
for($x=0;$x<sizeof($tmp);$x++){ |
443 |
|
|
$pos1=""; |
444 |
|
|
$pos1 = strpos($tmp[$x], "</b>"); |
445 |
|
|
// |
446 |
|
|
if ($pos1 === false) { |
447 |
fraynaud |
88 |
if(trim($tmp[$x])!=""){ |
448 |
jbastide |
210 |
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
449 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
450 |
fraynaud |
88 |
} |
451 |
|
|
}else{ |
452 |
jbastide |
210 |
$ctrl_fin_b=0; |
453 |
|
|
$ctrl_fin_b=substr_count($tmp[$x],"</b>"); |
454 |
|
|
$lettretype["corpsattribut"] = str_replace("B","",$lettretype["corpsattribut"]); |
455 |
|
|
$lettretype["corpsattribut"] = str_replace("b","",$lettretype["corpsattribut"]); |
456 |
|
|
if ($ctrl_fin_b>1){ |
457 |
|
|
// nbr </b> superieur a 1 |
458 |
|
|
if(trim($tmp[$x])!=""){ |
459 |
fraynaud |
88 |
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
460 |
jbastide |
210 |
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
461 |
fraynaud |
88 |
} |
462 |
jbastide |
210 |
}else{ |
463 |
|
|
$tmp1 = explode("</b>",$tmp[$x]); |
464 |
|
|
// |
465 |
|
|
if(trim($tmp1[0])!=""){ |
466 |
|
|
// |
467 |
|
|
$nbcar=0; |
468 |
|
|
$nbcar=$tmp1[0]; |
469 |
|
|
if( strlen($nbcar)==1) { |
470 |
|
|
// ??????bug fpdf write si affichage 1 seul caractere -> ajout 2 blancs |
471 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
472 |
|
|
$pdf->write($lettretype["corpshauteur"]," ".$tmp1[0]." "); |
473 |
|
|
}else{ |
474 |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
475 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp1[0]); |
476 |
|
|
} |
477 |
|
|
} |
478 |
|
|
if(trim($tmp1[1])!=""){ |
479 |
|
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
480 |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp1[1]); |
481 |
|
|
} |
482 |
fraynaud |
88 |
} |
483 |
jbastide |
210 |
// |
484 |
fraynaud |
88 |
} |
485 |
jbastide |
210 |
} |
486 |
|
|
} |
487 |
|
|
} //18/11/2011 fin de 'pas de \p' |
488 |
fraynaud |
88 |
// fermeture pdf |
489 |
|
|
$pdf->Output(); |
490 |
|
|
} |
491 |
|
|
} |
492 |
|
|
?> |