Download Reports'; $action = ''; if(array_key_exists('action', $_GET)) { $action = $_GET['action']; } if(array_key_exists('action', $_POST)) { $action = $_POST['action']; } switch($action) { case 'get_options': $rid = (int)$_POST['rid']; $r = report_load($mysqli, $rid); $vals = array(); $vals['format'] = $r['format']; $vals['include_registrations'] = $r['include_registrations']; $vals['test'] = time(NULL); form_ajax_response(array('status'=>0, 'val'=>$vals)); exit(); case 'download': $rid = (int)$_GET['rid']; $r = report_load($mysqli, $rid); /* Add report overrides */ $include_registrations = $_GET['include_registrations']; if(array_key_exists($include_registrations, $report_options['include_registrations']['values'])) { $r['include_registrations'] = $include_registrations; } $year = (int)$_GET['year']; $r['year'] = $year; if(array_key_exists($_GET['format'], $report_options['format']['values'])) { $r['format'] = $_GET['format']; } report_gen($mysqli, $r); exit(); } sfiab_page_begin($u, "Download Reports", $page_id, $help); $q = $mysqli->query("SELECT MIN(year) AS M FROM users"); $u = $q->fetch_assoc(); $min_year = $u['M']; $timeslots = timeslots_load_rounds($mysqli); ?>