query("SELECT `id` FROM log WHERE `type`='tour_scheduler' AND `result`='1' AND `year`='{$config['year']}' ORDER BY `id` DESC LIMIT 1");
if($q->num_rows != 1) {
$r['running'] = false;
$r['messages'] = "";
$r['percent'] = 0;
} else {
$d = $q->fetch_assoc();
/* Get all messages */
$r['running'] = true;
$r['messages'] = '';
$q = $mysqli->query("SELECT * FROM log WHERE `id`>='{$d['id']}' AND `type`='tour_scheduler' AND year='{$config['year']}' ORDER BY `id`");
$last_message = '';
while($d = $q->fetch_assoc()) {
if($last_message != $d['data']) {
$r['messages'] .= $d['data']."
";
$last_message = $d['data'];
}
$r['percent'] = $d['result'];
if($d['result'] == 100) {
$r['running'] = false;
}
}
}
/* Get data from most recent run of the scheduler from the log */
print(json_encode($r));
exit();
case 'run':
sfiab_log($mysqli, "tour_scheduler", $u, 1, "Initializing...");
$mysqli->real_query("INSERT INTO queue(`command`,`result`) VALUES('tour_scheduler','queued')");
queue_start($mysqli);
form_ajax_response(array('status'=>0, ));
exit();
}
sfiab_page_begin($u, "Tours", $page_id);
?>
Category | Grade | Max Capacity |
---|---|---|
=$c_str?> | =$g?> | =$stats['by_grade'][$g]?> |
Individual students can be assigned to a Tour on the Student List/Editor pages.
The tour scheduler takes about a minute to run and will:
Status: | |
Output: |
The complete output log is available here: Tour Scheduler Log