migrated ubiquitous libraries to composer autoloader (#421)
[openemr.git] / interface / cmsportal / lbf_form.php
blob41563aee4a70f329e5160a73ab30d93f25758e7e
1 <?php
2 /**
3 * LBF form handling for the WordPress Patient Portal.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Rod Roark <rod@sunsetsystems.com>
20 $sanitize_all_escapes = true;
21 $fake_register_globals = false;
23 require_once("../globals.php");
24 require_once("$srcdir/patient.inc");
25 require_once("$srcdir/options.inc.php");
26 require_once("portal.inc.php");
28 $postid = intval($_REQUEST['postid']);
30 // Get the portal request data.
31 if (!$postid) die(xlt('Request ID is missing!'));
32 $result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid));
33 if ($result['errmsg']) {
34 die(text($result['errmsg']));
37 // Look up the patient in OpenEMR.
38 $ptid = lookup_openemr_patient($result['post']['user']);
40 <html>
41 <head>
42 <?php html_header_show(); ?>
43 <link rel=stylesheet href="<?php echo $css_header; ?>" type="text/css">
45 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
46 <style>
48 tr.head { font-size:10pt; background-color:#cccccc; text-align:center; }
49 tr.detail { font-size:10pt; background-color:#ddddff; }
50 td input { background-color:transparent; }
52 </style>
54 <script type="text/javascript" src="../../library/textformat.js"></script>
55 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
56 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
57 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
58 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script>
60 <script language="JavaScript">
62 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
64 function myRestoreSession() {
65 if (top.restoreSession) top.restoreSession(); else opener.top.restoreSession();
66 return true;
69 function validate() {
70 var f = document.forms[0];
71 // TBD
72 return true;
75 function openPatient() {
76 myRestoreSession();
77 opener.top.RTop.document.location.href = '../patient_file/summary/demographics.php?set_pid=<?php echo attr($ptid); ?>';
80 </script>
81 </head>
83 <body class="body_top">
85 <?php echo "<!-- "; print_r($result); echo " -->\n"; // debugging ?>
87 <center>
89 <form method='post' action='lbf_form.php' onsubmit='return validate()'>
91 <table width='100%' cellpadding='1' cellspacing='2'>
92 <tr class='head'>
93 <th align='left'><?php echo xlt('Field'); ?></th>
94 <th align='left'><?php echo xlt('Value'); ?></th>
95 </tr>
97 <?php
98 foreach ($result['fields'] as $field_id => $newvalue) {
99 if (is_array($newvalue)) {
100 $tmp = '';
101 foreach ($newvalue as $value) {
102 if ($tmp !== '') $tmp .= ', ';
103 $tmp .= $value;
105 $newvalue = $tmp;
107 $newvalue = trim($newvalue);
108 $field_title = $result['labels'][$field_id];
109 echo " <tr class='detail'>\n";
110 echo " <td class='bold'>" . text($field_title) . "</td>\n";
111 echo " <td>";
112 echo text($newvalue);
113 echo "</td>\n";
114 echo " </tr>\n";
118 </table>
121 <input type='button' value='<?php echo xla('Open Patient'); ?>' onclick="openPatient()" />
122 &nbsp;
123 <input type='button' value='<?php echo xla('Back'); ?>' onclick="myRestoreSession();location='list_requests.php'" />
124 </p>
126 </form>
128 <script language="JavaScript">
129 </script>
131 </center>
132 </body>
133 </html>