-$smarty->assign('bytes_totales',$tmp[0]);
-$smarty->assign('total_jobs', $tmp[1]);
-
-$tmp = $totalfiles->fetchRow();
-$smarty->assign('files_totales',$tmp[0]);
-
-$client->free();
-$totalfiles->free();
-$last24bytes->free();
-
-
-// report_select.tpl & last_run_report.tpl
-$res = $dbSql->link->query("select Name from Job group by Name");
-$a_jobs = array();
-while ( $tmp = $res->fetchRow() )
- array_push($a_jobs, $tmp[0]);
-$smarty->assign('total_name_jobs',$a_jobs);
-$smarty->assign('time2',( (time())-2678400) ); // Current time - 1 month. <select> date
-$res->free();
-
-// volumes.tpl
-$volumes = $dbSql->GetDataVolumes(); // Obtain array with info
-$pools = array_keys($volumes); // Extract Pools
-$smarty->assign('pools',$pools);
-$smarty->assign('volumes',$volumes);
-
-// last_run_report.tpl
-if ($mode == "Lite" && $_GET['Full_popup'] != "yes") {
- $tmp = array();
- if ( $dbSql->driver == "mysql" )
- $status = $dbSql->link->query("select JobId,Name,EndTime,JobStatus from Job where EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) >UNIX_TIMESTAMP(NOW())-86400 and JobStatus!='T'" )
- or die ("Error: query at row 95");
- if ( $dbSql->driver == "pgsql" )
- $status = $dbSql->link->query("select JobId,Name,EndTime,JobStatus from Job where EndTime <= NOW() and EndTime >NOW() - 86400 * interval '1 second' and JobStatus!= 'T'")
- or die ( "Error: query at row 98" );
- $smarty->assign('status', $status->numRows());
- if ( $status->numRows() ) {
- while ( $res = $status->fetchRow() )
- array_push($tmp, $res);
- $smarty->assign('errors_array',$tmp);
- }
- $status->free();
-
- // Total Elapsed Time. Only for single Job.
- if ( $dbSql->driver == "mysql" )
- $ret = $dbSql->link->query("select UNIX_TIMESTAMP(EndTime)-UNIX_TIMESTAMP(StartTime) as elapsed from Job where EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-84600")
- or die ("Error at row 110");
- if ( $dbSql->driver == "pgsql" )
- $ret = $dbSql->link->query("select EndTime - StartTime as elapsed from Job where EndTime <= NOW() and EndTime > NOW() - 84600 * interval '1 second'")
- or die ("Error at row 113");
- while ( $res = $ret->fetchRow() ) {
- if ( $TotalElapsed < 1000000000 ) // Temporal "workaround" ;) Fix later
- $TotalElapsed += $res[0];
- }
- if ($TotalElapsed > 86400) // More than 1 day!
- $TotalElapsed = gmstrftime("%d days %H:%M:%S", $TotalElapsed);
- else
- $TotalElapsed = gmstrftime("%H:%M:%S", $TotalElapsed);
- $smarty->assign('TotalElapsed',$TotalElapsed);
- $ret->free();
+
+$graph = new BGraph( "graph.png" );
+$graph->SetData( $data, 'pie', 'text-data-single' );
+$graph->SetGraphSize( 400, 230 );
+
+$graph->Render();
+$dbSql->tpl->assign('graph_jobs', $graph->Get_Image_file() );
+unset($graph);
+
+// Pool and volumes graph
+$data = array();
+$graph = new BGraph( "graph1.png" );
+
+$pools = $dbSql->Get_Pools_List();
+
+foreach( $pools as $pool ) {
+ array_push( $data, $dbSql->CountVolumesByPool( $pool ) );
+}
+
+$graph->SetData( $data, 'pie', 'text-data-single' );
+$graph->SetGraphSize( 400, 230 );
+
+$graph->Render();
+$dbSql->tpl->assign('graph_pools', $graph->Get_Image_file() );
+
+// 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->GetStoredBytesByInterval( $day['start'], $day['end'] ) );