Database->query('SELECT Ride.Details, Ride.Id, Ride.SeatCount, '. 'RideStopFrom.Id AS RideStopFromId, RideStopTo.Id AS RideStopToId, '. '(SELECT Name FROM User WHERE User.Id=Ride.Driver) AS DriverName, '. 'CONCAT(CarManufacturer.Name, " ", CarModel.Name) AS CarName FROM Ride '. 'JOIN RideStop AS RideStopFrom ON (RideStopFrom.Ride = Ride.Id) AND (RideStopFrom.Place LIKE "%'.$_GET['from'].'%") '. 'JOIN RideStop AS RideStopTo ON (RideStopTo.Ride = Ride.Id) AND (RideStopTo.Place LIKE "%'.$_GET['to'].'%") '. 'LEFT JOIN Car ON Car.Id = Ride.Car '. 'LEFT JOIN CarModel ON CarModel.Id = Car.Model '. 'LEFT JOIN CarManufacturer ON CarManufacturer.Id = CarModel.Manufacturer '. 'WHERE Ride.Id='.$RideId); $DbRow = $DbResult->fetch_assoc(); $Track = array(); $Stops = array(); $DbResult2 = $this->Database->query('SELECT * FROM RideStop WHERE Ride='.$DbRow['Id'].' ORDER BY Sequence'); while ($DbRow2 = $DbResult2->fetch_assoc()) { $Track[] = $DbRow2; $Stops[] = $DbRow2['Place']; } $Output = '
Trasa: | '.implode(' → ', $Stops).' |
Odjezd z: | '.$Track[0]['Place'].' |
Příjezd do: | '.$Track[count($Track) - 1]['Place'].' |
Čas odjezdu: | '.$Track[0]['Time'].' |
Podrobnosti: | '.$DbRow['Details'].' |
Zastávka / Čas | Řidič | '; for ($I = 0; $I < $DbRow['SeatCount']; $I++) $Output .= 'Cestující | '; $Output .= '|
---|---|---|---|
'.$TrackItem['Place'].' '.$TrackItem['Time'].' | ';
if ($Index == 0) $Output .= 'Řidič | '; for ($I = 0; $I < $DbRow['SeatCount']; $I++) { if (!is_null($Table[$Index][$I])) { $Passenger = $Passengers[$Table[$Index][$I]]; if ($Index == $Passenger['SequenceFrom']) $Output .= ''.$Passenger['UserName'].' | '; } else { // Show unused space if (($Index == 0) or ((($Index - 1) >= 0) and (!is_null($Table[$Index - 1][$I])))) { $J = 1; while ((($Index + $J) < count($Table)) and is_null($Table[$Index + $J][$I])) $J++; $Output .= ''; } } } $Output .= ' |