If you put reports in the directory /openemr/interface/reports/myreports, they will...
[openemr.git] / interface / logview / logview.php
blobe0da25c21586f05df3e4736aaa00f97751735704
1 <?php
2 include_once("../globals.php");
3 include_once("$srcdir/log.inc");
4 ?>
5 <html>
6 <head>
8 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
10 </head>
11 <body <?php echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
12 <font class=title><?php xl('Logs Viewer','e'); ?></font>
13 <br>
15 <?php
16 $form_user = $_REQUEST['form_user'];
18 $res = sqlStatement("select distinct LEFT(date,10) as date from log order by date desc limit 30");
19 for($iter=0;$row=sqlFetchArray($res);$iter++) {
20 $ret[$iter] = $row;
23 // Get the users list.
24 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
25 "WHERE active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
26 "ORDER BY lname, fname");
29 <br>
30 <FORM METHOD="GET" name=the_form>
31 <span class=text><?php xl('Date','e'); ?>: </span>
32 <SELECT NAME="date">
33 <?php
34 $getdate = $_GET["date"] ? $_GET["date"] : date("Y-m-d");
36 $found = 0;
37 foreach ($ret as $iter) {
38 echo "<option value='{$iter["date"]}'";
39 if (!$found && substr($iter["date"],0,10) == $getdate) {
40 echo " selected";
41 $found++;
43 echo ">{$iter["date"]}</option>\n";
45 if (!$found) {
46 echo "<option value='$getdate'";
47 echo " selected";
48 echo ">$getdate</option>\n";
51 </SELECT>
53 &nbsp;&nbsp;<span class='text'><?php xl('User','e'); ?>: </span>
55 <?php
56 echo "<select name='form_user'>\n";
57 echo " <option value=''>" . xl('All') . "</option>\n";
58 while ($urow = sqlFetchArray($ures)) {
59 if (!trim($urow['username'])) continue;
60 echo " <option value='" . $urow['username'] . "'";
61 if ($urow['username'] == $form_user) echo " selected";
62 echo ">" . $urow['lname'];
63 if ($urow['fname']) echo ", " . $urow['fname'];
64 echo "</option>\n";
66 echo "</select>\n";
68 $res = sqlStatement("select distinct event from log order by event ASC");
70 $found = 0;
71 echo "&nbsp;<span class=text>";
72 for($iter=0;$row=sqlFetchArray($res);$iter++) {
74 <input type="radio" name="event" value="<?php echo $row["event"];?>"
75 <?php
76 if ($row["event"] == $_GET["event"]) {
77 echo " checked";
78 $found++;
81 ><?echo $row["event"]?>&nbsp;&nbsp;
82 <?php
83 $ret[$iter] = $row;
86 <input type="radio" name="event" value="*"<?php if (!$found) echo " checked";?>><?php xl('All','e'); ?>
87 </span>&nbsp;
88 <a href="javascript:document.the_form.submit();" class=link_submit>[<?php xl('Refresh','e'); ?>]</a>
89 </FORM>
90 <?php
91 if ($_GET["date"]) {
93 <TABLE BORDER=1 CELLPADDING=4>
94 <tr>
95 <TD><span class=bold><?php xl('Date'); ?></span></TD>
96 <TD><span class=bold><?php xl('Event','e'); ?></span></TD>
97 <TD><span class=bold><?php xl('User','e'); ?></span></TD>
98 <TD><span class=bold><?php xl('Group','e'); ?></span></TD>
99 <TD><span class=bold><?php xl('Comments','e'); ?></span></TD>
100 </tr>
101 <?php
102 if ($ret = getEventByDate($getdate, $form_user)) {
103 if (!$_GET["event"])
104 $gev = "*";
105 else
106 $gev = $_GET["event"];
107 foreach ($ret as $iter) {
108 if (($gev == "*") || ($gev == $iter["event"])) {
110 <TR>
111 <TD nowrap><span class=text><?php echo $iter["date"]?></span></TD>
112 <TD><span class=text><?php echo $iter["event"]?></span></TD>
113 <TD><span class=text><?php echo $iter["user"]?></span></TD>
114 <TD><span class=text><?php echo $iter["groupname"]?></span></TD>
115 <TD><span class=text><?php echo $iter["comments"]?></span></TD>
116 </TR>
118 <?php
123 </table>
124 <?php
127 <br><br>
129 </body>
130 </html>