From: Davide Franco Date: Sun, 24 Jul 2011 09:08:29 +0000 (+0200) Subject: bacula-web: Added last know good backup job to client report X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3268497a29be03a810a29fa81b6c3c29cb217333;p=bacula%2Fbacula bacula-web: Added last know good backup job to client report - Fixed some typo in template - Fixed code indentation --- 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}
+