chore(deps): bump twig/twig from 3.17.1 to 3.19.0 (#7951)
[openemr.git] / interface / reports / direct_message_log.php
blob46586905983841350f320602ec71b8721442005e
1 <?php
3 /**
4 * Report to view the Direct Message log.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2013-2018 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
15 use OpenEMR\Common\Acl\AclMain;
16 use OpenEMR\Common\Csrf\CsrfUtils;
17 use OpenEMR\Common\Twig\TwigContainer;
18 use OpenEMR\Core\Header;
20 if (!AclMain::aclCheckCore('admin', 'super')) {
21 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Direct Message Log")]);
22 exit;
25 if (!empty($_POST)) {
26 if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
27 CsrfUtils::csrfNotVerified();
32 <html>
34 <head>
35 <?php
36 $logstart = (isset($_POST['logstart'])) ? $_POST['logstart'] : 0;
37 if (isset($_POST['lognext']) && $_POST['lognext']) {
38 $logtop = $logstart + $_POST['lognext'];
39 } else {
40 $logtop = 0;
44 <?php Header::setupHeader(); ?>
46 <title><?php echo xlt('Direct Message Log'); ?></title>
48 <style>
50 /* specifically include & exclude from printing */
51 @media print {
52 #report_parameters {
53 visibility: hidden;
54 display: none;
56 #report_parameters_daterange {
57 visibility: visible;
58 display: inline;
60 #report_results table {
61 margin-top: 0;
65 /* specifically exclude some from the screen */
66 @media screen {
67 #report_parameters_daterange {
68 visibility: hidden;
69 display: none;
73 </style>
74 </head>
76 <body class="body_top">
78 <span class='title'><?php echo xlt('Direct Message Log'); ?></span>
80 <form method='post' name='theform' id='theform' action='direct_message_log.php' onsubmit='return top.restoreSession()'>
81 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
82 <input type='hidden' name='lognext' id='lognext' value=''>
84 <div id="report_parameters">
85 <table>
86 <tr>
87 <td width='470px'>
88 <div class="btn-group float-left" role="group">
89 <a id='refresh_button' href='#' class='btn btn-secondary btn-refresh' onclick='top.restoreSession(); $("#theform").submit()'>
90 <?php echo xlt('Refresh'); ?>
91 </a>
92 <a id='prev_button' href='#' class='btn btn-secondary btn-transmit' onclick='top.restoreSession(); $("#lognext").val(-100); $("#theform").submit()'>
93 <?php echo xlt('Older'); ?>
94 </a>
95 <a id='next_button' href='#' class='btn btn-secondary btn-transmit' onclick='top.restoreSession(); $("#lognext").val(100); $("#theform").submit()'>
96 <?php echo xlt('Newer'); ?>
97 </a>
98 </div>
99 </td>
100 </tr>
101 </table>
102 </div> <!-- end of search parameters -->
104 <br />
108 <div id="report_results">
109 <table class='table'>
111 <thead class='thead-light'>
113 <th align='center'>
114 <?php echo xlt('ID'); ?>
115 </th>
117 <th align='center'>
118 <?php echo xlt('Type'); ?>
119 </th>
121 <th align='center'>
122 <?php echo xlt('Date Created'); ?>
123 </th>
125 <th align='center'>
126 <?php echo xlt('Sender'); ?>
127 </th>
129 <th align='center'>
130 <?php echo xlt('Recipient'); ?>
131 </th>
133 <th align='center'>
134 <?php echo xlt('Status'); ?>
135 </th>
137 <th align='center'>
138 <?php echo xlt('Date of Status Change'); ?>
139 </th>
141 </thead>
142 <tbody> <!-- added for better print-ability -->
143 <?php
145 if (!$logtop) {
146 $res = sqlStatement("SELECT * FROM `direct_message_log` ORDER BY `id` DESC LIMIT 100");
147 } else {
148 $res = sqlStatement(
149 "SELECT * FROM `direct_message_log` WHERE `id` BETWEEN ? AND ? ORDER BY `id` DESC",
150 array($logtop - 99,$logtop)
154 $logstart = 0;
155 while ($row = sqlFetchArray($res)) {
156 if (!$logstart) {
157 $logstart = $row['id'];
160 <tr>
161 <td align='center'><?php echo text($row['id']); ?></td>
163 <?php if ($row['msg_type'] == "R") { ?>
164 <td align='center'><?php echo xlt("Received") ?></td>
165 <?php } elseif ($row['msg_type'] == "S") { ?>
166 <td align='center'><?php echo xlt("Sent") ?></td>
167 <?php } else {?>
168 <td align='center'>&nbsp;</td>
169 <?php } ?>
171 <td align='center'><?php echo text(oeFormatDateTime($row['create_ts'], "global", true)); ?></td>
172 <td align='center'><?php echo text($row['sender']); ?></td>
173 <td align='center'><?php echo text($row['recipient']); ?></td>
175 <?php if ($row['status'] == "Q") { ?>
176 <td align='center'><?php echo xlt("Queued") ?></td>
177 <?php } elseif ($row['status'] == "S") { ?>
178 <td align='center'><?php echo xlt("Sent") ?></td>
179 <?php } elseif ($row['status'] == "D") { ?>
180 <td align='center'><?php echo xlt("Sent - Confirmed") ?></td>
181 <?php } elseif ($row['status'] == "R") { ?>
182 <td align='center'><?php echo xlt("Received") ?></td>
183 <?php } elseif ($row['status'] == "F") { ?>
184 <td align='center'><?php echo xlt("Failed") ?></td>
185 <?php } else {?>
186 <td align='center'>&nbsp;</td>
187 <?php } ?>
189 <td align='center'><?php echo text($row['status_ts']); ?></td>
191 </tr>
192 <?php
193 } // $row = sqlFetchArray($res) while
195 </tbody>
196 </table>
197 </div> <!-- end of search results -->
199 <input type='hidden' name='logstart' id='logstart' value='<?php echo attr($logstart); ?>'>
200 </form>
202 </body>
203 </html>