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_pelvic_soap';
17 /** CHANGE THIS name to the name of your form. **/
20 /** CHANGE THIS to match the folder you created for this form. **/
21 $form_folder = 'pelvic_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 'pelvic_complaints' =>
43 array( 'field_id' => 'pelvic_complaints',
45 'fld_length' => '140',
47 'list_id' => 'Pelvic_Complaints' ),
49 array( 'field_id' => 'pelvic_exam',
51 'fld_length' => '140',
53 'list_id' => 'Pelvic_Exam' ),
54 'pelvic_assessment' =>
55 array( 'field_id' => 'pelvic_assessment',
57 'fld_length' => '140',
59 'list_id' => 'Pelvic_Assessment' ),
61 array( 'field_id' => 'pelvic_plan',
63 'fld_length' => '140',
65 'list_id' => 'Pelvic_Plan' ),
67 array( 'field_id' => 'plan_discussion',
69 'fld_length' => '151',
74 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=update&return=encounter&id='.$_GET['id'];
76 if ($_GET['mode']=='noencounter') {
77 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&return=show&id='.$_GET['id'];
78 $returnurl = 'show.php';
83 $returnurl = $GLOBALS['concurrent_layout'] ?
'encounter_top.php' : 'patient_encounter.php';
87 /* define check field functions. used for translating from fields to html viewable strings */
89 function chkdata_Txt(&$record, $var) {
90 return htmlspecialchars($record{"$var"},ENT_QUOTES
);
93 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
94 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en">
97 <!-- declare this document
as being encoded in UTF
-8 -->
98 <meta http
-equiv
="Content-Type" content
="text/html;charset=utf-8" ></meta
>
100 <!-- supporting javascript code
-->
102 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js"></script
>
103 <!-- For jquery
, required by the save
, discard
, and print buttons
. -->
104 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script
>
105 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script
>
107 <!-- Global Stylesheet
-->
108 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css"/>
109 <!-- Form Specific Stylesheet
. -->
110 <link rel
="stylesheet" href
="../../forms/<?php echo $form_folder; ?>/style.css" type
="text/css"/>
114 <script type
="text/javascript">
115 // this line is to assist the calendar text boxes
116 var mypcc
= '<?php echo $GLOBALS['phone_country_code
']; ?>';
118 <!-- FIXME
: this needs to detect access method
, and construct a URL appropriately
! -->
119 function PrintForm() {
120 newwin
= window
.open("<?php echo $rootdir.'/forms/'.$form_folder.'/print.php?id='.$_GET['id']; ?>","print_<?php echo $form_name; ?>");
124 <title
><?php
echo htmlspecialchars('View '.$form_name); ?
></title
>
127 <body
class="body_top">
130 <a href
="<?php echo $returnurl; ?>" onclick
="top.restoreSession()">
131 <span
class="title"><?php
htmlspecialchars(xl($form_name,'e')); ?
></span
>
132 <span
class="back">(<?php
xl('Back','e'); ?
>)</span
>
136 <form method
="post" action
="<?php echo $submiturl; ?>" id
="<?php echo $form_folder; ?>">
138 <!-- Save
/Cancel buttons
-->
139 <div id
="top_buttons" class="top_buttons">
140 <fieldset
class="top_buttons">
141 <input type
="button" class="save" value
="<?php xl('Save Changes','e'); ?>" />
142 <input type
="button" class="dontsave" value
="<?php xl('Don\'t Save Changes','e'); ?>" />
143 <input type
="button" class="print" value
="<?php xl('Print','e'); ?>" />
145 </div
><!-- end top_buttons
-->
147 <!-- container
for the main body of the form
-->
148 <div id
="form_container">
151 <!-- display the form
's manual based fields -->
152 <table border='0' cellpadding='0' width='100%
'>
153 <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>
154 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel
' colspan='1'><?php echo xl_layout_label('Complaints
','e
').':'; ?></td><td class='text data
' colspan='1'><?php echo generate_form_field($manual_layouts['pelvic_complaints
'], $xyzzy['pelvic_complaints
']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
156 </td></tr> <!-- end section subjective -->
157 <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>
158 <!-- 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['pelvic_exam
'], $xyzzy['pelvic_exam
']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
160 </td></tr> <!-- end section objective -->
161 <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>
162 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel
' colspan='1'><?php echo xl_layout_label('Assessment
','e
').':'; ?></td><td class='text data
' colspan='1'><?php echo generate_form_field($manual_layouts['pelvic_assessment
'], $xyzzy['pelvic_assessment
']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
164 </td></tr> <!-- end section assessment -->
165 <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>
166 <!-- called consumeRows 012--> <!-- generating 2 cells and calling --><td class='fieldlabel
' colspan='1'><?php echo xl_layout_label('Pelvic Plan
','e
').':'; ?></td><td class='text data
' colspan='1'><?php echo generate_form_field($manual_layouts['pelvic_plan
'], $xyzzy['pelvic_plan
']); ?></td><!-- generating empties --><td class='emptycell
' colspan='1'></td></tr>
167 <!-- called consumeRows 012--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel
' colspan='1'><?php echo xl_layout_label('Discussion
','e
').':'; ?></td><td class='text data
' colspan='1'><?php echo generate_form_field($manual_layouts['plan_discussion
'], $xyzzy['plan_discussion
']); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
169 </td></tr> <!-- end section plan -->
173 </div> <!-- end form_container -->
175 <!-- Save/Cancel buttons -->
176 <div id="bottom_buttons" class="button_bar">
178 <input type="button" class="save" value="<?php xl('Save Changes
','e
'); ?>" />
179 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes
','e
'); ?>" />
180 <input type="button" class="print" value="<?php xl('Print','e
'); ?>" />
182 </div><!-- end bottom_buttons -->
184 <script type="text/javascript">
185 // jQuery stuff to make the page a little easier to use
187 $(document).ready(function(){
188 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
189 $(".dontsave").click(function() { location.href='<?php
echo $returnurl; ?
>'; });
190 $(".print").click(function() { PrintForm(); });
192 $(".sectionlabel input").click( function() {
193 var section = $(this).attr("data-section");
194 if ( $(this).attr('checked
' ) ) {
195 $("#"+section).show();
197 $("#"+section).hide();
201 $(".sectionlabel input").attr( 'checked
', 'checked
' );
202 $(".section").show();