making forms compatible with new frame layout
[openemr.git] / contrib / forms / football_injury_audit / new.php
blob24c860f5ce042d1e5938200ec8663ab3316a8420
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) 2006 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) {
32 $tmp = $_POST[$rbname];
33 if (! $tmp) $tmp = '0';
34 return "'$tmp'";
37 function cbvalue($cbname) {
38 return $_POST[$cbname] ? '1' : '0';
41 function invalue($inname) {
42 return (int) trim($_POST[$inname]);
45 function txvalue($txname) {
46 return "'" . trim($_POST[$txname]) . "'";
49 function rbinput($name, $value, $desc, $colname) {
50 global $row;
51 $ret = "<input type='radio' name='$name' value='$value'";
52 if ($row[$colname] == $value) $ret .= " checked";
53 $ret .= " />$desc";
54 return $ret;
57 function rbcell($name, $value, $desc, $colname) {
58 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
61 function cbinput($name, $colname) {
62 global $row;
63 $ret = "<input type='checkbox' name='$name' value='1'";
64 if ($row[$colname]) $ret .= " checked";
65 $ret .= " />";
66 return $ret;
69 function cbcell($name, $desc, $colname) {
70 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
73 $formid = $_GET['id'];
75 // If Save was clicked, save the info.
77 if ($_POST['bn_save']) {
78 $fiinjmin = (int) $_POST['form_injmin'];
80 // If updating an existing form...
82 if ($formid) {
83 $query = "UPDATE form_football_injury_audit SET " .
84 "fiinjmin = " . invalue('form_injmin') . ", " .
85 "fiinjtime = " . rbvalue('form_injtime') . ", " .
86 "fimech_tackling = " . cbvalue('form_mech_tackling') . ", " .
87 "fimech_tackled = " . cbvalue('form_mech_tackled') . ", " .
88 "fimech_collision = " . cbvalue('form_mech_collision') . ", " .
89 "fimech_kicked = " . cbvalue('form_mech_kicked') . ", " .
90 "fimech_elbow = " . cbvalue('form_mech_elbow') . ", " .
91 "fimech_nofoul = " . cbvalue('form_mech_nofoul') . ", " .
92 "fimech_oppfoul = " . cbvalue('form_mech_oppfoul') . ", " .
93 "fimech_ownfoul = " . cbvalue('form_mech_ownfoul') . ", " .
94 "fimech_yellow = " . cbvalue('form_mech_yellow') . ", " .
95 "fimech_red = " . cbvalue('form_mech_red') . ", " .
96 "fimech_passing = " . cbvalue('form_mech_passing') . ", " .
97 "fimech_shooting = " . cbvalue('form_mech_shooting') . ", " .
98 "fimech_running = " . cbvalue('form_mech_running') . ", " .
99 "fimech_dribbling = " . cbvalue('form_mech_dribbling') . ", " .
100 "fimech_heading = " . cbvalue('form_mech_heading') . ", " .
101 "fimech_jumping = " . cbvalue('form_mech_jumping') . ", " .
102 "fimech_landing = " . cbvalue('form_mech_landing') . ", " .
103 "fimech_fall = " . cbvalue('form_mech_fall') . ", " .
104 "fimech_stretching = " . cbvalue('form_mech_stretching') . ", " .
105 "fimech_turning = " . cbvalue('form_mech_turning') . ", " .
106 "fimech_throwing = " . cbvalue('form_mech_throwing') . ", " .
107 "fimech_diving = " . cbvalue('form_mech_diving') . ", " .
108 "fimech_overuse = " . cbvalue('form_mech_overuse') . ", " .
109 "fimech_othercon = " . txvalue('form_mech_othercon') . ", " .
110 "fimech_othernon = " . txvalue('form_mech_othernon') . ", " .
111 "fisurface = " . rbvalue('form_surface') . ", " .
112 "fiposition = " . rbvalue('form_position') . ", " .
113 "fifootwear = " . rbvalue('form_footwear') . ", " .
114 "fiside = " . rbvalue('form_side') . ", " .
115 "firemoved = " . rbvalue('form_removed') . " " .
116 "WHERE id = '$formid'";
117 sqlStatement($query);
120 // If adding a new form...
122 else {
123 $query = "INSERT INTO form_football_injury_audit ( " .
124 "fiinjmin, fiinjtime, fimech_tackling, fimech_tackled, fimech_collision, " .
125 "fimech_kicked, fimech_elbow, fimech_nofoul, fimech_oppfoul, " .
126 "fimech_ownfoul, fimech_yellow, fimech_red, fimech_passing, " .
127 "fimech_shooting, fimech_running, fimech_dribbling, fimech_heading, " .
128 "fimech_jumping, fimech_landing, fimech_fall, fimech_stretching, " .
129 "fimech_turning, fimech_throwing, fimech_diving, fimech_overuse, " .
130 "fimech_othercon, fimech_othernon, fisurface, fiposition, fifootwear, " .
131 "fiside, firemoved " .
132 ") VALUES ( " .
133 invalue('form_injmin') . ", " .
134 rbvalue('form_injtime') . ", " .
135 cbvalue('form_mech_tackling') . ", " .
136 cbvalue('form_mech_tackled') . ", " .
137 cbvalue('form_mech_collision') . ", " .
138 cbvalue('form_mech_kicked') . ", " .
139 cbvalue('form_mech_elbow') . ", " .
140 cbvalue('form_mech_nofoul') . ", " .
141 cbvalue('form_mech_oppfoul') . ", " .
142 cbvalue('form_mech_ownfoul') . ", " .
143 cbvalue('form_mech_yellow') . ", " .
144 cbvalue('form_mech_red') . ", " .
145 cbvalue('form_mech_passing') . ", " .
146 cbvalue('form_mech_shooting') . ", " .
147 cbvalue('form_mech_running') . ", " .
148 cbvalue('form_mech_dribbling') . ", " .
149 cbvalue('form_mech_heading') . ", " .
150 cbvalue('form_mech_jumping') . ", " .
151 cbvalue('form_mech_landing') . ", " .
152 cbvalue('form_mech_fall') . ", " .
153 cbvalue('form_mech_stretching') . ", " .
154 cbvalue('form_mech_turning') . ", " .
155 cbvalue('form_mech_throwing') . ", " .
156 cbvalue('form_mech_diving') . ", " .
157 cbvalue('form_mech_overuse') . ", " .
158 txvalue('form_mech_othercon') . ", " .
159 txvalue('form_mech_othernon') . ", " .
160 rbvalue('form_surface') . ", " .
161 rbvalue('form_position') . ", " .
162 rbvalue('form_footwear') . ", " .
163 rbvalue('form_side') . ", " .
164 rbvalue('form_removed') . " " .
165 ")";
166 $newid = sqlInsert($query);
167 addForm($encounter, "Football Injury Audit", $newid, "football_injury_audit", $pid, $userauthorized);
170 formHeader("Redirecting....");
171 formJump();
172 formFooter();
173 exit;
176 if ($formid) {
177 $row = sqlQuery ("SELECT * FROM form_football_injury_audit WHERE " .
178 "id = '$formid' AND activity = '1'") ;
181 <html>
182 <head>
183 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
184 <style>
185 .billcell { font-family: sans-serif; font-size: 10pt }
186 </style>
188 <script type="text/javascript" src="../../../library/dialog.js"></script>
190 <script language="JavaScript">
192 // Pop up the coding window.
193 function docoding() {
194 var width = screen.width - 50;
195 if (!isNaN(top.screenX)) {
196 width -= top.screenX;
197 } else if (!isNaN(top.screenLeft)) {
198 width -= top.screenLeft;
200 if (width > 1000) width = 1000;
201 dlgopen('../../patient_file/encounter/coding_popup.php', '_blank', width, 550);
204 </script>
205 </head>
207 <body <?echo $top_bg_line;?> topmargin="0" rightmargin="0" leftmargin="2" bottommargin="0" marginwidth="2" marginheight="0">
208 <form method="post" action="<? echo $rootdir ?>/forms/football_injury_audit/new.php?id=<? echo $formid ?>">
210 <center>
212 <p class='title' style='margin-top:8px;margin-bottom:8px'>Football Injury Statistics</p>
214 <table border='1' width='98%'>
216 <tr bgcolor='#dddddd'>
217 <td colspan='2' align='center'><b>Time of Injury</b></td>
218 </tr>
220 <tr>
221 <td nowrap>Match Play</td>
222 <td nowrap>
223 <table width='100%'>
224 <tr>
225 <td nowrap>
226 Min of Injury
227 <input type='text' name='form_injmin' size='4'
228 value='<? echo addslashes($row['fiinjmin']) ?>' />
229 </td>
230 <? echo rbcell('form_injtime', '1', 'Warm Up' , 'fiinjtime') ?>
231 <? echo rbcell('form_injtime', '2', 'Extra Time', 'fiinjtime') ?>
232 <? echo rbcell('form_injtime', '3', 'Cool Down' , 'fiinjtime') ?>
233 </tr>
234 </table>
235 </td>
236 </tr>
238 <tr>
239 <td nowrap>Training</td>
240 <td nowrap>
241 <table width='100%'>
242 <tr>
243 <? echo rbcell('form_injtime', '4', 'Warm Up' , 'fiinjtime') ?>
244 <? echo rbcell('form_injtime', '5', 'During Session', 'fiinjtime') ?>
245 <? echo rbcell('form_injtime', '6', 'Cool Down' , 'fiinjtime') ?>
246 <? echo rbcell('form_injtime', '7', 'Rehabilitation', 'fiinjtime') ?>
247 </tr>
248 </table>
249 </td>
250 </tr>
252 <tr bgcolor='#dddddd'>
253 <td colspan='2' align='center'><b>Mechanism of Injury</b></td>
254 </tr>
256 <tr>
257 <td nowrap>Contact</td>
258 <td nowrap>
259 <table width='100%'>
260 <tr>
261 <? echo cbcell('form_mech_tackling' , 'Tackling' , 'fimech_tackling' ) ?>
262 <? echo cbcell('form_mech_tackled' , 'Tackled' , 'fimech_tackled' ) ?>
263 <? echo cbcell('form_mech_collision', 'Collision', 'fimech_collision') ?>
264 <? echo cbcell('form_mech_kicked' , 'Kicked' , 'fimech_kicked' ) ?>
265 </tr>
266 <tr>
267 <? echo cbcell('form_mech_elbow' , 'Use of Elbow' , 'fimech_elbow' ) ?>
268 <td colspan='3' nowrap>
269 Other:
270 <input type='text' name='form_mech_othercon' size='10'
271 title='Describe other'
272 value='<? echo addslashes($row['fimech_othercon']) ?>' />
273 </td>
274 </tr>
275 </table>
276 </td>
277 </tr>
279 <tr>
280 <td nowrap>Referee's Sanction</td>
281 <td nowrap>
282 <table width='100%'>
283 <tr>
284 <? echo cbcell('form_mech_nofoul' , 'No Foul' , 'fimech_nofoul' ) ?>
285 <? echo cbcell('form_mech_oppfoul', 'Opponent Foul', 'fimech_oppfoul') ?>
286 <? echo cbcell('form_mech_ownfoul', 'Own Foul' , 'fimech_ownfoul') ?>
287 <td width='25%'>&nbsp;</td>
288 </tr>
289 <tr>
290 <? echo cbcell('form_mech_yellow' , 'Yellow Card' , 'fimech_yellow' ) ?>
291 <? echo cbcell('form_mech_red' , 'Red Card' , 'fimech_red' ) ?>
292 <td width='25%'>&nbsp;</td>
293 <td width='25%'>&nbsp;</td>
294 </tr>
295 </table>
296 </td>
297 </tr>
299 <tr>
300 <td nowrap>Non Contact</td>
301 <td nowrap>
302 <table width='100%'>
303 <tr>
304 <? echo cbcell('form_mech_passing' , 'Passing' , 'fimech_passing' ) ?>
305 <? echo cbcell('form_mech_shooting' , 'Shooting' , 'fimech_shooting' ) ?>
306 <? echo cbcell('form_mech_running' , 'Running' , 'fimech_running' ) ?>
307 <? echo cbcell('form_mech_dribbling', 'Dribbling', 'fimech_dribbling') ?>
308 </tr>
309 <tr>
310 <? echo cbcell('form_mech_heading' , 'Heading' , 'fimech_heading' ) ?>
311 <? echo cbcell('form_mech_jumping' , 'Jumping' , 'fimech_jumping' ) ?>
312 <? echo cbcell('form_mech_landing' , 'Landing' , 'fimech_landing' ) ?>
313 <? echo cbcell('form_mech_fall' , 'Fall' , 'fimech_fall' ) ?>
314 </tr>
315 <tr>
316 <? echo cbcell('form_mech_stretching', 'Stretching' , 'fimech_stretching') ?>
317 <? echo cbcell('form_mech_turning' , 'Twisting/Turning', 'fimech_turning' ) ?>
318 <? echo cbcell('form_mech_throwing' , 'Throwing' , 'fimech_throwing' ) ?>
319 <? echo cbcell('form_mech_diving' , 'Diving' , 'fimech_diving' ) ?>
320 </tr>
321 <tr>
322 <? echo cbcell('form_mech_overuse', 'Overuse', 'fimech_overuse' ) ?>
323 <td colspan='3' nowrap>
324 Other:
325 <input type='text' name='form_mech_othernon' size='10'
326 title='Describe other'
327 value='<? echo addslashes($row['fimech_othernon']) ?>' />
328 </td>
329 </tr>
330 </table>
331 </td>
332 </tr>
334 <tr bgcolor='#dddddd'>
335 <td colspan='2' align='center'><b>Conditions</b></td>
336 </tr>
338 <tr>
339 <td nowrap>Surface</td>
340 <td nowrap>
341 <table width='100%'>
342 <tr>
343 <? echo rbcell('form_surface', '1', 'Pitch' , 'fisurface') ?>
344 <? echo rbcell('form_surface', '2', 'Training' , 'fisurface') ?>
345 <? echo rbcell('form_surface', '3', 'Artificial' , 'fisurface') ?>
346 <? echo rbcell('form_surface', '4', 'Indoor' , 'fisurface') ?>
347 </tr>
348 <tr>
349 <? echo rbcell('form_surface', '5', 'Gym' , 'fisurface') ?>
350 <? echo rbcell('form_surface', '6', 'Other' , 'fisurface') ?>
351 <td width='25%'>&nbsp;</td>
352 <td width='25%'>&nbsp;</td>
353 </tr>
354 </table>
355 </td>
356 </tr>
358 <tr>
359 <td nowrap>Position</td>
360 <td nowrap>
361 <table width='100%'>
362 <tr>
363 <? echo rbcell('form_position', '1', 'Defender' , 'fiposition') ?>
364 <? echo rbcell('form_position', '2', 'Midfield Offensive', 'fiposition') ?>
365 <? echo rbcell('form_position', '3', 'Midfield Defensive', 'fiposition') ?>
366 <? echo rbcell('form_position', '4', 'Forward' , 'fiposition') ?>
367 </tr>
368 <tr>
369 <? echo rbcell('form_position', '5', 'Goal Keeper' , 'fiposition') ?>
370 <? echo rbcell('form_position', '6', 'Substitute' , 'fiposition') ?>
371 <td width='25%'>&nbsp;</td>
372 <td width='25%'>&nbsp;</td>
373 </tr>
374 </table>
375 </td>
376 </tr>
378 <tr>
379 <td nowrap>Footwear</td>
380 <td nowrap>
381 <table width='100%'>
382 <tr>
383 <? echo rbcell('form_footwear', '1', 'Molded Stud' , 'fifootwear') ?>
384 <? echo rbcell('form_footwear', '2', 'Detachable Stud', 'fifootwear') ?>
385 <? echo rbcell('form_footwear', '3', 'Indoor Shoes' , 'fifootwear') ?>
386 <? echo rbcell('form_footwear', '4', 'Blades' , 'fifootwear') ?>
387 </tr>
388 </table>
389 </td>
390 </tr>
392 <tr>
393 <td nowrap>Side of Injury</td>
394 <td nowrap>
395 <table width='100%'>
396 <tr>
397 <? echo rbcell('form_side', '1', 'Left' , 'fiside') ?>
398 <? echo rbcell('form_side', '2', 'Right' , 'fiside') ?>
399 <? echo rbcell('form_side', '3', 'Bilateral' , 'fiside') ?>
400 <? echo rbcell('form_side', '4', 'Not Applicable', 'fiside') ?>
401 </tr>
402 </table>
403 </td>
404 </tr>
406 <tr bgcolor='#dddddd'>
407 <td colspan='2' align='center'><b>Post Injury Sequelae</b></td>
408 </tr>
410 <tr>
411 <td nowrap>Removed from<br>Play/Training<br>after Injury</td>
412 <td nowrap>
413 <table width='100%'>
414 <tr>
415 <? echo rbcell('form_removed', '1', 'Immediately', 'firemoved') ?>
416 <? echo rbcell('form_removed', '2', 'Later' , 'firemoved') ?>
417 <? echo rbcell('form_removed', '3', 'Not at All' , 'firemoved') ?>
418 <td width='25%'>&nbsp;</td>
419 </tr>
420 </table>
421 </td>
422 </tr>
424 </table>
427 <input type='submit' name='bn_save' value='Save' />
428 &nbsp;
429 <input type='button' value='Cancel' onclick="location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
430 &nbsp;
431 <input type='button' value='Add Injury Diagnosis...' onclick='docoding();'
432 title='Add or change coding for this encounter'
433 style='background-color:#ffff00;' />
434 </p>
436 </center>
438 </form>
439 <?php
441 // TBD: If $alertmsg, display it with a JavaScript alert().
444 </body>
445 </html>