]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/report.php
bacula-web: Added / updated GPL copyright header in php scripts
[bacula/bacula] / gui / bacula-web / report.php
index aec2cd2ebe73e3514fd659dc5b4f9c58194847e2..089cbd8e6ffc7fcf03be3f906ffa9e4d80049700 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 /* 
 +-------------------------------------------------------------------------+
-| Copyright (C) 2004-2005 Juan Luis Frances Jiminez                       |
+| Copyright (C) 2004 Juan Luis Francés Jiménez                                                   |
+| Copyright 2010-2011, Davide Franco                                             |
 |                                                                         |
 | This program is free software; you can redistribute it and/or           |
 | modify it under the terms of the GNU General Public License             |
 +-------------------------------------------------------------------------+ 
 */
 session_start();
-require ("paths.php");
-require($smarty_path."Smarty.class.php");
-include "classes.inc";
-
-$smarty = new Smarty;
-
-//$smarty->compile_check = true;
-//$smarty->debugging = true;
-
-$smarty->template_dir   = "./templates";
-$smarty->compile_dir    = "./templates_c";
-$smarty->config_dir     = "./configs";
-$smarty->config_load("bacula.conf");
-require("lang.php");
+include_once( 'config.inc.php' );
 
 $dbSql = new Bweb();
 
@@ -43,28 +31,29 @@ $bytes = $dbSql->CalculateBytesPeriod($_GET['server'],$dbSql->StartDate,$dbSql->
 $files = $dbSql->CalculateFilesPeriod($_GET['server'],$dbSql->StartDate,$dbSql->EndDate);
 $smarty->assign('startperiod',$dbSql->StartDate);
 $smarty->assign('endperiod',$dbSql->EndDate); 
-$smarty->assign('bytesperiod',$bytes);
+$smarty->assign('bytesperiod',$dbSql->human_file_size( $bytes ) );
 $smarty->assign('filesperiod',$files);
 
 // Array with jobs data
 $a_jobs = array();
 if ($dbSql->driver == "mysql")
-        $res_jobs = $dbSql->link->query("select *,SEC_TO_TIME( UNIX_TIMESTAMP(Job.EndTime)-UNIX_TIMESTAMP(Job.StartTime) ) as elapsed from Job where EndTime < '$dbSql->EndDate' and EndTime > '$dbSql->StartDate' and Name='$_GET[server]' order by EndTime")
+        $res_jobs = $dbSql->db_link->query("select *,SEC_TO_TIME( UNIX_TIMESTAMP(Job.EndTime)-UNIX_TIMESTAMP(Job.StartTime) ) as elapsed from Job where EndTime < '$dbSql->EndDate' and EndTime > '$dbSql->StartDate' and Name='$_GET[server]' order by EndTime")
                 or die("Error query row 50");
 else if ($dbSql->driver == "pgsql")
-        $res_jobs = $dbSql->link->query("select jobid as \"JobId\",job as \"Job\",name as \"Name\",type as \"Type\",level as \"Level\",clientid as \"ClientId\",jobstatus as \"JobStatus\",schedtime as \"SchedTime\",starttime as \"StartTime\",endtime as \"EndTime\",jobtdate as \"JobtDate\",volsessionid as \"VolSessionId\",volsessiontime as \"VolSessionTime\",jobfiles as \"JobFiles\",jobbytes as \"JobBytes\",joberrors as \"JobErrors\",jobmissingfiles as \"JobMissingFiles\",poolid as \"PoolId\",filesetid as \"FilesetId\",purgedfiles as \"PurgedFiles\",hasbase,Job.EndTime::timestamp-Job.StartTime::timestamp as elapsed from Job where EndTime < '$dbSql->EndDate' and EndTime > '$dbSql->StartDate' and Name='$_GET[server]' order by EndTime")
+        $res_jobs = $dbSql->db_link->query("select jobid as \"JobId\",job as \"Job\",name as \"Name\",type as \"Type\",level as \"Level\",clientid as \"ClientId\",jobstatus as \"JobStatus\",schedtime as \"SchedTime\",starttime as \"StartTime\",endtime as \"EndTime\",jobtdate as \"JobtDate\",volsessionid as \"VolSessionId\",volsessiontime as \"VolSessionTime\",jobfiles as \"JobFiles\",jobbytes as \"JobBytes\",joberrors as \"JobErrors\",jobmissingfiles as \"JobMissingFiles\",poolid as \"PoolId\",filesetid as \"FilesetId\",purgedfiles as \"PurgedFiles\",hasbase,Job.EndTime::timestamp-Job.StartTime::timestamp as elapsed from Job where EndTime < '$dbSql->EndDate' and EndTime > '$dbSql->StartDate' and Name='$_GET[server]' order by EndTime")
                 or die("Error query row 56");
 
 while ( $tmp = $res_jobs->fetchRow(DB_FETCHMODE_ASSOC) ) {
-        $tdate = explode (":",$tmp['elapsed']);                                                                           // Temporal "workaround" ;) Fix later
+        $tdate = explode (":",$tmp['elapsed']);                // Temporal "workaround" ;) Fix later
         if ( $tdate[0] > 300000 )
                 $tmp['elapsed'] = "00:00:00";
+               $tmp['JobBytes'] = $dbSql->human_file_size( $tmp['JobBytes'] );
         array_push($a_jobs,$tmp);
 }
 $smarty->assign('jobs',$a_jobs);
 
 // report_select.tpl
-$res = $dbSql->link->query("select Name from Job group by Name");
+$res = $dbSql->db_link->query("select Name from Job group by Name");
 $a_jobs = array();
 while ( $tmp = $res->fetchRow() )
         array_push($a_jobs, $tmp[0]);
@@ -74,5 +63,5 @@ $smarty->assign('time2',( (time())-2678400) );
 
 
 
-$smarty->display('report.tpl');
+$dbSql->tpl->display('report.tpl');
 ?>