4 * interface/logview/erx_logview.php Display NewCrop errors.
6 * Copyright (C) 2011 ZMG LLC <sam@zhservices.com>
8 * LICENSE: This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 3 of the License, or (at your option) any
11 * later version. This program is distributed in the hope that it will be
12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 * Public License for more details. You should have received a copy of the GNU
15 * General Public License along with this program.
16 * If not, see <http://opensource.org/licenses/gpl-license.php>.
20 * @author Eldho Chacko <eldho@zhservices.com>
21 * @author Vinish K <vinish@zhservices.com>
22 * @author Sam Likins <sam.likins@wsi-services.com>
23 * @link http://www.open-emr.org
26 require_once(__DIR__
.'/../globals.php');
27 require_once($srcdir.'/log.inc');
29 $error_log_path = $GLOBALS['OE_SITE_DIR'].'/documents/erx_error';
31 if (array_key_exists('filename', $_REQUEST)) {
32 $filename = $_REQUEST['filename'];
37 if (array_key_exists('start_date', $_REQUEST)) {
38 $start_date = $_REQUEST['start_date'];
46 preg_match('/erx_error-\d{4}-\d{1,2}-\d{1,2}\.log/', $filename, $matches);
49 if ($fd = fopen($error_log_path.'/'.$filename, 'r')) {
50 $bat_content = fread($fd, filesize($error_log_path.'/'.$filename));
53 header('Pragma: public');
55 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
56 header('Content-Type: application/force-download');
57 header('Content-Disposition: attachment; filename='.$filename);
58 header('Content-Description: File Transfer');
59 header('Content-Length: '.strlen($bat_content));
70 <?php
html_header_show(); ?
>
71 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
72 <link rel
="stylesheet" href
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.css" type
="text/css">
73 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
74 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.js"></script
>
75 <?php
include_once($GLOBALS['srcdir'].'/dynarch_calendar_en.inc.php'); ?
>
76 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar_setup.js"></script
>
77 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
79 <body
class="body_top">
81 <font
class="title"><?php
echo xlt('eRx Logs'); ?
></font
><br
><br
>
85 <span
class="text"><?php
echo xlt('Date'); ?
>: </span
>
88 <input type
="text" size
="10" name
="start_date" id
="start_date" value
="<?php echo $start_date ? substr($start_date, 0, 10) : date('Y-m-d'); ?>" title
="<?php echo xlt('yyyy-mm-dd Date of service'); ?>" onkeyup
="datekeyup(this, mypcc)" onblur
="dateblur(this, mypcc)" />
89 <img src
="<?php echo $GLOBALS['webroot']; ?>/interface/pic/show_calendar.gif" align
="absbottom" width
="24" height
="22" id
="img_begin_date" border
="0" alt
="[?]" style
="cursor: pointer; cursor: hand" title
="<?php echo xlt('Click here to choose a date'); ?>"> 
;
92 <input type
="submit" name
="search_logs" value
="<?php echo xlt('Search'); ?>">
100 if (array_key_exists('search_logs', $_REQUEST)) {
101 if ($handle = opendir($error_log_path)) {
102 while (false !== ($file = readdir($handle))) {
103 $file_as_in_folder = 'erx_error-'.$start_date.'.log';
105 if ($file != '.' && $file != '..' && $file_as_in_folder == $file) {
107 $fd = fopen($error_log_path.'/'.$file, 'r');
108 $bat_content = fread($fd, filesize($error_log_path.'/'.$file));
110 <p
><?php
echo xlt('Download'); ?
>: <a href
="erx_logview.php?filename=<?php echo htmlspecialchars($file, ENT_QUOTES); ?>"><?php
echo htmlspecialchars($file, ENT_NOQUOTES
); ?
></a
></p
>
111 <textarea rows
="35" cols
="132"><?php
echo htmlspecialchars($bat_content, ENT_QUOTES
); ?
></textarea
>
117 if ($check_for_file == 0) {
118 echo xlt('No log file exist for the selected date').': '.$start_date;
124 <script type
="text/javascript">
125 Calendar
.setup({inputField
:"start_date", ifFormat
:"%Y-%m-%d", button
:"img_begin_date"});