diff --git a/helpers/position.php b/helpers/position.php
index 0af1b33..b9d7149 100644
--- a/helpers/position.php
+++ b/helpers/position.php
@@ -202,6 +202,57 @@
return $position;
}
+ /**
+ * Get last position data from database
+ * (for all users)
+ *
+ * @return array|bool Array of uPosition positions, false on error
+ */
+ public static function getLastAllUsers() {
+ $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.comment,
+ p.image_id,
+ u.login
+ FROM
+ " . self::db()->table('positions') . " p
+ LEFT JOIN " . self::db()->table('users') . " u
+ ON ( p.user_id = u.id )
+ WHERE p.id = (
+ SELECT
+ p2.id
+ FROM
+ " . self::db()->table('positions') . " p2
+ WHERE
+ p2.user_id = p.user_id
+ ORDER BY
+ p2.time DESC,
+ p2.id DESC
+ LIMIT 1
+ )";
+
+ $result = self::db()->query($query);
+ if ($result === false) {
+ return false;
+ }
+ $positionsArr = [];
+ while ($row = $result->fetch_assoc()) {
+ $positionsArr[] = self::rowToObject($row);
+ }
+ $result->close();
+ return $positionsArr;
+ }
+
/**
* Get array of all positions
*
@@ -329,4 +380,4 @@
}
}
-?>
\ No newline at end of file
+?>
diff --git a/index.php b/index.php
index dabfc2b..8f135ef 100755
--- a/index.php
+++ b/index.php
@@ -150,7 +150,7 @@
= $lang["latest"] ?>
= $lang["autoreload"] ?> (= uConfig::$interval ?> s)
- = $lang["reload"] ?>
+ = $lang["reload"] ?>