3 * The page shown when the user requests a new form. allows the user to enter form contents, and save.
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 to the name of your form. **/
17 /** CHANGE THIS to match the folder you created for this form. **/
18 $form_folder = 'pelvic_soap';
20 /* Check the access control lists to ensure permissions to this page */
21 $thisauth = acl_check('patients', 'med');
23 die($form_name.': Access Denied.');
25 /* perform a squad check for pages touching patients, if we're in 'athletic team' mode */
26 if ($GLOBALS['athletic_team']!='false') {
27 $tmp = getPatientData($pid, 'squad');
28 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
32 if ($thisauth != 'write' && $thisauth != 'addonly')
33 die($form_name.': Adding is not authorized.');
34 /* in order to use the layout engine's draw functions, we need a fake table of layout data. */
35 $manual_layouts = array(
36 'pelvic_complaints' =>
37 array( 'field_id' => 'pelvic_complaints',
39 'fld_length' => '140',
41 'list_id' => 'Pelvic_Complaints' ),
43 array( 'field_id' => 'pelvic_exam',
45 'fld_length' => '140',
47 'list_id' => 'Pelvic_Exam' ),
48 'pelvic_assessment' =>
49 array( 'field_id' => 'pelvic_assessment',
51 'fld_length' => '140',
53 'list_id' => 'Pelvic_Assessment' ),
55 array( 'field_id' => 'pelvic_plan',
57 'fld_length' => '140',
59 'list_id' => 'Pelvic_Plan' ),
61 array( 'field_id' => 'plan_discussion',
63 'fld_length' => '151',
68 $submiturl = $GLOBALS['rootdir'].'/forms/'.$form_folder.'/save.php?mode=new&return=encounter';
69 /* no get logic here */
70 $returnurl = $GLOBALS['concurrent_layout'] ?
'encounter_top.php' : 'patient_encounter.php';
72 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
73 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en">
76 <!-- declare this document
as being encoded in UTF
-8 -->
77 <meta http
-equiv
="Content-Type" content
="text/html;charset=utf-8" ></meta
>
79 <!-- supporting javascript code
-->
81 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js"></script
>
82 <!-- For jquery
, required by the save
and discard buttons
. -->
83 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script
>
84 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script
>
86 <!-- Global Stylesheet
-->
87 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css"/>
88 <!-- Form Specific Stylesheet
. -->
89 <link rel
="stylesheet" href
="../../forms/<?php echo $form_folder; ?>/style.css" type
="text/css"/>
91 <!-- pop up calendar
-->
92 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot']; ?
>/library
/dynarch_calendar
.css
);</style
>
93 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.js"></script
>
94 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
95 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar_setup.js"></script
>
97 <script type
="text/javascript">
98 // this line is to assist the calendar text boxes
99 var mypcc
= '<?php echo $GLOBALS['phone_country_code
']; ?>';
101 <!-- a validator
for all the fields expected in this form
-->
102 function validate() {
106 <!-- a callback
for validating field contents
. executed at submission time
. -->
107 function submitme() {
108 var f
= document
.forms
[0];
110 top
.restoreSession();
119 <title
><?php
echo htmlspecialchars('New '.$form_name); ?
></title
>
122 <body
class="body_top">
125 <a href
="<?php echo $returnurl; ?>" onclick
="top.restoreSession()">
126 <span
class="title"><?php
xl($form_name,'e'); ?
></span
>
127 <span
class="back">(<?php
xl('Back','e'); ?
>)</span
>
131 <form method
="post" action
="<?php echo $submiturl; ?>" id
="<?php echo $form_folder; ?>">
133 <!-- Save
/Cancel buttons
-->
134 <div id
="top_buttons" class="top_buttons">
135 <fieldset
class="top_buttons">
136 <input type
="button" class="save" value
="<?php xl('Save','e'); ?>" />
137 <input type
="button" class="dontsave" value
="<?php xl('Don\'t Save','e'); ?>" />
139 </div
><!-- end top_buttons
-->
141 <!-- container
for the main body of the form
-->
142 <div id
="form_container">
145 <!-- display the form
's manual based fields -->
146 <table border='0' cellpadding='0' width='100%
'>
147 <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>
148 <!-- 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
'], ''); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
150 </td></tr> <!-- end section subjective -->
151 <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>
152 <!-- 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
'], ''); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
154 </td></tr> <!-- end section objective -->
155 <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>
156 <!-- 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
'], ''); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
158 </td></tr> <!-- end section assessment -->
159 <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>
160 <!-- 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
'], ''); ?></td><!-- generating empties --><td class='emptycell
' colspan='1'></td></tr>
161 <!-- 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
'], ''); ?></td><!-- called consumeRows 212--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
163 </td></tr> <!-- end section plan -->
167 </div> <!-- end form_container -->
169 <!-- Save/Cancel buttons -->
170 <div id="bottom_buttons" class="button_bar">
172 <input type="button" class="save" value="<?php xl('Save
','e
'); ?>" />
173 <input type="button" class="dontsave" value="<?php xl('Don\'t Save
','e
'); ?>" />
175 </div><!-- end bottom_buttons -->
177 <script type="text/javascript">
178 // jQuery stuff to make the page a little easier to use
180 $(document).ready(function(){
181 $(".save").click(function() { top.restoreSession(); document.forms["<?php echo $form_folder; ?>"].submit(); });
182 $(".dontsave").click(function() { location.href='<?php
echo "$rootdir/patient_file/encounter/$returnurl"; ?
>'; });
184 $(".sectionlabel input").click( function() {
185 var section = $(this).attr("data-section");
186 if ( $(this).attr('checked
' ) ) {
187 $("#"+section).show();
189 $("#"+section).hide();
193 $(".sectionlabel input").attr( 'checked
', 'checked
' );
194 $(".section").show();