rapport_membre_ca.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?php
  2. define("LIBERATIONSWEB", 20091223);
  3. session_start();
  4. // ----------------------
  5. // Droit de l'utilisateur
  6. // ----------------------
  7. if ($_SESSION['gestion_site'] < 'Oui') {
  8. exit;
  9. }
  10. //Librairie de fonctions
  11. require_once(__DIR__ . '/vendor/autoload.php');
  12. require_once("lib/libconfig.inc.php");
  13. require_once("lib/libsession.inc.php");
  14. require_once("lib/libfonctions.inc.php");
  15. require_once("lib/libmysql.inc.php");
  16. require_once("lib/libencode.inc.php");
  17. require_once("lib/libcourriel.inc.php");
  18. require_once("lib/libliberations.inc.php");
  19. require_once("lib/libcentrale.inc.php");
  20. require_once('fpdf/fpdf.php');
  21. class PDF extends FPDF {
  22. var $Adresse1;
  23. var $Ville;
  24. var $CodePostal;
  25. var $NumeroTel;
  26. var $NomEmployeur;
  27. var $NomEmploye;
  28. var $Texte23;
  29. var $Texte24;
  30. var $configCentrale;
  31. function WordWrap(&$text, $maxwidth) {
  32. $text = trim($text);
  33. if ($text === '')
  34. return 0;
  35. $space = $this->GetStringWidth(' ');
  36. $lines = explode("\n", $text);
  37. $text = '';
  38. $count = 0;
  39. foreach ($lines as $line) {
  40. $words = preg_split('/ +/', $line);
  41. $width = 0;
  42. foreach ($words as $word) {
  43. $wordwidth = $this->GetStringWidth($word);
  44. if ($wordwidth > $maxwidth) {
  45. // Word is too long, we cut it
  46. for ($i = 0;
  47. $i < strlen($word);
  48. $i++) {
  49. $wordwidth = $this->GetStringWidth(substr($word, $i, 1));
  50. if ($width + $wordwidth <= $maxwidth) {
  51. $width += $wordwidth;
  52. $text .= substr($word, $i, 1);
  53. } else {
  54. $width = $wordwidth;
  55. $text = rtrim($text) . "\n" . substr($word, $i, 1);
  56. $count++;
  57. }
  58. }
  59. } elseif ($width + $wordwidth <= $maxwidth) {
  60. $width += $wordwidth + $space;
  61. $text .= $word . ' ';
  62. } else {
  63. $width = $wordwidth + $space;
  64. $text = rtrim($text) . "\n" . $word . ' ';
  65. $count++;
  66. }
  67. }
  68. $text = rtrim($text) . "\n";
  69. $count++;
  70. }
  71. $text = rtrim($text);
  72. return $count;
  73. }
  74. //Entête de page
  75. function Header() {
  76. $this->SetXY(25, 25);
  77. $this->SetFont('Times', '', 24);
  78. $etiquette22 = "Liste des membres du conseil d'administration";
  79. $this->Cell(160, 10, $etiquette22, 0, 0, 'L');
  80. $Image29 = 'logo/' . $_SESSION["syndicat"] . "." . $_SESSION['logo'];
  81. $this->Image($Image29, 190, 25, 51, 18);
  82. $this->SetXY(26, 47);
  83. $this->SetFont('Times', 'B', 10);
  84. $NomFamille_etiquette = "Membre";
  85. $this->Cell(38, 5, $NomFamille_etiquette, 0, 0, 'L');
  86. $this->SetXY(68, 47);
  87. $this->SetFont('Times', 'B', 10);
  88. $Adresse1_etiquette = "Adresse";
  89. $this->Cell(38, 5, $Adresse1_etiquette, 0, 0, 'L');
  90. $this->SetXY(110, 47);
  91. $this->SetFont('Times', 'B', 10);
  92. $Ville_etiquette = "Ville";
  93. $this->Cell(34, 5, $Ville_etiquette, 0, 0, 'L');
  94. $this->SetXY(149, 47);
  95. $this->SetFont('Times', 'B', 10);
  96. $CodePostal_etiquette = "Code p.";
  97. $this->Cell(13, 5, $CodePostal_etiquette, 0, 0, 'L');
  98. $this->SetXY(164, 47);
  99. $this->SetFont('Times', 'B', 10);
  100. $NumeroTel_etiquette = mb_convert_encoding("Téléphone", 'ISO-8859-1', 'UTF-8');
  101. $this->Cell(20, 5, $NumeroTel_etiquette, 0, 0, 'L');
  102. $this->SetXY(187, 47);
  103. $this->SetFont('Times', 'B', 10);
  104. $NomEmployeur_etiquette = "Employeur";
  105. $this->Cell(23, 5, $NomEmployeur_etiquette, 0, 0, 'L');
  106. $this->SetLineWidth(1);
  107. $this->Line(26, 53, 244, 53);
  108. $this->SetY(55);
  109. }
  110. //Pied de page
  111. function Footer() {
  112. //Numéro de page
  113. //Positionnement à 1,5 cm du bas
  114. //Police Arial italique 8
  115. $this->SetY(-10);
  116. $this->SetFont('Arial', 'I', 8);
  117. $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
  118. $this->SetLineWidth(0);
  119. $this->Line(26, 205, 244, 205);
  120. $etiquette43 = $this->configCentrale["syndicat_nom"];
  121. $etiquette45 = $this->configCentrale["adresse"] . ", " . $this->configCentrale["ville"] .
  122. " (" . $this->configCentrale["province"] . ") " . $this->configCentrale["codepostal"] .
  123. " Téléphone : " . str_replace(array("(", ")"), "", $this->configCentrale["telephone"]) .
  124. " Télécopieur : " . str_replace(array("(", ")"), "", $this->configCentrale["telecopieur"]);
  125. $this->SetXY(25, 201);
  126. $this->SetFont('Times', 'B', 9);
  127. $this->Cell(219, 4, mb_convert_encoding($etiquette43, 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
  128. $this->SetXY(25, 205);
  129. $this->SetFont('Times', 'B', 9);
  130. $this->Cell(219, 4, mb_convert_encoding($etiquette45, 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
  131. }
  132. }
  133. $i = 0;
  134. unset($sqlparam);
  135. $sqlparam["table"][] = "employes";
  136. $sqlparam["table"][] = "employeurs";
  137. $sqlparam["join"][] = "employes.refemployeur=employeurs.refemployeur";
  138. $sqlparam["champs"][] = "CONCAT(employes.nomfamille,' ',employes.prenom) as nomemploye";
  139. $sqlparam["champs"][] = "CONCAT(employes.adresse1, if(isnull(employes.adresse2),' ',"
  140. . "CONCAT(' ',employes.adresse2))) AS adresse";
  141. $sqlparam["champs"][] = "employes.ville";
  142. $sqlparam["champs"][] = "CONCAT(LEFT(employes.codepostal,3),\" \",RIGHT(employes.codepostal,3)) as codepost";
  143. $sqlparam["champs"][] = "employes.numtel";
  144. $sqlparam["champs"][] = "employeurs.nomemployeur";
  145. $sqlparam["ordre"][] = "CONCAT(employes.nomfamille, ' ', employes.prenom) ASC";
  146. $sqlparam["where"][] = "employes.membreca=-1";
  147. $result = executerRequeteSql($sqlparam);
  148. //Instanciation de la classe dérivée
  149. $pdf = new PDF('L', 'mm', 'Letter');
  150. $pdf->SetMargins(25, 25);
  151. $pdf->AliasNbPages();
  152. $pdf->SetFont('Times', '', 9);
  153. $pdf->AddPage();
  154. $pdf->configCentrale = buildConfigCentrale();
  155. foreach ($result as $clef => $champs) {
  156. $pdf->NomEmploye = mb_convert_encoding($champs["nomemploye"], 'ISO-8859-1', 'UTF-8');
  157. $pdf->Adresse = mb_convert_encoding($champs["adresse"], 'ISO-8859-1', 'UTF-8');
  158. $pdf->Ville = mb_convert_encoding($champs["ville"], 'ISO-8859-1', 'UTF-8');
  159. $pdf->CodePostal = mb_convert_encoding($champs["codepost"], 'ISO-8859-1', 'UTF-8');
  160. $removeChars = array("(", ")", "-", " ");
  161. $champs["numtel"] = str_replace($removeChars, "", $champs["numtel"]);
  162. $pdf->NumeroTel = formatPhone($champs["numtel"]);
  163. $pdf->NomEmployeur = mb_convert_encoding($champs["nomemployeur"], 'ISO-8859-1', 'UTF-8');
  164. $pdf->SetX(25);
  165. $pdf->SetFont('Times', '', 8);
  166. $pdf->Cell(38, 5, $pdf->NomEmploye, 0, 0, 'L');
  167. $pdf->SetX(68);
  168. $pdf->SetFont('Times', '', 8);
  169. $pdf->Cell(38, 4, $pdf->Adresse, 0, 0, 'L');
  170. $pdf->SetX(110);
  171. $pdf->SetFont('Times', '', 8);
  172. $pdf->Cell(34, 4, $pdf->Ville, 0, 0, 'L');
  173. $pdf->SetX(149);
  174. $pdf->SetFont('Times', '', 8);
  175. $pdf->Cell(13, 4, $pdf->CodePostal, 0, 0, 'L');
  176. $pdf->SetX(164);
  177. $pdf->SetFont('Times', '', 8);
  178. $pdf->Cell(20, 4, $pdf->NumeroTel, 0, 0, 'L');
  179. $pdf->SetX(187);
  180. $pdf->SetFont('Times', '', 8);
  181. $pdf->Cell(56, 4, $pdf->NomEmployeur, 0, 0, 'L');
  182. $pdf->Ln();
  183. }
  184. $pdf->Output();