From: Davide Franco Date: Fri, 28 Jan 2011 16:05:46 +0000 (+0100) Subject: bacula-web: New PHP scrips for Backup Job report X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4f9375e9e428fdff1a48aac90ca1487b4f919887;p=bacula%2Fbacula bacula-web: New PHP scrips for Backup Job report - backupjob-report.php and 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