switch to explode since split deprecated
[openemr.git] / interface / reports / background_services.php
blobdc5d5bc200065fb68db6b4dde34483d2e8b92832
1 <?php
2 /**
3 * Report to view the background services.
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();?>
39 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
41 <title><?php echo xlt('Background Services'); ?></title>
43 <script type="text/javascript" src="../../library/js/jquery-1.7.2.min.js"></script>
45 <style type="text/css">
47 /* specifically include & exclude from printing */
48 @media print {
49 #report_parameters {
50 visibility: hidden;
51 display: none;
53 #report_parameters_daterange {
54 visibility: visible;
55 display: inline;
57 #report_results table {
58 margin-top: 0px;
62 /* specifically exclude some from the screen */
63 @media screen {
64 #report_parameters_daterange {
65 visibility: hidden;
66 display: none;
70 </style>
71 </head>
73 <body class="body_top">
75 <span class='title'><?php echo xlt('Background Services'); ?></span>
77 <form method='post' name='theform' id='theform' action='background_services.php' onsubmit='return top.restoreSession()'>
79 <div id="report_parameters">
80 <table>
81 <tr>
82 <td width='470px'>
83 <div style='float:left'>
85 <table class='text'>
86 <div style='margin-left:15px'>
87 <a id='refresh_button' href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit()'>
88 <span>
89 <?php echo xlt('Refresh'); ?>
90 </span>
91 </a>
92 </div>
93 </table>
94 </td>
95 </tr>
96 </table>
97 </div> <!-- end of search parameters -->
99 <br>
103 <div id="report_results">
104 <table>
106 <thead>
107 <th align='center'>
108 <?php echo xlt('Service Name'); ?>
109 </th>
111 <th align='center'>
112 <?php echo xlt('Active'); ?>
113 </th>
115 <th align='center'>
116 <?php echo xlt('Automatic'); ?>
117 </th>
119 <th align='center'>
120 <?php echo xlt('Interval (minutes)'); ?>
121 </th>
123 <th align='center'>
124 <?php echo xlt('Currently Running'); ?>
125 </th>
127 <th align='center'>
128 <?php echo xlt('Last Run Started At'); ?>
129 </th>
131 <th align='center'>
132 <?php echo xlt('Next Scheduled Run'); ?>
133 </th>
135 <th align='center'>
136 &nbsp;
137 </th>
139 </thead>
140 <tbody> <!-- added for better print-ability -->
141 <?php
143 $res = sqlStatement("SELECT *, (`next_run` - INTERVAL `execute_interval` MINUTE) as `last_run_start`" .
144 " FROM `background_services` ORDER BY `sort_order`");
145 while ($row = sqlFetchArray($res)) {
147 <tr>
148 <td align='center'><?php echo xlt($row['title']); ?></td>
150 <td align='center'><?php echo ($row['active']) ? xlt("Yes") : xlt("No"); ?></td>
152 <?php if ($row['active']) { ?>
153 <td align='center'><?php echo ($row['execute_interval'] > 0) ? xlt("Yes") : xlt("No"); ?></td>
154 <?php } else { ?>
155 <td align='center'><?php echo xlt('Not Applicable'); ?></td>
156 <?php } ?>
158 <?php if ($row['active'] && ($row['execute_interval'] > 0)) { ?>
159 <td align='center'><?php echo text($row['execute_interval']); ?></td>
160 <?php } else { ?>
161 <td align='center'><?php echo xlt('Not Applicable'); ?></td>
162 <?php } ?>
164 <td align='center'><?php echo ($row['running']>0) ? xlt("Yes") : xlt("No"); ?></td>
166 <?php if ( $row['running'] > -1) { ?>
167 <td align='center'><?php echo text($row['last_run_start']); ?></td>
168 <?php } else { ?>
169 <td align='center'><?php echo xlt('Never'); ?></td>
170 <?php } ?>
172 <?php if ( $row['active'] && ($row['execute_interval'] > 0) ) { ?>
173 <td align='center'><?php echo text($row['next_run']); ?></td>
174 <?php } else { ?>
175 <td align='center'><?php echo xlt('Not Applicable'); ?></td>
176 <?php } ?>
178 <?php if ($row['name'] == "phimail") { ?>
179 <td align='center'><a href='direct_message_log.php' onclick='top.restoreSession()'><?php echo xlt("View Log"); ?></a></td>
180 <?php } else { ?>
181 <td align='center'>&nbsp;</td>
182 <?php } ?>
184 </tr>
185 <?php
186 } // $row = sqlFetchArray($res) while
188 </tbody>
189 </table>
190 </div> <!-- end of search results -->
192 </form>
194 </body>
195 </html>