$dbSql = new Bweb();
- $clientid = '';
- $client = '';
- $client_jobs = array();
- $backup_jobs = array();
+ $clientid = '';
+ $client = '';
+ $period = '';
+ $client_jobs = array();
+ $backup_jobs = array();
+ $days_stored_bytes = array();
+ $days_stored_files = array();
$job_levels = array( 'D' => 'Differential', 'I' => 'Incremental', 'F' => 'Full' );
$clientid = $http_get['client_id'];
else
die( "Application error: Client not specified " );
+
+ // Backup period
+ if( isset( $http_post['period'] ) )
+ $period = $http_post['period'];
+ else
+ die( "Please specify a backup period" );
// Client informations
$client = $dbSql->getClientInfos($clientid);
}catch(PDOException $e) {
CDBError::raiseError($e);
}
+
$dbSql->tpl->assign( 'backup_jobs', $backup_jobs);
+ // Get the last 7 days interval (start and end)
+ $days = CTimeUtils::getLastDaysIntervals( $period );
+
+ // ===============================================================
+ // Last 7 days stored Bytes graph
+ // ===============================================================
+ $graph = new CGraph( "graph2.png" );
+
+ foreach( $days as $day ) {
+ $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end'], 'ALL', $clientid);
+ $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false );
+ $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
+ }
+
+ $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );
+ $graph->SetGraphSize( 400, 230 );
+ $graph->SetYTitle( "GB" );
+
+ $graph->Render();
+ $dbSql->tpl->assign('graph_stored_bytes', $graph->Get_Image_file() );
+
+ // ===============================================================
+ // Getting last 7 days stored files graph
+ // ===============================================================
+ $graph = new CGraph("graph3.png" );
+
+ foreach( $days as $day ) {
+ $stored_files = $dbSql->getStoredFiles( $day['start'], $day['end'], 'ALL', $clientid);
+ $days_stored_files[] = array( date("m-d", $day['start']), $stored_files );
+ }
+
+ $graph->SetData( $days_stored_files, 'bars', 'text-data' );
+ $graph->SetGraphSize( 400, 230 );
+ $graph->SetYTitle( "Files" );
+
+ $graph->Render();
+ $dbSql->tpl->assign('graph_stored_files', $graph->Get_Image_file() );
+
+ $dbSql->tpl->assign( 'period', $period);
$dbSql->tpl->assign( 'client_name', $client['name']);
$dbSql->tpl->assign( 'client_os', $client['os']);
$dbSql->tpl->assign( 'client_arch', $client['arch']);