added support for mariadb in the ubuntu-debian packages
[openemr.git] / interface / reports / direct_message_log.php
blobcd8586bbf47ae66be3a1a764d6094e660184badf
1 <?php
2 /**
3 * Report to view the Direct Message log.
5 * Copyright (C) 2013 Brady Miller <brady@sparmy.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Brady Miller <brady@sparmy.com>
20 * @link http://www.open-emr.org
23 //SANITIZE ALL ESCAPES
24 $sanitize_all_escapes=true;
27 //STOP FAKE REGISTER GLOBALS
28 $fake_register_globals=false;
31 require_once("../globals.php");
34 <html>
36 <head>
37 <?php html_header_show();
38 $logstart = (isset($_POST['logstart'])) ? $_POST['logstart'] : 0;
39 if (isset($_POST['lognext']) && $_POST['lognext']) $logtop = $logstart + $_POST['lognext'];
40 else $logtop = 0;
43 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
45 <title><?php echo xlt('Direct Message Log'); ?></title>
47 <script type="text/javascript" src="../../library/js/jquery-1.7.2.min.js"></script>
49 <style type="text/css">
51 /* specifically include & exclude from printing */
52 @media print {
53 #report_parameters {
54 visibility: hidden;
55 display: none;
57 #report_parameters_daterange {
58 visibility: visible;
59 display: inline;
61 #report_results table {
62 margin-top: 0px;
66 /* specifically exclude some from the screen */
67 @media screen {
68 #report_parameters_daterange {
69 visibility: hidden;
70 display: none;
74 </style>
75 </head>
77 <body class="body_top">
79 <span class='title'><?php echo xlt('Direct Message Log'); ?></span>
81 <form method='post' name='theform' id='theform' action='direct_message_log.php' onsubmit='return top.restoreSession()'>
82 <input type='hidden' name='lognext' id='lognext' value=''>
84 <div id="report_parameters">
85 <table>
86 <tr>
87 <td width='470px'>
88 <div style='float:left'>
90 <table class='text'>
91 <div style='margin-left:15px'>
92 <a id='refresh_button' href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit()'>
93 <span>
94 <?php echo xlt('Refresh'); ?>
95 </span>
96 </a>
97 <a id='prev_button' href='#' class='css_button' onclick='top.restoreSession(); $("#lognext").val(-100); $("#theform").submit()'>
98 <span>
99 <?php echo xlt('Older'); ?>
100 </span>
101 </a>
102 <a id='next_button' href='#' class='css_button' onclick='top.restoreSession(); $("#lognext").val(100); $("#theform").submit()'>
103 <span>
104 <?php echo xlt('Newer'); ?>
105 </span>
106 </a>
107 </div>
108 </table>
109 </td>
110 </tr>
111 </table>
112 </div> <!-- end of search parameters -->
114 <br>
118 <div id="report_results">
119 <table>
121 <thead>
123 <th align='center'>
124 <?php echo xlt('ID'); ?>
125 </th>
127 <th align='center'>
128 <?php echo xlt('Type'); ?>
129 </th>
131 <th align='center'>
132 <?php echo xlt('Date Created'); ?>
133 </th>
135 <th align='center'>
136 <?php echo xlt('Sender'); ?>
137 </th>
139 <th align='center'>
140 <?php echo xlt('Recipient'); ?>
141 </th>
143 <th align='center'>
144 <?php echo xlt('Status'); ?>
145 </th>
147 <th align='center'>
148 <?php echo xlt('Date of Status Change'); ?>
149 </th>
151 </thead>
152 <tbody> <!-- added for better print-ability -->
153 <?php
155 if (!$logtop)
156 $res = sqlStatement("SELECT * FROM `direct_message_log` ORDER BY `id` DESC LIMIT 100");
157 else
158 $res = sqlStatement("SELECT * FROM `direct_message_log` WHERE `id` BETWEEN ? AND ? ORDER BY `id` DESC",
159 array($logtop-99,$logtop));
161 $logstart = 0;
162 while ($row = sqlFetchArray($res)) {
163 if (!$logstart) $logstart = $row['id'];
165 <tr>
166 <td align='center'><?php echo text($row['id']); ?></td>
168 <?php if ($row['msg_type'] == "R") { ?>
169 <td align='center'><?php echo xlt("Received") ?></td>
170 <?php } else if ($row['msg_type'] == "S") { ?>
171 <td align='center'><?php echo xlt("Sent") ?></td>
172 <?php } else {?>
173 <td align='center'>&nbsp;</td>
174 <?php } ?>
176 <td align='center'><?php echo text($row['create_ts']); ?></td>
177 <td align='center'><?php echo text($row['sender']); ?></td>
178 <td align='center'><?php echo text($row['recipient']); ?></td>
180 <?php if ($row['status'] == "Q") { ?>
181 <td align='center'><?php echo xlt("Queued") ?></td>
182 <?php } else if ($row['status'] == "S") { ?>
183 <td align='center'><?php echo xlt("Sent") ?></td>
184 <?php } else if ($row['status'] == "D") { ?>
185 <td align='center'><?php echo xlt("Sent - Confirmed") ?></td>
186 <?php } else if ($row['status'] == "R") { ?>
187 <td align='center'><?php echo xlt("Received") ?></td>
188 <?php } else if ($row['status'] == "F") { ?>
189 <td align='center'><?php echo xlt("Failed") ?></td>
190 <?php } else {?>
191 <td align='center'>&nbsp;</td>
192 <?php } ?>
194 <td align='center'><?php echo text($row['status_ts']); ?></td>
196 </tr>
197 <?php
198 } // $row = sqlFetchArray($res) while
200 </tbody>
201 </table>
202 </div> <!-- end of search results -->
204 <input type='hidden' name='logstart' id='logstart' value='<?php echo text($logstart); ?>'>
205 </form>
207 </body>
208 </html>