UTF8 encoding support
[openemr.git] / contrib / forms / podiatry / view.php
blob56002c384b652536732a53449f6ec47319ba89ce
1 <?php
2 //////////////////////////////////////////////////////////////////////
3 // ------------------ DO NOT MODIFY VIEW.PHP !!! ---------------------
4 // View.php is an exact duplicate of new.php. If you wish to make
5 // any changes, then change new.php and either (recommended) make
6 // view.php a symbolic link to new.php, or copy new.php to view.php.
7 //
8 // And if you check in a change to either module, be sure to check
9 // in the other (identical) module also.
11 // This nonsense will go away if we ever move to subversion.
12 //////////////////////////////////////////////////////////////////////
14 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
16 // This program is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU General Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
21 include_once("../../globals.php");
22 include_once("$srcdir/api.inc");
23 include_once("$srcdir/forms.inc");
25 $row = array();
27 if (! $encounter) { // comes from globals.php
28 die("Internal error: we do not seem to be in an encounter!");
31 function cbvalue($cbname) {
32 return $_POST[$cbname] ? '1' : '0';
35 function cbinput($name, $colname) {
36 global $row;
37 $ret = "<input type='checkbox' name='$name' value='1'";
38 if ($row[$colname]) $ret .= " checked";
39 $ret .= " />";
40 return $ret;
43 function cbcell($name, $desc, $colname) {
44 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
47 $formid = $_GET['id'];
49 // If Save was clicked, save the info.
51 if ($_POST['bn_save']) {
53 $fu_timing = $_POST['fu_timing'];
54 $fu_location = $_POST['fu_location'];
56 // If updating an existing form...
58 if ($formid) {
59 $query = "UPDATE form_podiatry SET " .
60 "notes = '" . $_POST['form_notes'] . "', " .
61 "followup_required = " . cbvalue('fu_required') . ", " .
62 "followup_timing = '$fu_timing'" . ", " .
63 "followup_location = '$fu_location'" . " " .
64 "WHERE id = '$formid'";
65 sqlStatement($query);
68 // If adding a new form...
70 else {
71 $query = "INSERT INTO form_podiatry ( " .
72 "notes, followup_required, followup_timing, followup_location " .
73 ") VALUES ( " .
74 "'" . $_POST['form_notes'] . "', " .
75 cbvalue('fu_required') . ", " .
76 "'$fu_timing'" . ", " .
77 "'$fu_location'" . " " .
78 ")";
79 $newid = sqlInsert($query);
80 addForm($encounter, "Podiatry", $newid, "podiatry", $pid, $userauthorized);
83 formHeader("Redirecting....");
84 formJump();
85 formFooter();
86 exit;
89 if ($formid) {
90 $row = sqlQuery ("SELECT * FROM form_podiatry WHERE " .
91 "id = '$formid' AND activity = '1'") ;
94 <html>
95 <head>
96 <? html_header_show();?>
97 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
98 <script type="text/javascript" src="../../../library/dialog.js"></script>
99 <script language='JavaScript'>
100 function newEvt() {
101 dlgopen('../../main/calendar/add_edit_event.php?patientid=<? echo $pid ?>',
102 '_blank', 550, 270);
103 return false;
105 </script>
106 </head>
108 <body <?echo $top_bg_line;?> topmargin="0" rightmargin="0" leftmargin="2"
109 bottommargin="0" marginwidth="2" marginheight="0">
110 <form method="post" action="<? echo $rootdir ?>/forms/podiatry/new.php?id=<? echo $formid ?>"
111 onsubmit="return top.restoreSession()">
113 <center>
116 <table border='1' width='95%'>
118 <tr bgcolor='#dddddd'>
119 <td colspan='2' align='center'><b>Notes from Podiatrist</b></td>
120 </tr>
122 <tr>
123 <td width='5%' nowrap> Notes </td>
124 <td width='95%' nowrap>
125 <textarea name='form_notes' rows='18' style='width:100%'><? echo $row['notes'] ?></textarea>
126 </td>
127 </tr>
129 <tr>
130 <td nowrap>Follow Up</td>
131 <td nowrap>
132 <table width='100%'>
133 <tr>
134 <td width='1%' nowrap>
135 <? echo cbinput('fu_required', 'followup_required') ?>Required on&nbsp;
136 </td>
137 <td width='49%' nowrap>
138 <input type='text' name='fu_timing' size='10' style='width:100%'
139 title='When to follow up'
140 value='<? echo addslashes($row['followup_timing']) ?>' />
141 </td>
142 <td width='1%' nowrap>
143 &nbsp;at&nbsp;
144 </td>
145 <td width='49%' nowrap>
146 <input type='text' name='fu_location' size='10' style='width:100%'
147 title='Where to follow up'
148 value='<? echo addslashes($row['followup_location']) ?>' />
149 </td>
150 </tr>
151 </table>
152 </td>
153 </tr>
155 </table>
158 <input type='submit' name='bn_save' value='Save' />
159 &nbsp;
160 <input type='button' value='Add Appointment' onclick='newEvt()' />
161 &nbsp;
162 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
163 </p>
165 </center>
167 </form>
168 </body>
169 </html>