--- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -1,223 +1,308 @@ - ' . $pageTitle . ' - '; - if ($datepicker) echo ''; - if (isDebugServer()) echo ' - - '; - else echo ' - - '; - if ($datepicker) echo ' - '; - echo ''; - if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod')) { - echo ' + +' . $pageTitle . ' - Canberra Bus Timetable + + + + '; + $jqmVersion = "1.0"; + if (isDebugServer()) { + $jqmcss = $basePath . "css/jquery.mobile-$jqmVersion.css"; + $jqjs = $basePath . "js/jquery-1.6.4.min.js"; + $jqmjs = $basePath . "js/jquery.mobile-$jqmVersion.js"; + + $jqmcss = $basePath . "css/jquery.mobile-b90eab4935.css"; + $jqmjs = $basePath . "js/jquery.mobile-b90eab4935.js"; + } else { + $jqmcss = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.css"; + $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"; + $jqmjs = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.js"; + + } + echo ' + + + + + + + + + '; + echo ''; + echo ''; + if (isIOSDevice()){ + echo ' '; - } - if ($geolocate) { - echo " "; - } - echo ' - "; + } + if (isAnalyticsOn()) + echo ' +"; + echo ' + + + '; + if ($opendiv) { + echo '
+
+ Back +

' . $pageTitle . '

+ Home +
+ +
'; + if ($GTFSREnabled) { + $overrides = getServiceOverride(); + if (isset($overrides['service_id'])) { + if ($overrides['service_id'] == "noservice") { + echo '
Buses are not running today due to industrial action/public holiday. See http://www.action.act.gov.au for details.
'; + } else { + echo '
Buses are running on an altered timetable today due to industrial action/public holiday. See http://www.action.act.gov.au for details.
'; + } + } + $serviceAlerts = getServiceAlertsAsArray("agency", "0"); + if (isset($serviceAlerts['entity']) && sizeof($serviceAlerts['entity']) > 0) { + foreach ($serviceAlerts['entity'] as $entity) { + echo "
" . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['start'])) . " to " . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['end'])) . "{$entity['alert']['header_text']['translation'][0]['text']}
Warning: {$entity['alert']['description_text']['translation'][0]['text']} +
Source
"; + } + } + } + } +} + +function include_footer() { + global $basePath; + echo ''; + if (isAnalyticsOn()) { + echo "".' - - - '; - if ($opendiv) { - echo '
- -
-

' . $pageTitle . '

-
- -
'; - } -} -function include_footer() -{ - if ($geolocate && isset($_SESSION['lat'])) { - echo ""; - } - echo ''; - if (!isDebug()) { - $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); - echo ''; - } -} -function timePlaceSettings($geolocate = false) -{ - global $service_periods; - $geoerror = false; - if ($geolocate == true) { - $geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; - } - if ($geoerror) { - echo '
Sorry, but your location could not currently be detected. + })();"; + $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); + echo ''; + } + echo "\n
"; +} +function timeSettings() { + global $service_periods; +echo '
+

Change Time (' . (isset($_REQUEST['time']) ? $_REQUEST['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...

+
+ + + + +
+
+ + + Current Time? +
+
+ + + +
+ + +
+
'; +} +function placeSettings() { + + $geoerror = false; + $geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; + + echo '
'; + if ($geoerror) { + echo 'Sorry, but your location could not currently be detected. Please allow location permission, wait for your location to be detected, - or enter an address/co-ordinates in the box below.
'; - } - echo '
-

Change Time/Place (' . (isset($_SESSION['time']) ? $_SESSION['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...

-
+ or enter an address/co-ordinates in the box below.'; + } + echo '
'; + echo '
+

Change Location...

+
-
- - Current Time? -
-
- - - -
- -
'; +
+
'; +} + +function trackEvent($category, $action, $label = "", $value = - 1) { + if (isAnalyticsOn()) { + echo "\n"; + } +} + +//stop list collapsing +function stopCompare($stopName) { + return substr(trim(preg_replace("/\(Platform.*/", "", $stopName)),0,9); +} +function stopGroupTitle($stopName,$stopdesc) { + if (preg_match("/Dr |Cct |Cir |Av |St |Cr |Parade |Way |Bank /",$stopName)) { + $descParts = explode("
",$stopdesc); + return trim(str_replace("Street: ","",$descParts[0])); + } else { + return trim(preg_replace("/\(Platform.*/", "",$stopName)); + } +} + +function viaPointNames($tripid, $stop_sequence = "") { + $viaPointNames = Array(); + foreach (viaPoints($tripid, $stop_sequence) as $point) { + if (strstr($point['stop_name'], "Station") + || strstr($point['stop_name'], "Shops") + || strstr($point['stop_name'], "CIT") + || strstr($point['stop_name'], "School") + || strstr($point['stop_name'], "University") + ) { + $viaPointNames[] = $point['stop_name']; + } + } + if (sizeof($viaPointNames) > 0) { + return r_implode(", ", $viaPointNames); + } else { + return ""; + } } ?>