some date formatting work
[openemr.git] / interface / reports / direct_message_log.php
blobb03d7453b2ce843162b6ba9ca097420996395d74
1 <?php
2 /**
3 * Report to view the Direct Message log.
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2013-2018 Brady Miller <brady.g.miller@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
15 use OpenEMR\Core\Header;
18 <html>
20 <head>
21 <?php
22 $logstart = (isset($_POST['logstart'])) ? $_POST['logstart'] : 0;
23 if (isset($_POST['lognext']) && $_POST['lognext']) {
24 $logtop = $logstart + $_POST['lognext'];
25 } else {
26 $logtop = 0;
30 <?php Header::setupHeader(); ?>
32 <title><?php echo xlt('Direct Message Log'); ?></title>
34 <style type="text/css">
36 /* specifically include & exclude from printing */
37 @media print {
38 #report_parameters {
39 visibility: hidden;
40 display: none;
42 #report_parameters_daterange {
43 visibility: visible;
44 display: inline;
46 #report_results table {
47 margin-top: 0px;
51 /* specifically exclude some from the screen */
52 @media screen {
53 #report_parameters_daterange {
54 visibility: hidden;
55 display: none;
59 </style>
60 </head>
62 <body class="body_top">
64 <span class='title'><?php echo xlt('Direct Message Log'); ?></span>
66 <form method='post' name='theform' id='theform' action='direct_message_log.php' onsubmit='return top.restoreSession()'>
67 <input type='hidden' name='lognext' id='lognext' value=''>
69 <div id="report_parameters">
70 <table>
71 <tr>
72 <td width='470px'>
73 <div class="btn-group pull-left" role="group">
74 <a id='refresh_button' href='#' class='btn btn-default btn-refresh' onclick='top.restoreSession(); $("#theform").submit()'>
75 <?php echo xlt('Refresh'); ?>
76 </a>
77 <a id='prev_button' href='#' class='btn btn-default btn-transmit' onclick='top.restoreSession(); $("#lognext").val(-100); $("#theform").submit()'>
78 <?php echo xlt('Older'); ?>
79 </a>
80 <a id='next_button' href='#' class='btn btn-default btn-transmit' onclick='top.restoreSession(); $("#lognext").val(100); $("#theform").submit()'>
81 <?php echo xlt('Newer'); ?>
82 </a>
83 </div>
84 </td>
85 </tr>
86 </table>
87 </div> <!-- end of search parameters -->
89 <br>
93 <div id="report_results">
94 <table>
96 <thead>
98 <th align='center'>
99 <?php echo xlt('ID'); ?>
100 </th>
102 <th align='center'>
103 <?php echo xlt('Type'); ?>
104 </th>
106 <th align='center'>
107 <?php echo xlt('Date Created'); ?>
108 </th>
110 <th align='center'>
111 <?php echo xlt('Sender'); ?>
112 </th>
114 <th align='center'>
115 <?php echo xlt('Recipient'); ?>
116 </th>
118 <th align='center'>
119 <?php echo xlt('Status'); ?>
120 </th>
122 <th align='center'>
123 <?php echo xlt('Date of Status Change'); ?>
124 </th>
126 </thead>
127 <tbody> <!-- added for better print-ability -->
128 <?php
130 if (!$logtop) {
131 $res = sqlStatement("SELECT * FROM `direct_message_log` ORDER BY `id` DESC LIMIT 100");
132 } else {
133 $res = sqlStatement(
134 "SELECT * FROM `direct_message_log` WHERE `id` BETWEEN ? AND ? ORDER BY `id` DESC",
135 array($logtop-99,$logtop)
139 $logstart = 0;
140 while ($row = sqlFetchArray($res)) {
141 if (!$logstart) {
142 $logstart = $row['id'];
145 <tr>
146 <td align='center'><?php echo text($row['id']); ?></td>
148 <?php if ($row['msg_type'] == "R") { ?>
149 <td align='center'><?php echo xlt("Received") ?></td>
150 <?php } else if ($row['msg_type'] == "S") { ?>
151 <td align='center'><?php echo xlt("Sent") ?></td>
152 <?php } else {?>
153 <td align='center'>&nbsp;</td>
154 <?php } ?>
156 <td align='center'><?php echo text(oeFormatDateTime($row['create_ts'], "global", true)); ?></td>
157 <td align='center'><?php echo text($row['sender']); ?></td>
158 <td align='center'><?php echo text($row['recipient']); ?></td>
160 <?php if ($row['status'] == "Q") { ?>
161 <td align='center'><?php echo xlt("Queued") ?></td>
162 <?php } else if ($row['status'] == "S") { ?>
163 <td align='center'><?php echo xlt("Sent") ?></td>
164 <?php } else if ($row['status'] == "D") { ?>
165 <td align='center'><?php echo xlt("Sent - Confirmed") ?></td>
166 <?php } else if ($row['status'] == "R") { ?>
167 <td align='center'><?php echo xlt("Received") ?></td>
168 <?php } else if ($row['status'] == "F") { ?>
169 <td align='center'><?php echo xlt("Failed") ?></td>
170 <?php } else {?>
171 <td align='center'>&nbsp;</td>
172 <?php } ?>
174 <td align='center'><?php echo text($row['status_ts']); ?></td>
176 </tr>
177 <?php
178 } // $row = sqlFetchArray($res) while
180 </tbody>
181 </table>
182 </div> <!-- end of search results -->
184 <input type='hidden' name='logstart' id='logstart' value='<?php echo text($logstart); ?>'>
185 </form>
187 </body>
188 </html>