This example form can be used as a template
[openemr.git] / interface / forms / example / view.php
bloba92e324afbe9df005dabc20c17b166ed8af74d19
1 <?php
2 /*
3 * Sports Physical Form created by Jason Morrill: January 2009
4 */
6 include_once("../../globals.php");
7 include_once("$srcdir/api.inc");
9 /** CHANGE THIS - name of the database table associated with this form **/
10 $table_name = "form_example";
12 /** CHANGE THIS name to the name of your form **/
13 $form_name = "My Example Form";
15 /** CHANGE THIS to match the folder you created for this form **/
16 $form_folder = "example";
18 formHeader("Form: ".$form_name);
19 $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
21 /* load the saved record */
22 $record = formFetch($table_name, $_GET["id"]);
24 /* remove the time-of-day from the date fields */
25 if ($record['form_date'] != "") {
26 $dateparts = split(" ", $record['form_date']);
27 $record['form_date'] = $dateparts[0];
29 if ($record['dob'] != "") {
30 $dateparts = split(" ", $record['dob']);
31 $record['dob'] = $dateparts[0];
33 if ($record['sig_date'] != "") {
34 $dateparts = split(" ", $record['sig_date']);
35 $record['sig_date'] = $dateparts[0];
39 <html><head>
40 <?php html_header_show();?>
42 <!-- supporting javascript code -->
43 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script>
44 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script>
46 <!-- page styles -->
47 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
48 <link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css" type="text/css">
50 <!-- pop up calendar -->
51 <style type="text/css">@import url(<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.css);</style>
52 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script>
53 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_en.js"></script>
54 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script>
56 <script language="JavaScript">
57 // this line is to assist the calendar text boxes
58 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
60 function PrintForm() {
61 newwin = window.open("<?php echo "http://".$_SERVER['SERVER_NAME'].$rootdir."/forms/".$form_folder."/print.php?id=".$_GET["id"]; ?>","mywin");
63 </script>
65 </head>
67 <body class="body_top">
69 <?php echo date("F d, Y", time()); ?>
71 <form method=post action="<?php echo $rootdir;?>/forms/<?php echo $form_folder; ?>/save.php?mode=update&id=<?php echo $_GET["id"];?>" name="my_form">
72 <span class="title"><?php xl($form_name,'e'); ?></span><br>
74 <!-- Save/Cancel links -->
75 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>"> &nbsp;
76 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>"> &nbsp;
77 <input type="button" class="printform" value="<?php xl('Print','e'); ?>"> &nbsp;
79 <!-- container for the main body of the form -->
80 <div id="form_container">
82 <div id="general">
83 <table>
84 <tr><td>
85 Date:
86 <input type='text' size='10' name='form_date' id='form_date'
87 value='<?php echo stripslashes($record['form_date']);?>'
88 title='<?php xl('yyyy-mm-dd','e'); ?>'
89 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
90 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
91 id='img_form_date' border='0' alt='[?]' style='cursor:pointer;cursor:hand'
92 title='<?php xl('Click here to choose a date','e'); ?>'>
93 </td></tr>
94 <tr><td>
95 Name: <input id="name" name="name" type="text" size="50" maxlength="250" value="<?php echo stripslashes($record['name']);?>">
96 Date of Birth:
97 <input type='text' size='10' name='dob' id='dob'
98 value='<?php echo stripslashes($record['dob']);?>'
99 title='<?php xl('yyyy-mm-dd Date of Birth','e'); ?>'
100 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc);'
102 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
103 id='img_dob' border='0' alt='[?]' style='cursor:pointer;cursor:hand'
104 title='<?php xl('Click here to choose a date','e'); ?>'>
105 </td></tr>
106 <tr><td>
107 Phone: <input name="phone" id="phone" type="text" size="15" maxlength="15" value="<?php echo stripslashes($record['phone']);?>">
108 </td></tr>
109 <tr><td>
110 Address: <input name="address" id="address" type="text" size="80" maxlength="250" value="<?php echo stripslashes($record['address']);?>">
111 </td></tr>
112 </table>
113 </div>
115 <div id="bottom">
116 Use this space to express notes <br>
117 <textarea name="notes" id="notes" cols="80" rows="4"><?php echo stripslashes($record['notes']);?></textarea>
118 <br><br>
119 <div style="text-align:right;">
120 Signature?
121 <input type="radio" id="sig" name="sig" value="y" <?php if ($record["sig"] == 'y') echo "CHECKED"; ?>>Yes
123 <input type="radio" id="sig" name="sig" value="n" <?php if ($record["sig"] == 'n') echo "CHECKED"; ?>>No
124 &nbsp;&nbsp;
125 Date of signature:
126 <input type='text' size='10' name='sig_date' id='sig_date'
127 value='<?php echo stripslashes($record['sig_date']);?>'
128 title='<?php xl('yyyy-mm-dd','e'); ?>'
129 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
130 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
131 id='img_sig_date' border='0' alt='[?]' style='cursor:pointer;cursor:hand'
132 title='<?php xl('Click here to choose a date','e'); ?>'>
133 </div>
134 </div>
136 </div> <!-- end form_container -->
138 <input type="button" class="save" value="<?php xl('Save Changes','e'); ?>"> &nbsp;
139 <input type="button" class="dontsave" value="<?php xl('Don\'t Save Changes','e'); ?>"> &nbsp;
140 <input type="button" class="printform" value="<?php xl('Print','e'); ?>"> &nbsp;
142 </form>
144 </body>
146 <script language="javascript">
147 /* required for popup calendar */
148 Calendar.setup({inputField:"dob", ifFormat:"%Y-%m-%d", button:"img_dob"});
149 Calendar.setup({inputField:"form_date", ifFormat:"%Y-%m-%d", button:"img_form_date"});
150 Calendar.setup({inputField:"sig_date", ifFormat:"%Y-%m-%d", button:"img_sig_date"});
152 // jQuery stuff to make the page a little easier to use
154 $(document).ready(function(){
155 $(".save").click(function() { top.restoreSession(); document.my_form.submit(); });
156 $(".dontsave").click(function() { location.href='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
157 $(".printform").click(function() { PrintForm(); });
160 </script>
162 </html>