PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/export/imprimer.php

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