PageRenderTime 55ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/export/imprimer.php

https://bitbucket.org/mw4rf/ajpsc-annuaire
PHP | 274 lines | 218 code | 31 blank | 25 comment | 27 complexity | 2896891bf003974a0543fadd97fc39af MD5 | raw file
  1. <?php
  2. session_start();
  3. include('../includes/config.inc.php');
  4. include('../includes/phrases.php');
  5. include('../includes/fonctions.inc.php');
  6. connexion();
  7. /*
  8. * Ce fichier s'appelle de maničre autonome, sans passer par index.php.
  9. * Les paramčtres sont:
  10. * - id => l'id de la fiche ŕ afficher pour imprimer. Si non défini: toutes les fiches.
  11. * - tri => "pr" pour trier par promo ou "nm" pour trier par nom. Si non défini: pas de tri.
  12. *
  13. */
  14. // Exportation 1 fiche
  15. if(isset($_GET['id']))
  16. {
  17. $voir_id = addslashes($_GET['id']);
  18. if(!is_numeric($voir_id)) die();
  19. $sql = "SELECT * FROM utilisateur WHERE id='$voir_id'";
  20. }
  21. // Exportation TOUTES les fiches
  22. elseif(isset($_GET["tout"]) and $_GET["tout"] == 1)
  23. {
  24. $sql = "SELECT * FROM utilisateur";
  25. if(isset($_GET['tri']))
  26. {
  27. $tri = $_GET['tri'];
  28. if($tri == "pr")
  29. $sql .= " ORDER BY promotion ASC;";
  30. elseif($tri == "nm")
  31. $sql .= " ORDER BY nom ASC;";
  32. else
  33. $sql .= ";";
  34. }
  35. }
  36. // Exportation résultat recherche
  37. elseif(isset($_SESSION["exportation_permission"]) and $_SESSION["exportation_permission"] == true)
  38. {
  39. $sql = $_SESSION["exportation_requete"];
  40. }
  41. // Si rien de ce qui précčde... par défaut => tout
  42. else
  43. {
  44. $sql = "SELECT * FROM utilisateur";
  45. }
  46. $req = mysql_query($sql) or die('Erreur');
  47. ?>
  48. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  49. <!--
  50. /*******************************************************************************
  51. ********************************************************************************
  52. ********** AJPSC Annuaire **********
  53. ********** Version <?php echo $_version; ?> **********
  54. ********** Copyright (c) 2006-<?php echo date("Y"); ?> Guillaume Florimond **********
  55. ********** www.ajpsc.com **********
  56. ********** www.valhalla.fr **********
  57. ********************************************************************************
  58. *******************************************************************************/
  59. -->
  60. <html>
  61. <head>
  62. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  63. <title>AJPSC.com::Annuaire</title>
  64. <meta name="author" content="Guillaume Florimond">
  65. <!-- JavaScript -->
  66. <!-- @GF -->
  67. <script src="../includes/js/scripts.js" type="text/javascript"></script>
  68. <!-- @Tierce-Partie : SweetTitles -->
  69. <script src="../includes/js/sweettitles/addEvent.js" type="text/javascript"></script>
  70. <script src="../includes/js/sweettitles/titles.js" type="text/javascript"></script>
  71. <!-- // JavaScript -->
  72. <!-- Style CSS -->
  73. <style type="text/css" media="screen,print">
  74. @import url("../themes/<?php echo obtenir_theme(); ?>/style.css");
  75. </style>
  76. </head>
  77. <body>
  78. <div id="imprimer">
  79. <?php
  80. // Debut WHILE
  81. while($data = mysql_fetch_assoc($req))
  82. {
  83. $afficher['nom'] = (stripslashes(formater_nom($data['nom'])));
  84. $afficher['prenom'] = (stripslashes(formater_nom($data['prenom'])));
  85. $afficher['promotion'] = (stripslashes($data['promotion']));
  86. $afficher['nationalite'] = (stripslashes($data['nationalite']));
  87. $afficher['naissance'] = (stripslashes($data['naissance']));
  88. $afficher['adresse'] = (stripslashes($data['adresse']));
  89. $afficher['email'] = (stripslashes($data['email']));
  90. $afficher['modif'] = formater_date($data['modif'],false);
  91. $afficher['q1'] = (stripslashes($data['q1']));
  92. $afficher['q2'] = (stripslashes($data['q2']));
  93. $afficher['q3'] = (stripslashes($data['q3']));
  94. $afficher['q4'] = (stripslashes($data['q4']));
  95. $afficher['q5'] = (stripslashes($data['q5']));
  96. $afficher['q6'] = (stripslashes($data['q6']));
  97. $afficher['q7'] = (stripslashes($data['q7']));
  98. /* Photo */
  99. $sql2 = "SELECT height,width FROM photo WHERE user_id='".$data['id']."'";
  100. $req2 = mysql_query($sql2) or die('Erreur');
  101. $data2 = mysql_fetch_assoc($req2);
  102. $imgW = $data2['width'];
  103. $imgH = $data2['height'];
  104. if($imgW == 0) $imgW = 1;
  105. // Resizing image to make a thumbnail
  106. $thumb_width = $_config['images_largeur_fiches'];
  107. $thumb_height = round($imgH / $imgW * $thumb_width);
  108. // Storage: DB / FS ?
  109. if($_config['photos_storage'] == "DB")
  110. $src = "../includes/photo.php?id=$voir_id";
  111. else
  112. $src = $_config['data_folder']."/photos/".$data2['user_id'].'.'.$data2['extension'];
  113. $photo = "<img height=\"$thumb_height\" width=\"$thumb_width\" src=\"$src\">";
  114. ?>
  115. <table width="80%" border="0" align="center" cellpadding="2" cellspacing="2" class="imprimer_reponse">
  116. <tr>
  117. <td>
  118. <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" class="reponse">
  119. <tr>
  120. <td>
  121. <table width="100%" border="0" align="left" cellpadding="2" cellspacing="2" class="reponse">
  122. <tr>
  123. <td class="plus-gros"><span class="petites-majuscules"><?php echo $afficher['nom']; ?></span>&nbsp;<?php echo $afficher['prenom']; ?></td>
  124. </tr>
  125. <tr>
  126. <td><?php dire("ne-vp") ?>
  127. &nbsp;<?php echo $afficher['nationalite']; ?>&nbsp;
  128. <?php dire("ne-le") ?>
  129. &nbsp;<?php echo convertir_date($afficher['naissance']); ?>
  130. </td>
  131. </tr>
  132. <tr>
  133. <td>
  134. <?php dire('c3'); ?>&nbsp;<?php echo abbr3($afficher['promotion'], promotion($afficher['promotion'])); ?>
  135. <br />
  136. <i><?php dire("modif"); echo " ".$afficher['modif']; ?></i>
  137. </td>
  138. </tr>
  139. </table>
  140. </td>
  141. <td style="text-align:right;"><?php echo $photo; ?></td>
  142. </tr>
  143. </table>
  144. </td>
  145. </tr>
  146. <tr>
  147. <td>&nbsp;</td>
  148. </tr><tr>
  149. <td><?php echo $afficher['adresse']; ?></td>
  150. </tr>
  151. <tr>
  152. <td>
  153. <?php echo $afficher['email']; ?>
  154. </td>
  155. </tr>
  156. <tr class="imprimer_orange">
  157. <td height="3">&nbsp;</td>
  158. </tr>
  159. <?php if($afficher['q1'] != "") { ?>
  160. <tr>
  161. <td class="imprimer_question"><?php dire("q1"); ?></td>
  162. </tr>
  163. <tr>
  164. <td><?php echo $afficher['q1']; ?></td>
  165. </tr>
  166. <tr>
  167. <td>&nbsp;</td>
  168. </tr>
  169. <?php } ?>
  170. <?php if($afficher['q2'] != "") { ?>
  171. <tr>
  172. <td class="imprimer_question"><?php dire("q2"); ?></td>
  173. </tr>
  174. <tr>
  175. <td><?php echo $afficher['q2']; ?></td>
  176. </tr>
  177. <tr>
  178. <td>&nbsp;</td>
  179. </tr>
  180. <?php } ?>
  181. <?php if($afficher['q3'] != "") { ?>
  182. <tr>
  183. <td class="imprimer_question"><?php dire("q3"); ?></td>
  184. </tr>
  185. <tr>
  186. <td><?php echo $afficher['q3']; ?></td>
  187. </tr>
  188. <tr>
  189. <td>&nbsp;</td>
  190. </tr>
  191. <?php } ?>
  192. <?php if($afficher['q4'] != "") { ?>
  193. <tr>
  194. <td class="imprimer_question"><?php dire("q4"); ?></td>
  195. </tr>
  196. <tr>
  197. <td><?php echo $afficher['q4']; ?></td>
  198. </tr>
  199. <tr>
  200. <td>&nbsp;</td>
  201. </tr>
  202. <?php } ?>
  203. <?php if($afficher['q5'] != "") { ?>
  204. <tr>
  205. <td class="imprimer_question"><?php dire("q5"); ?></td>
  206. </tr>
  207. <tr>
  208. <td><?php echo $afficher['q5']; ?></td>
  209. </tr>
  210. <tr>
  211. <td>&nbsp;</td>
  212. </tr>
  213. <?php } ?>
  214. <?php if($afficher['q6'] != "") { ?>
  215. <tr>
  216. <td class="imprimer_question"><?php dire("q6"); ?></td>
  217. </tr>
  218. <tr>
  219. <td><?php echo $afficher['q6']; ?></td>
  220. </tr>
  221. <tr>
  222. <td>&nbsp;</td>
  223. </tr>
  224. <?php } ?>
  225. <?php if($afficher['q7'] != "") { ?>
  226. <tr>
  227. <td class="imprimer_question"><?php dire("q7"); ?></td>
  228. </tr>
  229. <tr>
  230. <td><?php echo $afficher['q7']; ?></td>
  231. </tr>
  232. <?php } ?>
  233. </table>
  234. <?php if(!isset($_GET['id'])) { ?>
  235. <p class="imprimer_separateur">&nbsp;</p>
  236. <?php } ?>
  237. <?php
  238. // Fin WHILE
  239. }
  240. ?>
  241. </div>
  242. </body>
  243. </html>