preparing for 5.0.1 release in several weeks (#1509)
[openemr.git] / interface / main / daemon_frame.php
blobbee67e1894e4b34d31218ce0800991e5880915e0
1 <?php
2 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This script runs in a hidden frame, reloads itself periodically,
10 // and does whatever might need doing in the background.
12 // Tell auth.inc that this is the daemon script; this is so that
13 // inactivity timeouts will still work, and to avoid logging an
14 // event every time we run.
15 $GLOBALS['DAEMON_FLAG'] = true;
17 include_once("../globals.php");
19 $daemon_interval = 120; // Interval in seconds between reloads.
20 $colorh = '#ff0000'; // highlight color
21 $colorn = '#000000'; // normal color
23 // Check if there are faxes in the recvq.
24 $faxcount = 0;
25 if ($GLOBALS['enable_hylafax']) {
26 $statlines = array();
27 exec("faxstat -r -l -h " . $GLOBALS['hylafax_server'], $statlines);
28 foreach ($statlines as $line) {
29 if (substr($line, 0, 1) == '-') {
30 ++$faxcount;
35 $color_fax = $faxcount ? $colorh : $colorn;
37 // Check if this user has any active patient notes assigned to them.
38 $row = sqlQuery("SELECT count(*) AS count FROM pnotes WHERE " .
39 "activity = 1 ".
40 " AND deleted != 1 ". // exlude ALL deleted notes
41 " AND assigned_to = '" . $_SESSION['authUser'] . "'");
42 $color_aun = $row['count'] ? $colorh : $colorn;
44 <html>
45 <body bgcolor="#000000">
46 <script language='JavaScript'>
48 function timerint() {
49 location.reload();
50 return;
53 var ld = parent.left_nav.document;
55 if (ld && ld.getElementById('searchFields')) {
56 setTimeout('timerint()', <?php echo $daemon_interval * 1000; ?>);
58 var elem = ld.getElementById('lbl_fax');
59 if (elem) elem.style.color = '<?php echo $color_fax; ?>';
61 elem = ld.getElementById('lbl_aun');
62 if (elem) elem.style.color = '<?php echo $color_aun; ?>';
64 else {
65 // Nav frame is not fully loaded yet, so wait a few secs.
66 setTimeout('timerint()', 5000);
69 </script>
70 </body>
71 </html>