Highway to PSR2
[openemr.git] / contrib / forms / soccer_injury / new.php
blob836c7c90c07a9f458a7a3bb0b1ecdaa0b903c361
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 ?>"
215 onsubmit="return top.restoreSession()">
217 <center>
219 <p class='title' style='margin-top:8px;margin-bottom:8px'>Football Injury Statistics</p>
221 <table border='1'>
223 <tr bgcolor='#dddddd'>
224 <td colspan='2' align='center'><b>Time of Injury</b></td>
225 </tr>
227 <tr>
228 <td nowrap>Time</td>
229 <td nowrap>
230 <input type='text' name='time' size='5' title='Hour or hh:mm' value='<?php echo $siinjtime ?>' />&nbsp;
231 <input type='radio' name='timeampm' value='am'<?php if ($siampm == 'am') {
232 echo ' checked';
233 } ?> />am&nbsp;
234 <input type='radio' name='timeampm' value='pm'<?php if ($siampm == 'pm') {
235 echo ' checked';
236 } ?> />pm&nbsp;
237 </td>
238 </tr>
240 <tr>
241 <td nowrap>Game Play</td>
242 <td nowrap>
243 <table width='100%'>
244 <tr>
245 <?php echo rbcell('gameplay', '1', '1st Quarter', 'sigametime') ?>
246 <?php echo rbcell('gameplay', '2', '2nd Quarter', 'sigametime') ?>
247 <?php echo rbcell('gameplay', '3', '3rd Quarter', 'sigametime') ?>
248 <?php echo rbcell('gameplay', '4', '4th Quarter', 'sigametime') ?>
249 </tr>
250 <tr>
251 <?php echo rbcell('gameplay', '5', 'Warm Up', 'sigametime') ?>
252 <?php echo rbcell('gameplay', '6', 'Extra Time', 'sigametime') ?>
253 <?php echo rbcell('gameplay', '7', 'Cool Down', 'sigametime') ?>
254 <td width='25%'>&nbsp;</td>
255 </tr>
256 </table>
257 </td>
258 </tr>
260 <tr>
261 <td nowrap>Training</td>
262 <td nowrap>
263 <table width='100%'>
264 <tr>
265 <?php echo rbcell('gameplay', '11', 'Warm Up', 'sigametime') ?>
266 <?php echo rbcell('gameplay', '12', 'During Session', 'sigametime') ?>
267 <?php echo rbcell('gameplay', '13', 'Cool Down', 'sigametime') ?>
268 <td width='25%'>&nbsp;</td>
269 </tr>
270 </table>
271 </td>
272 </tr>
274 <tr bgcolor='#dddddd'>
275 <td colspan='2' align='center'><b>Mechanism of Injury</b></td>
276 </tr>
278 <tr>
279 <td nowrap>Contact</td>
280 <td nowrap>
281 <table width='100%'>
282 <tr>
283 <?php echo rbcell('activity', '1', 'Tackling', 'simechanism') ?>
284 <?php echo rbcell('activity', '2', 'Tackled', 'simechanism') ?>
285 <?php echo rbcell('activity', '3', 'Collision', 'simechanism') ?>
286 <?php echo rbcell('activity', '4', 'Kicked', 'simechanism') ?>
287 </tr>
288 <tr>
289 <?php echo rbcell('activity', '5', 'Use of Elbow', 'simechanism') ?>
290 <?php echo rbcell('activity', '6', 'Hit by Ball', 'simechanism') ?>
291 <td colspan='2' nowrap>
292 <?php echo rbinput('activity', '7', 'Other:', 'simechanism') ?>
293 <input type='text' name='activity_other' size='10'
294 title='Describe other'
295 value='<?php echo addslashes($row['simech_other']) ?>' />
296 </td>
297 </tr>
298 </table>
299 </td>
300 </tr>
302 <tr>
303 <td nowrap>Non Contact</td>
304 <td nowrap>
305 <table width='100%'>
306 <tr>
307 <?php echo rbcell('activity', '11', 'Passing', 'simechanism') ?>
308 <?php echo rbcell('activity', '12', 'Shooting', 'simechanism') ?>
309 <?php echo rbcell('activity', '13', 'Running', 'simechanism') ?>
310 <?php echo rbcell('activity', '14', 'Dribbling', 'simechanism') ?>
311 </tr>
312 <tr>
313 <?php echo rbcell('activity', '15', 'Heading', 'simechanism') ?>
314 <?php echo rbcell('activity', '16', 'Jumping', 'simechanism') ?>
315 <?php echo rbcell('activity', '17', 'Landing', 'simechanism') ?>
316 <?php echo rbcell('activity', '18', 'Fall', 'simechanism') ?>
317 </tr>
318 <tr>
319 <?php echo rbcell('activity', '19', 'Stretching', 'simechanism') ?>
320 <?php echo rbcell('activity', '20', 'Twist/Turning', 'simechanism') ?>
321 <?php echo rbcell('activity', '21', 'Throwing', 'simechanism') ?>
322 <?php echo rbcell('activity', '22', 'Diving', 'simechanism') ?>
323 </tr>
324 <tr>
325 <td colspan='4' nowrap>
326 <?php echo rbinput('activity', '23', 'Other:', 'simechanism') ?>
327 <input type='text' name='activity_nc_other' size='10'
328 title='Describe other'
329 value='<?php echo addslashes($row['simech_other']) ?>' />
330 </td>
331 </tr>
332 </table>
333 </td>
334 </tr>
336 <tr bgcolor='#dddddd'>
337 <td colspan='2' align='center'><b>Conditions</b></td>
338 </tr>
340 <tr>
341 <td nowrap>Surface</td>
342 <td nowrap>
343 <table width='100%'>
344 <tr>
345 <?php echo rbcell('surface', '1', 'Pitch', 'sisurface') ?>
346 <?php echo rbcell('surface', '2', 'Training', 'sisurface') ?>
347 <?php echo rbcell('surface', '3', 'Artificial', 'sisurface') ?>
348 <?php echo rbcell('surface', '4', 'All Weather', 'sisurface') ?>
349 </tr>
350 <tr>
351 <?php echo rbcell('surface', '5', 'Indoor', 'sisurface') ?>
352 <?php echo rbcell('surface', '6', 'Gym', 'sisurface') ?>
353 <?php echo rbcell('surface', '7', 'Other', 'sisurface') ?>
354 <td width='25%'>&nbsp;</td>
355 </tr>
356 </table>
357 </td>
358 </tr>
360 <tr>
361 <td nowrap>Position</td>
362 <td nowrap>
363 <table width='100%'>
364 <tr>
365 <?php echo rbcell('position', '1', 'Defender', 'siposition') ?>
366 <?php echo rbcell('position', '2', 'Midfield Offense', 'siposition') ?>
367 <?php echo rbcell('position', '3', 'Midfield Defense', 'siposition') ?>
368 <?php echo rbcell('position', '4', 'Wing Back', 'siposition') ?>
369 </tr>
370 <tr>
371 <?php echo rbcell('position', '5', 'Forward', 'siposition') ?>
372 <?php echo rbcell('position', '6', 'Striker', 'siposition') ?>
373 <?php echo rbcell('position', '7', 'Goal Keeper', 'siposition') ?>
374 <?php echo rbcell('position', '8', 'Starting Lineup', 'siposition') ?>
375 </tr>
376 <tr>
377 <?php echo rbcell('position', '9', 'Substitute', 'siposition') ?>
378 <td width='25%'>&nbsp;</td>
379 <td width='25%'>&nbsp;</td>
380 <td width='25%'>&nbsp;</td>
381 </tr>
382 </table>
383 </td>
384 </tr>
386 <tr>
387 <td nowrap>Footwear</td>
388 <td nowrap>
389 <table width='100%'>
390 <tr>
391 <?php echo rbcell('footwear', '1', 'Molded Cleat', 'sifootwear') ?>
392 <?php echo rbcell('footwear', '2', 'Detachable Cleats', 'sifootwear') ?>
393 <?php echo rbcell('footwear', '3', 'Indoor Shoes', 'sifootwear') ?>
394 <?php echo rbcell('footwear', '4', 'Turf Shoes', 'sifootwear') ?>
395 </tr>
396 </table>
397 </td>
398 </tr>
400 <tr>
401 <td nowrap>Other Equipment</td>
402 <td nowrap>
403 <table width='100%'>
404 <tr>
405 <?php echo cbcell('equip_1', 'Shin Pads', 'siequip_1') ?>
406 <?php echo cbcell('equip_2', 'Gloves', 'siequip_2') ?>
407 <?php echo cbcell('equip_3', 'Ankle Strapping', 'siequip_3') ?>
408 <?php echo cbcell('equip_4', 'Knee Strapping', 'siequip_4') ?>
409 </tr>
410 <tr>
411 <?php echo cbcell('equip_5', 'Bracing', 'siequip_5') ?>
412 <?php echo cbcell('equip_6', 'Synthetic Cast', 'siequip_6') ?>
413 <td width='25%'>&nbsp;</td>
414 <td width='25%'>&nbsp;</td>
415 </tr>
416 </table>
417 </td>
418 </tr>
420 <tr>
421 <td nowrap>Side of Injury</td>
422 <td nowrap>
423 <table width='100%'>
424 <tr>
425 <?php echo rbcell('side', '1', 'Left', 'siside') ?>
426 <?php echo rbcell('side', '2', 'Right', 'siside') ?>
427 <?php echo rbcell('side', '3', 'Bilateral', 'siside') ?>
428 <?php echo rbcell('side', '4', 'Not Applicable', 'siside') ?>
429 </tr>
430 </table>
431 </td>
432 </tr>
434 <tr bgcolor='#dddddd'>
435 <td colspan='2' align='center'><b>Post Injury Sequelae</b></td>
436 </tr>
438 <tr>
439 <td nowrap>Removed from<br>Play/Training<br>after Injury</td>
440 <td nowrap>
441 <table width='100%'>
442 <tr>
443 <?php echo rbcell('removed', '1', 'Immediately', 'siremoved') ?>
444 <?php echo rbcell('removed', '2', 'Later', 'siremoved') ?>
445 <?php echo rbcell('removed', '3', 'Not at All', 'siremoved') ?>
446 <td width='25%'>&nbsp;</td>
447 </tr>
448 </table>
449 </td>
450 </tr>
452 <tr>
453 <td nowrap>Medical Treatment<br>Sought from</td>
454 <td nowrap>
455 <table width='100%'>
456 <tr>
457 <?php echo cbcell('treat_1', 'Hospital A&amp;E Dept', 'sitreat_1') ?>
458 <?php echo cbcell('treat_2', 'General Practitioner', 'sitreat_2') ?>
459 <?php echo cbcell('treat_3', 'Physiotherapist', 'sitreat_3') ?>
460 <?php echo cbcell('treat_4', 'Nurse', 'sitreat_4') ?>
461 </tr>
462 <tr>
463 <?php echo cbcell('treat_5', 'Hospital Specialist', 'sitreat_5') ?>
464 <?php echo cbcell('treat_6', 'Osteopath', 'sitreat_6') ?>
465 <?php echo cbcell('treat_7', 'Chiropractor', 'sitreat_7') ?>
466 <?php echo cbcell('treat_8', 'Sports Massage Th', 'sitreat_8') ?>
467 </tr>
468 <tr>
469 <?php echo cbcell('treat_9', 'Sports Physician', 'sitreat_9') ?>
470 <td colspan='3' nowrap>
471 <?php echo cbinput('treat_10', 'sitreat_10') ?>Other:
472 <input type='text' name='treat_other' size='10'
473 title='Describe other'
474 value='<?php echo addslashes($row['sitreat_other']) ?>' />
475 </td>
476 </tr>
477 </table>
478 </td>
479 </tr>
481 <tr>
482 <td colspan='2' nowrap>
483 If player is unlikely to return to play please check here:
484 <?php echo cbinput('noreturn', 'sinoreturn') ?>
485 </td>
486 </tr>
488 </table>
491 <input type='submit' name='bn_save' value='Save' />
492 &nbsp;
493 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
494 </p>
496 </center>
498 </form>
499 <?php
501 // TBD: If $alertmsg, display it with a JavaScript alert().
504 </body>
505 </html>