2 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
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.
25 if ($GLOBALS['hylafax_server']) {
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 " .
37 " AND deleted != 1 ". // exlude ALL deleted notes
38 " AND assigned_to = '" . $_SESSION['authUser'] . "'");
39 $color_aun = $row['count'] ?
$colorh : $colorn;
42 <body bgcolor
="#000000">
43 <script language
='JavaScript'>
50 var ld
= parent
.left_nav
.document
;
52 if (ld
&& ld
.getElementById('searchFields')) {
53 setTimeout('timerint()', <?php
echo $daemon_interval * 1000; ?
>);
55 var elem
= ld
.getElementById('lbl_fax');
56 if (elem
) elem
.style
.color
= '<?php echo $color_fax; ?>';
58 elem
= ld
.getElementById('lbl_aun');
59 if (elem
) elem
.style
.color
= '<?php echo $color_aun; ?>';
62 // Nav frame is not fully loaded yet, so wait a few secs.
63 setTimeout('timerint()', 5000);