]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/jobs.php
bacula-web: Modified internal php code for smarty classe instance name
[bacula/bacula] / gui / bacula-web / jobs.php
index cc41205559a5c3283a88039c43fa4db10e9f268d..daea6dbad37b8205d1d5ca75ab5b75bc964bf54a 100644 (file)
@@ -1,36 +1,25 @@
 <?php
   session_start();
-  require_once ("paths.php");
-  require_once ($smarty_path."Smarty.class.php");
-  require_once ("bweb.inc.php");
-  require_once ("config.inc.php");  
+  require_once('paths.php');
+  include_once( 'bweb.inc.php' );
 
-  $smarty = new Smarty();     
   $dbSql = new Bweb();
-
-  require("lang.php");
-
-  // Smarty configuration
-  $smarty->compile_check = true;
-  $smarty->debugging = false;
-  $smarty->force_compile = true;
-
-  $smarty->template_dir = "./templates";
-  $smarty->compile_dir = "./templates_c";
-  $smarty->config_dir     = "./configs";
-  
   // Jobs list
   $query          = "";
   $last_jobs = array();
   
   // Job Status list
   $job_status = array( 'Any', 'Waiting', 'Running', 'Completed', 'Failed', 'Canceled' );
-  $smarty->assign( 'job_status', $job_status );
+  $dbSql->tpl->assign( 'job_status', $job_status );
   
+  // Jobs per page
+  $jobs_per_page = array( 25,50,75,100,150 );
+  $dbSql->tpl->assign( 'jobs_per_page', $jobs_per_page );
+
   // Global variables
   $job_level = array( 'D' => 'Diff', 'I' => 'Incr', 'F' => 'Full' );
   
-  $query .= "SELECT Job.JobId, Job.Name AS Job_name, Job.StartTime, Job.EndTime, Job.Level, Job.JobBytes, Pool.Name, Job.JobStatus, Pool.Name AS Pool_name, Status.JobStatusLong ";
+  $query .= "SELECT Job.JobId, Job.Name AS Job_name, Job.StartTime, Job.EndTime, Job.Level, Job.JobBytes, Job.JobFiles, Pool.Name, Job.JobStatus, Pool.Name AS Pool_name, Status.JobStatusLong ";
   $query .= "FROM Job ";
   $query .= "LEFT JOIN Pool ON Job.PoolId=Pool.PoolId ";
   $query .= "LEFT JOIN Status ON Job.JobStatus = Status.JobStatus ";
                        $query .= "WHERE Job.JobStatus = 'R' ";
                break;
                case 'waiting':
-                       $query .= "WHERE Job.JobStatus IN ('F','S','M','m','s','j','c','d','t','C','R') ";
+                       $query .= "WHERE Job.JobStatus IN ('F','S','M','m','s','j','c','d','t','C') ";
                break;
                case 'completed':
                        $query .= "WHERE Job.JobStatus = 'T' ";
                break;
                case 'failed':
-                       $query .= "WHERE Job.JobStatus = 'f' ";
+                       $query .= "WHERE Job.JobStatus IN ('f','E') ";
                break;
                case 'canceled':
                        $query .= "WHERE Job.JobStatus = 'A' ";
   $query .= "ORDER BY Job.JobId DESC ";
   
   // Determine how many jobs to display
-  if( isset($_POST['limit']) )
-       $query .= "LIMIT " . $_POST['limit'];
+  if( isset($_POST['jobs_per_page']) )
+       $query .= "LIMIT " . $_POST['jobs_per_page'];
   else
-       $query .= "LIMIT 20 ";
+       $query .= "LIMIT 25 ";
   
   //echo $query . '<br />';
   
                array_push( $last_jobs, $job);
          }
   }
-  $smarty->assign( 'last_jobs', $last_jobs );
+  $dbSql->tpl->assign( 'last_jobs', $last_jobs );
   
   // Count jobs
   if( isset( $_POST['status'] ) )
   else
        $total_jobs = $dbSql->CountJobs( ALL );
   
-  $smarty->assign( 'total_jobs', $total_jobs );
+  $dbSql->tpl->assign( 'total_jobs', $total_jobs );
   
   // Process and display the template 
-  $smarty->display('jobs.tpl');
+  $dbSql->tpl->display('jobs.tpl');
 ?>