bug fixins (#1951)
[openemr.git] / interface / cmsportal / lbf_form.php
blobd7816ce973e17d8447df6924c928ff84c923665e
1 <?php
2 /**
3 * LBF form handling for the WordPress Patient Portal.
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2014 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/patient.inc");
17 require_once("$srcdir/options.inc.php");
18 require_once("portal.inc.php");
20 $postid = intval($_REQUEST['postid']);
22 // Get the portal request data.
23 if (!$postid) {
24 die(xlt('Request ID is missing!'));
27 $result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid));
28 if ($result['errmsg']) {
29 die(text($result['errmsg']));
32 // Look up the patient in OpenEMR.
33 $ptid = lookup_openemr_patient($result['post']['user']);
35 <html>
36 <head>
37 <?php html_header_show(); ?>
38 <link rel=stylesheet href="<?php echo $css_header; ?>" type="text/css">
39 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker/build/jquery.datetimepicker.min.css">
41 <style>
43 tr.head { font-size:10pt; background-color:#cccccc; text-align:center; }
44 tr.detail { font-size:10pt; background-color:#ddddff; }
45 td input { background-color:transparent; }
47 </style>
49 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
50 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-1-7-2/jquery.min.js"></script>
51 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker/build/jquery.datetimepicker.full.min.js"></script>
53 <script language="JavaScript">
55 function myRestoreSession() {
56 if (top.restoreSession) top.restoreSession(); else opener.top.restoreSession();
57 return true;
60 function validate() {
61 var f = document.forms[0];
62 // TBD
63 return true;
66 function openPatient() {
67 myRestoreSession();
68 opener.top.RTop.document.location.href = '../patient_file/summary/demographics.php?set_pid=<?php echo attr($ptid); ?>';
71 $(document).ready(function() {
72 $('.datepicker').datetimepicker({
73 <?php $datetimepicker_timepicker = false; ?>
74 <?php $datetimepicker_showseconds = false; ?>
75 <?php $datetimepicker_formatInput = true; ?>
76 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
77 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
78 });
79 $('.datetimepicker').datetimepicker({
80 <?php $datetimepicker_timepicker = true; ?>
81 <?php $datetimepicker_showseconds = false; ?>
82 <?php $datetimepicker_formatInput = true; ?>
83 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
84 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
85 });
86 });
88 </script>
89 </head>
91 <body class="body_top">
93 <?php echo "<!-- ";
94 print_r($result);
95 echo " -->\n"; // debugging ?>
97 <center>
99 <form method='post' action='lbf_form.php' onsubmit='return validate()'>
101 <table width='100%' cellpadding='1' cellspacing='2'>
102 <tr class='head'>
103 <th align='left'><?php echo xlt('Field'); ?></th>
104 <th align='left'><?php echo xlt('Value'); ?></th>
105 </tr>
107 <?php
108 foreach ($result['fields'] as $field_id => $newvalue) {
109 if (is_array($newvalue)) {
110 $tmp = '';
111 foreach ($newvalue as $value) {
112 if ($tmp !== '') {
113 $tmp .= ', ';
116 $tmp .= $value;
119 $newvalue = $tmp;
122 $newvalue = trim($newvalue);
123 $field_title = $result['labels'][$field_id];
124 echo " <tr class='detail'>\n";
125 echo " <td class='bold'>" . text($field_title) . "</td>\n";
126 echo " <td>";
127 echo text($newvalue);
128 echo "</td>\n";
129 echo " </tr>\n";
133 </table>
136 <input type='button' value='<?php echo xla('Open Patient'); ?>' onclick="openPatient()" />
137 &nbsp;
138 <input type='button' value='<?php echo xla('Back'); ?>' onclick="myRestoreSession();location='list_requests.php'" />
139 </p>
141 </form>
142 </center>
143 </body>
144 </html>