<?php function edit_sh_bu_getContent( $db_id ){ if( !is_numeric($db_id) ) return "<div>Not an integer $db_id</div>"; $db_id = (int)$db_id; [$table, $colIdxs] = rpc( 'f:getbu_list_all', "where BUID=$db_id" ); if( count($table)==0 ) return "<div>Item not found $db_id</div>"; $row = $table[0]; //we're expecting the first and only item $bun = $row[ $colIdxs['BUName']]; $bus = $row[ $colIdxs['Dir_Src']]; $bu_dt = $row[ $colIdxs['BU_DATE']]; if($bu_dt==''){ $bu_dt = date("Y-m-d"); } $bu_t = $row[ $colIdxs['BU_TIME']]; if($bu_t==''){ $bu_t = '00:00'; } $bu_r = $row[ $colIdxs['BU_REPEAT']]; switch($bu_r){ case 'D': $id_checked = 'id="sched_ip_daily"'; break; case 'W': $id_checked = 'id="sched_ip_weekly"'; break; case 'M': $id_checked = 'id="sched_ip_monthly"'; break; case 'N': default: $id_checked = 'id="sched_ip_none"'; } $content = <<<'EOD' <div class="section_header" >Edit Backup Schedule</div> <div class="content_section_text" style="min-height: 350px;" > <div class="two-col-panel"> <div>ID</div> <div>$db_id</div> <div>Backup Name</div> <div>$bun</div> <div>Data Source</div> <div>$bus</div> <div>Next Run Date/Time</div> <div><input id="sched_date" type="date" value="$bu_dt" ></div> <div></div> <div><input id="sched_time" type="time" value="$bu_t"></div> <div>Repeat</div> <div> <input style="width: 25px;" type="radio" name="sched_period" id="sched_ip_none" ><label for="sched_ip_none">None</label><br> <input style="width: 25px;" type="radio" name="sched_period" id="sched_ip_daily"><label for="sched_ip_daily">Daily</label><br> <input style="width: 25px;" type="radio" name="sched_period" id="sched_ip_weekly" ><label for="sched_ip_weekly">Weekly</label><br> <input style="width: 25px;" type="radio" name="sched_period" id="sched_ip_monthly"><label for="sched_ip_monthly">Monthly</label> </div> <div></div> <div> <button class="btn_exec" onclick="btn_clk_nav(this, 'btn_edit_shed_bu', $db_id)" >Save</button> <button class="btn_exec" onclick="btn_clk_nav(this, 'btn_cancel')" >Cancel</button> </div> </div> </div> EOD; $content = str_replace($id_checked, $id_checked.' checked ', $content ); $content = str_replace('$bus', $bus, $content); $content = str_replace('$bun', $bun, $content); $content = str_replace('$bu_dt', $bu_dt, $content); $content = str_replace('$bu_t', $bu_t, $content); return str_replace('$db_id', $db_id, $content); } ?>