From 250cad3d20b23985a7c2029f3b2648f7297c6a09 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 17 Mar 2010 04:27:24 +0800 Subject: [PATCH] Added user mapping and a page title. --- modules/exif_gps/controllers/exif_gps.php | 42 +++++++++++++++----- modules/exif_gps/views/exif_gps_map.html.php | 11 ++++- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/modules/exif_gps/controllers/exif_gps.php b/modules/exif_gps/controllers/exif_gps.php index 0a0846c9..4b3e626b 100644 --- a/modules/exif_gps/controllers/exif_gps.php +++ b/modules/exif_gps/controllers/exif_gps.php @@ -18,23 +18,43 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class EXIF_GPS_Controller extends Controller { - public function map($album_id) { + public function map($map_type, $type_id) { // Map all items in the specified album. - // Generate an array of all items in the current album that have exif gps - // coordinates and order by latitude (to group items w/ the same - // coordinates together). - $items = ORM::factory("item") - ->join("exif_coordinates", "items.id", "exif_coordinates.item_id") - ->where("items.parent_id", "=", $album_id) - ->viewable() - ->order_by("exif_coordinates.latitude", "ASC") - ->find_all(); - + $map_title = ""; + if ($map_type == "album") { + // Generate an array of all items in the current album that have exif gps + // coordinates and order by latitude (to group items w/ the same + // coordinates together). + $items = ORM::factory("item", $type_id) + ->join("exif_coordinates", "items.id", "exif_coordinates.item_id") + ->viewable() + ->order_by("exif_coordinates.latitude", "ASC") + ->descendants(); + $curr_album = ORM::factory("item")->where("id", "=", $type_id)->find_all(); + $map_title = $curr_album[0]->name; + } elseif ($map_type == "user") { + // Generate an array of all items uploaded by the current user that + // have exif gps coordinates and order by latitude (to group items + // w/ the same coordinates together). + $items = ORM::factory("item") + ->join("exif_coordinates", "items.id", "exif_coordinates.item_id") + ->where("items.owner_id", "=", $type_id) + ->viewable() + ->order_by("exif_coordinates.latitude", "ASC") + ->find_all(); + $curr_user = ORM::factory("user")->where("id", "=", $type_id)->find_all(); + $map_title = $curr_user[0]->full_name . "'s " . t("Photos"); + } // Make a new page. $template = new Theme_View("page.html", "other", "TagsMap"); $template->page_title = t("Gallery :: Map"); $template->content = new View("exif_gps_map.html"); + if ($map_title == "") { + $template->content->title = t("Map"); + } else { + $template->content->title = t("Map of") . " " . $map_title; + } // Load in module preferences. $template->content->items = $items; diff --git a/modules/exif_gps/views/exif_gps_map.html.php b/modules/exif_gps/views/exif_gps_map.html.php index bd1b01aa..749e2f35 100644 --- a/modules/exif_gps/views/exif_gps_map.html.php +++ b/modules/exif_gps/views/exif_gps_map.html.php @@ -65,4 +65,13 @@ google.setOnLoadCallback(initialize); -
\ No newline at end of file + +
+
+ dynamic_top() ?> +
+

+
+
+
+dynamic_bottom() ?> \ No newline at end of file