Contributed GYM Forms, some of the table.sql files include inserts into list_options...
[openemr.git] / contrib / forms / urinary_soap / view.php
blob251f13666d941f69fc6cd3a69ead34be22ca0fcf
1 <?php
2 /*
3 * The page shown when the user requests to see this form. Allows the user to edit form contents, and save. has a button for printing the saved form contents.
4 */
6 /* for $GLOBALS[], ?? */
7 require_once('../../globals.php');
8 /* for acl_check(), ?? */
9 require_once($GLOBALS['srcdir'].'/api.inc');
10 /* for generate_form_field, ?? */
11 require_once($GLOBALS['srcdir'].'/options.inc.php');
12 /* note that we cannot include options_listadd.inc here, as it generates code before the <html> tag */
14 /** CHANGE THIS - name of the database table associated with this form **/
15 $table_name = 'form_urinary_soap';
17 /** CHANGE THIS name to the name of your form. **/
18 $form_name = 'Urinary Symptoms';
20 /** CHANGE THIS to match the folder you created for this form. **/
21 $form_folder = 'urinary_soap';
23 /* Check the access control lists to ensure permissions to this page */
24 $thisauth = acl_check('patients', 'med');
25 if (!$thisauth) {
26 die($form_name.': Access Denied.');
28 /* perform a squad check for pages touching patients, if we're in 'athletic team' mode */
29 if ($GLOBALS['athletic_team']!='false') {
30 $tmp = getPatientData($pid, 'squad');
31 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
32 $thisauth = 0;
35 if ($thisauth != 'write' && $thisauth != 'addonly')
36 die($form_name.': Adding is not authorized.');
37 /* Use the formFetch function from api.inc to load the saved record */
38 $xyzzy = formFetch($table_name, $_GET['id']);
40 /* in order to use the layout engine's draw functions, we need a fake table of layout data. */
41 $manual_layouts = array(
42 'urinary_complaints' =>
43 array( 'field_id' => 'urinary_complaints',
44 'data_type' => '25',
45 'fld_length' => '140',
46 'description' => '',
47 'list_id' => 'Urinary_Complaints' ),
48 'previous_cultures' =>
49 array( 'field_id' => 'previous_cultures',
50 'data_type' => '2',
51 'fld_length' => '151',
52 'max_length' => '255',
53 'description' => '',
54 'list_id' => '' ),
55 'other' =>
56 array( 'field_id' => 'other',
57 'data_type' => '3',
58 'fld_length' => '151',
59 'max_length' => '4',
60 'description' => '',
61 'list_id' => '' ),
62 'duration' =>
63 array( 'field_id' => 'duration',
64 'data_type' => '2',
65 'fld_length' => '140',
66 'max_length' => '255',
67 'description' => '',
68 'list_id' => '' ),
69 'exam' =>
70 array( 'field_id' => 'exam',
71 'data_type' => '25',
72 'fld_length' => '140',
73 'description' => '',
74 'list_id' => 'Urinary_Exam' ),
75 'diagnosis' =>
76 array( 'field_id' => 'diagnosis',
77 'data_type' => '25',
78 'fld_length' => '140',
79 'description' => '',
80 'list_id' => 'Urinary_Diagnosis' ),
81 'plan' =>
82 array( 'field_id' => 'plan',
83 'data_type' => '25',
84 'fld_length' => '140',
85 'description' => '',
86 'list_id' => 'Urinary_Plans' )
88 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=update&amp;return=encounter&amp;id='.$_GET['id'];
89 if ($_GET['mode']) {
90 if ($_GET['mode']=='noencounter') {
91 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&amp;return=show&amp;id='.$_GET['id'];
92 $returnurl = 'show.php';
95 else
97 $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
101 /* define check field functions. used for translating from fields to html viewable strings */
103 function chkdata_Txt(&$record, $var) {
104 return htmlspecialchars($record{"$var"},ENT_QUOTES);
107 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
108 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
109 <head>
111 <!-- declare this document as being encoded in UTF-8 -->
112 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
114 <!-- supporting javascript code -->
115 <!-- for dialog -->
116 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js"></script>
117 <!-- For jquery, required by the save, discard, and print buttons. -->
118 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script>
119 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script>
121 <!-- Global Stylesheet -->
122 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css"/>
123 <!-- Form Specific Stylesheet. -->
124 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css" type="text/css"/>
128 <script type="text/javascript">
129 // this line is to assist the calendar text boxes
130 var mypcc = '<?php echo $GLOBALS['phone_country_code']; ?>';
132 <!-- FIXME: this needs to detect access method, and construct a URL appropriately! -->
133 function PrintForm() {
134 newwin = window.open("<?php echo $rootdir.'/forms/'.$form_folder.'/print.php?id='.$_GET['id']; ?>","print_<?php echo $form_name; ?>");
137 </script>
138 <title><?php echo htmlspecialchars('View '.$form_name); ?></title>
140 </head>
141 <body class="body_top">
143 <div id="title">
144 <a href="<?php echo $returnurl; ?>" onclick="top.restoreSession()">
145 <span class="title"><?php htmlspecialchars(xl($form_name,'e')); ?></span>
146 <span class="back">(<?php xl('Back','e'); ?>)</span>
147 </a>
148 </div>
150 <form method="post" action="<?php echo $submiturl; ?>" id="<?php echo $form_folder; ?>">
152 <!-- Save/Cancel buttons -->
153 <div id="top_buttons" class="top_buttons">
154 <fieldset class="top_buttons">
155 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
156 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
157 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
158 </fieldset>
159 </div><!-- end top_buttons -->
161 <!-- container for the main body of the form -->
162 <div id="form_container">
163 <fieldset>
165 <!-- display the form's manual based fields -->
166 <table border='0' cellpadding='0' width='100%'>
167 <tr><td class='sectionlabel'><input type='checkbox' id='form_cb_m_1' value='1' data-section="subjective" checked="checked" />Subjective</td></tr><tr><td><div id="subjective" class='section'><table>
168 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Urinary Complaints','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['urinary_complaints'], $xyzzy['urinary_complaints']); ?></td><!-- generating empties --><td class='emptycell' colspan='1'></td></tr>
169 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Previous Cultures','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['previous_cultures'], $xyzzy['previous_cultures']); ?></td><!-- generating empties --><td class='emptycell' colspan='1'></td></tr>
170 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Other','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['other'], $xyzzy['other']); ?></td><!-- generating empties --><td class='emptycell' colspan='1'></td></tr>
171 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Duration','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['duration'], $xyzzy['duration']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
172 </table></div>
173 </td></tr> <!-- end section subjective -->
174 <tr><td class='sectionlabel'><input type='checkbox' id='form_cb_m_2' value='1' data-section="objective" checked="checked" />Objective</td></tr><tr><td><div id="objective" class='section'><table>
175 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Exam','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['exam'], $xyzzy['exam']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
176 </table></div>
177 </td></tr> <!-- end section objective -->
178 <tr><td class='sectionlabel'><input type='checkbox' id='form_cb_m_3' value='1' data-section="assessment" checked="checked" />Assessment</td></tr><tr><td><div id="assessment" class='section'><table>
179 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Diagnosis','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['diagnosis'], $xyzzy['diagnosis']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
180 </table></div>
181 </td></tr> <!-- end section assessment -->
182 <tr><td class='sectionlabel'><input type='checkbox' id='form_cb_m_4' value='1' data-section="plan" checked="checked" />Plan</td></tr><tr><td><div id="plan" class='section'><table>
183 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Plan','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['plan'], $xyzzy['plan']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
184 </table></div>
185 </td></tr> <!-- end section plan -->
186 </table>
188 </fieldset>
189 </div> <!-- end form_container -->
191 <!-- Save/Cancel buttons -->
192 <div id="bottom_buttons" class="button_bar">
193 <fieldset>
194 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
195 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
196 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
197 </fieldset>
198 </div><!-- end bottom_buttons -->
199 </form>
200 <script type="text/javascript">
201 // jQuery stuff to make the page a little easier to use
203 $(document).ready(function(){
204 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
205 $(".dontsave").click(function() { location.href='<?php echo $returnurl; ?>'; });
206 $(".print").click(function() { PrintForm(); });
208 $(".sectionlabel input").click( function() {
209 var section = $(this).attr("data-section");
210 if ( $(this).attr('checked' ) ) {
211 $("#"+section).show();
212 } else {
213 $("#"+section).hide();
217 $(".sectionlabel input").attr( 'checked', 'checked' );
218 $(".section").show();
220 </script>
221 </body>
222 </html>