2 include_once("../globals.php");
3 include_once("$srcdir/log.inc");
4 include_once("$srcdir/formdata.inc.php");
5 require_once("$srcdir/formatting.inc.php");
9 <?php
html_header_show();?
>
10 <link rel
="stylesheet" href
='<?php echo $GLOBALS['webroot
'] ?>/library/dynarch_calendar.css' type
='text/css'>
11 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
12 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script
>
13 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
14 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script
>
16 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
17 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
24 border
-collapse
: collapse
;
27 background
-color
: #cccccc;
28 cursor
: pointer
; cursor
: hand
;
35 background
-color
: #ffffff;
36 border
-bottom
: 1px solid
#808080;
42 background
-color
: #336699;
47 //function to disable the event type field if the event name is disclosure
48 function eventTypeChange(eventname
)
50 if (eventname
== "disclosure") {
51 document
.theform
.type_event
.disabled
= true;
54 document
.theform
.type_event
.disabled
= false;
58 // VicarePlus :: This invokes the find-patient popup.
59 function sel_patient() {
60 dlgopen('../main/calendar/find_patient_popup.php?pflag=0', '_blank', 500, 400);
63 // VicarePlus :: This is for callback by the find-patient popup.
64 function setpatient(pid
, lname
, fname
, dob
) {
65 var f
= document
.theform
;
66 f
.form_patient
.value
= lname +
', ' + fname
;
67 f
.form_pid
.value
= pid
;
72 <body
class="body_top">
73 <font
class="title"><?php
xl('Logs Viewer','e'); ?
></font
>
77 if ($_GET["start_date"])
78 $start_date = formData('start_date','G');
80 if ($_GET["end_date"])
81 $end_date = formData('end_date','G');
83 if ($_GET["form_patient"])
84 $form_patient = formData('form_patient','G');
87 * Start date should not be greater than end date - Date Validation
89 if ($start_date && $end_date)
91 if($start_date > $end_date){
92 echo "<table><tr class='alert'><td colspan=7>"; xl('Start Date should not be greater than End Date',e
);
93 echo "</td></tr></table>";
100 $form_user = formData('form_user','R');
101 $form_pid = formData('form_pid','R');
102 if ($form_patient == '' ) $form_pid = '';
104 $res = sqlStatement("select distinct LEFT(date,10) as date from log order by date desc limit 30");
105 for($iter=0;$row=sqlFetchArray($res);$iter++
) {
109 // Get the users list.
110 $sqlQuery = "SELECT username, fname, lname FROM users " .
111 "WHERE active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) ";
113 $ures = sqlStatement($sqlQuery);
117 $get_sdate=$start_date ?
$start_date : date("Y-m-d H:i:s");
118 $get_edate=$end_date ?
$end_date : date("Y-m-d H:i:s");
123 <FORM METHOD
="GET" name
="theform" id
="theform">
126 $sortby = formData('sortby','G') ;
127 $direction = formData('direction','G') ;
129 <input type
="hidden" name
="direction" id
="direction" value
="<?php echo !empty($direction) ? $direction : 'asc'; ?>">
130 <input type
="hidden" name
="sortby" id
="sortby" value
="<?php echo $sortby; ?>">
131 <input type
=hidden name
=csum value
="">
134 <span
class="text"><?php
xl('Start Date','e'); ?
>: </span
>
136 <input type
="text" size
="18" name
="start_date" id
="start_date" value
="<?php echo $start_date ? $start_date : (date("Y
-m
-d
") . " 00:00:00"); ?>" title
="<?php xl('yyyy-mm-dd H:m Start Date','e'); ?>" onkeyup
="datekeyup(this,mypcc,true)" onblur
="dateblur(this,mypcc,true)" />
137 <img src
="../pic/show_calendar.gif" align
="absbottom" width
="24" height
="22" id
="img_begin_date" border
="0" alt
="[?]" style
="cursor: pointer; cursor: hand" title
="<?php xl('Click here to choose date time','e'); ?>"> 
;
140 <span
class="text"><?php
xl('End Date','e'); ?
>: </span
>
142 <input type
="text" size
="18" name
="end_date" id
="end_date" value
="<?php echo $end_date ? $end_date : (date("Y
-m
-d
") . " 23:59:00"); ?>" title
="<?php xl('yyyy-mm-dd H:m End Date','e'); ?>" onkeyup
="datekeyup(this,mypcc,true)" onblur
="dateblur(this,mypcc,true)" />
143 <img src
="../pic/show_calendar.gif" align
="absbottom" width
="24" height
="22" id
="img_end_date" border
="0" alt
="[?]" style
="cursor: pointer; cursor: hand" title
="<?php xl('Click here to choose date time','e'); ?>"> 
;
145 <!--VicarePlus
:: Feature
For Generating Log
For The Selected Patient
--!>
147  
; 
;<span
class='text'><?php
echo htmlspecialchars(xl('Patient'),ENT_NOQUOTES
); ?
>: </span
>
150 <input type
='text' size
='20' name
='form_patient' style
='width:100%;cursor:pointer;cursor:hand' value
='<?php echo $form_patient ? $form_patient : htmlspecialchars(xl('Click To Select
'),ENT_QUOTES); ?>' onclick
='sel_patient()' title
='<?php echo htmlspecialchars(xl('Click to select patient
'),ENT_QUOTES); ?>' />
151 <input type
='hidden' name
='form_pid' value
='<?php echo $form_pid; ?>' />
155 <span
class='text'><?php
xl('User','e'); ?
>: </span
>
159 echo "<select name='form_user'>\n";
160 echo " <option value=''>" . xl('All') . "</option>\n";
161 while ($urow = sqlFetchArray($ures)) {
162 if (!trim($urow['username'])) continue;
163 echo " <option value='" . $urow['username'] . "'";
164 if ($urow['username'] == $form_user) echo " selected";
165 echo ">" . $urow['lname'];
166 if ($urow['fname']) echo ", " . $urow['fname'];
173 <!-- list of events name
-->
174 <span
class='text'><?php
xl('Name of Events','e'); ?
>: </span
>
178 $res = sqlStatement("select distinct event from log order by event ASC");
179 $ename_list=array(); $j=0;
180 while ($erow = sqlFetchArray($res)) {
181 if (!trim($erow['event'])) continue;
182 $data = explode('-', $erow['event']);
183 $data_c = count($data);
185 for($i=1;$i<($data_c-1);$i++
)
187 $ename.="-".$data[$i];
189 $ename_list[$j]=$ename;
192 $res1 = sqlStatement("select distinct event from extended_log order by event ASC");
193 // $j=0; // This can't be right! -- Rod 2013-08-23
194 while ($row = sqlFetchArray($res1)) {
195 if (!trim($row['event'])) continue;
196 $new_event = explode('-', $row['event']);
197 $no = count($new_event);
198 $events=$new_event[0];
199 for($i=1;$i<($no-1);$i++
)
201 $events.="-".$new_event[$i];
203 if ($events=="disclosure")
204 $ename_list[$j]=$events;
207 $ename_list=array_unique($ename_list);
208 $ename_list=array_merge($ename_list);
209 $ecount=count($ename_list);
210 echo "<select name='eventname' onchange='eventTypeChange(this.options[this.selectedIndex].value);'>\n";
211 echo " <option value=''>" . xl('All') . "</option>\n";
212 for($k=0;$k<$ecount;$k++
) {
213 echo " <option value='" .$ename_list[$k]. "'";
214 if ($ename_list[$k] == $eventname && $ename_list[$k]!= "") echo " selected";
215 echo ">" . $ename_list[$k];
221 <!-- type of events ends
-->
223  
; 
;<span
class='text'><?php
xl('Type of Events','e'); ?
>: </span
>
226 $event_types=array("select", "update", "insert", "delete", "replace");
227 $lcount=count($event_types);
228 if($eventname=="disclosure"){
229 echo "<select name='type_event' disabled='disabled'>\n";
230 echo " <option value=''>" . xl('All') . "</option>\n";
234 echo "<select name='type_event'>\n";}
235 echo " <option value=''>" . xl('All') . "</option>\n";
236 for($k=0;$k<$lcount;$k++
) {
237 echo " <option value='" .$event_types[$k]. "'";
238 if ($event_types[$k] == $type_event && $event_types[$k]!= "") echo " selected";
239 echo ">" . preg_replace('/^select$/','Query',$event_types[$k]); // Convert select to Query for MU2 requirement
246 <span
class='text'><?php
xl('Include Checksum','e'); ?
>: </span
>
250 $check_sum = formData('check_sum','G');
252 <input type
="checkbox" name
="check_sum" " <?php if ($check_sum == 'on') echo "checked
"; ?>"></input
>
255 <input type
=hidden name
="event" value
=<?php
echo $event ; ?
>>
256 <a href
="javascript:document.theform.submit();" class='link_submit'>[<?php
xl('Refresh','e'); ?
>]</a
>
259 <div id
='valid_button'>
260 <input type
=button id
='validate_log' onclick
='validatelog();' value
='<?php echo xla('Validate Log
'); ?>'></input
>
262 <div id
='log_loading' style
="display: none">
263 <img src
='../../images/loading.gif'/>
271 <?php
if ($start_date && $end_date && $err_message!=1) { ?
>
275 <!-- <TH
><?php
xl('Date', 'e'); ?
><TD
> -->
276 <th id
="sortby_date" class="text sortby" title
="<?php xl('Sort by date/time','e'); ?>"><?php
xl('Date','e'); ?
></th
>
277 <th id
="sortby_event" class="text sortby" title
="<?php xl('Sort by Event','e'); ?>"><?php
xl('Event','e'); ?
></th
>
278 <th id
="sortby_category" class="text sortby" title
="<?php xl('Sort by Category','e'); ?>"><?php
xl('Category','e'); ?
></th
>
279 <th id
="sortby_user" class="text sortby" title
="<?php xl('Sort by User','e'); ?>"><?php
xl('User','e'); ?
></th
>
280 <th id
="sortby_cuser" class="text sortby" title
="<?php xl('Sort by Crt User','e'); ?>"><?php
xl('Certificate User','e'); ?
></th
>
281 <th id
="sortby_group" class="text sortby" title
="<?php xl('Sort by Group','e'); ?>"><?php
xl('Group','e'); ?
></th
>
282 <th id
="sortby_pid" class="text sortby" title
="<?php xl('Sort by PatientID','e'); ?>"><?php
xl('PatientID','e'); ?
></th
>
283 <th id
="sortby_success" class="text sortby" title
="<?php xl('Sort by Success','e'); ?>"><?php
xl('Success','e'); ?
></th
>
284 <th id
="sortby_comments" class="text sortby" title
="<?php xl('Sort by Comments','e'); ?>"><?php
xl('Comments','e'); ?
></th
>
285 <?php
if($check_sum) {?
>
286 <th id
="sortby_checksum" class="text sortby" title
="<?php xl('Sort by Checksum','e'); ?>"><?php
xl('Checksum','e'); ?
></th
>
291 $eventname = formData('eventname','G');
292 $type_event = formData('type_event','G');
294 <input type
=hidden name
=event value
=<?php
echo $eventname."-".$type_event ?
>>
298 if($eventname != "" && $type_event != "")
300 $getevent=$eventname."-".$type_event;
303 if(($eventname == "") && ($type_event != ""))
304 { $tevent=$type_event;
306 else if($type_event =="" && $eventname != "")
308 else if ($eventname == "")
313 if ($ret = getEvents(array('sdate' => $get_sdate,'edate' => $get_edate, 'user' => $form_user, 'patient' => $form_pid, 'sortby' => $_GET['sortby'], 'levent' =>$gev, 'tevent' =>$tevent,'direction' => $_GET['direction']))) {
316 foreach ($ret as $iter) {
318 $patterns = array ('/^success/','/^failure/','/ encounter/');
319 $replace = array ( xl('success'), xl('failure'), xl('encounter','',' '));
321 $log_id = $iter['id'];
322 $commentEncrStatus = "No";
323 $logEncryptData = logCommentEncryptData($log_id);
324 if(count($logEncryptData) > 0){
325 $commentEncrStatus = $logEncryptData['encrypt'];
328 //July 1, 2014: Ensoftek: Decrypt comment data if encrypted
329 if($commentEncrStatus == "Yes"){
330 $trans_comments = preg_replace($patterns, $replace, aes256Decrypt($iter["comments"]));
332 $trans_comments = preg_replace($patterns, $replace, $iter["comments"]);
336 <TR
class="oneresult">
337 <TD
class="text"><?php
echo oeFormatShortDate(substr($iter["date"], 0, 10)) . substr($iter["date"], 10) ?
></TD
>
338 <TD
class="text"><?php
echo preg_replace('/select$/','Query',$iter["event"]); //Convert select term to Query for MU2 requirements ?></TD>
339 <TD
class="text"><?php
echo $iter["category"]?
></TD
>
340 <TD
class="text"><?php
echo $iter["user"]?
></TD
>
341 <TD
class="text"><?php
echo $iter["crt_user"]?
></TD
>
342 <TD
class="text"><?php
echo $iter["groupname"]?
></TD
>
343 <TD
class="text"><?php
echo $iter["patient_id"]?
></TD
>
344 <TD
class="text"><?php
echo $iter["success"]?
></TD
>
345 <TD
class="text"><?php
echo nl2br(text(preg_replace('/^select/i','Query',$trans_comments))); //Convert select term to Query for MU2 requirements ?></TD>
346 <?php
if($check_sum) { ?
>
347 <TD
class="text"><?php
echo $iter["checksum"]?
></TD
>
355 if (($eventname=="disclosure") ||
($gev == ""))
357 $eventname="disclosure";
358 if ($ret = getEvents(array('sdate' => $get_sdate,'edate' => $get_edate, 'user' => $form_user, 'patient' => $form_pid, 'sortby' => $_GET['sortby'], 'event' =>$eventname))) {
359 foreach ($ret as $iter) {
360 $comments=xl('Recipient Name').":".$iter["recipient"].";".xl('Disclosure Info').":".$iter["description"];
362 <TR
class="oneresult">
363 <TD
class="text"><?php
echo htmlspecialchars(oeFormatShortDate(substr($iter["date"], 0, 10)) . substr($iter["date"], 10),ENT_NOQUOTES
); ?
></TD
>
364 <TD
class="text"><?php
echo htmlspecialchars(xl($iter["event"]),ENT_NOQUOTES
);?
></TD
>
365 <TD
class="text"><?php
echo htmlspecialchars(xl($iter["category"]),ENT_NOQUOTES
);?
></TD
>
366 <TD
class="text"><?php
echo htmlspecialchars($iter["user"],ENT_NOQUOTES
);?
></TD
>
367 <TD
class="text"><?php
echo htmlspecialchars($iter["crt_user"],ENT_NOQUOTES
);?
></TD
>
368 <TD
class="text"><?php
echo htmlspecialchars($iter["groupname"],ENT_NOQUOTES
);?
></TD
>
369 <TD
class="text"><?php
echo htmlspecialchars($iter["patient_id"],ENT_NOQUOTES
);?
></TD
>
370 <TD
class="text"><?php
echo htmlspecialchars($iter["success"],ENT_NOQUOTES
);?
></TD
>
371 <TD
class="text"><?php
echo htmlspecialchars($comments,ENT_NOQUOTES
);?
></TD
>
372 <?php
if($check_sum) { ?
>
373 <TD
class="text"><?php
echo htmlspecialchars($iter["checksum"],ENT_NOQUOTES
);?
></TD
>
388 <script language
="javascript">
390 // jQuery stuff to make the page a little easier to use
391 $
(document
).ready(function(){
392 // funny thing here... good learning experience
393 // the TR has TD children which have their own background and text color
394 // toggling the TR color doesn't change the TD color
395 // so we need to change all the TR's children (the TD's) just as we did the TR
396 // thus we have two calls to toggleClass:
397 // 1 - for the parent (the TR)
398 // 2 - for each of the children (the TDs)
399 $
(".oneresult").mouseover(function() { $
(this
).toggleClass("highlight"); $
(this
).children().toggleClass("highlight"); });
400 $
(".oneresult").mouseout(function() { $
(this
).toggleClass("highlight"); $
(this
).children().toggleClass("highlight"); });
402 // click-able column headers to sort the list
404 $
("#sortby_date").click(function() { set_sort_direction(); $
("#sortby").val("date"); $
("#theform").submit(); });
405 $
("#sortby_event").click(function() { set_sort_direction(); $
("#sortby").val("event"); $
("#theform").submit(); });
406 $
("#sortby_category").click(function() { set_sort_direction(); $
("#sortby").val("category"); $
("#theform").submit(); });
407 $
("#sortby_user").click(function() { set_sort_direction(); $
("#sortby").val("user"); $
("#theform").submit(); });
408 $
("#sortby_cuser").click(function() { set_sort_direction(); $
("#sortby").val("user"); $
("#theform").submit(); });
409 $
("#sortby_group").click(function() { set_sort_direction(); $
("#sortby").val("groupname"); $
("#theform").submit(); });
410 $
("#sortby_pid").click(function() { set_sort_direction(); $
("#sortby").val("patient_id"); $
("#theform").submit(); });
411 $
("#sortby_success").click(function() { set_sort_direction(); $
("#sortby").val("success"); $
("#theform").submit(); });
412 $
("#sortby_comments").click(function() { set_sort_direction(); $
("#sortby").val("comments"); $
("#theform").submit(); });
413 $
("#sortby_checksum").click(function() { set_sort_direction(); $
("#sortby").val("checksum"); $
("#theform").submit(); });
416 function set_sort_direction(){
417 if($
('#direction').val() == 'asc')
418 $
('#direction').val('desc');
420 $
('#direction').val('asc');
425 /* required for popup calendar */
426 Calendar
.setup({inputField
:"start_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_begin_date", showsTime
:true});
427 Calendar
.setup({inputField
:"end_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_end_date", showsTime
:true});
429 function validatelog(){
430 var img
= document
.getElementById('log_loading');
431 var btn
= document
.getElementById('valid_button');
433 if(img
.style
.display
== "block"){
436 img
.style
.display
= "block";
437 if(btn
){btn
.style
.display
= "none"}
440 url
:"../../library/log_validation.php",
443 success
:function(response
){
445 img
.style
.display
="none";
446 if(btn
){btn
.style
.display
="block";}
452 img
.style
.display
="none";
453 if(btn
){btn
.style
.display
="block";}
455 alert('<?php echo xls("Audit Log Validation Failed"); ?>');