From da8a74468f5f7cdcc5eaf75946d3576ebb7cf443 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 23 Dec 2002 23:40:37 +0000 Subject: [PATCH] Now read values from file Keep code for reading value by DB --- htdocs/public/dons/therm.php | 64 +++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/htdocs/public/dons/therm.php b/htdocs/public/dons/therm.php index c1b2afa4d7a..39e875099a7 100644 --- a/htdocs/public/dons/therm.php +++ b/htdocs/public/dons/therm.php @@ -25,20 +25,60 @@ if (file_exists ($thermlib)) { include($thermlib); - /* - * Read Values + if (1) + { + + + $dons_file = "/var/run/dolibarr.don.eucd"; + + /* + * Read Values + */ + + if (file_exists ($dons_file)) + { + + $fp = fopen($dons_file, 'r' ); + + + if ($fp) + { + $intentValue = fgets( $fp, 10 ); + $pendingValue = fgets( $fp, 10 ); + $actualValue = fgets( $fp, 10 ); + fclose( $fp ); + } + + } + + } + else + { + + + + /* + * Read Values + */ + + $conf = new Conf(); + $dbt = new Db(); + $dontherm = new Don($dbt); + + $actualValue = $dontherm->sum_actual(); + $pendingValue = $dontherm->sum_pending(); + $intentValue = $dontherm->sum_intent(); + + $dbt->close(); + } + + + /* + * Graph thermometer */ - - $conf = new Conf(); - $dbt = new Db(); - $dontherm = new Don($dbt); - - $actualValue = $dontherm->sum_actual(); - $pendingValue = $dontherm->sum_pending(); - $intentValue = $dontherm->sum_intent(); - + print moneyMeter($actualValue, $pendingValue, $intentValue); - $dbt->close(); + } ?>