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.
8 // And if you check in a change to either module, be sure to check
9 // in the other (identical) module also.
11 // This nonsense will go away if we ever move to subversion.
12 //////////////////////////////////////////////////////////////////////
14 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
16 // This program is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU General Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
21 include_once("../../globals.php");
22 include_once("$srcdir/api.inc");
23 include_once("$srcdir/forms.inc");
27 if (! $encounter) { // comes from globals.php
28 die("Internal error: we do not seem to be in an encounter!");
31 function rbvalue($rbname)
33 $tmp = $_POST[$rbname];
41 function rbinput($name, $value, $desc, $colname)
44 $ret = "<input type='radio' name='$name' value='$value'";
45 if ($row[$colname] == $value) {
53 $formid = $_GET['id'];
55 // If Save was clicked, save the info.
57 if ($_POST['bn_save']) {
58 // If updating an existing form...
61 $query = "UPDATE form_sports_fitness SET " .
62 "height_meters = '" . $_POST['form_height_meters'] . "', " .
63 "weight_kg = '" . $_POST['form_weight_kg'] . "', " .
64 "skin_folds_9x = '" . $_POST['form_skin_folds_9x'] . "', " .
65 "skin_folds_5x = '" . $_POST['form_skin_folds_5x'] . "', " .
66 "pct_body_fat = '" . $_POST['form_pct_body_fat'] . "', " .
67 "method_body_fat = " . rbvalue('form_method_body_fat') . ", " .
68 "pulse = '" . $_POST['form_pulse'] . "', " .
69 "bps = '" . $_POST['form_bps'] . "', " .
70 "bpd = '" . $_POST['form_bpd'] . "', " .
71 "beep_level = '" . $_POST['form_beep_level'] . "', " .
72 "beep_shuttles = '" . $_POST['form_beep_shuttles'] . "', " .
73 "beep_vo2_max = '" . $_POST['form_beep_vo2_max'] . "', " .
74 "vertical_jump_meters = '" . $_POST['form_vertical_jump_meters'] . "', " .
75 "agility_505 = '" . $_POST['form_agility_505'] . "', " .
76 "sit_and_reach_cm = '" . $_POST['form_sit_and_reach_cm'] . "', " .
77 "other = '" . $_POST['form_other'] . "' " .
78 "WHERE id = '$formid'";
80 } // If adding a new form...
83 $query = "INSERT INTO form_sports_fitness ( " .
84 "height_meters, weight_kg, skin_folds_9x, skin_folds_5x, " .
85 "pct_body_fat, method_body_fat, pulse, bps, bpd, " .
86 "beep_level, beep_shuttles, beep_vo2_max, " .
87 "vertical_jump_meters, agility_505, sit_and_reach_cm, other " .
89 "'" . $_POST['form_height_meters'] . "', " .
90 "'" . $_POST['form_weight_kg'] . "', " .
91 "'" . $_POST['form_skin_folds_9x'] . "', " .
92 "'" . $_POST['form_skin_folds_5x'] . "', " .
93 "'" . $_POST['form_pct_body_fat'] . "', " .
94 rbvalue('form_method_body_fat') . ", " .
95 "'" . $_POST['form_pulse'] . "', " .
96 "'" . $_POST['form_bps'] . "', " .
97 "'" . $_POST['form_bpd'] . "', " .
98 "'" . $_POST['form_beep_level'] . "', " .
99 "'" . $_POST['form_beep_shuttles'] . "', " .
100 "'" . $_POST['form_beep_vo2_max'] . "', " .
101 "'" . $_POST['form_vertical_jump_meters'] . "', " .
102 "'" . $_POST['form_agility_505'] . "', " .
103 "'" . $_POST['form_sit_and_reach_cm'] . "', " .
104 "'" . $_POST['form_other'] . "' " .
106 $newid = sqlInsert($query);
107 addForm($encounter, "Sports Fitness", $newid, "sports_fitness", $pid, $userauthorized);
110 formHeader("Redirecting....");
117 $row = sqlQuery("SELECT * FROM form_sports_fitness WHERE " .
118 "id = '$formid' AND activity = '1'") ;
123 <?php
html_header_show();?
>
124 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
125 <script language
="JavaScript">
129 <body
class="body_top">
130 <form method
="post" action
="<?php echo $rootdir ?>/forms/sports_fitness/new.php?id=<?php echo $formid ?>"
131 onsubmit
="return top.restoreSession()">
136 <table border
='1' width
='95%'>
138 <tr bgcolor
='#dddddd'>
139 <td colspan
='2' align
='center'><b
>Physical + Fitness Tests
</b
></td
>
143 <td nowrap
>Vitals
</td
>
147 <td width
='20%' nowrap
>
150 <td width
='13%' nowrap
>
151 <input type
='text' name
='form_height_meters' size
='6'
152 title
='Height in meters'
153 value
='<?php echo addslashes($row['height_meters
']) ?>' />  
;
155 <td width
='20%' nowrap
>
158 <td width
='13%' nowrap
>
159 <input type
='text' name
='form_weight_kg' size
='6'
160 title
='Weight in kilograms'
161 value
='<?php echo addslashes($row['weight_kg
']) ?>' />  
;
163 <td width
='20%' nowrap
>
175 <input type
='text' name
='form_pulse' size
='6'
176 title
='Resting pulse rate per minute'
177 value
='<?php echo addslashes($row['pulse
']) ?>' />  
;
183 <input type
='text' name
='form_bps' size
='6'
185 value
='<?php echo addslashes($row['bps
']) ?>' />  
;
191 <input type
='text' name
='form_bpd' size
='6'
193 value
='<?php echo addslashes($row['bps
']) ?>' />  
;
201 <td
>Body
<br
>Composition
</td
>
205 <td width
='20%' nowrap
>
208 <td width
='13%' nowrap
>
209 <input type
='text' name
='form_skin_folds_9x' size
='6'
210 title
='Total of 9 skin fold readings in cm'
211 value
='<?php echo addslashes($row['skin_folds_9x
']) ?>' />  
;
213 <td width
='20%' nowrap
>
216 <td width
='13%' nowrap
>
217 <input type
='text' name
='form_skin_folds_5x' size
='6'
218 title
='Total of 5 skin fold readings in cm'
219 value
='<?php echo addslashes($row['skin_folds_5x
']) ?>' />  
;
221 <td width
='20%' nowrap
>
225 <input type
='text' name
='form_pct_body_fat' size
='6'
226 title
='Percent body fat'
227 value
='<?php echo addslashes($row['pct_body_fat
']) ?>' />  
;
231 <td colspan
='6' nowrap
>
232 B
.F
. Method Used
: 
;
233 <?php
echo rbinput('form_method_body_fat', 'Caliper', 'Caliper', 'method_body_fat') ?
> 
;
234 <?php
echo rbinput('form_method_body_fat', 'Electronic', 'Electronic', 'method_body_fat') ?
> 
;
235 <?php
echo rbinput('form_method_body_fat', 'Hydrostatic', 'Hydrostatic', 'method_body_fat') ?
>
243 <td nowrap
>Beep Test
</td
>
247 <td width
='20%' nowrap
>
250 <td width
='13%' nowrap
>
251 <input type
='text' name
='form_beep_level' size
='6'
252 title
='Level Reached'
253 value
='<?php echo addslashes($row['beep_level
']) ?>' />  
;
255 <td width
='20%' nowrap
>
258 <td width
='13%' nowrap
>
259 <input type
='text' name
='form_beep_shuttles' size
='6'
260 title
='Number of shuttles at this level'
261 value
='<?php echo addslashes($row['beep_shuttles
']) ?>' />  
;
263 <td width
='20%' nowrap
>
267 <input type
='text' name
='form_beep_vo2_max' size
='6'
269 value
='<?php echo addslashes($row['beep_vo2_max
']) ?>' />  
;
277 <td nowrap
>Other Tests
</td
>
281 <td width
='20%' nowrap
>
284 <td width
='13%' nowrap
>
285 <input type
='text' name
='form_vertical_jump_meters' size
='6'
286 title
='Vertical Jump Test in Meters'
287 value
='<?php echo addslashes($row['vertical_jump_meters
']) ?>' />  
;
289 <td width
='20%' nowrap
>
292 <td width
='13%' nowrap
>
293 <input type
='text' name
='form_agility_505' size
='6'
294 title
='505 Agility Test in Seconds'
295 value
='<?php echo addslashes($row['agility_505
']) ?>' />  
;
297 <td width
='20%' nowrap
>
301 <input type
='text' name
='form_sit_and_reach_cm' size
='6'
302 title
='Sit and Reach Test in cm + or - ve'
303 value
='<?php echo addslashes($row['sit_and_reach_cm
']) ?>' />  
;
311 <td nowrap
>Still More
</td
>
313 <textarea name
='form_other' rows
='8' style
='width:100%'><?php
echo $row['other'] ?
></textarea
>
320 <input type
='submit' name
='bn_save' value
='Save' />
322 <input type
='button' value
='Cancel' onclick
="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
330 // TBD: If $alertmsg, display it with a JavaScript alert().