function insertAfter(referenceNode, newNode) { referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); } function add_before(name) { var objTo = document.getElementById(name) var divtest = document.createElement("div"); divtest.innerHTML = \'Zastávka:\'; objTo.parentNode.insertBefore(divtest, objTo.childNodes[0]) } function add_after(name) { var objTo = document.getElementById(name) var divtest = document.createElement("div"); divtest.innerHTML = \'Zastávka:\'; insertAfter(objTo, divtest) } '. '
'. ''. ''. ''. ''. ''. ''. ''. ''. '
Trasa:
Počátek:
Zastávka:
Konec:

Parametry jízdy:
Čas odjezdu:
Počet míst pro cestující:
'. '
'. ''. '
'; } else { if ($_GET['step'] == '2') { $TimeFrom = strtotime($_GET['time-from']); $Output = '
'; $Output .= '
'. '
'. '
'. '
'. '
'. '
'. 'Popis:

'. 'Auto: '. ''. '
'; $Map = new MapGoogle($this->System); $Map->Key = 'AIzaSyDQ-tOjP9mO8ZpSEuBc5_oCRg30rpQZiBI'; $Map->Width = 400; $Map->Height = 300; $Map->Path = array($_GET['from'], $_GET['to']); //$Map->Path = array('Praha', 'Brno', 'Zlín', 'Vsetín'); $Track = $Map->Route(); $Output .= '

Trasa

'; $PricePerKm = 0.8; $Output .= ''; foreach ($Track as $Index => $TrackItem) { if ($Index > 0) { $Track[$Index]['Time'] = $TimeFrom + $Track[$Index - 1]['Duration']; $RelDistance = $TrackItem['Distance'] - $Track[$Index - 1]['Distance']; $RelDuration = $TrackItem['Duration'] - $Track[$Index - 1]['Duration']; $Track[$Index]['Price'] = round($PricePerKm * $RelDistance / 1000); $Output .= ''. ''. ''. ''. ''; } else { $Track[$Index]['Time'] = $TimeFrom; $Track[$Index]['Price'] = 0; } } $Output .= ''. ''. ''. ''. ''; $Output .= '
ÚsekOdjezdTrváníVzdálenost [km]Cena [Kč]
'.$Map->Path[$Index - 1].' → '.$TrackItem['Destination'].''.TimeToMysqlDateTime($Track[$Index]['Time']).''.time_elapsed($RelDuration).''.round($RelDistance / 1000).''.$Track[$Index]['Price'].'
'.$Map->Path[0].' → '.$Map->Path[count($Map->Path) - 1].''.TimeToMysqlDateTime($Track[0]['Time']).''.time_elapsed($Track[count($Track) - 1]['Duration']).''.round($Track[count($Track) - 1]['Distance'] / 1000).''.round($PricePerKm * $Track[count($Track) - 1]['Distance'] / 1000).'

'; $Output .= 'Vzdálenost: '.round($Track[count($Track) - 1]['Distance'] / 1000, 1).' km
'; $Output .= 'Délka jízdy: '.time_elapsed($Track[count($Track) - 1]['Duration']).'
'; $Output .= '
'; $Map->Key = 'AIzaSyDwKYuEdkXAl9Y2RyDLf5m03n-ItHaqdKs'; $Output .= $Map->Show(); $Output .= '
'; $_SESSION['Track'] = $Track; $_SESSION['SeatCount'] = $_GET['seats']; } else if ($_GET['step'] == '3') { $this->Database->insert('Ride', array( 'Driver' => Core::Cast($this->System)->User->User['Id'], 'SeatCount' => $_POST['seats'], 'Car' => $_POST['car'], 'Details' => $_POST['desc'], )); $RideId = $this->Database->insert_id; foreach ($_SESSION['Track'] as $Index => $TrackItem) { $this->Database->insert('RideStop', array( 'Ride' => $RideId, 'Place' => $TrackItem['Destination'], 'Time' => TimeToMysqlDateTime($TrackItem['Time']), 'Price' => $TrackItem['Price'], 'Sequence' => $Index, 'PassengerCount' => 0, )); } $Output = 'Nová jízda přidána.'; } } return $Output; } }