2 include_once("../globals.php");
3 include_once("$srcdir/log.inc");
4 require_once("$srcdir/formatting.inc.php");
8 <?php
html_header_show();?
>
9 <link rel
="stylesheet" href
='<?php echo $GLOBALS['webroot
'] ?>/library/dynarch_calendar.css' type
='text/css'>
10 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
11 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script
>
12 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
13 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script
>
15 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
16 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
23 border
-collapse
: collapse
;
26 background
-color
: #cccccc;
27 cursor
: pointer
; cursor
: hand
;
34 background
-color
: #ffffff;
35 border
-bottom
: 1px solid
#808080;
41 background
-color
: #336699;
46 //function to disable the event type field if the event name is disclosure
47 function eventTypeChange(eventname
)
49 if (eventname
== "disclosure") {
50 document
.theform
.type_event
.disabled
= true;
53 document
.theform
.type_event
.disabled
= false;
57 // VicarePlus :: This invokes the find-patient popup.
58 function sel_patient() {
59 dlgopen('../main/calendar/find_patient_popup.php?pflag=0', '_blank', 500, 400);
62 // VicarePlus :: This is for callback by the find-patient popup.
63 function setpatient(pid
, lname
, fname
, dob
) {
64 var f
= document
.theform
;
65 f
.form_patient
.value
= lname +
', ' + fname
;
66 f
.form_pid
.value
= pid
;
71 <body
class="body_top">
72 <font
class="title"><?php
xl('Logs Viewer','e'); ?
></font
>
76 if ($_GET["start_date"])
77 $start_date = formData('start_date','G');
79 if ($_GET["end_date"])
80 $end_date = formData('end_date','G');
82 if ($_GET["form_patient"])
83 $form_patient = formData('form_patient','G');
86 * Start date should not be greater than end date - Date Validation
88 if ($start_date && $end_date)
90 if($start_date > $end_date){
91 echo "<table><tr class='alert'><td colspan=7>"; xl('Start Date should not be greater than End Date',e
);
92 echo "</td></tr></table>";
99 $form_user = formData('form_user','R');
100 $form_pid = formData('form_pid','R');
101 if ($form_patient == '' ) $form_pid = '';
103 $res = sqlStatement("select distinct LEFT(date,10) as date from log order by date desc limit 30");
104 for($iter=0;$row=sqlFetchArray($res);$iter++
) {
108 // Get the users list.
109 $sqlQuery = "SELECT username, fname, lname FROM users " .
110 "WHERE active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) ";
112 $ures = sqlStatement($sqlQuery);
116 $get_sdate=$start_date ?
$start_date : date("Y-m-d H:i:s");
117 $get_edate=$end_date ?
$end_date : date("Y-m-d H:i:s");
122 <FORM METHOD
="GET" name
="theform" id
="theform">
125 $sortby = formData('sortby','G') ;
126 $direction = formData('direction','G') ;
128 <input type
="hidden" name
="direction" id
="direction" value
="<?php echo !empty($direction) ? $direction : 'asc'; ?>">
129 <input type
="hidden" name
="sortby" id
="sortby" value
="<?php echo $sortby; ?>">
130 <input type
=hidden name
=csum value
="">
133 <span
class="text"><?php
xl('Start Date','e'); ?
>: </span
>
135 <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)" />
136 <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'); ?>"> 
;
139 <span
class="text"><?php
xl('End Date','e'); ?
>: </span
>
141 <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)" />
142 <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'); ?>"> 
;
144 <!--VicarePlus
:: Feature
For Generating Log
For The Selected Patient
--!>
146  
; 
;<span
class='text'><?php
echo htmlspecialchars(xl('Patient'),ENT_NOQUOTES
); ?
>: </span
>
149 <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); ?>' />
150 <input type
='hidden' name
='form_pid' value
='<?php echo $form_pid; ?>' />
154 <span
class='text'><?php
xl('User','e'); ?
>: </span
>
158 echo "<select name='form_user'>\n";
159 echo " <option value=''>" . xl('All') . "</option>\n";
160 while ($urow = sqlFetchArray($ures)) {
161 if (!trim($urow['username'])) continue;
162 echo " <option value='" . $urow['username'] . "'";
163 if ($urow['username'] == $form_user) echo " selected";
164 echo ">" . $urow['lname'];
165 if ($urow['fname']) echo ", " . $urow['fname'];
172 <!-- list of events name
-->
173 <span
class='text'><?php
xl('Name of Events','e'); ?
>: </span
>
177 $res = sqlStatement("select distinct event from log order by event ASC");
178 $ename_list=array(); $j=0;
179 while ($erow = sqlFetchArray($res)) {
180 if (!trim($erow['event'])) continue;
181 $data = explode('-', $erow['event']);
182 $data_c = count($data);
184 for($i=1;$i<($data_c-1);$i++
)
186 $ename.="-".$data[$i];
188 $ename_list[$j]=$ename;
191 $res1 = sqlStatement("select distinct event from extended_log order by event ASC");
192 // $j=0; // This can't be right! -- Rod 2013-08-23
193 while ($row = sqlFetchArray($res1)) {
194 if (!trim($row['event'])) continue;
195 $new_event = explode('-', $row['event']);
196 $no = count($new_event);
197 $events=$new_event[0];
198 for($i=1;$i<($no-1);$i++
)
200 $events.="-".$new_event[$i];
202 if ($events=="disclosure")
203 $ename_list[$j]=$events;
206 $ename_list=array_unique($ename_list);
207 $ename_list=array_merge($ename_list);
208 $ecount=count($ename_list);
209 echo "<select name='eventname' onchange='eventTypeChange(this.options[this.selectedIndex].value);'>\n";
210 echo " <option value=''>" . xl('All') . "</option>\n";
211 for($k=0;$k<$ecount;$k++
) {
212 echo " <option value='" .$ename_list[$k]. "'";
213 if ($ename_list[$k] == $eventname && $ename_list[$k]!= "") echo " selected";
214 echo ">" . $ename_list[$k];
220 <!-- type of events ends
-->
222  
; 
;<span
class='text'><?php
xl('Type of Events','e'); ?
>: </span
>
225 $event_types=array("select", "update", "insert", "delete", "replace");
226 $lcount=count($event_types);
227 if($eventname=="disclosure"){
228 echo "<select name='type_event' disabled='disabled'>\n";
229 echo " <option value=''>" . xl('All') . "</option>\n";
233 echo "<select name='type_event'>\n";}
234 echo " <option value=''>" . xl('All') . "</option>\n";
235 for($k=0;$k<$lcount;$k++
) {
236 echo " <option value='" .$event_types[$k]. "'";
237 if ($event_types[$k] == $type_event && $event_types[$k]!= "") echo " selected";
238 echo ">" . preg_replace('/^select$/','Query',$event_types[$k]); // Convert select to Query for MU2 requirement
245 <span
class='text'><?php
xl('Include Checksum','e'); ?
>: </span
>
249 $check_sum = formData('check_sum','G');
251 <input type
="checkbox" name
="check_sum" " <?php if ($check_sum == 'on') echo "checked
"; ?>"></input
>
254 <input type
=hidden name
="event" value
=<?php
echo $event ; ?
>>
255 <a href
="javascript:document.theform.submit();" class='link_submit'>[<?php
xl('Refresh','e'); ?
>]</a
>
258 <div id
='valid_button'>
259 <input type
=button id
='validate_log' onclick
='validatelog();' value
='<?php echo xla('Validate Log
'); ?>'></input
>
261 <div id
='log_loading' style
="display: none">
262 <img src
='../../images/loading.gif'/>
270 <?php
if ($start_date && $end_date && $err_message!=1) { ?
>
274 <!-- <TH
><?php
xl('Date', 'e'); ?
><TD
> -->
275 <th id
="sortby_date" class="text sortby" title
="<?php xl('Sort by date/time','e'); ?>"><?php
xl('Date','e'); ?
></th
>
276 <th id
="sortby_event" class="text sortby" title
="<?php xl('Sort by Event','e'); ?>"><?php
xl('Event','e'); ?
></th
>
277 <th id
="sortby_category" class="text sortby" title
="<?php xl('Sort by Category','e'); ?>"><?php
xl('Category','e'); ?
></th
>
278 <th id
="sortby_user" class="text sortby" title
="<?php xl('Sort by User','e'); ?>"><?php
xl('User','e'); ?
></th
>
279 <th id
="sortby_cuser" class="text sortby" title
="<?php xl('Sort by Crt User','e'); ?>"><?php
xl('Certificate User','e'); ?
></th
>
280 <th id
="sortby_group" class="text sortby" title
="<?php xl('Sort by Group','e'); ?>"><?php
xl('Group','e'); ?
></th
>
281 <th id
="sortby_pid" class="text sortby" title
="<?php xl('Sort by PatientID','e'); ?>"><?php
xl('PatientID','e'); ?
></th
>
282 <th id
="sortby_success" class="text sortby" title
="<?php xl('Sort by Success','e'); ?>"><?php
xl('Success','e'); ?
></th
>
283 <th id
="sortby_comments" class="text sortby" title
="<?php xl('Sort by Comments','e'); ?>"><?php
xl('Comments','e'); ?
></th
>
284 <?php
if($check_sum) {?
>
285 <th id
="sortby_checksum" class="text sortby" title
="<?php xl('Sort by Checksum','e'); ?>"><?php
xl('Checksum','e'); ?
></th
>
290 $eventname = formData('eventname','G');
291 $type_event = formData('type_event','G');
293 <input type
=hidden name
=event value
=<?php
echo $eventname."-".$type_event ?
>>
297 if($eventname != "" && $type_event != "")
299 $getevent=$eventname."-".$type_event;
302 if(($eventname == "") && ($type_event != ""))
303 { $tevent=$type_event;
305 else if($type_event =="" && $eventname != "")
307 else if ($eventname == "")
312 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']))) {
315 foreach ($ret as $iter) {
317 $patterns = array ('/^success/','/^failure/','/ encounter/');
318 $replace = array ( xl('success'), xl('failure'), xl('encounter','',' '));
320 $log_id = $iter['id'];
321 $commentEncrStatus = "No";
322 $logEncryptData = logCommentEncryptData($log_id);
323 if(count($logEncryptData) > 0){
324 $commentEncrStatus = $logEncryptData['encrypt'];
327 //July 1, 2014: Ensoftek: Decrypt comment data if encrypted
328 if($commentEncrStatus == "Yes"){
329 $trans_comments = preg_replace($patterns, $replace, aes256Decrypt($iter["comments"]));
331 $trans_comments = preg_replace($patterns, $replace, $iter["comments"]);
335 <TR
class="oneresult">
336 <TD
class="text"><?php
echo oeFormatShortDate(substr($iter["date"], 0, 10)) . substr($iter["date"], 10) ?
></TD
>
337 <TD
class="text"><?php
echo preg_replace('/select$/','Query',$iter["event"]); //Convert select term to Query for MU2 requirements ?></TD>
338 <TD
class="text"><?php
echo $iter["category"]?
></TD
>
339 <TD
class="text"><?php
echo $iter["user"]?
></TD
>
340 <TD
class="text"><?php
echo $iter["crt_user"]?
></TD
>
341 <TD
class="text"><?php
echo $iter["groupname"]?
></TD
>
342 <TD
class="text"><?php
echo $iter["patient_id"]?
></TD
>
343 <TD
class="text"><?php
echo $iter["success"]?
></TD
>
344 <TD
class="text"><?php
echo nl2br(text(preg_replace('/^select/i','Query',$trans_comments))); //Convert select term to Query for MU2 requirements ?></TD>
345 <?php
if($check_sum) { ?
>
346 <TD
class="text"><?php
echo $iter["checksum"]?
></TD
>
354 if (($eventname=="disclosure") ||
($gev == ""))
356 $eventname="disclosure";
357 if ($ret = getEvents(array('sdate' => $get_sdate,'edate' => $get_edate, 'user' => $form_user, 'patient' => $form_pid, 'sortby' => $_GET['sortby'], 'event' =>$eventname))) {
358 foreach ($ret as $iter) {
359 $comments=xl('Recipient Name').":".$iter["recipient"].";".xl('Disclosure Info').":".$iter["description"];
361 <TR
class="oneresult">
362 <TD
class="text"><?php
echo htmlspecialchars(oeFormatShortDate(substr($iter["date"], 0, 10)) . substr($iter["date"], 10),ENT_NOQUOTES
); ?
></TD
>
363 <TD
class="text"><?php
echo htmlspecialchars(xl($iter["event"]),ENT_NOQUOTES
);?
></TD
>
364 <TD
class="text"><?php
echo htmlspecialchars(xl($iter["category"]),ENT_NOQUOTES
);?
></TD
>
365 <TD
class="text"><?php
echo htmlspecialchars($iter["user"],ENT_NOQUOTES
);?
></TD
>
366 <TD
class="text"><?php
echo htmlspecialchars($iter["crt_user"],ENT_NOQUOTES
);?
></TD
>
367 <TD
class="text"><?php
echo htmlspecialchars($iter["groupname"],ENT_NOQUOTES
);?
></TD
>
368 <TD
class="text"><?php
echo htmlspecialchars($iter["patient_id"],ENT_NOQUOTES
);?
></TD
>
369 <TD
class="text"><?php
echo htmlspecialchars($iter["success"],ENT_NOQUOTES
);?
></TD
>
370 <TD
class="text"><?php
echo htmlspecialchars($comments,ENT_NOQUOTES
);?
></TD
>
371 <?php
if($check_sum) { ?
>
372 <TD
class="text"><?php
echo htmlspecialchars($iter["checksum"],ENT_NOQUOTES
);?
></TD
>
387 <script language
="javascript">
389 // jQuery stuff to make the page a little easier to use
390 $
(document
).ready(function(){
391 // funny thing here... good learning experience
392 // the TR has TD children which have their own background and text color
393 // toggling the TR color doesn't change the TD color
394 // so we need to change all the TR's children (the TD's) just as we did the TR
395 // thus we have two calls to toggleClass:
396 // 1 - for the parent (the TR)
397 // 2 - for each of the children (the TDs)
398 $
(".oneresult").mouseover(function() { $
(this
).toggleClass("highlight"); $
(this
).children().toggleClass("highlight"); });
399 $
(".oneresult").mouseout(function() { $
(this
).toggleClass("highlight"); $
(this
).children().toggleClass("highlight"); });
401 // click-able column headers to sort the list
403 $
("#sortby_date").click(function() { set_sort_direction(); $
("#sortby").val("date"); $
("#theform").submit(); });
404 $
("#sortby_event").click(function() { set_sort_direction(); $
("#sortby").val("event"); $
("#theform").submit(); });
405 $
("#sortby_category").click(function() { set_sort_direction(); $
("#sortby").val("category"); $
("#theform").submit(); });
406 $
("#sortby_user").click(function() { set_sort_direction(); $
("#sortby").val("user"); $
("#theform").submit(); });
407 $
("#sortby_cuser").click(function() { set_sort_direction(); $
("#sortby").val("user"); $
("#theform").submit(); });
408 $
("#sortby_group").click(function() { set_sort_direction(); $
("#sortby").val("groupname"); $
("#theform").submit(); });
409 $
("#sortby_pid").click(function() { set_sort_direction(); $
("#sortby").val("patient_id"); $
("#theform").submit(); });
410 $
("#sortby_success").click(function() { set_sort_direction(); $
("#sortby").val("success"); $
("#theform").submit(); });
411 $
("#sortby_comments").click(function() { set_sort_direction(); $
("#sortby").val("comments"); $
("#theform").submit(); });
412 $
("#sortby_checksum").click(function() { set_sort_direction(); $
("#sortby").val("checksum"); $
("#theform").submit(); });
415 function set_sort_direction(){
416 if($
('#direction').val() == 'asc')
417 $
('#direction').val('desc');
419 $
('#direction').val('asc');
424 /* required for popup calendar */
425 Calendar
.setup({inputField
:"start_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_begin_date", showsTime
:true});
426 Calendar
.setup({inputField
:"end_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_end_date", showsTime
:true});
428 function validatelog(){
429 var img
= document
.getElementById('log_loading');
430 var btn
= document
.getElementById('valid_button');
432 if(img
.style
.display
== "block"){
435 img
.style
.display
= "block";
436 if(btn
){btn
.style
.display
= "none"}
439 url
:"../../library/log_validation.php",
442 success
:function(response
){
444 img
.style
.display
="none";
445 if(btn
){btn
.style
.display
="block";}
451 img
.style
.display
="none";
452 if(btn
){btn
.style
.display
="block";}
454 alert('<?php echo xls("Audit Log Validation Failed"); ?>');