}
// Media used bytes in a human format
$media['volbytes'] = $this->human_file_size( $media['volbytes'] );
- //echo "volume " . $media['volumename'] . 'vol bytes' .$media['volbytes'] . '<br />';
} else {
$media['lastwritten'] = "N/A";
$media['expire'] = "N/A";
$media['volbytes'] = "0 KB";
}
+
+ // Odd or even row
+ if( count( $volumes[ $pool['name'] ] ) % 2)
+ $media['class'] = 'odd';
+
// Add the media in pool array
array_push( $volumes[ $pool['name']], $media);
}
$where_status = "JobStatus = 'T' ";
break;
case 'failed':
- $where_status = "JobStatus = 'f' ";
+ $where_status = "JobStatus IN ('f','E') ";
break;
case 'canceled':
$where_status = "JobStatus = 'A' ";
break;
+ case 'waiting':
+ $where_status = "JobStatus IN ('F','S','M','m','s','j','c','d','t') ";
+ break;
} // end switch
}
}
}
+ // Return elasped time string for a job
+ function Get_ElapsedTime( $start_time, $end_time )
+ {
+ $diff = $end_time - $start_time;
+
+ $daysDiff = sprintf("%02d", floor($diff/60/60/24) );
+ $diff -= $daysDiff*60*60*24;
+
+ $hrsDiff = sprintf("%02d", floor($diff/60/60) );
+ $diff -= $hrsDiff*60*60;
+
+ $minsDiff = sprintf("%02d", floor($diff/60) );
+ $diff -= $minsDiff*60;
+ $secsDiff = sprintf("%02d", $diff );
+
+ if( $daysDiff > 0 )
+ return $daysDiff . 'day(s) ' . $hrsDiff.':' . $minsDiff . ':' . $secsDiff;
+ else
+ return $hrsDiff . ':' . $minsDiff . ':' . $secsDiff;
+ }
+
public function Get_ElapsedTime_Job( $delay = LAST_DAY )
{
$query = "";
$total_elapsed += $time['elapsed'];
}
// Verify if elapsed time is more than 1 day
- if ( $total_elapsed > 86400 ) {
+ if ( $total_elapsed > LAST_DAY ) {
return date("%d days H:i:s", $total_elapsed );
}else {
return date("H:i:s", $total_elapsed );
return array( $day, $stored_bytes );
}
}
+
+ public function GetStoredBytesByJob( $jobname, $start_date, $end_date )
+ {
+ $query = "SELECT SUM(JobBytes) as stored_bytes, EndTime FROM Job ";
+ $query .= "WHERE ( EndTime BETWEEN '$start_date' AND '$end_date' ) AND ";
+ $query .= "Name = '$jobname'";
+
+ echo 'query ' . $query . '<br />';
+
+ $result = $this->db_link->query( $query );
+
+ if( PEAR::isError( $result ) ) {
+ die( "Unable to get Job Bytes from catalog" );
+ }else{
+ $stored_bytes = 0;
+ $tmp = $result->fetchRow( DB_FETCHMODE_ASSOC );
+
+ $day = date( "D d", strtotime($end_date) );
+
+ if( isset( $tmp['stored_bytes'] ) ) {
+ $hbytes = $this->human_file_size( $tmp['stored_bytes'], 3, 'GB');
+ $hbytes = explode( " ", $hbytes );
+ $stored_bytes = $hbytes[0];
+ }
+
+ return array( $day, $stored_bytes );
+ }
+ }
} // end class Bweb
?>