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.php";
22 $smarty = new Smarty();
27 // Smarty configuration
28 $smarty->compile_check = true;
29 $smarty->debugging = false;
30 $smarty->force_compile = true;
32 $smarty->template_dir = "./templates";
33 $smarty->compile_dir = "./templates_c";
34 $smarty->config_dir = "./configs";
36 // Get the last 10 failed jobs
38 $failed_jobs = array();
40 switch( $dbSql->driver )
43 $query = "SELECT SEC_TO_TIME( UNIX_TIMESTAMP(Job.EndTime)-UNIX_TIMESTAMP(Job.StartTime) ) AS elapsed, Job.JobId, Job.Name AS job_name, Job.StartTime, Job.EndTime, Job.Level, Pool.Name AS pool_name, Job.JobStatus ";
44 $query .= "FROM Job ";
45 $query .= "LEFT JOIN Pool ON Job.PoolId=Pool.PoolId ";
46 $query .= "WHERE Job.JobStatus = 'f' ";
47 //$query .= "WHERE Job.EndTime BETWEEN <= NOW() and UNIX_TIMESTAMP(EndTime) >UNIX_TIMESTAMP(NOW())-86400 ";
48 $query .= "ORDER BY Job.EndTime DESC ";
54 $query = "select (Job.EndTime - Job.StartTime ) AS elapsed, Job.Name, Job.StartTime, Job.EndTime, Job.Level, Pool.Name, Job.JobStatus ";
55 $query .= "FROM Job ";
56 $query .= "LEFT JOIN Pool ON Job.PoolId=Pool.PoolId ";
57 $query .= "WHERE EndTime <= NOW() and EndTime > NOW() - 86400 * interval '1 second' ";
58 $query .= "ORDER BY Job.EndTime DESC";
62 $jobsresult = $dbSql->db_link->query( $query );
64 if( PEAR::isError( $jobsresult ) ) {
65 echo "SQL query = $query <br />";
66 die("Unable to get last failed jobs from catalog" . $jobsresult->getMessage() );
68 while( $job = $jobsresult->fetchRow( DB_FETCHMODE_ASSOC ) ) {
69 array_push( $failed_jobs, $job);
72 $smarty->assign( 'failed_jobs', $failed_jobs );
74 $smarty->display('jobs.tpl');