3 +-------------------------------------------------------------------------+
4 | Copyright (C) 2004 Juan Luis Francés Jiménez |
6 | This program is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU General Public License |
8 | as published by the Free Software Foundation; either version 2 |
9 | of the License, or (at your option) any later version. |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. |
15 +-------------------------------------------------------------------------+
18 require ("paths.php");
19 require($smarty_path."Smarty.class.php");
20 include "classes.inc";
24 //$smarty->compile_check = true;
25 //$smarty->debugging = true;
27 $smarty->template_dir = "./templates";
28 $smarty->compile_dir = "./templates_c";
29 $smarty->config_dir = "./configs";
30 $smarty->config_load("bacula.conf");
35 if ( $_GET['default'] == 1) { // Default params, 1 month
36 $dbSql->StartDate = strftime("%Y-%m-%d %H:%M:%S",time()-2678400);
37 $dbSql->EndDate = strftime("%Y-%m-%d %H:%M:%S",time());
40 $dbSql->PrepareDate($_GET['StartDateMonth'],$_GET['StartDateDay'],$_GET['StartDateYear'],$_GET['EndDateMonth'],$_GET['EndDateDay'],$_GET['EndDateYear']);
42 $bytes = $dbSql->CalculateBytesPeriod($_GET['server'],$dbSql->StartDate,$dbSql->EndDate);
43 $files = $dbSql->CalculateFilesPeriod($_GET['server'],$dbSql->StartDate,$dbSql->EndDate);
44 $smarty->assign('startperiod',$dbSql->StartDate);
45 $smarty->assign('endperiod',$dbSql->EndDate);
46 $smarty->assign('bytesperiod',$bytes);
47 $smarty->assign('filesperiod',$files);
49 // Array with jobs data
51 $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")
52 or die("Error query row 50");
54 while ( $tmp = $res_jobs->fetchRow(DB_FETCHMODE_ASSOC) ) {
55 $tdate = explode (":",$tmp[elapsed]); // Temporal "workaround" ;) Fix later
56 if ( $tdate[0] > 300000 )
57 $tmp[elapsed] = "00:00:00";
58 array_push($a_jobs,$tmp);
60 $smarty->assign('jobs',$a_jobs);
63 $res = $dbSql->link->query("select Name from Job group by Name");
65 while ( $tmp = $res->fetchRow() )
66 array_push($a_jobs, $tmp[0]);
67 $smarty->assign('total_name_jobs',$a_jobs);
69 $smarty->assign('time2',( (time())-2678400) ); // Current time - 1 month. <select> date
73 $smarty->display('report.tpl');