PageRenderTime 31ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/forms/sports_fitness/view.php

https://github.com/tmccormi/openemr
PHP | 334 lines | 284 code | 27 blank | 23 comment | 8 complexity | 074a1170a462813a73e55ef748483ae2 MD5 | raw file
  1. <?php
  2. //////////////////////////////////////////////////////////////////////
  3. // ------------------ DO NOT MODIFY VIEW.PHP !!! ---------------------
  4. // View.php is an exact duplicate of new.php. If you wish to make
  5. // any changes, then change new.php and either (recommended) make
  6. // view.php a symbolic link to new.php, or copy new.php to view.php.
  7. //
  8. // And if you check in a change to either module, be sure to check
  9. // in the other (identical) module also.
  10. //
  11. // This nonsense will go away if we ever move to subversion.
  12. //////////////////////////////////////////////////////////////////////
  13. // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
  14. //
  15. // This program is free software; you can redistribute it and/or
  16. // modify it under the terms of the GNU General Public License
  17. // as published by the Free Software Foundation; either version 2
  18. // of the License, or (at your option) any later version.
  19. include_once("../../globals.php");
  20. include_once("$srcdir/api.inc");
  21. include_once("$srcdir/forms.inc");
  22. $row = array();
  23. if (! $encounter) { // comes from globals.php
  24. die("Internal error: we do not seem to be in an encounter!");
  25. }
  26. function rbvalue($rbname)
  27. {
  28. $tmp = $_POST[$rbname];
  29. if (! $tmp) {
  30. return "NULL";
  31. }
  32. return "'$tmp'";
  33. }
  34. function rbinput($name, $value, $desc, $colname)
  35. {
  36. global $row;
  37. $ret = "<input type='radio' name='$name' value='$value'";
  38. if ($row[$colname] == $value) {
  39. $ret .= " checked";
  40. }
  41. $ret .= " />$desc";
  42. return $ret;
  43. }
  44. $formid = $_GET['id'];
  45. // If Save was clicked, save the info.
  46. //
  47. if ($_POST['bn_save']) {
  48. // If updating an existing form...
  49. //
  50. if ($formid) {
  51. $query = "UPDATE form_sports_fitness SET " .
  52. "height_meters = '" . $_POST['form_height_meters'] . "', " .
  53. "weight_kg = '" . $_POST['form_weight_kg'] . "', " .
  54. "skin_folds_9x = '" . $_POST['form_skin_folds_9x'] . "', " .
  55. "skin_folds_5x = '" . $_POST['form_skin_folds_5x'] . "', " .
  56. "pct_body_fat = '" . $_POST['form_pct_body_fat'] . "', " .
  57. "method_body_fat = " . rbvalue('form_method_body_fat') . ", " .
  58. "pulse = '" . $_POST['form_pulse'] . "', " .
  59. "bps = '" . $_POST['form_bps'] . "', " .
  60. "bpd = '" . $_POST['form_bpd'] . "', " .
  61. "beep_level = '" . $_POST['form_beep_level'] . "', " .
  62. "beep_shuttles = '" . $_POST['form_beep_shuttles'] . "', " .
  63. "beep_vo2_max = '" . $_POST['form_beep_vo2_max'] . "', " .
  64. "vertical_jump_meters = '" . $_POST['form_vertical_jump_meters'] . "', " .
  65. "agility_505 = '" . $_POST['form_agility_505'] . "', " .
  66. "sit_and_reach_cm = '" . $_POST['form_sit_and_reach_cm'] . "', " .
  67. "other = '" . $_POST['form_other'] . "' " .
  68. "WHERE id = '$formid'";
  69. sqlStatement($query);
  70. } // If adding a new form...
  71. //
  72. else {
  73. $query = "INSERT INTO form_sports_fitness ( " .
  74. "height_meters, weight_kg, skin_folds_9x, skin_folds_5x, " .
  75. "pct_body_fat, method_body_fat, pulse, bps, bpd, " .
  76. "beep_level, beep_shuttles, beep_vo2_max, " .
  77. "vertical_jump_meters, agility_505, sit_and_reach_cm, other " .
  78. ") VALUES ( " .
  79. "'" . $_POST['form_height_meters'] . "', " .
  80. "'" . $_POST['form_weight_kg'] . "', " .
  81. "'" . $_POST['form_skin_folds_9x'] . "', " .
  82. "'" . $_POST['form_skin_folds_5x'] . "', " .
  83. "'" . $_POST['form_pct_body_fat'] . "', " .
  84. rbvalue('form_method_body_fat') . ", " .
  85. "'" . $_POST['form_pulse'] . "', " .
  86. "'" . $_POST['form_bps'] . "', " .
  87. "'" . $_POST['form_bpd'] . "', " .
  88. "'" . $_POST['form_beep_level'] . "', " .
  89. "'" . $_POST['form_beep_shuttles'] . "', " .
  90. "'" . $_POST['form_beep_vo2_max'] . "', " .
  91. "'" . $_POST['form_vertical_jump_meters'] . "', " .
  92. "'" . $_POST['form_agility_505'] . "', " .
  93. "'" . $_POST['form_sit_and_reach_cm'] . "', " .
  94. "'" . $_POST['form_other'] . "' " .
  95. ")";
  96. $newid = sqlInsert($query);
  97. addForm($encounter, "Sports Fitness", $newid, "sports_fitness", $pid, $userauthorized);
  98. }
  99. formHeader("Redirecting....");
  100. formJump();
  101. formFooter();
  102. exit;
  103. }
  104. if ($formid) {
  105. $row = sqlQuery("SELECT * FROM form_sports_fitness WHERE " .
  106. "id = '$formid' AND activity = '1'") ;
  107. }
  108. ?>
  109. <html>
  110. <head>
  111. <?php html_header_show();?>
  112. <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
  113. <script language="JavaScript">
  114. </script>
  115. </head>
  116. <body class="body_top">
  117. <form method="post" action="<?php echo $rootdir ?>/forms/sports_fitness/new.php?id=<?php echo $formid ?>"
  118. onsubmit="return top.restoreSession()">
  119. <center>
  120. <p>
  121. <table border='1' width='95%'>
  122. <tr bgcolor='#dddddd'>
  123. <td colspan='2' align='center'><b>Physical + Fitness Tests</b></td>
  124. </tr>
  125. <tr>
  126. <td nowrap>Vitals</td>
  127. <td nowrap>
  128. <table width='100%'>
  129. <tr>
  130. <td width='20%' nowrap>
  131. Height (meters):
  132. </td>
  133. <td width='13%' nowrap>
  134. <input type='text' name='form_height_meters' size='6'
  135. title='Height in meters'
  136. value='<?php echo addslashes($row['height_meters']) ?>' /> &nbsp;
  137. </td>
  138. <td width='20%' nowrap>
  139. Weight (kg):
  140. </td>
  141. <td width='13%' nowrap>
  142. <input type='text' name='form_weight_kg' size='6'
  143. title='Weight in kilograms'
  144. value='<?php echo addslashes($row['weight_kg']) ?>' /> &nbsp;
  145. </td>
  146. <td width='20%' nowrap>
  147. &nbsp;
  148. </td>
  149. <td nowrap>
  150. &nbsp;
  151. </td>
  152. </tr>
  153. <tr>
  154. <td nowrap>
  155. Resting Pulse:
  156. </td>
  157. <td nowrap>
  158. <input type='text' name='form_pulse' size='6'
  159. title='Resting pulse rate per minute'
  160. value='<?php echo addslashes($row['pulse']) ?>' /> &nbsp;
  161. </td>
  162. <td nowrap>
  163. Systolic BP:
  164. </td>
  165. <td nowrap>
  166. <input type='text' name='form_bps' size='6'
  167. title='mm Hg'
  168. value='<?php echo addslashes($row['bps']) ?>' /> &nbsp;
  169. </td>
  170. <td nowrap>
  171. Dyastolic BP:
  172. </td>
  173. <td nowrap>
  174. <input type='text' name='form_bpd' size='6'
  175. title='mm Hg'
  176. value='<?php echo addslashes($row['bps']) ?>' /> &nbsp;
  177. </td>
  178. </tr>
  179. </table>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td>Body<br>Composition</td>
  184. <td nowrap>
  185. <table width='100%'>
  186. <tr>
  187. <td width='20%' nowrap>
  188. Skin Folds 9x:
  189. </td>
  190. <td width='13%' nowrap>
  191. <input type='text' name='form_skin_folds_9x' size='6'
  192. title='Total of 9 skin fold readings in cm'
  193. value='<?php echo addslashes($row['skin_folds_9x']) ?>' /> &nbsp;
  194. </td>
  195. <td width='20%' nowrap>
  196. Skin Folds 5x:
  197. </td>
  198. <td width='13%' nowrap>
  199. <input type='text' name='form_skin_folds_5x' size='6'
  200. title='Total of 5 skin fold readings in cm'
  201. value='<?php echo addslashes($row['skin_folds_5x']) ?>' /> &nbsp;
  202. </td>
  203. <td width='20%' nowrap>
  204. % Body Fat:
  205. </td>
  206. <td nowrap>
  207. <input type='text' name='form_pct_body_fat' size='6'
  208. title='Percent body fat'
  209. value='<?php echo addslashes($row['pct_body_fat']) ?>' /> &nbsp;
  210. </td>
  211. </tr>
  212. <tr>
  213. <td colspan='6' nowrap>
  214. B.F. Method Used:&nbsp;
  215. <?php echo rbinput('form_method_body_fat', 'Caliper', 'Caliper', 'method_body_fat') ?>&nbsp;
  216. <?php echo rbinput('form_method_body_fat', 'Electronic', 'Electronic', 'method_body_fat') ?>&nbsp;
  217. <?php echo rbinput('form_method_body_fat', 'Hydrostatic', 'Hydrostatic', 'method_body_fat') ?>
  218. </td>
  219. </tr>
  220. </table>
  221. </td>
  222. </tr>
  223. <tr>
  224. <td nowrap>Beep Test</td>
  225. <td nowrap>
  226. <table width='100%'>
  227. <tr>
  228. <td width='20%' nowrap>
  229. Level:
  230. </td>
  231. <td width='13%' nowrap>
  232. <input type='text' name='form_beep_level' size='6'
  233. title='Level Reached'
  234. value='<?php echo addslashes($row['beep_level']) ?>' /> &nbsp;
  235. </td>
  236. <td width='20%' nowrap>
  237. Shuttles:
  238. </td>
  239. <td width='13%' nowrap>
  240. <input type='text' name='form_beep_shuttles' size='6'
  241. title='Number of shuttles at this level'
  242. value='<?php echo addslashes($row['beep_shuttles']) ?>' /> &nbsp;
  243. </td>
  244. <td width='20%' nowrap>
  245. VO2 Max:
  246. </td>
  247. <td nowrap>
  248. <input type='text' name='form_beep_vo2_max' size='6'
  249. title='ml/kg/min'
  250. value='<?php echo addslashes($row['beep_vo2_max']) ?>' /> &nbsp;
  251. </td>
  252. </tr>
  253. </table>
  254. </td>
  255. </tr>
  256. <tr>
  257. <td nowrap>Other Tests</td>
  258. <td nowrap>
  259. <table width='100%'>
  260. <tr>
  261. <td width='20%' nowrap>
  262. Vertical Jump:
  263. </td>
  264. <td width='13%' nowrap>
  265. <input type='text' name='form_vertical_jump_meters' size='6'
  266. title='Vertical Jump Test in Meters'
  267. value='<?php echo addslashes($row['vertical_jump_meters']) ?>' /> &nbsp;
  268. </td>
  269. <td width='20%' nowrap>
  270. 505 Agility:
  271. </td>
  272. <td width='13%' nowrap>
  273. <input type='text' name='form_agility_505' size='6'
  274. title='505 Agility Test in Seconds'
  275. value='<?php echo addslashes($row['agility_505']) ?>' /> &nbsp;
  276. </td>
  277. <td width='20%' nowrap>
  278. Sit &amp; Reach:
  279. </td>
  280. <td nowrap>
  281. <input type='text' name='form_sit_and_reach_cm' size='6'
  282. title='Sit and Reach Test in cm + or - ve'
  283. value='<?php echo addslashes($row['sit_and_reach_cm']) ?>' /> &nbsp;
  284. </td>
  285. </tr>
  286. </table>
  287. </td>
  288. </tr>
  289. <tr>
  290. <td nowrap>Still More</td>
  291. <td nowrap>
  292. <textarea name='form_other' rows='8' style='width:100%'><?php echo $row['other'] ?></textarea>
  293. </td>
  294. </tr>
  295. </table>
  296. <p>
  297. <input type='submit' name='bn_save' value='Save' />
  298. &nbsp;
  299. <input type='button' value='Cancel' onclick="parent.closeTab(window.name, false)" />
  300. </p>
  301. </center>
  302. </form>
  303. <?php
  304. // TBD: If $alertmsg, display it with a JavaScript alert().
  305. ?>
  306. </body>
  307. </html>