31 |
*/ |
*/ |
32 |
|
|
33 |
|
|
34 |
$sql_courrier="select * from instruction where instruction=".$idx; |
$sql_courrier="select * from ".DB_PREFIXE."instruction where instruction=".$idx; |
35 |
$res = $f->db->query($sql_courrier); |
$res = $f->db->query($sql_courrier); |
36 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
37 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
63 |
//$complement="<-Ici le complement->"; |
//$complement="<-Ici le complement->"; |
64 |
// ============================================================================================= |
// ============================================================================================= |
65 |
|
|
66 |
/* format a voir |
// format date courrier en francais |
67 |
if ($f->formatDate=="AAAA-MM-JJ"){ |
if ($f->formatdate=="AAAA-MM-JJ"){ |
68 |
$valTemp=explode("-",$datecourrier); |
$valTemp=explode("-",$datecourrier); |
69 |
$datecourrier = $valTemp[2]."/".$valTemp[1]."/".$valTemp[0]; |
$datecourrier = $valTemp[2]."/".$valTemp[1]."/".$valTemp[0]; |
70 |
} |
} |
71 |
*/ |
|
72 |
|
|
73 |
/** |
/** |
74 |
* acces table om_lettretype |
* acces table om_lettretype |
260 |
$temp = explode("[",$lettretype["corps"]); |
$temp = explode("[",$lettretype["corps"]); |
261 |
for($i=1;$i<sizeof($temp);$i++){ |
for($i=1;$i<sizeof($temp);$i++){ |
262 |
$temp1 = explode("]",$temp[$i]); |
$temp1 = explode("]",$temp[$i]); |
263 |
$corps=str_replace("[".$temp1[0]."]",$row[$temp1[0]],$corps); |
$corps=str_replace("[".$temp1[0]."]",$row[$temp1[0]],$corps); |
264 |
|
//18//11/2011 + |
265 |
|
$temp1[0]=""; |
266 |
|
//FIN + |
267 |
} |
} |
268 |
//************************************************ |
//18//11/2011++ |
269 |
// traitement attribut affichage <b> dans corps * |
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
270 |
// aout 2008 * |
$pdf->SetXY($lettretype["corpsleft"],$lettretype["corpstop"]); |
271 |
//************************************************ |
//FIN++ |
272 |
$pos=""; |
//18//11/2011 AJOUT \p |
273 |
$pos = strpos($corps, "<b>"); |
if (strstr($corps,'\p')){ |
274 |
if(CHARSET=='UTF8') |
$temp=""; |
275 |
$corps= utf8_decode($corps); |
$temp = explode("\p",$corps); |
276 |
if ($pos === false) { |
//////////////////////// |
277 |
// compatibilite :aucun attribut affichage dans corps |
// image en fond de page |
278 |
//*************************************************************************** |
if (file_exists("../trs/bg_".$obj."1.png")) { |
279 |
if(trim($corps)!="") { |
$pdf->Image("../trs/bg_".$obj."1.png", 0, 0, 210, 0, '', ''); |
280 |
$pdf->SetFont($lettretype["corpsfont"], |
} |
281 |
$lettretype["corpsattribut"], |
//////////////////////// |
282 |
$lettretype["corpstaille"]); |
//************************************************ |
283 |
$pdf->SetXY($lettretype["corpsleft"], |
//traitement attribut affichage <b> dans $temp[0]* |
284 |
$lettretype["corpstop"]); |
// aout 2008 * |
285 |
$pdf->MultiCell($lettretype["corpslargeur"], |
//************************************************ |
286 |
$lettretype["corpshauteur"] , |
$pos=""; |
287 |
$corps."vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv", |
$pos = strpos($temp[0], "<b>"); |
288 |
$lettretype["corpsbordure"], |
if ($pos === false) { |
289 |
$lettretype["corpsalign"], |
// compatibilite :aucun attribut affichage dans corps |
290 |
0); |
//*************************************************************************** |
291 |
} |
$pdf->MultiCell($lettretype["corpslargeur"],$lettretype["corpshauteur"],$temp[0],$lettretype["corpsbordure"],$lettretype["corpsalign"],0); |
292 |
//**************************************************************************** |
}else{ |
293 |
// attribut affichage <b> present dans corps |
$tmp=""; |
294 |
}else{ |
$tmp=explode('<b>', $temp[0]); |
295 |
$pdf->SetXY($lettretype["corpsleft"],$lettretype["corpstop"]); |
// |
296 |
$tmp=""; |
for($x=0;$x<sizeof($tmp);$x++){ |
297 |
$tmp=explode('<b>', $corps); |
$pos1=""; |
298 |
// |
$pos1 = strpos($tmp[$x], "</b>"); |
299 |
for($x=0;$x<sizeof($tmp);$x++){ |
// |
300 |
$pos1=""; |
if ($pos1 === false) { |
301 |
$pos1 = strpos($tmp[$x], "</b>"); |
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, |
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 |
// |
// |
442 |
if ($pos1 === false) { |
for($x=0;$x<sizeof($tmp);$x++){ |
443 |
if(trim($tmp[$x])!=""){ |
$pos1=""; |
444 |
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
$pos1 = strpos($tmp[$x], "</b>"); |
445 |
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
// |
446 |
} |
if ($pos1 === false) { |
|
}else{ |
|
|
$ctrl_fin_b=0; |
|
|
$ctrl_fin_b=substr_count($tmp[$x],"</b>"); |
|
|
$lettretype["corpsattribut"] = str_replace("B","",$lettretype["corpsattribut"]); |
|
|
$lettretype["corpsattribut"] = str_replace("b","",$lettretype["corpsattribut"]); |
|
|
if ($ctrl_fin_b>1){ |
|
|
// nbr </b> superieur a 1 |
|
447 |
if(trim($tmp[$x])!=""){ |
if(trim($tmp[$x])!=""){ |
448 |
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
449 |
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
450 |
} |
} |
451 |
}else{ |
}else{ |
452 |
$tmp1 = explode("</b>",$tmp[$x]); |
$ctrl_fin_b=0; |
453 |
// |
$ctrl_fin_b=substr_count($tmp[$x],"</b>"); |
454 |
if(trim($tmp1[0])!=""){ |
$lettretype["corpsattribut"] = str_replace("B","",$lettretype["corpsattribut"]); |
455 |
// |
$lettretype["corpsattribut"] = str_replace("b","",$lettretype["corpsattribut"]); |
456 |
$nbcar=0; |
if ($ctrl_fin_b>1){ |
457 |
$nbcar=$tmp1[0]; |
// nbr </b> superieur a 1 |
458 |
if( strlen($nbcar)==1) { |
if(trim($tmp[$x])!=""){ |
|
// ??????bug fpdf write si affichage 1 seul caractere -> ajout 2 blancs |
|
|
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
|
|
$pdf->write($lettretype["corpshauteur"]," ".$tmp1[0]." "); |
|
|
}else{ |
|
459 |
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
$pdf->SetFont($lettretype["corpsfont"],"B".$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
460 |
$pdf->write($lettretype["corpshauteur"],$tmp1[0]); |
$pdf->write($lettretype["corpshauteur"],$tmp[$x]); |
461 |
|
} |
462 |
|
}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 |
} |
} |
483 |
if(trim($tmp1[1])!=""){ |
// |
|
$pdf->SetFont($lettretype["corpsfont"],$lettretype["corpsattribut"],$lettretype["corpstaille"]); |
|
|
$pdf->write($lettretype["corpshauteur"],$tmp1[1]); |
|
|
} |
|
484 |
} |
} |
485 |
// |
} |
486 |
} |
} |
487 |
} |
} //18/11/2011 fin de 'pas de \p' |
|
} |
|
488 |
// fermeture pdf |
// fermeture pdf |
489 |
$pdf->Output(); |
$pdf->Output(); |
490 |
} |
} |