.inc files migration to .inc.php (#5897)
[openemr.git] / contrib / forms / specialist_notes / view.php
blob9d3e074489f0bd4953d088f603fbf6e553c297af
1 <?php
3 //////////////////////////////////////////////////////////////////////
4 // ------------------ DO NOT MODIFY VIEW.PHP !!! ---------------------
5 // View.php is an exact duplicate of new.php. If you wish to make
6 // any changes, then change new.php and either (recommended) make
7 // view.php a symbolic link to new.php, or copy new.php to view.php.
8 //
9 // And if you check in a change to either module, be sure to check
10 // in the other (identical) module also.
12 // This nonsense will go away if we ever move to subversion.
13 //////////////////////////////////////////////////////////////////////
15 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
17 // This program is free software; you can redistribute it and/or
18 // modify it under the terms of the GNU General Public License
19 // as published by the Free Software Foundation; either version 2
20 // of the License, or (at your option) any later version.
22 require_once("../../globals.php");
23 require_once("$srcdir/api.inc.php");
24 require_once("$srcdir/forms.inc.php");
26 use OpenEMR\Core\Header;
28 $row = array();
30 if (! $encounter) { // comes from globals.php
31 die("Internal error: we do not seem to be in an encounter!");
34 function cbvalue($cbname)
36 return $_POST[$cbname] ? '1' : '0';
39 function cbinput($name, $colname)
41 global $row;
42 $ret = "<input type='checkbox' name='" . attr($name) . "' value='1'";
43 if ($row[$colname]) {
44 $ret .= " checked";
47 $ret .= " />";
48 return $ret;
51 function cbcell($name, $desc, $colname)
53 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
56 $formid = $_GET['id'];
58 // If Save was clicked, save the info.
60 if ($_POST['bn_save']) {
61 $fu_timing = $_POST['fu_timing'];
62 $fu_location = $_POST['fu_location'];
64 // If updating an existing form...
66 if ($formid) {
67 $query = "UPDATE form_specialist_notes SET
68 notes = ?,
69 followup_required = ?,
70 followup_timing = ?,
71 followup_location = ?,
72 WHERE id = ?";
73 sqlStatement($query, array($_POST['form_notes'] , cbvalue('fu_required'), $fu_timing, $fu_location, $formid ));
74 } else { // If adding a new form...
75 $query = "INSERT INTO form_specialist_notes ( " .
76 "notes, followup_required, followup_timing, followup_location " .
77 ") VALUES ( ?, ?, ?, ? )";
78 $newid = sqlInsert($query, array($_POST['form_notes'] , cbvalue('fu_required'), $fu_timing, $fu_location));
79 addForm($encounter, "Specialist Notes", $newid, "specialist_notes", $pid, $userauthorized);
82 formHeader("Redirecting....");
83 formJump();
84 formFooter();
85 exit;
88 if ($formid) {
89 $row = sqlQuery("SELECT * FROM form_specialist_notes WHERE " .
90 "id = ? AND activity = '1'", array($formid)) ;
93 <html>
94 <head>
95 <?php Header::setupHeader(); ?>
96 <script>
97 function newEvt() {
98 dlgopen('../../main/calendar/add_edit_event.php?patientid=' + <?php echo js_url($pid); ?>,
99 '_blank', 775, 500);
100 return false;
102 </script>
103 </head>
105 <body class="body_top">
106 <form method="post" action="<?php echo $rootdir ?>/forms/specialist_notes/new.php?id=<?php echo attr_url($formid); ?>" onsubmit="return top.restoreSession()">
108 <center>
111 <table border='1' width='95%'>
113 <tr bgcolor='#dddddd'>
114 <td colspan='2' align='center'><b>Notes from Specialist</b></td>
115 </tr>
117 <tr>
118 <td width='5%' nowrap> Notes </td>
119 <td width='95%' nowrap>
120 <textarea name='form_notes' rows='18' style='width:100%'><?php echo text($row['notes']); ?></textarea>
121 </td>
122 </tr>
124 <tr>
125 <td nowrap>Follow Up</td>
126 <td nowrap>
127 <table width='100%'>
128 <tr>
129 <td width='1%' nowrap>
130 <?php echo cbinput('fu_required', 'followup_required') ?>Required on&nbsp;
131 </td>
132 <td width='49%' nowrap>
133 <input type='text' name='fu_timing' size='10' style='width:100%'
134 title='When to follow up'
135 value='<?php echo attr($row['followup_timing']) ?>' />
136 </td>
137 <td width='1%' nowrap>
138 &nbsp;at&nbsp;
139 </td>
140 <td width='49%' nowrap>
141 <input type='text' name='fu_location' size='10' style='width:100%'
142 title='Where to follow up'
143 value='<?php echo attr($row['followup_location']) ?>' />
144 </td>
145 </tr>
146 </table>
147 </td>
148 </tr>
150 </table>
153 <input type='submit' name='bn_save' value='Save' />
154 &nbsp;
155 <input type='button' value='Add Appointment' onclick='newEvt()' />
156 &nbsp;
157 <input type='button' value='Cancel' onclick="parent.closeTab(window.name, false)" />
158 </p>
160 </center>
162 </form>
163 </body>
164 </html>