function getFinalData($color = 'gray', $json = false) { global $myStops; global $myArrival; $arrival = $myArrival[$color]; $schedules = loadDataStr(getDateStr($color)); $finalDisplay = array(); foreach ($schedules as $stopName => $departTimes) { $stopId = $stopName; $stopName = $myStops[$stopName]; $count = 3; $arrival[$stopId] = str_replace('min', '', $arrival[$stopId]); $arrivals = explode('&', $arrival[$stopId]); if (!empty($arrivals)) { foreach ($arrivals as &$a) { $a = trim($a); if (is_numeric($a)) { $a = $a . ' min'; } else { $a = ''; } } } foreach ($departTimes as $departTime) { if ($departTime > 0) { $count--; if ($count >= 0) { if ($json == true) { $finalDisplay[$stopName][] = secondsToArray($departTime); } else { $rider = array_shift($arrivals); $finalDisplay[$stopName][] = secondsToReadableTime($departTime) . "(Rider: " . (empty($rider) ? 'N/A' : $rider) . ")"; } } } } } return $finalDisplay; }
function getFinalData($color = 'gray', $json = false) { $schedules = loadDataStr(getDateStr($color)); $finalDisplay = array(); foreach ($schedules as $stopName => $departTimes) { $count = 3; foreach ($departTimes as $departTime) { if ($departTime > 0) { $count--; if ($count >= 0) { if ($json == true) { $finalDisplay[$stopName][] = secondsToArray($departTime); } else { $finalDisplay[$stopName][] = secondsToReadableTime($departTime); } } } } } return $finalDisplay; }