]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/bweb.inc.php
bacula-web: Enhanced pools and volume page
[bacula/bacula] / gui / bacula-web / bweb.inc.php
index c3ab7cc6af4072c3115d572255d95f49bd4eb5ac..8e2c68ec5b0df09252d2088d674ff225532afed2 100644 (file)
@@ -327,12 +327,16 @@ class Bweb extends DB {
                                                                                }
                                                                                // 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);
                                                        }
@@ -366,7 +370,7 @@ class Bweb extends DB {
                                                $where_status = "JobStatus = 'T' ";
                                        break;
                                        case 'failed':
-                                               $where_status = "JobStatus = 'f' ";
+                                               $where_status = "JobStatus IN ('f','E') ";
                                        break;
                                        case 'canceled':
                                                $where_status = "JobStatus = 'A' ";
@@ -637,5 +641,33 @@ class Bweb extends DB {
                                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
 ?>