| 70 | rodolico | 1 | <?php
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 |   | 
        
           |  |  | 4 | define ('SQL_GET_BACKUPS', "select 
 | 
        
           |  |  | 5 |                              concat( '<a href=\"index.html?backups_id=', backups.backups_id, '\">',device.name,'</a>') 'Device',
 | 
        
           |  |  | 6 |                              server_device.name 'Server',
 | 
        
           |  |  | 7 |                              round ( backups.allocated_size / 1024 / 1024, 0 ) 'Size (M)',
 | 
        
           |  |  | 8 |                              backups.start_time 'Start Time',
 | 
        
           |  |  | 9 |                              backups.bandwidth_allocated 'Bandwidth (Mb/s)',
 | 
        
           |  |  | 10 |                              backups.responsible_party 'Responsible',
 | 
        
           |  |  | 11 |                              lastrun.last_run 'Last Report',
 | 
        
           |  |  | 12 |                              concat('<a href=\"edit.html?backups_id=',backups.backups_id,'\">Edit</a>') Action
 | 
        
           |  |  | 13 |                            from 
 | 
        
           |  |  | 14 |                              backups join device using (device_id) 
 | 
        
           |  |  | 15 |                              join (
 | 
        
           |  |  | 16 |                                  backups_server join device server_device using (device_id)
 | 
        
           |  |  | 17 |                                   )
 | 
        
           |  |  | 18 |                                  using ( backups_server_id )
 | 
        
           |  |  | 19 |                               join (
 | 
        
           |  |  | 20 |                                        select 
 | 
        
           |  |  | 21 |                                           backups_id, 
 | 
        
           |  |  | 22 |                                           max(report_date) last_run 
 | 
        
           |  |  | 23 |                                        from 
 | 
        
           |  |  | 24 |                                           backups_run
 | 
        
           |  |  | 25 |                                        group by backups_id
 | 
        
           |  |  | 26 |                                    ) lastrun
 | 
        
           |  |  | 27 |                                  on lastrun.backups_id = backups.backups_id
 | 
        
           |  |  | 28 |                            where 
 | 
        
           |  |  | 29 |                              <whereClause>
 | 
        
           |  |  | 30 |                            order by
 | 
        
           |  |  | 31 |                               server_device.name,
 | 
        
           |  |  | 32 |                               device.name"
 | 
        
           |  |  | 33 |       );
 | 
        
           |  |  | 34 |   | 
        
           |  |  | 35 |   | 
        
           |  |  | 36 | /*
 | 
        
           |  |  | 37 | "select 
 | 
        
           |  |  | 38 |                              concat( '<a href=\"index.html?backups_id=', backups.backups_id, '\">',device.name,'</a>') 'Device',
 | 
        
           |  |  | 39 |                              server_device.name 'Server',
 | 
        
           |  |  | 40 |                              round ( backups.allocated_size / 1024 / 1024, 0 ) 'Size (M)',
 | 
        
           |  |  | 41 |                              backups.start_time 'Start Time',
 | 
        
           |  |  | 42 |                              backups.bandwidth_allocated 'Bandwidth (Mb/s)',
 | 
        
           |  |  | 43 |                              backups.responsible_party 'Responsible',
 | 
        
           |  |  | 44 |                              run.last_run 'Last Run',
 | 
        
           |  |  | 45 |                              concat('<a href=\"edit.html?backups_id=',backups.backups_id,'\">Edit</a>') Action
 | 
        
           |  |  | 46 |                            from 
 | 
        
           |  |  | 47 |                              backups join device using (device_id) 
 | 
        
           |  |  | 48 |                              join (
 | 
        
           |  |  | 49 |                                  backups_server join device server_device using (device_id)
 | 
        
           |  |  | 50 |                                   )
 | 
        
           |  |  | 51 |                                  using ( backups_server_id )
 | 
        
           |  |  | 52 |                              join (
 | 
        
           |  |  | 53 |                                 select max(report_date) last_run, backups_id from backups_run 
 | 
        
           |  |  | 54 |                                   ) run using (backups_id)
 | 
        
           |  |  | 55 |                            where 
 | 
        
           |  |  | 56 |                              <whereClause>
 | 
        
           |  |  | 57 |                            order by
 | 
        
           |  |  | 58 |                               server_device.name,
 | 
        
           |  |  | 59 |                               device.name" );
 | 
        
           |  |  | 60 | */
 | 
        
           |  |  | 61 |   | 
        
           |  |  | 62 | ?>
 |