<% On Error Resume Next IF (checkPermission("drivers")="FAILED") THEN response.write("You do not have permission to view this page") response.end END IF Function Qpad(tval) IF len(tval)=1 THEN Qpad="0"&tval ELSE Qpad=tval END IF End Function Function dataWriteLatLong(fld) Set laloregEx = New RegExp laloregEx.Global = true laloregEx.Pattern = "[^0-9a-zA-Z\:\-\.\-]" IF IsNull(fld) OR IsEmpty(fld) THEN dataWriteLatLong=fld ELSE dataWriteLatLong=laloregEx.Replace(fld, "") END IF End Function Function fetchOnboardPassengerCount(sID, rID) IF sID <> "" AND IsNumeric(sID) THEN curdate=year(now())&"-"&Qpad(month(now()))&"-"&Qpad(day(now())) SET rsRC=dbCBK.Execute("SELECT COUNT(*) As pcnt from cbk_touchdata WHERE schoolID='"&sID&"' AND touchindatetime LIKE '"&curdate&"%' AND touchout='0' limit 1") IF rsRC.EOF THEN onbrd=0 END IF DO WHILE NOT rsRC.EOF onbrd=rsRC("pcnt") rsRC.MoveNext loop rsRC.close SET rsRC = Nothing fetchOnboardPassengerCount=onbrd ELSE 'missing data fetchOnboardPassengerCount=0 END IF End Function Function fetchActiveRouteCountByParent(scid) IF scid <> "" AND IsNumeric(scid) THEN strrcSQL="SELECT COUNT(*) AS rcbp FROM cbk_routes WHERE curSTATUS='on' AND `schoolID`='"&str_u_id&"' AND `routeID`='00000'" IF str_ass_pupil_list <> "" THEN rccapl=split(str_ass_pupil_list,"||") for each x in rccapl IF x <> "" AND IsNumeric(x) THEN strrcSQL=strrcSQL&" OR curSTATUS='on' AND `schoolID`='"&str_u_id&"' AND pupilIDS LIKE '%||"&x&"||%'" END IF next END IF SET rsRC=dbCBK.Execute(strrcSQL) IF rsRC.EOF THEN rcret=0 END IF DO WHILE NOT rsRC.EOF rcret=rsRC("rcbp") rsRC.MoveNext loop rsRC.close SET rsRC = Nothing fetchActiveRouteCountByParent=rcret ELSE 'missing data fetchActiveRouteCountByParent=0 END IF End Function Function fetchActivePassengerCountByParent(schID) fetchActivePassengerCountByParent=3 End Function Function fetchPupilByID(pID) pID=trim(pID) IF pID = "0" THEN fpRET="No Pupil Assigned" fetchPupil=fpRET ELSEIF pID <> "" AND IsNumeric(pID) THEN SET rsfbPID = dbCBK.Execute("SELECT cbk_pupils.pupilID As pupilID, cbk_pupils.roleID As roleID, cbk_pupils.name As name, cbk_schools.schoolname As schoolname FROM cbk_pupils LEFT JOIN cbk_schools ON cbk_pupils.schoolID = cbk_schools.schoolID WHERE cbk_pupils.schoolID='"&str_u_id&"' AND cbk_pupils.pupilID='"&pID&"' limit 1") IF rsfbPID.EOF THEN fpRET="Pupil not found.." END IF DO WHILE NOT rsfbPID.EOF fpRET=rsfbPID("name") rsfbPID.MoveNext loop rsfbPID.Close SET rsfbPID = Nothing fetchPupilByID=fpRET ELSE Exit Function END IF End Function Function getAssignedRouteID(pid) pid=trim(pid) IF pid <> "" AND IsNumeric(pid) THEN strpas="||"&pid&"||" '888888888888888888888888 'look for active route incase pupil is assigned to more than 1 route, we want to show the active route if possible '88888888888888888888888 SET rsPAS=dbCBK.Execute("SELECT routeID, routename from cbk_routes WHERE pupilIDS LIKE '%"&strpas&"%' AND curSTATUS='on' order by routeID desc limit 1") IF rsPAS.EOF THEN ret="none" END IF DO WHILE NOT rspas.EOF pas_rid=rsPAS("routeID") rsPAS.MoveNext loop rsPAS.Close SET rsPAS = Nothing IF ret="none" THEN '888888888888888888888888 'no active route so show the newest route they are assigned to '88888888888888888888888 SET rsPAS=dbCBK.Execute("SELECT routeID, routename from cbk_routes WHERE pupilIDS LIKE '%"&strpas&"%' order by routeID desc limit 1") IF rsPAS.EOF THEN ret2="none" END IF DO WHILE NOT rspas.EOF pas_rid2=rsPAS("routeID") rsPAS.MoveNext loop rsPAS.Close IF ret2="none" THEN getAssignedRouteID="none" ELSE getAssignedRouteID=pas_rid2 END IF ELSE getAssignedRouteID=pas_rid END IF ELSE Exit Function END IF End Function sel_pupilID=sanitizeRequest("sp","querystring") %>
<%IF request("display")<>"" THEN%> " /> <%END IF%>

