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) {
32 $tmp = $_POST[$rbname];
33 if (! $tmp) return "NULL";
37 function rbinput($name, $value, $desc, $colname) {
39 $ret = "<input type='radio' name='$name' value='$value'";
40 if ($row[$colname] == $value) $ret .= " checked";
45 $formid = $_GET['id'];
47 // If Save was clicked, save the info.
49 if ($_POST['bn_save']) {
51 // If updating an existing form...
54 $query = "UPDATE form_sports_fitness SET " .
55 "height_meters = '" . $_POST['form_height_meters'] . "', " .
56 "weight_kg = '" . $_POST['form_weight_kg'] . "', " .
57 "skin_folds_9x = '" . $_POST['form_skin_folds_9x'] . "', " .
58 "skin_folds_5x = '" . $_POST['form_skin_folds_5x'] . "', " .
59 "pct_body_fat = '" . $_POST['form_pct_body_fat'] . "', " .
60 "method_body_fat = " . rbvalue('form_method_body_fat') . ", " .
61 "pulse = '" . $_POST['form_pulse'] . "', " .
62 "bps = '" . $_POST['form_bps'] . "', " .
63 "bpd = '" . $_POST['form_bpd'] . "', " .
64 "beep_level = '" . $_POST['form_beep_level'] . "', " .
65 "beep_shuttles = '" . $_POST['form_beep_shuttles'] . "', " .
66 "beep_vo2_max = '" . $_POST['form_beep_vo2_max'] . "', " .
67 "vertical_jump_meters = '" . $_POST['form_vertical_jump_meters'] . "', " .
68 "agility_505 = '" . $_POST['form_agility_505'] . "', " .
69 "sit_and_reach_cm = '" . $_POST['form_sit_and_reach_cm'] . "', " .
70 "other = '" . $_POST['form_other'] . "' " .
71 "WHERE id = '$formid'";
75 // If adding a new form...
78 $query = "INSERT INTO form_sports_fitness ( " .
79 "height_meters, weight_kg, skin_folds_9x, skin_folds_5x, " .
80 "pct_body_fat, method_body_fat, pulse, bps, bpd, " .
81 "beep_level, beep_shuttles, beep_vo2_max, " .
82 "vertical_jump_meters, agility_505, sit_and_reach_cm, other " .
84 "'" . $_POST['form_height_meters'] . "', " .
85 "'" . $_POST['form_weight_kg'] . "', " .
86 "'" . $_POST['form_skin_folds_9x'] . "', " .
87 "'" . $_POST['form_skin_folds_5x'] . "', " .
88 "'" . $_POST['form_pct_body_fat'] . "', " .
89 rbvalue('form_method_body_fat') . ", " .
90 "'" . $_POST['form_pulse'] . "', " .
91 "'" . $_POST['form_bps'] . "', " .
92 "'" . $_POST['form_bpd'] . "', " .
93 "'" . $_POST['form_beep_level'] . "', " .
94 "'" . $_POST['form_beep_shuttles'] . "', " .
95 "'" . $_POST['form_beep_vo2_max'] . "', " .
96 "'" . $_POST['form_vertical_jump_meters'] . "', " .
97 "'" . $_POST['form_agility_505'] . "', " .
98 "'" . $_POST['form_sit_and_reach_cm'] . "', " .
99 "'" . $_POST['form_other'] . "' " .
101 $newid = sqlInsert($query);
102 addForm($encounter, "Sports Fitness", $newid, "sports_fitness", $pid, $userauthorized);
105 formHeader("Redirecting....");
112 $row = sqlQuery ("SELECT * FROM form_sports_fitness WHERE " .
113 "id = '$formid' AND activity = '1'") ;
118 <?php
html_header_show();?
>
119 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
120 <script language
="JavaScript">
124 <body
class="body_top">
125 <form method
="post" action
="<?php echo $rootdir ?>/forms/sports_fitness/new.php?id=<?php echo $formid ?>"
126 onsubmit
="return top.restoreSession()">
131 <table border
='1' width
='95%'>
133 <tr bgcolor
='#dddddd'>
134 <td colspan
='2' align
='center'><b
>Physical + Fitness Tests
</b
></td
>
138 <td nowrap
>Vitals
</td
>
142 <td width
='20%' nowrap
>
145 <td width
='13%' nowrap
>
146 <input type
='text' name
='form_height_meters' size
='6'
147 title
='Height in meters'
148 value
='<?php echo addslashes($row['height_meters
']) ?>' />  
;
150 <td width
='20%' nowrap
>
153 <td width
='13%' nowrap
>
154 <input type
='text' name
='form_weight_kg' size
='6'
155 title
='Weight in kilograms'
156 value
='<?php echo addslashes($row['weight_kg
']) ?>' />  
;
158 <td width
='20%' nowrap
>
170 <input type
='text' name
='form_pulse' size
='6'
171 title
='Resting pulse rate per minute'
172 value
='<?php echo addslashes($row['pulse
']) ?>' />  
;
178 <input type
='text' name
='form_bps' size
='6'
180 value
='<?php echo addslashes($row['bps
']) ?>' />  
;
186 <input type
='text' name
='form_bpd' size
='6'
188 value
='<?php echo addslashes($row['bps
']) ?>' />  
;
196 <td
>Body
<br
>Composition
</td
>
200 <td width
='20%' nowrap
>
203 <td width
='13%' nowrap
>
204 <input type
='text' name
='form_skin_folds_9x' size
='6'
205 title
='Total of 9 skin fold readings in cm'
206 value
='<?php echo addslashes($row['skin_folds_9x
']) ?>' />  
;
208 <td width
='20%' nowrap
>
211 <td width
='13%' nowrap
>
212 <input type
='text' name
='form_skin_folds_5x' size
='6'
213 title
='Total of 5 skin fold readings in cm'
214 value
='<?php echo addslashes($row['skin_folds_5x
']) ?>' />  
;
216 <td width
='20%' nowrap
>
220 <input type
='text' name
='form_pct_body_fat' size
='6'
221 title
='Percent body fat'
222 value
='<?php echo addslashes($row['pct_body_fat
']) ?>' />  
;
226 <td colspan
='6' nowrap
>
227 B
.F
. Method Used
: 
;
228 <?php
echo rbinput('form_method_body_fat', 'Caliper' , 'Caliper' , 'method_body_fat') ?
> 
;
229 <?php
echo rbinput('form_method_body_fat', 'Electronic' , 'Electronic' , 'method_body_fat') ?
> 
;
230 <?php
echo rbinput('form_method_body_fat', 'Hydrostatic', 'Hydrostatic', 'method_body_fat') ?
>
238 <td nowrap
>Beep Test
</td
>
242 <td width
='20%' nowrap
>
245 <td width
='13%' nowrap
>
246 <input type
='text' name
='form_beep_level' size
='6'
247 title
='Level Reached'
248 value
='<?php echo addslashes($row['beep_level
']) ?>' />  
;
250 <td width
='20%' nowrap
>
253 <td width
='13%' nowrap
>
254 <input type
='text' name
='form_beep_shuttles' size
='6'
255 title
='Number of shuttles at this level'
256 value
='<?php echo addslashes($row['beep_shuttles
']) ?>' />  
;
258 <td width
='20%' nowrap
>
262 <input type
='text' name
='form_beep_vo2_max' size
='6'
264 value
='<?php echo addslashes($row['beep_vo2_max
']) ?>' />  
;
272 <td nowrap
>Other Tests
</td
>
276 <td width
='20%' nowrap
>
279 <td width
='13%' nowrap
>
280 <input type
='text' name
='form_vertical_jump_meters' size
='6'
281 title
='Vertical Jump Test in Meters'
282 value
='<?php echo addslashes($row['vertical_jump_meters
']) ?>' />  
;
284 <td width
='20%' nowrap
>
287 <td width
='13%' nowrap
>
288 <input type
='text' name
='form_agility_505' size
='6'
289 title
='505 Agility Test in Seconds'
290 value
='<?php echo addslashes($row['agility_505
']) ?>' />  
;
292 <td width
='20%' nowrap
>
296 <input type
='text' name
='form_sit_and_reach_cm' size
='6'
297 title
='Sit and Reach Test in cm + or - ve'
298 value
='<?php echo addslashes($row['sit_and_reach_cm
']) ?>' />  
;
306 <td nowrap
>Still More
</td
>
308 <textarea name
='form_other' rows
='8' style
='width:100%'><?php
echo $row['other'] ?
></textarea
>
315 <input type
='submit' name
='bn_save' value
='Save' />
317 <input type
='button' value
='Cancel' onclick
="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
325 // TBD: If $alertmsg, display it with a JavaScript alert().