Relocated code block that sets the default facility for a new event
[openemr.git] / interface / main / daemon_frame.php
blobbf694ceab70c682481a60befb3854e6f18eae4c9
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['hylafax_server']) {
26 $statlines = array();
27 exec("faxstat -r -l -h " . $GLOBALS['hylafax_server'], $statlines);
28 foreach ($statlines as $line) {
29 if (substr($line, 0, 1) == '-') ++$faxcount;
32 $color_fax = $faxcount ? $colorh : $colorn;
34 // Check if this user has any active patient notes assigned to them.
35 $row = sqlQuery("SELECT count(*) AS count FROM pnotes WHERE " .
36 "activity = 1 AND assigned_to = '" . $_SESSION['authUser'] . "'");
37 $color_aun = $row['count'] ? $colorh : $colorn;
39 <html>
40 <body bgcolor="#000000">
41 <script language='JavaScript'>
43 function timerint() {
44 location.reload();
45 return;
48 var ld = parent.left_nav.document;
50 if (ld && ld.getElementById('logout_link')) {
51 setTimeout('timerint()', <?php echo $daemon_interval * 1000; ?>);
53 var elem = ld.getElementById('lbl_fax');
54 if (elem) elem.style.color = '<?php echo $color_fax; ?>';
56 elem = ld.getElementById('lbl_aun');
57 if (elem) elem.style.color = '<?php echo $color_aun; ?>';
59 else {
60 // Nav frame is not fully loaded yet, so wait a few secs.
61 setTimeout('timerint()', 5000);
64 </script>
65 </body>
66 </html>