/** getCommonBusesForNormalizedStopName: function returns the common buses that go to the junction from the start or end point. We will be TODO: CHekc the functionality again **/ function getCommonBusesForNormalizedStopName($stopName, $arrBusesForIntersection) { $arrJunctionBuses = array(); $arrJunctionBuses = getArrayBusesForStop($stopName); // print_r($arrBusesForIntersection); // echo "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"; // print_r($arrJunctionBuses); $arrCommon = array(); //$arrCommon=array_intersect($arrJunctionBuses,$arrBusesForIntersection); //find the common values for ($i = 0; $i < sizeof($arrBusesForIntersection); $i++) { $temp = $arrBusesForIntersection[$i]; for ($j = 0; $j < sizeof($arrJunctionBuses); $j++) { if (strcmp($temp, $arrJunctionBuses[$j]) == 0) { if (checkArray($arrCommon, $temp) == 0) { array_push($arrCommon, $temp); } } } } $buses = ""; for ($i = 0; $i < sizeof($arrCommon); $i++) { $buses = $buses . $arrCommon[$i] . ","; } //return getBusesForStop($stopName); return $buses; }
/** getCommonBusesForNormalizedStopName: function returns the common buses that go to the junction from the start or end point. We will be TODO: CHekc the functionality again **/ function getCommonBusesForNormalizedStopName($stopName, $arrBusesForIntersection) { $arrJunctionBuses = array(); /*if(strcmp($stopName,"Central Silk Board (ORR)")==0) { $busQuery="SELECT DISTINCT BusNumber FROM BusDetails WHERE (StopName='Central Silk Board (ORR)') OR (StopName = 'Central Silk Board (Hosur RD)') OR (StopName = 'Central Silk Board (BTM)') ORDER BY BusNumber"; $busResult= mysql_query($busQuery); $busRowsnum = mysql_num_rows($busResult); for($j=0;$j<$busRowsnum;$j++) { $busRow=mysql_fetch_row($busResult); array_push($arrJunctionBuses,$busRow[0]); } } else if(strcmp($stopName,"Marathahalli Bridge")==0) { $busQuery="SELECT DISTINCT BusNumber FROM BusDetails WHERE (StopName='Marathahalli (Jn. Vartur & ORR)') OR (StopName = 'Marathahalli Bridge (ORR)') OR (StopName = 'Marathahalli Bridge') OR (StopName='Marathahalli Multiplex Bridge') OR (StopName='Marathahalli Jn') ORDER BY BusNumber"; $busResult= mysql_query($busQuery); $busRowsnum = mysql_num_rows($busResult); for($j=0;$j<$busRowsnum;$j++) { $busRow=mysql_fetch_row($busResult); array_push($arrJunctionBuses,$busRow[0]); } } else if(strcmp($stopName,"Marathahalli Multiplex")==0) { $busQuery="SELECT DISTINCT BusNumber FROM BusDetails WHERE (StopName='Marathahalli Jn(Multiplex)') OR (StopName = 'Marathahalli (Mulitplex ORR)') OR (StopName = 'Marathahalli Multiplex') ORDER BY BusNumber"; $busResult= mysql_query($busQuery); $busRowsnum = mysql_num_rows($busResult); for($j=0;$j<$busRowsnum;$j++) { $busRow=mysql_fetch_row($busResult); array_push($arrJunctionBuses,$busRow[0]); } } else if(strcmp($stopName,"Hebbala")==0) { $busQuery="SELECT DISTINCT BusNumber FROM BusDetails WHERE (StopName='Hebbala') OR (StopName = 'Hebbala (ORR)') OR (StopName = 'Hebbala (Canara Bank)') ORDER BY BusNumber"; $busResult= mysql_query($busQuery); $busRowsnum = mysql_num_rows($busResult); for($j=0;$j<$busRowsnum;$j++) { $busRow=mysql_fetch_row($busResult); array_push($arrJunctionBuses,$busRow[0]); } } else { //echo "STOP".$stopName; $arrJunctionBuses=getArrayBusesForStop($stopName); }*/ $arrJunctionBuses = getArrayBusesForStop($stopName); // print_r($arrBusesForIntersection); // echo "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"; // print_r($arrJunctionBuses); $arrCommon = array(); //$arrCommon=array_intersect($arrJunctionBuses,$arrBusesForIntersection); //find the common values for ($i = 0; $i < sizeof($arrBusesForIntersection); $i++) { $temp = $arrBusesForIntersection[$i]; for ($j = 0; $j < sizeof($arrJunctionBuses); $j++) { if (strcmp($temp, $arrJunctionBuses[$j]) == 0) { if (checkArray($arrCommon, $temp) == 0) { array_push($arrCommon, $temp); } } } } //print_r($arrCommon); $buses = ""; for ($i = 0; $i < sizeof($arrCommon); $i++) { $buses = $buses . $arrCommon[$i] . ","; } //return getBusesForStop($stopName); return $buses; }