From 46d25dddd610916820b9b66ecc720822ed3fee37 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Sun, 24 Jul 2011 11:08:29 +0200 Subject: [PATCH] bacula-web: Added last know good backup job to client report - Fixed some typo in template - Fixed code indentation --- gui/bacula-web/client-report.php | 26 ++++++++++++++++++++++ gui/bacula-web/templates/client-report.tpl | 26 ++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/gui/bacula-web/client-report.php b/gui/bacula-web/client-report.php index fd4291eb08..6997645975 100644 --- a/gui/bacula-web/client-report.php +++ b/gui/bacula-web/client-report.php @@ -18,9 +18,13 @@ include_once( 'config/global.inc.php' ); $dbSql = new Bweb(); + $clientid = ''; $client = ''; $client_jobs = array(); + $backup_jobs = array(); + + $job_levels = array( 'D' => 'Differential', 'I' => 'Incremental', 'F' => 'Full' ); $http_post = CHttpRequest::getRequestVars( $_POST ); $http_get = CHttpRequest::getRequestVars( $_GET ); @@ -35,6 +39,28 @@ // Client informations $client = $dbSql->getClientInfos($clientid); + // Client's backup jobs + $query = 'SELECT Job.Name, Job.Jobid, Job.Level, Job.Jobbytes, Job.Jobfiles, Status.JobStatusLong FROM Job '; + $query .= "LEFT JOIN Status ON Job.JobStatus = Status.JobStatus "; + $query .= "WHERE Job.ClientId = '$clientid' AND Job.JobStatus = 'T' "; + $query .= 'ORDER BY Job.EndTime DESC '; + $query .= 'LIMIT 1'; + + try{ + $jobs_result = $dbSql->db_link->runQuery($query); + + foreach( $jobs_result->fetchAll() as $job ) { + $job['level'] = $job_levels[ $job['level'] ]; + $job['jobfiles'] = number_format( $job['jobfiles'], 0, '.', "'"); + $job['jobbytes'] = CUtils::Get_Human_Size( $job['jobbytes'] ); + + $backup_jobs[] = $job; + } + }catch(PDOException $e) { + CDBError::raiseError($e); + } + $dbSql->tpl->assign( 'backup_jobs', $backup_jobs); + $dbSql->tpl->assign( 'client_name', $client['name']); $dbSql->tpl->assign( 'client_os', $client['os']); $dbSql->tpl->assign( 'client_arch', $client['arch']); diff --git a/gui/bacula-web/templates/client-report.tpl b/gui/bacula-web/templates/client-report.tpl index 962d61d971..6f93b146f8 100644 --- a/gui/bacula-web/templates/client-report.tpl +++ b/gui/bacula-web/templates/client-report.tpl @@ -9,13 +9,13 @@ {include file=header.tpl}
-

Client(s) Report

+

Client Report

Client informations

@@ -32,6 +32,28 @@
+

Last good backup job

+ + + + + + + + + + {foreach from=$backup_jobs item=job} + + + + + + + + + {/foreach} +
NameJod IdLevelBytesFilesStatus
{$job.name}{$job.jobid}{$job.level}{$job.jobbytes}{$job.jobfiles}{$job.jobstatuslong}
+
-- 2.39.5