Better handling of time zones
This commit is contained in:
parent
0ef57926dd
commit
f04b229644
@ -80,7 +80,7 @@ switch ($action) {
|
|||||||
case "addpos":
|
case "addpos":
|
||||||
$lat = isset($_REQUEST["lat"]) ? $_REQUEST["lat"] : NULL;
|
$lat = isset($_REQUEST["lat"]) ? $_REQUEST["lat"] : NULL;
|
||||||
$lon = isset($_REQUEST["lon"]) ? $_REQUEST["lon"] : NULL;
|
$lon = isset($_REQUEST["lon"]) ? $_REQUEST["lon"] : NULL;
|
||||||
$time = isset($_REQUEST["time"]) ? $_REQUEST["time"] : NULL;
|
$timestamp = isset($_REQUEST["time"]) ? $_REQUEST["time"] : NULL;
|
||||||
$altitude = isset($_REQUEST["altitude"]) ? $_REQUEST["altitude"] : NULL;
|
$altitude = isset($_REQUEST["altitude"]) ? $_REQUEST["altitude"] : NULL;
|
||||||
$speed = isset($_REQUEST["speed"]) ? $_REQUEST["speed"] : NULL;
|
$speed = isset($_REQUEST["speed"]) ? $_REQUEST["speed"] : NULL;
|
||||||
$bearing = isset($_REQUEST["bearing"]) ? $_REQUEST["bearing"] : NULL;
|
$bearing = isset($_REQUEST["bearing"]) ? $_REQUEST["bearing"] : NULL;
|
||||||
@ -90,7 +90,7 @@ switch ($action) {
|
|||||||
$imageId = isset($_REQUEST["imageid"]) ? $_REQUEST["imageid"] : NULL;
|
$imageId = isset($_REQUEST["imageid"]) ? $_REQUEST["imageid"] : NULL;
|
||||||
$trackId = isset($_REQUEST["trackid"]) ? $_REQUEST["trackid"] : NULL;
|
$trackId = isset($_REQUEST["trackid"]) ? $_REQUEST["trackid"] : NULL;
|
||||||
|
|
||||||
if (is_null($lat) || is_null($lon) || is_null($time) || is_null($trackId)) {
|
if (is_null($lat) || is_null($lon) || is_null($timestamp) || is_null($trackId)) {
|
||||||
setError($response, "missing required parameter");
|
setError($response, "missing required parameter");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ switch ($action) {
|
|||||||
require_once(ROOT_DIR . "/helpers/position.php");
|
require_once(ROOT_DIR . "/helpers/position.php");
|
||||||
$position = new uPosition();
|
$position = new uPosition();
|
||||||
$positionId = $position->add($user->id, $trackId,
|
$positionId = $position->add($user->id, $trackId,
|
||||||
$time, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId);
|
$timestamp, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId);
|
||||||
|
|
||||||
if ($positionId === false) {
|
if ($positionId === false) {
|
||||||
setError($response, "Server error");
|
setError($response, "Server error");
|
||||||
|
@ -109,11 +109,10 @@ select {
|
|||||||
#user, #track, #summary, #export, #import, #other, #units {
|
#user, #track, #summary, #export, #import, #other, #units {
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
#summary span {
|
#summary div {
|
||||||
display: block;
|
|
||||||
padding-top: .3em;
|
padding-top: .3em;
|
||||||
}
|
}
|
||||||
#summary span img {
|
#summary div img {
|
||||||
margin-bottom: -2px;
|
margin-bottom: -2px;
|
||||||
}
|
}
|
||||||
#login {
|
#login {
|
||||||
@ -170,6 +169,10 @@ select {
|
|||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
|
#pbody .smaller {
|
||||||
|
color: gray;
|
||||||
|
font-size: .9em;
|
||||||
|
}
|
||||||
#pfooter {
|
#pfooter {
|
||||||
font-size: .6rem;
|
font-size: .6rem;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
class uPosition {
|
class uPosition {
|
||||||
public $id;
|
public $id;
|
||||||
public $time;
|
public $timestamp;
|
||||||
public $userId;
|
public $userId;
|
||||||
public $userLogin;
|
public $userLogin;
|
||||||
public $trackId;
|
public $trackId;
|
||||||
@ -53,7 +53,7 @@
|
|||||||
self::$db = uDb::getInstance();
|
self::$db = uDb::getInstance();
|
||||||
|
|
||||||
if (!empty($positionId)) {
|
if (!empty($positionId)) {
|
||||||
$query = "SELECT p.id, p.time, p.user_id, p.track_id,
|
$query = "SELECT p.id, UNIX_TIMESTAMP(p.time) AS tstamp, p.user_id, p.track_id,
|
||||||
p.latitude, p.longitude, p.altitude, p.speed, p.bearing, p.accuracy, p.provider,
|
p.latitude, p.longitude, p.altitude, p.speed, p.bearing, p.accuracy, p.provider,
|
||||||
p.comment, p.image_id, u.login, t.name
|
p.comment, p.image_id, u.login, t.name
|
||||||
FROM `" . self::$db->table('positions') . "` p
|
FROM `" . self::$db->table('positions') . "` p
|
||||||
@ -82,9 +82,9 @@
|
|||||||
* @param int $imageId
|
* @param int $imageId
|
||||||
* @return int|bool New position id in database, false on error
|
* @return int|bool New position id in database, false on error
|
||||||
*/
|
*/
|
||||||
public function add($userId, $trackId, $time, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId) {
|
public function add($userId, $trackId, $timestamp, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId) {
|
||||||
$positionId = false;
|
$positionId = false;
|
||||||
if (!is_null($lat) && !is_null($lon) && !is_null($time) && !empty($userId) && !empty($trackId)) {
|
if (!is_null($lat) && !is_null($lon) && !is_null($timestamp) && !empty($userId) && !empty($trackId)) {
|
||||||
$track = new uTrack($trackId);
|
$track = new uTrack($trackId);
|
||||||
if ($track->isValid && $track->userId == $userId) {
|
if ($track->isValid && $track->userId == $userId) {
|
||||||
$query = "INSERT INTO `" . self::$db->table('positions') . "`
|
$query = "INSERT INTO `" . self::$db->table('positions') . "`
|
||||||
@ -94,7 +94,7 @@
|
|||||||
$stmt = self::$db->prepare($query);
|
$stmt = self::$db->prepare($query);
|
||||||
$stmt->bind_param('iisddddddssi',
|
$stmt->bind_param('iisddddddssi',
|
||||||
$userId, $trackId,
|
$userId, $trackId,
|
||||||
$time, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId);
|
$timestamp, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
if (!self::$db->error && !$stmt->errno) {
|
if (!self::$db->error && !$stmt->errno) {
|
||||||
$positionId = self::$db->insert_id;
|
$positionId = self::$db->insert_id;
|
||||||
@ -151,7 +151,7 @@
|
|||||||
$where = "";
|
$where = "";
|
||||||
$params = NULL;
|
$params = NULL;
|
||||||
}
|
}
|
||||||
$query = "SELECT p.id, p.time, p.user_id, p.track_id,
|
$query = "SELECT p.id, UNIX_TIMESTAMP(p.time) AS tstamp, p.user_id, p.track_id,
|
||||||
p.latitude, p.longitude, p.altitude, p.speed, p.bearing, p.accuracy, p.provider,
|
p.latitude, p.longitude, p.altitude, p.speed, p.bearing, p.accuracy, p.provider,
|
||||||
p.comment, p.image_id, u.login, t.name
|
p.comment, p.image_id, u.login, t.name
|
||||||
FROM `" . self::$db->table('positions') . "` p
|
FROM `" . self::$db->table('positions') . "` p
|
||||||
@ -183,7 +183,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$where = "";
|
$where = "";
|
||||||
}
|
}
|
||||||
$query = "SELECT p.id, p.time, p.user_id, p.track_id,
|
$query = "SELECT p.id, UNIX_TIMESTAMP(p.time) AS tstamp, p.user_id, p.track_id,
|
||||||
p.latitude, p.longitude, p.altitude, p.speed, p.bearing, p.accuracy, p.provider,
|
p.latitude, p.longitude, p.altitude, p.speed, p.bearing, p.accuracy, p.provider,
|
||||||
p.comment, p.image_id, u.login, t.name
|
p.comment, p.image_id, u.login, t.name
|
||||||
FROM `" . self::$db->table('positions') . "` p
|
FROM `" . self::$db->table('positions') . "` p
|
||||||
@ -227,7 +227,7 @@
|
|||||||
* @return int Number of seconds
|
* @return int Number of seconds
|
||||||
*/
|
*/
|
||||||
public function secondsTo($target) {
|
public function secondsTo($target) {
|
||||||
return strtotime($this->time) - strtotime($target->time);
|
return $this->timestamp - $target->timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,7 +239,7 @@
|
|||||||
private function rowToObject($row) {
|
private function rowToObject($row) {
|
||||||
$position = new uPosition();
|
$position = new uPosition();
|
||||||
$position->id = $row['id'];
|
$position->id = $row['id'];
|
||||||
$position->time = $row['time'];
|
$position->timestamp = $row['tstamp'];
|
||||||
$position->userId = $row['user_id'];
|
$position->userId = $row['user_id'];
|
||||||
$position->userLogin = $row['login'];
|
$position->userLogin = $row['login'];
|
||||||
$position->trackId = $row['track_id'];
|
$position->trackId = $row['track_id'];
|
||||||
@ -272,7 +272,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($stmt->execute()) {
|
if ($stmt->execute()) {
|
||||||
$stmt->bind_result($this->id, $this->time, $this->userId, $this->trackId,
|
$stmt->bind_result($this->id, $this->timestamp, $this->userId, $this->trackId,
|
||||||
$this->latitude, $this->longitude, $this->altitude, $this->speed,
|
$this->latitude, $this->longitude, $this->altitude, $this->speed,
|
||||||
$this->bearing, $this->accuracy, $this->provider,
|
$this->bearing, $this->accuracy, $this->provider,
|
||||||
$this->comment, $this->imageId, $this->userLogin, $this->trackName);
|
$this->comment, $this->imageId, $this->userLogin, $this->trackName);
|
||||||
|
@ -81,10 +81,9 @@ function displayTrack(xml, update) {
|
|||||||
setTimeout(function () { google.maps.event.removeListener(zListener) }, 2000);
|
setTimeout(function () { google.maps.event.removeListener(zListener) }, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latestTime = p.dateoccured;
|
|
||||||
polies.push(poly);
|
polies.push(poly);
|
||||||
|
|
||||||
updateSummary(p.dateoccured, totalMeters, totalSeconds);
|
updateSummary(p.timestamp, totalMeters, totalSeconds);
|
||||||
if (p.tid != trackid) {
|
if (p.tid != trackid) {
|
||||||
trackid = p.tid;
|
trackid = p.tid;
|
||||||
setTrack(trackid);
|
setTrack(trackid);
|
||||||
@ -120,7 +119,7 @@ function setMarker(p, i, posLen) {
|
|||||||
var marker = new google.maps.Marker({
|
var marker = new google.maps.Marker({
|
||||||
map: map,
|
map: map,
|
||||||
position: p.coordinates,
|
position: p.coordinates,
|
||||||
title: p.dateoccured
|
title: (new Date(p.timestamp * 1000)).toLocaleString()
|
||||||
});
|
});
|
||||||
if (latest == 1) { marker.setIcon('//maps.google.com/mapfiles/dd-end.png') }
|
if (latest == 1) { marker.setIcon('//maps.google.com/mapfiles/dd-end.png') }
|
||||||
else if (i == 0) { marker.setIcon('//maps.google.com/mapfiles/marker_greenA.png') }
|
else if (i == 0) { marker.setIcon('//maps.google.com/mapfiles/marker_greenA.png') }
|
||||||
|
@ -119,10 +119,8 @@ function displayTrack(xml, update) {
|
|||||||
map.zoomOut();
|
map.zoomOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latestTime = p.dateoccured;
|
|
||||||
//polies.push(poly);
|
|
||||||
|
|
||||||
updateSummary(p.dateoccured, totalMeters, totalSeconds);
|
updateSummary(p.timestamp, totalMeters, totalSeconds);
|
||||||
if (p.tid != trackid) {
|
if (p.tid != trackid) {
|
||||||
trackid = p.tid;
|
trackid = p.tid;
|
||||||
setTrack(trackid);
|
setTrack(trackid);
|
||||||
|
40
js/main.js
40
js/main.js
@ -33,7 +33,6 @@ if (units == 'imperial') {
|
|||||||
unit_km = 'km';
|
unit_km = 'km';
|
||||||
}
|
}
|
||||||
var latest = 0;
|
var latest = 0;
|
||||||
var latestTime = 0;
|
|
||||||
var live = 0;
|
var live = 0;
|
||||||
var chart;
|
var chart;
|
||||||
var altitudes = new Array();
|
var altitudes = new Array();
|
||||||
@ -154,7 +153,7 @@ function parsePosition(p) {
|
|||||||
var username = getNode(p, 'username');
|
var username = getNode(p, 'username');
|
||||||
var trackname = getNode(p, 'trackname');
|
var trackname = getNode(p, 'trackname');
|
||||||
var tid = getNode(p, 'trackid');
|
var tid = getNode(p, 'trackid');
|
||||||
var dateoccured = getNode(p, 'dateoccured');
|
var timestamp = getNode(p, 'timestamp');
|
||||||
var distance = parseInt(getNode(p, 'distance'));
|
var distance = parseInt(getNode(p, 'distance'));
|
||||||
var seconds = parseInt(getNode(p, 'seconds'));
|
var seconds = parseInt(getNode(p, 'seconds'));
|
||||||
return {
|
return {
|
||||||
@ -169,16 +168,24 @@ function parsePosition(p) {
|
|||||||
'username': username,
|
'username': username,
|
||||||
'trackname': trackname,
|
'trackname': trackname,
|
||||||
'tid': tid,
|
'tid': tid,
|
||||||
'dateoccured': dateoccured,
|
'timestamp': timestamp,
|
||||||
'distance': distance,
|
'distance': distance,
|
||||||
'seconds': seconds
|
'seconds': seconds
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPopupHtml(p, i, count) {
|
function getPopupHtml(p, i, count) {
|
||||||
var dateTime = p.dateoccured.split(" ");
|
var date = '–––';
|
||||||
var date = dateTime[0];
|
var time = '–––';
|
||||||
var time = dateTime[1];
|
if (p.timestamp > 0) {
|
||||||
|
var d = new Date(p.timestamp * 1000);
|
||||||
|
date = d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2);
|
||||||
|
time = d.toTimeString();
|
||||||
|
var offset;
|
||||||
|
if ((offset = time.indexOf(' ')) >= 0) {
|
||||||
|
time = time.substr(0, offset) + ' <span class="smaller">' + time.substr(offset + 1) + '</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
var provider = '';
|
var provider = '';
|
||||||
if (p.provider == 'gps') {
|
if (p.provider == 'gps') {
|
||||||
provider = ' (<img class="icon" alt="' + lang['gps'] + '" title="' + lang['gps'] + '" src="images/gps_dark.svg">)';
|
provider = ' (<img class="icon" alt="' + lang['gps'] + '" title="' + lang['gps'] + '" src="images/gps_dark.svg">)';
|
||||||
@ -283,15 +290,26 @@ function removeLoader(el) {
|
|||||||
el.innerHTML = el.textContent || el.innerText;
|
el.innerHTML = el.textContent || el.innerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSummary(l, d, s) {
|
function updateSummary(timestamp, d, s) {
|
||||||
var t = document.getElementById('summary');
|
var t = document.getElementById('summary');
|
||||||
if (latest == 0) {
|
if (latest == 0) {
|
||||||
t.innerHTML = '<div class="menutitle u">' + lang['summary'] + '</div>' +
|
t.innerHTML = '<div class="menutitle u">' + lang['summary'] + '</div>' +
|
||||||
'<span><img class="icon" alt="' + lang['tdistance'] + '" title="' + lang['tdistance'] + '" src="images/distance.svg"> ' + (d.toKm() * factor_km).toFixed(2) + ' ' + unit_km + '</span>' +
|
'<div><img class="icon" alt="' + lang['tdistance'] + '" title="' + lang['tdistance'] + '" src="images/distance.svg"> ' + (d.toKm() * factor_km).toFixed(2) + ' ' + unit_km + '</div>' +
|
||||||
'<span><img class="icon" alt="' + lang['ttime'] + '" title="' + lang['ttime'] + '" src="images/time.svg"> ' + s.toHMS() + '</span>';
|
'<div><img class="icon" alt="' + lang['ttime'] + '" title="' + lang['ttime'] + '" src="images/time.svg"> ' + s.toHMS() + '</div>';
|
||||||
|
} else {
|
||||||
|
var today = new Date();
|
||||||
|
var d = new Date(timestamp * 1000);
|
||||||
|
var dateString = '';
|
||||||
|
if (d.toDateString() != today.toDateString()) {
|
||||||
|
dateString += d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2);
|
||||||
|
dateString += '<br>';
|
||||||
}
|
}
|
||||||
else {
|
var timeString = d.toTimeString();
|
||||||
t.innerHTML = '<div class="menutitle u">' + lang['latest'] + ':</div>' + l;
|
var offset;
|
||||||
|
if ((offset = timeString.indexOf(' ')) >= 0) {
|
||||||
|
timeString = timeString.substr(0, offset) + ' <span style="font-weight:normal">' + timeString.substr(offset + 1) + '</span>';
|
||||||
|
}
|
||||||
|
t.innerHTML = '<div class="menutitle u">' + lang['latest'] + ':</div>' + dateString + timeString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ function process_user_tracks($user_id) {
|
|||||||
*/
|
*/
|
||||||
function process_track($user_id, $old_id, $new_id) {
|
function process_track($user_id, $old_id, $new_id) {
|
||||||
global $pt_mysqli, $mysqli;
|
global $pt_mysqli, $mysqli;
|
||||||
$sql = "SELECT Latitude, Longitude, Altitude, Speed, Angle, DateOccurred, Comments FROM pt_positions WHERE FK_Users_ID = ? AND FK_Trips_ID = ? ORDER BY DateOccurred";
|
$sql = "SELECT Latitude, Longitude, Altitude, Speed, Angle, UNIX_TIMESTAMP(DateOccurred), Comments FROM pt_positions WHERE FK_Users_ID = ? AND FK_Trips_ID = ? ORDER BY DateOccurred, ID";
|
||||||
if (!($pos_select = $pt_mysqli->prepare($sql))) {
|
if (!($pos_select = $pt_mysqli->prepare($sql))) {
|
||||||
echo "Prepare failed: (" . $pt_mysqli->errno . ") " . $pt_mysqli->error . "\n";
|
echo "Prepare failed: (" . $pt_mysqli->errno . ") " . $pt_mysqli->error . "\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -185,7 +185,7 @@ function process_track($user_id, $old_id, $new_id) {
|
|||||||
echo "Binding parameters failed: (" . $pos_select->errno . ") " . $pos_select->error . "\n";
|
echo "Binding parameters failed: (" . $pos_select->errno . ") " . $pos_select->error . "\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!$pos_select->bind_result($lat, $lon, $altitude, $speed, $bearing, $time, $comment)) {
|
if (!$pos_select->bind_result($lat, $lon, $altitude, $speed, $bearing, $timestamp, $comment)) {
|
||||||
echo "Binding parameters failed: (" . $pos_select->errno . ") " . $pos_select->error . "\n";
|
echo "Binding parameters failed: (" . $pos_select->errno . ") " . $pos_select->error . "\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -194,17 +194,17 @@ function process_track($user_id, $old_id, $new_id) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$pos_select->store_result();
|
$pos_select->store_result();
|
||||||
if (!($pos_insert = $mysqli->prepare("INSERT INTO `$tPositions` (time, user_id, track_id, latitude, longitude, altitude, speed, bearing, accuracy, provider, comment, image_id)
|
if (!($pos_insert = $mysqli->prepare("INSERT INTO `$tPositions` (FROM_UNIXTIME(time), user_id, track_id, latitude, longitude, altitude, speed, bearing, accuracy, provider, comment, image_id)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"))) {
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"))) {
|
||||||
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error . "\n";
|
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error . "\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$provider = $comment = $time = $imageid = null;
|
$provider = $comment = $timestamp = $imageid = null;
|
||||||
$lat = $lon = 0;
|
$lat = $lon = 0;
|
||||||
$altitude = $speed = $bearing = $accuracy = null;
|
$altitude = $speed = $bearing = $accuracy = null;
|
||||||
|
|
||||||
if (!$pos_insert->bind_param('siiddddddssi',
|
if (!$pos_insert->bind_param('siiddddddssi',
|
||||||
$time, $user_id, $new_id, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageid)) {
|
$timestamp, $user_id, $new_id, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageid)) {
|
||||||
echo "Binding parameters failed: (" . $pos_insert->errno . ") " . $pos_insert->error . "\n";
|
echo "Binding parameters failed: (" . $pos_insert->errno . ") " . $pos_insert->error . "\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ if ($trackId && $userId) {
|
|||||||
"{$lang["user"]}: " . htmlspecialchars($position->userLogin) . "<br>{$lang["track"]}: " . htmlspecialchars($position->trackName) .
|
"{$lang["user"]}: " . htmlspecialchars($position->userLogin) . "<br>{$lang["track"]}: " . htmlspecialchars($position->trackName) .
|
||||||
"</div>" .
|
"</div>" .
|
||||||
"<div>" .
|
"<div>" .
|
||||||
"<div style=\"padding-top: 10px;\"><b>{$lang["time"]}:</b> {$position->time}<br>" .
|
"<div style=\"padding-top: 10px;\"><b>{$lang["time"]}:</b> " . date("Y-m-d H:i:s (e)", $position->timestamp) . "<br>" .
|
||||||
(!is_null($position->speed) ? "<b>{$lang["speed"]}:</b> " . round($position->speed * 3.6 * $factor_kmh, 2) . " {$unit_kmh}<br>" : "") .
|
(!is_null($position->speed) ? "<b>{$lang["speed"]}:</b> " . round($position->speed * 3.6 * $factor_kmh, 2) . " {$unit_kmh}<br>" : "") .
|
||||||
(!is_null($position->altitude) ? "<b>{$lang["altitude"]}:</b> " . round($position->altitude * $factor_m) . " {$unit_m}<br>" : "") .
|
(!is_null($position->altitude) ? "<b>{$lang["altitude"]}:</b> " . round($position->altitude * $factor_m) . " {$unit_m}<br>" : "") .
|
||||||
"<b>{$lang["ttime"]}:</b> " . toHMS($totalSeconds) . "<br>" .
|
"<b>{$lang["ttime"]}:</b> " . toHMS($totalSeconds) . "<br>" .
|
||||||
@ -182,7 +182,7 @@ if ($trackId && $userId) {
|
|||||||
$xml->writeAttribute("version", "1.1");
|
$xml->writeAttribute("version", "1.1");
|
||||||
$xml->startElement("metadata");
|
$xml->startElement("metadata");
|
||||||
$xml->writeElement("name", $positionsArr[0]->trackName);
|
$xml->writeElement("name", $positionsArr[0]->trackName);
|
||||||
$xml->writeElement("time", gmdate("Y-m-d\TH:i:s\Z", strtotime($positionsArr[0]->time)));
|
$xml->writeElement("time", gmdate("Y-m-d\TH:i:s\Z", $positionsArr[0]->timestamp));
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->startElement("trk");
|
$xml->startElement("trk");
|
||||||
$xml->writeElement("name", $positionsArr[0]->trackName);
|
$xml->writeElement("name", $positionsArr[0]->trackName);
|
||||||
@ -200,11 +200,11 @@ if ($trackId && $userId) {
|
|||||||
$xml->writeAttribute("lat", $position->latitude);
|
$xml->writeAttribute("lat", $position->latitude);
|
||||||
$xml->writeAttribute("lon", $position->longitude);
|
$xml->writeAttribute("lon", $position->longitude);
|
||||||
if (!is_null($position->altitude)) { $xml->writeElement("ele", $position->altitude); }
|
if (!is_null($position->altitude)) { $xml->writeElement("ele", $position->altitude); }
|
||||||
$xml->writeElement("time", gmdate("Y-m-d\TH:i:s\Z", strtotime($position->time)));
|
$xml->writeElement("time", gmdate("Y-m-d\TH:i:s\Z", $position->timestamp));
|
||||||
$xml->writeElement("name", ++$i);
|
$xml->writeElement("name", ++$i);
|
||||||
$xml->startElement("desc");
|
$xml->startElement("desc");
|
||||||
$description =
|
$description =
|
||||||
"{$lang["user"]}: {$position->userLogin} {$lang["track"]}: {$position->trackName} {$lang["time"]}: {$position->time}" .
|
"{$lang["user"]}: {$position->userLogin} {$lang["track"]}: {$position->trackName} {$lang["time"]}: " . date("Y-m-d H:i:s (e)", $position->timestamp) .
|
||||||
(!is_null($position->speed) ? " {$lang["speed"]}: " . round($position->speed * 3.6 * $factor_kmh, 2) . " {$unit_kmh}" : "") .
|
(!is_null($position->speed) ? " {$lang["speed"]}: " . round($position->speed * 3.6 * $factor_kmh, 2) . " {$unit_kmh}" : "") .
|
||||||
(!is_null($position->altitude) ? " {$lang["altitude"]}: " . round($position->altitude * $factor_m) . " {$unit_m}" : "") .
|
(!is_null($position->altitude) ? " {$lang["altitude"]}: " . round($position->altitude * $factor_m) . " {$unit_m}" : "") .
|
||||||
" {$lang["ttime"]}: " . toHMS($totalSeconds) .
|
" {$lang["ttime"]}: " . toHMS($totalSeconds) .
|
||||||
|
@ -56,7 +56,7 @@ if ($userId) {
|
|||||||
$xml->writeElement("altitude", ($position->altitude) ? round($position->altitude) : $position->altitude);
|
$xml->writeElement("altitude", ($position->altitude) ? round($position->altitude) : $position->altitude);
|
||||||
$xml->writeElement("speed", $position->speed);
|
$xml->writeElement("speed", $position->speed);
|
||||||
$xml->writeElement("bearing", $position->bearing);
|
$xml->writeElement("bearing", $position->bearing);
|
||||||
$xml->writeElement("dateoccured", $position->time);
|
$xml->writeElement("timestamp", $position->timestamp);
|
||||||
$xml->writeElement("accuracy", $position->accuracy);
|
$xml->writeElement("accuracy", $position->accuracy);
|
||||||
$xml->writeElement("provider", $position->provider);
|
$xml->writeElement("provider", $position->provider);
|
||||||
$xml->writeElement("comments", $position->comment);
|
$xml->writeElement("comments", $position->comment);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user