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) 2006-2007 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");
24 include_once('cia.inc.php');
28 if (! $encounter) { // comes from globals.php
29 die("Internal error: we do not seem to be in an encounter!");
32 function rbvalue($rbname) {
33 $tmp = $_POST[$rbname];
34 if (! $tmp) $tmp = '0';
38 function cbvalue($cbname) {
39 return $_POST[$cbname] ?
'1' : '0';
42 function invalue($inname) {
43 return (int) trim($_POST[$inname]);
46 function txvalue($txname) {
47 return "'" . trim($_POST[$txname]) . "'";
50 function rbinput($name, $value, $desc, $colname) {
52 $ret = "<input type='radio' name='$name' value='$value'";
53 if ($row[$colname] == $value) $ret .= " checked";
58 function rbcell($name, $value, $desc, $colname) {
59 return " <td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
62 function cbinput($name, $colname) {
64 $ret = "<input type='checkbox' name='$name' value='1'";
65 if ($row[$colname]) $ret .= " checked";
70 function cbcell($name, $desc, $colname) {
71 return " <td width='25%' nowrap>" . cbinput($name, $colname) .
75 // Generate HTML table entries for the designated set of radio buttons.
77 function genRadios($group, &$arr) {
79 foreach ($arr as $key => $value) {
81 if ($i) echo " </tr>\n";
84 echo rbcell("form_$group", $key, $value, "ci$group");
88 echo " <td width='25%'> </td>\n";
91 if ($i) echo " </tr>\n";
94 $formid = $_GET['id'];
96 // If Save was clicked, save the info.
98 if ($_POST['bn_save']) {
99 $fiinjmin = (int) $_POST['form_injmin'];
101 // If updating an existing form...
104 $query = "UPDATE form_cricket_injury_audit SET " .
105 "cicounty = " . rbvalue('form_county') . ", " .
106 "citeam = " . rbvalue('form_team') . ", " .
107 "ciduration = " . rbvalue('form_duration') . ", " .
108 "cirole = " . rbvalue('form_role') . ", " .
109 "cimatchtype = " . rbvalue('form_matchtype') . ", " .
110 "cicause = " . rbvalue('form_cause') . ", " .
111 "ciactivity = " . rbvalue('form_activity') . ", " .
112 "cibatside = " . rbvalue('form_batside') . ", " .
113 "cibowlside = " . rbvalue('form_bowlside') . ", " .
114 "cibowltype = " . rbvalue('form_bowltype') . " " .
115 "WHERE id = '$formid'";
116 sqlStatement($query);
119 // If adding a new form...
122 $query = "INSERT INTO form_cricket_injury_audit ( " .
123 "cicounty, citeam, ciduration, cirole, cimatchtype, cicause, " .
124 "ciactivity, cibatside, cibowlside, cibowltype " .
126 rbvalue('form_county') . ", " .
127 rbvalue('form_team') . ", " .
128 rbvalue('form_duration') . ", " .
129 rbvalue('form_role') . ", " .
130 rbvalue('form_matchtype') . ", " .
131 rbvalue('form_cause') . ", " .
132 rbvalue('form_activity') . ", " .
133 rbvalue('form_batside') . ", " .
134 rbvalue('form_bowlside') . ", " .
135 rbvalue('form_bowltype') . " " .
137 $newid = sqlInsert($query);
138 addForm($encounter, "Cricket Injury Audit", $newid, "cricket_injury_audit", $pid, $userauthorized);
141 formHeader("Redirecting....");
148 $row = sqlQuery ("SELECT * FROM form_cricket_injury_audit WHERE " .
149 "id = '$formid' AND activity = '1'") ;
154 <?php
html_header_show();?
>
155 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
157 .billcell
{ font
-family
: sans
-serif
; font
-size
: 10pt
}
160 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
162 <script language
="JavaScript">
164 // Pop up the coding window.
165 function docoding() {
166 var width
= screen
.width
- 50;
167 if (!isNaN(top
.screenX
)) {
168 width
-= top
.screenX
;
169 } else if (!isNaN(top
.screenLeft
)) {
170 width
-= top
.screenLeft
;
172 if (width
> 1000) width
= 1000;
173 dlgopen('../../patient_file/encounter/coding_popup.php', '_blank', width
, 550);
179 <body
<?
echo $top_bg_line;?
> topmargin
="0" rightmargin
="0" leftmargin
="2" bottommargin
="0" marginwidth
="2" marginheight
="0">
180 <form method
="post" action
="<?php echo $rootdir ?>/forms/cricket_injury_audit/new.php?id=<?php echo $formid ?>"
181 onsubmit
="return top.restoreSession()">
185 <p
class='title' style
='margin-top:8px;margin-bottom:8px'>Cricket Injury Statistics
</p
>
187 <table border
='1' width
='98%'>
189 <tr bgcolor
='#dddddd'>
190 <td colspan
='2' align
='center'><b
>Match Information
</b
></td
>
194 <td nowrap
>County
</td
>
197 <?php
genRadios('county', $arr_county); ?
>
203 <td nowrap
>Team ATI
</td
>
206 <?php
genRadios('team', $arr_team); ?
>
212 <td nowrap
>Match Duration
</td
>
215 <?php
genRadios('duration', $arr_duration); ?
>
221 <td nowrap
>Main Role in Team
</td
>
224 <?php
genRadios('role', $arr_role); ?
>
230 <td nowrap
>Injured In
</td
>
233 <?php
genRadios('matchtype', $arr_matchtype); ?
>
238 <tr bgcolor
='#dddddd'>
239 <td colspan
='2' align
='center'><b
>Mechanism of Injury
</b
></td
>
243 <td nowrap
>Cause
</td
>
246 <?php
genRadios('cause', $arr_cause); ?
>
252 <td nowrap
>Activity ATI
</td
>
255 <?php
genRadios('activity', $arr_activity); ?
>
260 <tr bgcolor
='#dddddd'>
261 <td colspan
='2' align
='center'><b
>Conditions
</b
></td
>
265 <td nowrap
>Batting Side
</td
>
268 <?php
genRadios('batside', $arr_batside); ?
>
274 <td nowrap
>Bowling Side
</td
>
277 <?php
genRadios('bowlside', $arr_bowlside); ?
>
283 <td nowrap
>Bowling Type
</td
>
286 <?php
genRadios('bowltype', $arr_bowltype); ?
>
294 <input type
='submit' name
='bn_save' value
='Save' />
296 <input type
='button' value
='Cancel' onclick
="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
298 <input type
='button' value
='Add Injury Diagnosis...' onclick
='docoding();'
299 title
='Add or change coding for this encounter'
300 style
='background-color:#ffff00;' />
308 // TBD: If $alertmsg, display it with a JavaScript alert().