Highway to PSR2
[openemr.git] / contrib / forms / soccer_injury / view.php
blob7b6287c177e3a0559412c4aa783e41c8f9fe6a03
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.
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");
25 $row = array();
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];
34 if (! $tmp) {
35 $tmp = '0';
38 return "'$tmp'";
41 function cbvalue($cbname)
43 return $_POST[$cbname] ? '1' : '0';
46 function rbinput($name, $value, $desc, $colname)
48 global $row;
49 $ret = "<input type='radio' name='$name' value='$value'";
50 if ($row[$colname] == $value) {
51 $ret .= " checked";
54 $ret .= " />$desc";
55 return $ret;
58 function rbcell($name, $value, $desc, $colname)
60 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
63 function cbinput($name, $colname)
65 global $row;
66 $ret = "<input type='checkbox' name='$name' value='1'";
67 if ($row[$colname]) {
68 $ret .= " checked";
71 $ret .= " />";
72 return $ret;
75 function cbcell($name, $desc, $colname)
77 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
80 $formid = $_GET['id'];
82 // If Save was clicked, save the info.
84 if ($_POST['bn_save']) {
85 $tmp = strtotime($_POST['time'] . $_POST['timeampm']);
86 if ($tmp < 0) {
87 die("Time is not valid!");
90 $siinjtime = date("H:i:s", $tmp);
92 $simech_other = '';
93 if ($_POST['activity'] == '7') {
94 $simech_other = $_POST['activity_other'];
95 } else if ($_POST['activity'] == '23') {
96 $simech_other = $_POST['activity_nc_other'];
99 $sitreat_other = '';
100 if ($_POST['treat_10']) {
101 $sitreat_other = $_POST['treat_other'];
104 // If updating an existing form...
106 if ($formid) {
107 $query = "UPDATE form_soccer_injury SET " .
108 "siinjtime = '$siinjtime', " .
109 "sigametime = " . rbvalue('gameplay') . ", " .
110 "simechanism = " . rbvalue('activity') . ", " .
111 "simech_other = '$simech_other', " .
112 "sisurface = " . rbvalue('surface') . ", " .
113 "siposition = " . rbvalue('position') . ", " .
114 "sifootwear = " . rbvalue('footwear') . ", " .
115 "siequip_1 = " . cbvalue('equip_1') . ", " .
116 "siequip_2 = " . cbvalue('equip_2') . ", " .
117 "siequip_3 = " . cbvalue('equip_3') . ", " .
118 "siequip_4 = " . cbvalue('equip_4') . ", " .
119 "siequip_5 = " . cbvalue('equip_5') . ", " .
120 "siequip_6 = " . cbvalue('equip_6') . ", " .
121 "siside = " . rbvalue('side') . ", " .
122 "siremoved = " . rbvalue('removed') . ", " .
123 "sitreat_1 = " . cbvalue('treat_1') . ", " .
124 "sitreat_2 = " . cbvalue('treat_2') . ", " .
125 "sitreat_3 = " . cbvalue('treat_3') . ", " .
126 "sitreat_4 = " . cbvalue('treat_4') . ", " .
127 "sitreat_5 = " . cbvalue('treat_5') . ", " .
128 "sitreat_6 = " . cbvalue('treat_6') . ", " .
129 "sitreat_7 = " . cbvalue('treat_7') . ", " .
130 "sitreat_8 = " . cbvalue('treat_8') . ", " .
131 "sitreat_9 = " . cbvalue('treat_9') . ", " .
132 "sitreat_10 = " . cbvalue('treat_10') . ", " .
133 "sitreat_other = '$sitreat_other', " .
134 "sinoreturn = " . cbvalue('noreturn') . " " .
135 "WHERE id = '$formid'";
136 sqlStatement($query);
137 } // If adding a new form...
139 else {
140 $query = "INSERT INTO form_soccer_injury ( " .
141 "siinjtime, sigametime, simechanism, simech_other, sisurface, " .
142 "siposition, sifootwear, " .
143 "siequip_1, siequip_2, siequip_3, siequip_4, siequip_5, siequip_6, " .
144 "siside, siremoved, " .
145 "sitreat_1, sitreat_2, sitreat_3, sitreat_4, sitreat_5, " .
146 "sitreat_6, sitreat_7, sitreat_8, sitreat_9, sitreat_10, " .
147 "sitreat_other, sinoreturn " .
148 ") VALUES ( " .
149 "'$siinjtime', " .
150 rbvalue('gameplay') . ", " .
151 rbvalue('activity') . ", " .
152 "'$simech_other', " .
153 rbvalue('surface') . ", " .
154 rbvalue('position') . ", " .
155 rbvalue('footwear') . ", " .
156 cbvalue('equip_1') . ", " .
157 cbvalue('equip_2') . ", " .
158 cbvalue('equip_3') . ", " .
159 cbvalue('equip_4') . ", " .
160 cbvalue('equip_5') . ", " .
161 cbvalue('equip_6') . ", " .
162 rbvalue('side') . ", " .
163 rbvalue('removed') . ", " .
164 cbvalue('treat_1') . ", " .
165 cbvalue('treat_2') . ", " .
166 cbvalue('treat_3') . ", " .
167 cbvalue('treat_4') . ", " .
168 cbvalue('treat_5') . ", " .
169 cbvalue('treat_6') . ", " .
170 cbvalue('treat_7') . ", " .
171 cbvalue('treat_8') . ", " .
172 cbvalue('treat_9') . ", " .
173 cbvalue('treat_10') . ", " .
174 "'$sitreat_other', " .
175 cbvalue('noreturn') . " " .
176 ")";
177 $newid = sqlInsert($query);
178 addForm($encounter, "Football Injury", $newid, "soccer_injury", $pid, $userauthorized);
181 formHeader("Redirecting....");
182 formJump();
183 formFooter();
184 exit;
187 $siinjtime = '';
188 $siampm = '';
189 if ($formid) {
190 $row = sqlQuery("SELECT * FROM form_soccer_injury WHERE " .
191 "id = '$formid' AND activity = '1'") ;
192 $siinjtime = substr($row['siinjtime'], 0, 5);
193 $siampm = 'am';
194 $siinjhour = substr($siinjtime, 0, 2);
195 if ($siinjhour > 12) {
196 $siampm = 'pm';
197 $siinjtime = substr($siinjhour + 500 - 12, 1, 2) . substr($siinjtime, 2);
201 <html>
202 <head>
203 <?php html_header_show();?>
204 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
205 <style>
206 .billcell { font-family: sans-serif; font-size: 10pt }
207 </style>
208 <script language="JavaScript">
210 </script>
211 </head>
213 <body class="body_top">
214 <form method="post" action="<?php echo $rootdir ?>/forms/soccer_injury/new.php?id=<?php echo $formid ?>" onsubmit="return top.restoreSession()">
216 <center>
218 <p class='title' style='margin-top:8px;margin-bottom:8px'>Football Injury Statistics</p>
220 <table border='1'>
222 <tr bgcolor='#dddddd'>
223 <td colspan='2' align='center'><b>Time of Injury</b></td>
224 </tr>
226 <tr>
227 <td nowrap>Time</td>
228 <td nowrap>
229 <input type='text' name='time' size='5' title='Hour or hh:mm' value='<?php echo $siinjtime ?>' />&nbsp;
230 <input type='radio' name='timeampm' value='am'<?php if ($siampm == 'am') {
231 echo ' checked';
232 } ?> />am&nbsp;
233 <input type='radio' name='timeampm' value='pm'<?php if ($siampm == 'pm') {
234 echo ' checked';
235 } ?> />pm&nbsp;
236 </td>
237 </tr>
239 <tr>
240 <td nowrap>Game Play</td>
241 <td nowrap>
242 <table width='100%'>
243 <tr>
244 <?php echo rbcell('gameplay', '1', '1st Quarter', 'sigametime') ?>
245 <?php echo rbcell('gameplay', '2', '2nd Quarter', 'sigametime') ?>
246 <?php echo rbcell('gameplay', '3', '3rd Quarter', 'sigametime') ?>
247 <?php echo rbcell('gameplay', '4', '4th Quarter', 'sigametime') ?>
248 </tr>
249 <tr>
250 <?php echo rbcell('gameplay', '5', 'Warm Up', 'sigametime') ?>
251 <?php echo rbcell('gameplay', '6', 'Extra Time', 'sigametime') ?>
252 <?php echo rbcell('gameplay', '7', 'Cool Down', 'sigametime') ?>
253 <td width='25%'>&nbsp;</td>
254 </tr>
255 </table>
256 </td>
257 </tr>
259 <tr>
260 <td nowrap>Training</td>
261 <td nowrap>
262 <table width='100%'>
263 <tr>
264 <?php echo rbcell('gameplay', '11', 'Warm Up', 'sigametime') ?>
265 <?php echo rbcell('gameplay', '12', 'During Session', 'sigametime') ?>
266 <?php echo rbcell('gameplay', '13', 'Cool Down', 'sigametime') ?>
267 <td width='25%'>&nbsp;</td>
268 </tr>
269 </table>
270 </td>
271 </tr>
273 <tr bgcolor='#dddddd'>
274 <td colspan='2' align='center'><b>Mechanism of Injury</b></td>
275 </tr>
277 <tr>
278 <td nowrap>Contact</td>
279 <td nowrap>
280 <table width='100%'>
281 <tr>
282 <?php echo rbcell('activity', '1', 'Tackling', 'simechanism') ?>
283 <?php echo rbcell('activity', '2', 'Tackled', 'simechanism') ?>
284 <?php echo rbcell('activity', '3', 'Collision', 'simechanism') ?>
285 <?php echo rbcell('activity', '4', 'Kicked', 'simechanism') ?>
286 </tr>
287 <tr>
288 <?php echo rbcell('activity', '5', 'Use of Elbow', 'simechanism') ?>
289 <?php echo rbcell('activity', '6', 'Hit by Ball', 'simechanism') ?>
290 <td colspan='2' nowrap>
291 <?php echo rbinput('activity', '7', 'Other:', 'simechanism') ?>
292 <input type='text' name='activity_other' size='10'
293 title='Describe other'
294 value='<?php echo addslashes($row['simech_other']) ?>' />
295 </td>
296 </tr>
297 </table>
298 </td>
299 </tr>
301 <tr>
302 <td nowrap>Non Contact</td>
303 <td nowrap>
304 <table width='100%'>
305 <tr>
306 <?php echo rbcell('activity', '11', 'Passing', 'simechanism') ?>
307 <?php echo rbcell('activity', '12', 'Shooting', 'simechanism') ?>
308 <?php echo rbcell('activity', '13', 'Running', 'simechanism') ?>
309 <?php echo rbcell('activity', '14', 'Dribbling', 'simechanism') ?>
310 </tr>
311 <tr>
312 <?php echo rbcell('activity', '15', 'Heading', 'simechanism') ?>
313 <?php echo rbcell('activity', '16', 'Jumping', 'simechanism') ?>
314 <?php echo rbcell('activity', '17', 'Landing', 'simechanism') ?>
315 <?php echo rbcell('activity', '18', 'Fall', 'simechanism') ?>
316 </tr>
317 <tr>
318 <?php echo rbcell('activity', '19', 'Stretching', 'simechanism') ?>
319 <?php echo rbcell('activity', '20', 'Twist/Turning', 'simechanism') ?>
320 <?php echo rbcell('activity', '21', 'Throwing', 'simechanism') ?>
321 <?php echo rbcell('activity', '22', 'Diving', 'simechanism') ?>
322 </tr>
323 <tr>
324 <td colspan='4' nowrap>
325 <?php echo rbinput('activity', '23', 'Other:', 'simechanism') ?>
326 <input type='text' name='activity_nc_other' size='10'
327 title='Describe other'
328 value='<?php echo addslashes($row['simech_other']) ?>' />
329 </td>
330 </tr>
331 </table>
332 </td>
333 </tr>
335 <tr bgcolor='#dddddd'>
336 <td colspan='2' align='center'><b>Conditions</b></td>
337 </tr>
339 <tr>
340 <td nowrap>Surface</td>
341 <td nowrap>
342 <table width='100%'>
343 <tr>
344 <?php echo rbcell('surface', '1', 'Pitch', 'sisurface') ?>
345 <?php echo rbcell('surface', '2', 'Training', 'sisurface') ?>
346 <?php echo rbcell('surface', '3', 'Artificial', 'sisurface') ?>
347 <?php echo rbcell('surface', '4', 'All Weather', 'sisurface') ?>
348 </tr>
349 <tr>
350 <?php echo rbcell('surface', '5', 'Indoor', 'sisurface') ?>
351 <?php echo rbcell('surface', '6', 'Gym', 'sisurface') ?>
352 <?php echo rbcell('surface', '7', 'Other', 'sisurface') ?>
353 <td width='25%'>&nbsp;</td>
354 </tr>
355 </table>
356 </td>
357 </tr>
359 <tr>
360 <td nowrap>Position</td>
361 <td nowrap>
362 <table width='100%'>
363 <tr>
364 <?php echo rbcell('position', '1', 'Defender', 'siposition') ?>
365 <?php echo rbcell('position', '2', 'Midfield Offense', 'siposition') ?>
366 <?php echo rbcell('position', '3', 'Midfield Defense', 'siposition') ?>
367 <?php echo rbcell('position', '4', 'Wing Back', 'siposition') ?>
368 </tr>
369 <tr>
370 <?php echo rbcell('position', '5', 'Forward', 'siposition') ?>
371 <?php echo rbcell('position', '6', 'Striker', 'siposition') ?>
372 <?php echo rbcell('position', '7', 'Goal Keeper', 'siposition') ?>
373 <?php echo rbcell('position', '8', 'Starting Lineup', 'siposition') ?>
374 </tr>
375 <tr>
376 <?php echo rbcell('position', '9', 'Substitute', 'siposition') ?>
377 <td width='25%'>&nbsp;</td>
378 <td width='25%'>&nbsp;</td>
379 <td width='25%'>&nbsp;</td>
380 </tr>
381 </table>
382 </td>
383 </tr>
385 <tr>
386 <td nowrap>Footwear</td>
387 <td nowrap>
388 <table width='100%'>
389 <tr>
390 <?php echo rbcell('footwear', '1', 'Molded Cleat', 'sifootwear') ?>
391 <?php echo rbcell('footwear', '2', 'Detachable Cleats', 'sifootwear') ?>
392 <?php echo rbcell('footwear', '3', 'Indoor Shoes', 'sifootwear') ?>
393 <?php echo rbcell('footwear', '4', 'Turf Shoes', 'sifootwear') ?>
394 </tr>
395 </table>
396 </td>
397 </tr>
399 <tr>
400 <td nowrap>Other Equipment</td>
401 <td nowrap>
402 <table width='100%'>
403 <tr>
404 <?php echo cbcell('equip_1', 'Shin Pads', 'siequip_1') ?>
405 <?php echo cbcell('equip_2', 'Gloves', 'siequip_2') ?>
406 <?php echo cbcell('equip_3', 'Ankle Strapping', 'siequip_3') ?>
407 <?php echo cbcell('equip_4', 'Knee Strapping', 'siequip_4') ?>
408 </tr>
409 <tr>
410 <?php echo cbcell('equip_5', 'Bracing', 'siequip_5') ?>
411 <?php echo cbcell('equip_6', 'Synthetic Cast', 'siequip_6') ?>
412 <td width='25%'>&nbsp;</td>
413 <td width='25%'>&nbsp;</td>
414 </tr>
415 </table>
416 </td>
417 </tr>
419 <tr>
420 <td nowrap>Side of Injury</td>
421 <td nowrap>
422 <table width='100%'>
423 <tr>
424 <?php echo rbcell('side', '1', 'Left', 'siside') ?>
425 <?php echo rbcell('side', '2', 'Right', 'siside') ?>
426 <?php echo rbcell('side', '3', 'Bilateral', 'siside') ?>
427 <?php echo rbcell('side', '4', 'Not Applicable', 'siside') ?>
428 </tr>
429 </table>
430 </td>
431 </tr>
433 <tr bgcolor='#dddddd'>
434 <td colspan='2' align='center'><b>Post Injury Sequelae</b></td>
435 </tr>
437 <tr>
438 <td nowrap>Removed from<br>Play/Training<br>after Injury</td>
439 <td nowrap>
440 <table width='100%'>
441 <tr>
442 <?php echo rbcell('removed', '1', 'Immediately', 'siremoved') ?>
443 <?php echo rbcell('removed', '2', 'Later', 'siremoved') ?>
444 <?php echo rbcell('removed', '3', 'Not at All', 'siremoved') ?>
445 <td width='25%'>&nbsp;</td>
446 </tr>
447 </table>
448 </td>
449 </tr>
451 <tr>
452 <td nowrap>Medical Treatment<br>Sought from</td>
453 <td nowrap>
454 <table width='100%'>
455 <tr>
456 <?php echo cbcell('treat_1', 'Hospital A&amp;E Dept', 'sitreat_1') ?>
457 <?php echo cbcell('treat_2', 'General Practitioner', 'sitreat_2') ?>
458 <?php echo cbcell('treat_3', 'Physiotherapist', 'sitreat_3') ?>
459 <?php echo cbcell('treat_4', 'Nurse', 'sitreat_4') ?>
460 </tr>
461 <tr>
462 <?php echo cbcell('treat_5', 'Hospital Specialist', 'sitreat_5') ?>
463 <?php echo cbcell('treat_6', 'Osteopath', 'sitreat_6') ?>
464 <?php echo cbcell('treat_7', 'Chiropractor', 'sitreat_7') ?>
465 <?php echo cbcell('treat_8', 'Sports Massage Th', 'sitreat_8') ?>
466 </tr>
467 <tr>
468 <?php echo cbcell('treat_9', 'Sports Physician', 'sitreat_9') ?>
469 <td colspan='3' nowrap>
470 <?php echo cbinput('treat_10', 'sitreat_10') ?>Other:
471 <input type='text' name='treat_other' size='10'
472 title='Describe other'
473 value='<?php echo addslashes($row['sitreat_other']) ?>' />
474 </td>
475 </tr>
476 </table>
477 </td>
478 </tr>
480 <tr>
481 <td colspan='2' nowrap>
482 If player is unlikely to return to play please check here:
483 <?php echo cbinput('noreturn', 'sinoreturn') ?>
484 </td>
485 </tr>
487 </table>
490 <input type='submit' name='bn_save' value='Save' />
491 &nbsp;
492 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
493 </p>
495 </center>
497 </form>
498 <?php
500 // TBD: If $alertmsg, display it with a JavaScript alert().
503 </body>
504 </html>