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.
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');
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']))
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',
45 'fld_length' => '140',
47 'list_id' => 'Vaginitis_Complaints' ),
49 array( 'field_id' => 'other',
51 'fld_length' => '151',
56 array( 'field_id' => 'duration',
58 'fld_length' => '163',
59 'max_length' => '255',
63 array( 'field_id' => 'objective_exam',
65 'fld_length' => '140',
67 'list_id' => 'Vaginitis_Exam' ),
69 array( 'field_id' => 'vaginitis',
71 'fld_length' => '140',
73 'list_id' => 'Vaginitis_Diagnosis' ),
75 array( 'field_id' => 'plan_medications',
77 'fld_length' => '140',
79 'list_id' => 'Vaginitis_Medications' ),
80 'plan_behavior_modification' =>
81 array( 'field_id' => 'plan_behavior_modification',
88 array( 'field_id' => 'plan_cultures',
90 'fld_length' => '140',
92 'list_id' => 'Vaginitis_Cultures' ),
94 array( 'field_id' => 'plan_other',
101 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=update&return=encounter&id='.$_GET['id'];
103 if ($_GET['mode']=='noencounter') {
104 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&return=show&id='.$_GET['id'];
105 $returnurl = 'show.php';
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">
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
-->
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; ?>");
151 <title
><?php
echo htmlspecialchars('View '.$form_name); ?
></title
>
154 <body
class="body_top">
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
>
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'); ?>" />
172 </div
><!-- end top_buttons
-->
174 <!-- container
for the main body of the form
-->
175 <div id
="form_container">
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>
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>
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>
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>
200 </td></tr> <!-- end section plan -->
204 </div> <!-- end form_container -->
206 <!-- Save/Cancel buttons -->
207 <div id="bottom_buttons" class="button_bar">
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
'); ?>" />
213 </div><!-- end bottom_buttons -->
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();
228 $("#"+section).hide();
232 $(".sectionlabel input").attr( 'checked
', 'checked
' );
233 $(".section").show();