From ebbefa45e407240926fe4a64befcb114a9be1d08 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Fri, 11 Feb 2011 17:24:00 +0100 Subject: [PATCH] bacula-web: Added Total stored bytes to the BackupJob Report's page --- gui/bacula-web/backupjob-report.php | 14 +++++++++----- gui/bacula-web/templates/backupjob-report.tpl | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gui/bacula-web/backupjob-report.php b/gui/bacula-web/backupjob-report.php index 26a1b2308d..59e3c9dc87 100644 --- a/gui/bacula-web/backupjob-report.php +++ b/gui/bacula-web/backupjob-report.php @@ -28,10 +28,7 @@ else die( "Please specify a backup job name " ); - $smarty->assign('backupjob_name', $backupjob_name ); - // Last 7 days stored Bytes graph - $data = array(); $graph = new BGraph( "graph2.png" ); $days = array(); @@ -41,18 +38,25 @@ array_push( $days, array( 'start' => date( "Y-m-d 00:00:00", $today ), 'end' => date( "Y-m-d 23:59:00", $today ) ) ); } - $days_stored_bytes = array(); + $days_stored_bytes = array(); + $backupjob_bytes = 0; foreach( $days as $day ) { array_push( $days_stored_bytes, $dbSql->GetStoredBytesByJob( $backupjob_name, $day['start'], $day['end'] ) ); } - + + // Calculate total bytes for this period + foreach( $days_stored_bytes as $day ) + $backupjob_bytes += $day[1]; + $graph->SetData( $days_stored_bytes, 'bars', 'text-data' ); $graph->SetGraphSize( 400, 230 ); $graph->Render(); $smarty->assign('graph_stored_bytes', $graph->Get_Image_file() ); + $smarty->assign('backupjob_name', $backupjob_name ); + $smarty->assign('backupjob_bytes', $backupjob_bytes ); // Process and display the template $smarty->display('backupjob-report.tpl'); diff --git a/gui/bacula-web/templates/backupjob-report.tpl b/gui/bacula-web/templates/backupjob-report.tpl index 0f0c0dfa4b..f422968cc0 100644 --- a/gui/bacula-web/templates/backupjob-report.tpl +++ b/gui/bacula-web/templates/backupjob-report.tpl @@ -37,7 +37,7 @@ Transfered Bytes - ppp{$backupjob_bytes} + {$backupjob_bytes} GB Transfered Files -- 2.39.5