<?php include 'functions.php'; $reader = get_sheet_reader('.'); $output = []; $first = 1; foreach ($reader as $row) { if ($first) { $keys = $row; $first = 0; } else { if (passes_filters($keys, $row, $_GET)) { array_push($output, encode_row($keys, $row)); } } } echo json_encode($output);
function get_column($col_name, $filters) { $reader = get_sheet_reader('..'); $col_list = []; $first = 1; foreach ($reader as $row) { if ($first) { $keys = $row; $first = 0; } else { if (passes_filters($keys, $row, $filters)) { $col_list = array_merge($col_list, get_from_row($col_name, $keys, $row)); } } } sort($col_list); return remove_duplicates($col_list); }