]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Improved and fixed small bugs in php code
authorDavide Franco <bacula-dev@dflc.ch>
Wed, 6 Jul 2011 19:03:34 +0000 (21:03 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 2 Aug 2011 09:56:22 +0000 (11:56 +0200)
gui/bacula-web/backupjob-report.php

index 1a2b561c584795ce0b0e423b97e90455446da637..06a88824234952f4c1f7e0836e7276f397145f7d 100644 (file)
 \r
   // Get the last 7 days interval (start and end)\r
   for( $c = 6 ; $c >= 0 ; $c-- ) {\r
-         $today = ( mktime() - ($c * LAST_DAY) );\r
-         array_push( $days, array( 'start' => date( "Y-m-d 00:00:00", $today ), 'end' => date( "Y-m-d 23:59:00", $today ) ) );\r
+         $today  = NOW - ($c * DAY);
+         $days[] = CTimeUtils::get_Day_Intervals($today);
   }\r
   
   // Generate Backup Job report period string\r
-  $backupjob_period = "From " . date( "Y-m-d", mktime()-LAST_WEEK ) . " to " . date( "Y-m-d", mktime() );\r
+  $backupjob_period = "From " . date( "Y-m-d", (NOW-WEEK) ) . " to " . date( "Y-m-d", NOW );
   
   // ===============================================================
   // Last 7 days stored Bytes graph\r
   // ===============================================================  
   $graph = new CGraph( "graph2.png" );
 \r
-  foreach( $days as $day )\r
-    array_push( $days_stored_bytes, $dbSql->GetStoredBytesByJob( $backupjob_name, $day['start'], $day['end'] ) );\r
+  foreach( $days as $day ) {
+       $stored_bytes = CUtils::Get_Human_Size( $dbSql->getStoredBytes( $day['start'], $day['end'], $backupjob_name), 1, 'GB', false );
+       $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
+  }
  \r
   // Calculate total bytes for this period\r
-  foreach( $days_stored_bytes as $day )\r
-       $backupjob_bytes += $day[1];\r
+  $backupjob_bytes = $dbSql->getStoredBytes( LAST_WEEK, NOW, $backupjob_name );
+  $backupjob_bytes = CUtils::Get_Human_Size( $backupjob_bytes );
        \r
   $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );\r
   $graph->SetGraphSize( 400, 230 );\r