- // Global variables
- $job_status = array( 'D' => 'Diff', 'I' => 'Incr', 'F' => 'Full' );
-
- // Running jobs
- $running_jobs = array();
-
- $query = "SELECT Job.JobId, Job.JobStatus, Status.JobStatusLong, Job.Name, Job.StartTime, Job.EndTime, Job.Level, Pool.Name AS Pool_name ";
- $query .= "FROM Job ";
- $query .= "JOIN Status ON Job.JobStatus = Status.JobStatus ";
- $query .= "LEFT JOIN Pool ON Job.PoolId = Pool.PoolId ";
- $query .= "WHERE Job.JobStatus IN ('F','S','M','m','s','j','c','d','t','C','R')";
- $query .= "ORDER BY JobId";
-
- $jobsresult = $dbSql->db_link->query( $query );
-
- if( PEAR::isError( $jobsresult ) ) {
- echo "SQL query = $query <br />";
- die("Unable to get last failed jobs from catalog" . $jobsresult->getMessage() );
- }else {
- while( $job = $jobsresult->fetchRow( DB_FETCHMODE_ASSOC ) ) {
-
- // Elapsed time for this job
- $elapsed = 'N/A';
- if( $job['JobStatus'] == 'R' )
- $job['elapsed_time'] = $dbSql->Get_ElapsedTime( strtotime($job['StartTime']), time() );
- else
- $job['elapsed_time'] = 'N/A';
-
- // Odd or even row
- if( count($running_jobs) % 2)
- $job['Job_classe'] = 'odd';
-
- // Job Status
- $job['Level'] = $job_status[ $job['Level'] ];
-
- array_push( $running_jobs, $job);
- }
- }
-
- $smarty->assign( 'running_jobs', $running_jobs );
-
- // Get the last jobs list