Location Map

Keep track of bus locations.
These are the buses currently active with passengers. Active Vehicles: <%=fetchActiveRouteCountByParent(str_u_id)%>

Select Your Child

Please choose from the dropdown menu

How To

Find the bus location <% IF sel_pupilID<> "" AND IsNumeric(sel_pupilID) THEN IF (CStr(getAssignedRouteID(sel_pupilID)) <> "none") THEN this_r=getAssignedRouteID(sel_pupilID) 'fetch live status for selected route SET RSLiveBus=dbCBK.Execute("select `routename`,`curSTATUS` FROM cbk_routes WHERE routeID='"&this_r&"' AND schoolID='"&str_u_id&"' order by routeID desc limit 1") IF RSLiveBus.EOF THEN this_RS="off" END IF DO WHILE NOT RSLiveBus.EOF this_RN=RSLiveBus("routename") this_RS=RSLiveBus("curSTATUS") RSLiveBus.MoveNext loop RSLiveBus.Close SET RSLiveBus = Nothing SELECT CASE this_RS case "on": response.write("

The route is currently active, the live bus location is shown on the map

") case else: response.write("

This route is currently inactive, so the live location is unavailable.

") END SELECT ELSE response.write("

No route assigned. Please try again later or select a different pupil.

") END IF %> <%ELSE%>

Select your child from the drop down menu and click the search button to locate the bus your child is assigned to.

<%END IF%>
<% IF sel_pupilID<> "" AND IsNumeric(sel_pupilID) THEN r=getAssignedRouteID(sel_pupilID) IF r <> "" AND IsNumeric(r) THEN 'retrieve our start point for display SET rsEd=dbCBK.Execute("SELECT `lat`,`lon` FROM cbk_route_waypoints WHERE routeID='"&r&"' AND schoolID='"&str_u_id&"' AND entry_type='start' AND lat <> '' limit 1") IF rsEd.Eof THEN 'no start found END IF DO WHILE NOT rsEd.Eof %> ,<%=rsEd("lon")%>" /> <% rsEd.MoveNext loop rsEd.Close SET rsEd= Nothing 'retrieve our way points for display wc=1 SET rsEd=dbCBK.Execute("SELECT `lat`,`lon` FROM cbk_route_waypoints WHERE routeID='"&r&"' AND schoolID='"&str_u_id&"' AND entry_type='way' AND lat <> '' limit 20") IF rsEd.Eof THEN 'no ways found END IF DO WHILE NOT rsEd.Eof %> ,<%=rsEd("lon")%>" /> <% wc=wc+1 rsEd.MoveNext loop rsEd.Close SET rsEd= Nothing 'retrieve our end point for display SET rsEd=dbCBK.Execute("SELECT `lat`,`lon` FROM cbk_route_waypoints WHERE routeID='"&r&"' AND schoolID='"&str_u_id&"' AND entry_type='end' AND lat <> '' limit 1") IF rsEd.Eof THEN 'no ways found END IF DO WHILE NOT rsEd.Eof %> ,<%=rsEd("lon")%>" /> <% rsEd.MoveNext loop rsEd.Close SET rsEd= Nothing 'fetch live location data for selected route SET RSLiveBus=dbCBK.Execute("select `routename`,`curLAT`,`curLONG`,`curSTATUS` FROM cbk_routes WHERE routeID='"&r&"' AND schoolID='"&str_u_id&"' limit 1") DO WHILE NOT RSLiveBus.EOF %> " /> " /> " /> " /> <% RSLiveBus.MoveNext loop RSLiveBus.Close SET RSLiveBus = Nothing %> <% END IF END IF %>