From 6a95234b58f7cda441d58a5e8e3de123830c3625 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Fri, 28 Jan 2011 17:05:46 +0100 Subject: [PATCH] bacula-web: New PHP scrips for Backup Job report - backupjob-report.php and templates/backupjob-report.tpl --- gui/bacula-web/backupjob-report.php | 60 ++++++++++++++++ gui/bacula-web/templates/backupjob-report.tpl | 68 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 gui/bacula-web/backupjob-report.php create mode 100644 gui/bacula-web/templates/backupjob-report.tpl diff --git a/gui/bacula-web/backupjob-report.php b/gui/bacula-web/backupjob-report.php new file mode 100644 index 0000000000..26a1b2308d --- /dev/null +++ b/gui/bacula-web/backupjob-report.php @@ -0,0 +1,60 @@ +compile_check = true; + $smarty->debugging = false; + $smarty->force_compile = true; + + $smarty->template_dir = "./templates"; + $smarty->compile_dir = "./templates_c"; + $smarty->config_dir = "./configs"; + + $backupjob_name = ""; + + if( isset( $_POST["backupjob_name"] ) ) + $backupjob_name = $_POST["backupjob_name"]; + elseif( isset( $_GET["backupjob_name"] ) ) + $backupjob_name = $_GET["backupjob_name"]; + 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(); + + // Get the last 7 days interval (start and end) + for( $c = 6 ; $c >= 0 ; $c-- ) { + $today = ( mktime() - ($c * LAST_DAY) ); + 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(); + + foreach( $days as $day ) { + array_push( $days_stored_bytes, $dbSql->GetStoredBytesByJob( $backupjob_name, $day['start'], $day['end'] ) ); + } + + $graph->SetData( $days_stored_bytes, 'bars', 'text-data' ); + $graph->SetGraphSize( 400, 230 ); + + $graph->Render(); + $smarty->assign('graph_stored_bytes', $graph->Get_Image_file() ); + + + // Process and display the template + $smarty->display('backupjob-report.tpl'); + +?> \ No newline at end of file diff --git a/gui/bacula-web/templates/backupjob-report.tpl b/gui/bacula-web/templates/backupjob-report.tpl new file mode 100644 index 0000000000..d633db326d --- /dev/null +++ b/gui/bacula-web/templates/backupjob-report.tpl @@ -0,0 +1,68 @@ + + + +bacula-web + +{literal} + +{/literal} + + + +{popup_init src='./external_packages/js/overlib.js'} +{include file=header.tpl} + + + +
+ +
+

Backup Job Report

+ + + + + + + + + + + + + + + + + + + +
Backup Job name:{$backupjob_name}
Period:ppp{$backupjob_period}
Transfered Bytesppp{$backupjob_bytes}
Transfered Filesppp{$backupjob_files}
+
+ + +
+

Last jobs

+
+ + +
+

Transfered Bytes (last week)

+ +
+ + +
+

Transfered Files

+
+ +
+ +{include file="footer.tpl"} \ No newline at end of file -- 2.39.2