--- a/include/common-transit.inc.php +++ b/include/common-transit.inc.php @@ -20,14 +20,17 @@ 'saturday', 'weekday' ); - +function service_period_day ($spid) { + $idParts = explode("-",$spid); + return strtolower($idParts[2]); +} function service_period($date = "") { - if (isset($_SESSION['service_period'])) - return $_SESSION['service_period']; + if (isset($_REQUEST['service_period'])) + return $_REQUEST['service_period']; $override = getServiceOverride($date); if ($override['service_id']) { - return $override['service_id']; + return service_period_day ($override['service_id']); } switch (date('w', ($date != "" ? $date : time()))) { @@ -38,6 +41,20 @@ default: return 'weekday'; } +} +function service_ids($service_period) { + switch ($service_period) { + case 'sunday': + return Array("2010-TUGGSUN-Sunday-20","2010-BELCSUN-Sunday-19"); + case 'saturday': + return Array("2010-BELCSAT-Saturday-19","2010-TUGGSAT-Saturday-19"); + default: + //return 'weekday'; + return Array("2010-BELCMAST-Weekday-15","2010-TUGGMAST-Weekday-14"); + } +} +function valid_service_ids() { + return array_merge(service_ids(""),service_ids('saturday'),service_ids('sunday')); } function midnight_seconds($time = "") { @@ -87,7 +104,7 @@ "UNKNOWN_EFFECT" => "Unknown effect", "STOP_MOVED" => "Stop moved"); - set_include_path(get_include_path() . PATH_SEPARATOR . $labsPath . "lib/Protobuf-PHP/library/DrSlump/"); + set_include_path(get_include_path() . PATH_SEPARATOR . ($basePath . "lib/Protobuf-PHP/library/DrSlump/")); include_once("Protobuf.php"); include_once("Protobuf/Message.php"); @@ -95,7 +112,7 @@ include_once("Protobuf/Descriptor.php"); include_once("Protobuf/Field.php"); - include_once($labsPath . "lib/Protobuf-PHP/gtfs-realtime.php"); + include_once($basePath . "lib/Protobuf-PHP/gtfs-realtime.php"); include_once("Protobuf/CodecInterface.php"); include_once("Protobuf/Codec/PhpArray.php"); include_once("Protobuf/Codec/Binary.php");