Contributed GYM Forms, some of the table.sql files include inserts into list_options...
[openemr.git] / contrib / forms / vaginitis_soap / view.php
blob783e299cca29c7cfde5bc92d7c37268b73611486
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_vaginitis_soap';
17 /** CHANGE THIS name to the name of your form. **/
18 $form_name = 'Vaginitis Complaints';
20 /** CHANGE THIS to match the folder you created for this form. **/
21 $form_folder = 'vaginitis_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 'vaginitis_complaints' =>
43 array( 'field_id' => 'vaginitis_complaints',
44 'data_type' => '25',
45 'fld_length' => '140',
46 'description' => '',
47 'list_id' => 'Vaginitis_Complaints' ),
48 'other' =>
49 array( 'field_id' => 'other',
50 'data_type' => '3',
51 'fld_length' => '151',
52 'max_length' => '4',
53 'description' => '',
54 'list_id' => '' ),
55 'duration' =>
56 array( 'field_id' => 'duration',
57 'data_type' => '2',
58 'fld_length' => '163',
59 'max_length' => '255',
60 'description' => '',
61 'list_id' => '' ),
62 'objective_exam' =>
63 array( 'field_id' => 'objective_exam',
64 'data_type' => '25',
65 'fld_length' => '140',
66 'description' => '',
67 'list_id' => 'Vaginitis_Exam' ),
68 'vaginitis' =>
69 array( 'field_id' => 'vaginitis',
70 'data_type' => '25',
71 'fld_length' => '140',
72 'description' => '',
73 'list_id' => 'Vaginitis_Diagnosis' ),
74 'plan_medications' =>
75 array( 'field_id' => 'plan_medications',
76 'data_type' => '25',
77 'fld_length' => '140',
78 'description' => '',
79 'list_id' => 'Vaginitis_Medications' ),
80 'plan_behavior_modification' =>
81 array( 'field_id' => 'plan_behavior_modification',
82 'data_type' => '3',
83 'fld_length' => '40',
84 'max_length' => '4',
85 'description' => '',
86 'list_id' => '' ),
87 'plan_cultures' =>
88 array( 'field_id' => 'plan_cultures',
89 'data_type' => '25',
90 'fld_length' => '140',
91 'description' => '',
92 'list_id' => 'Vaginitis_Cultures' ),
93 'plan_other' =>
94 array( 'field_id' => 'plan_other',
95 'data_type' => '3',
96 'fld_length' => '40',
97 'max_length' => '4',
98 'description' => '',
99 'list_id' => '' )
101 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=update&amp;return=encounter&amp;id='.$_GET['id'];
102 if ($_GET['mode']) {
103 if ($_GET['mode']=='noencounter') {
104 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&amp;return=show&amp;id='.$_GET['id'];
105 $returnurl = 'show.php';
108 else
110 $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
114 /* define check field functions. used for translating from fields to html viewable strings */
116 function chkdata_Txt(&$record, $var) {
117 return htmlspecialchars($record{"$var"},ENT_QUOTES);
120 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
121 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
122 <head>
124 <!-- declare this document as being encoded in UTF-8 -->
125 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
127 <!-- supporting javascript code -->
128 <!-- for dialog -->
129 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js"></script>
130 <!-- For jquery, required by the save, discard, and print buttons. -->
131 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script>
132 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script>
134 <!-- Global Stylesheet -->
135 <link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css"/>
136 <!-- Form Specific Stylesheet. -->
137 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css" type="text/css"/>
141 <script type="text/javascript">
142 // this line is to assist the calendar text boxes
143 var mypcc = '<?php echo $GLOBALS['phone_country_code']; ?>';
145 <!-- FIXME: this needs to detect access method, and construct a URL appropriately! -->
146 function PrintForm() {
147 newwin = window.open("<?php echo $rootdir.'/forms/'.$form_folder.'/print.php?id='.$_GET['id']; ?>","print_<?php echo $form_name; ?>");
150 </script>
151 <title><?php echo htmlspecialchars('View '.$form_name); ?></title>
153 </head>
154 <body class="body_top">
156 <div id="title">
157 <a href="<?php echo $returnurl; ?>" onclick="top.restoreSession()">
158 <span class="title"><?php htmlspecialchars(xl($form_name,'e')); ?></span>
159 <span class="back">(<?php xl('Back','e'); ?>)</span>
160 </a>
161 </div>
163 <form method="post" action="<?php echo $submiturl; ?>" id="<?php echo $form_folder; ?>">
165 <!-- Save/Cancel buttons -->
166 <div id="top_buttons" class="top_buttons">
167 <fieldset class="top_buttons">
168 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
169 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
170 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
171 </fieldset>
172 </div><!-- end top_buttons -->
174 <!-- container for the main body of the form -->
175 <div id="form_container">
176 <fieldset>
178 <!-- display the form's manual based fields -->
179 <table border='0' cellpadding='0' width='100%'>
180 <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>
181 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Vaginitis Complaints','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['vaginitis_complaints'], $xyzzy['vaginitis_complaints']); ?></td><!-- generating empties --><td class='emptycell' colspan='1'></td></tr>
182 <!-- 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>
183 <!-- 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>
184 </table></div>
185 </td></tr> <!-- end section subjective -->
186 <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>
187 <!-- 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['objective_exam'], $xyzzy['objective_exam']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
188 </table></div>
189 </td></tr> <!-- end section objective -->
190 <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>
191 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Vginitis','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['vaginitis'], $xyzzy['vaginitis']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
192 </table></div>
193 </td></tr> <!-- end section assessment -->
194 <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>
195 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Medications','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['plan_medications'], $xyzzy['plan_medications']); ?></td><!-- generating empties --><td class='emptycell' colspan='1'></td></tr>
196 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Behavior Modification','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['plan_behavior_modification'], $xyzzy['plan_behavior_modification']); ?></td><!-- generating empties --><td class='emptycell' colspan='1'></td></tr>
197 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Cultures','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['plan_cultures'], $xyzzy['plan_cultures']); ?></td><!-- generating empties --><td class='emptycell' colspan='1'></td></tr>
198 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><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['plan_other'], $xyzzy['plan_other']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
199 </table></div>
200 </td></tr> <!-- end section plan -->
201 </table>
203 </fieldset>
204 </div> <!-- end form_container -->
206 <!-- Save/Cancel buttons -->
207 <div id="bottom_buttons" class="button_bar">
208 <fieldset>
209 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>" />
210 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>" />
211 <input type="button" class="print" value="<?php xl('Print','e'); ?>" />
212 </fieldset>
213 </div><!-- end bottom_buttons -->
214 </form>
215 <script type="text/javascript">
216 // jQuery stuff to make the page a little easier to use
218 $(document).ready(function(){
219 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
220 $(".dontsave").click(function() { location.href='<?php echo $returnurl; ?>'; });
221 $(".print").click(function() { PrintForm(); });
223 $(".sectionlabel input").click( function() {
224 var section = $(this).attr("data-section");
225 if ( $(this).attr('checked' ) ) {
226 $("#"+section).show();
227 } else {
228 $("#"+section).hide();
232 $(".sectionlabel input").attr( 'checked', 'checked' );
233 $(".section").show();
235 </script>
236 </body>
237 </html>