<?php /** * Returns the main backup list page. */ function getbu_list_content( ){ //this is called destructuring [$table, $colIdxs] = rpc( 'f:getbu_list_all', "order by BUID" ); error_log("rpc for getbu_list_all done"); $html_rows=''; foreach( $table as $row ) { $view_type = 'edit-file-bu'; if($row[ $colIdxs['BuType'] ]==1){ $view_type = 'edit-db-bu'; } $html_row = '<tr>'; $html_row .= '<td>'.$row[ $colIdxs['BUID'] ].'</td>'; $html_row .= "<td class='td_icon' title='edit' ><img class=\"btn_mse\" onclick=\"btn_clk_nav(this, '$view_type', {$row[ $colIdxs['BUID']]})\" src='img/edit-icon-24x24.png'></td>"; // edit icon $html_row .= "<td class='td_icon' title='delete' ><img class=\"btn_mse\" onclick=\"btn_clk_nav(this, 'delete-bu', {$row[ $colIdxs['BUID']]})\" src='img/trash-bin-red-24x24.png'></td>"; // trash icon $html_row .= "<td class=\"btn_mse\" onclick=\"btn_clk_nav(this, '$view_type', {$row[ $colIdxs['BUID']]})\" >{$row[ $colIdxs['BUName']]}</td>"; $but = $row[$colIdxs['BuType']]==1?'DB':'F'; $html_row .= "<td>$but</td>"; if($row[ $colIdxs['BuError'] ]!=''){ $html_row .= "<td><span style='color:red;'>!! </span>{$row[ $colIdxs['LastRunDt']]}</td>"; }else{ $html_row .= "<td>{$row[ $colIdxs['LastRunDt']]}</td>"; } if( $row[ $colIdxs['BU_REPEAT'] ]=='N' ){ $html_row .= "<td title='edit schedule' ><img src=\"img/red-cross.png\" class=\" btn_mse\" onclick=\"btn_clk_nav(this, 'sched', {$row[ $colIdxs['BUID']]})\" ></td>"; }else{ $html_row .= "<td title='edit schedule' ><button class=\"btn_mse btn_exec btn_small\" onclick=\"btn_clk_nav(this, 'sched', {$row[ $colIdxs['BUID']]})\" >Edit</button> {$row[ $colIdxs['BU_REPEAT']]}</td>"; } if($row[ $colIdxs['BuRunning']]){ $html_row .= '<td><img src="img/green-tick.png"></td>'; }else{ $html_row .= "<td id=\"td_run_{$row[ $colIdxs['BUID']]}\" ><button class=\"btn_mse btn_exec btn_small\" onclick=\"btn_clk_nav(this, 'btn_run_bu noTest', {$row[ $colIdxs['BUID']]})\" >Run Now</button></td>"; } $html_row .= '</tr>'; $html_rows .= $html_row; } $content = <<<'EOD' <div class="section_header" >Backup Config List</div> <div class="content_section_text" style="min-height: 350px;" > <br> <table class="tblcenter" > <tr> <th>ID</th> <th></th> <th></th> <th>Name</th> <th>Type</th> <th>Last Run (UTC)</th> <th>Scheduled</th> <th>Running</th> </tr> --INSERT-ROWS-- <tr class="high-row-style"> <td></td> <td></td> <td></td> <td class="td_label_bkup" >Database backup</td> <td> <button class="btn_mse btn_exec" onclick="btn_clk_nav(this, 'new-db-bu')">Create</button> </td> </tr> <tr> <td></td> <td></td> <td></td> <td class="td_label_bkup" >Files backup</td> <td> <button class="btn_mse btn_exec" onclick="btn_clk_nav(this, 'new-file-bu' )">Create</button> </td> </tr> </table> </div> EOD; return str_replace('--INSERT-ROWS--', $html_rows, $content); } ?>