--- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -1,227 +1,329 @@ - + - ' . $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.1.0"; + if (isDebugServer()) { + $jqmcss = $basePath . "css/jquery.mobile-$jqmVersion.min.css"; + $jqjs = $basePath . "js/jquery-1.7.2.min.js"; + $jqmjs = $basePath . "js/jquery.mobile-$jqmVersion.min.js"; + } else { + $jqmcss = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.css"; + $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"; + $jqmjs = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.js"; + } + echo ' + + + + + + + + + '; + echo ''; + echo ''; + if (isIOSDevice()) { + echo ' '; - } - if ($geolocate) { - echo " "; - } - if (isAnalyticsOn()) echo ' - "; + } + if (isAnalyticsOn()) + echo ' +"; -echo ' + echo ' '; - if ($opendiv) { - echo '
- -
-

' . $pageTitle . '

+ if ($opendiv) { + echo '
'; + echo '
+ Back +

' . $pageTitle . '

+ Home
'; - } -} -function include_footer() -{ - if ($geolocate && isset($_SESSION['lat'])) { - echo ""; - } - echo ''; - if (isAnalyticsOn()) { - echo ""; + $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 ""; + } +} + +//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 ""; + } +} +