4 * Report to view the Direct Message log.
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")]);
26 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
27 CsrfUtils
::csrfNotVerified();
36 $logstart = (isset($_POST['logstart'])) ?
$_POST['logstart'] : 0;
37 if (isset($_POST['lognext']) && $_POST['lognext']) {
38 $logtop = $logstart +
$_POST['lognext'];
44 <?php Header
::setupHeader(); ?
>
46 <title
><?php
echo xlt('Direct Message Log'); ?
></title
>
50 /* specifically include & exclude from printing */
56 #report_parameters_daterange {
60 #report_results table {
65 /* specifically exclude some from the screen */
67 #report_parameters_daterange {
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">
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'); ?
>
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'); ?
>
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'); ?
>
102 </div
> <!-- end of search parameters
-->
108 <div id
="report_results">
109 <table
class='table'>
111 <thead
class='thead-light'>
114 <?php
echo xlt('ID'); ?
>
118 <?php
echo xlt('Type'); ?
>
122 <?php
echo xlt('Date Created'); ?
>
126 <?php
echo xlt('Sender'); ?
>
130 <?php
echo xlt('Recipient'); ?
>
134 <?php
echo xlt('Status'); ?
>
138 <?php
echo xlt('Date of Status Change'); ?
>
142 <tbody
> <!-- added
for better
print-ability
-->
146 $res = sqlStatement("SELECT * FROM `direct_message_log` ORDER BY `id` DESC LIMIT 100");
149 "SELECT * FROM `direct_message_log` WHERE `id` BETWEEN ? AND ? ORDER BY `id` DESC",
150 array($logtop - 99,$logtop)
155 while ($row = sqlFetchArray($res)) {
157 $logstart = $row['id'];
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
>
168 <td align
='center'> 
;</td
>
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
>
186 <td align
='center'> 
;</td
>
189 <td align
='center'><?php
echo text($row['status_ts']); ?
></td
>
193 } // $row = sqlFetchArray($res) while
197 </div
> <!-- end of search results
-->
199 <input type
='hidden' name
='logstart' id
='logstart' value
='<?php echo attr($logstart); ?>'>