Added user mapping and a page title.
This commit is contained in:
parent
ff9b1802d2
commit
6b88b8411c
@ -18,23 +18,43 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class EXIF_GPS_Controller extends Controller {
|
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.
|
// Map all items in the specified album.
|
||||||
|
|
||||||
// Generate an array of all items in the current album that have exif gps
|
$map_title = "";
|
||||||
// coordinates and order by latitude (to group items w/ the same
|
if ($map_type == "album") {
|
||||||
// coordinates together).
|
// Generate an array of all items in the current album that have exif gps
|
||||||
$items = ORM::factory("item")
|
// coordinates and order by latitude (to group items w/ the same
|
||||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
// coordinates together).
|
||||||
->where("items.parent_id", "=", $album_id)
|
$items = ORM::factory("item", $type_id)
|
||||||
->viewable()
|
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||||
->order_by("exif_coordinates.latitude", "ASC")
|
->viewable()
|
||||||
->find_all();
|
->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.
|
// Make a new page.
|
||||||
$template = new Theme_View("page.html", "other", "TagsMap");
|
$template = new Theme_View("page.html", "other", "TagsMap");
|
||||||
$template->page_title = t("Gallery :: Map");
|
$template->page_title = t("Gallery :: Map");
|
||||||
$template->content = new View("exif_gps_map.html");
|
$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.
|
// Load in module preferences.
|
||||||
$template->content->items = $items;
|
$template->content->items = $items;
|
||||||
|
@ -65,4 +65,13 @@
|
|||||||
google.setOnLoadCallback(initialize);
|
google.setOnLoadCallback(initialize);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<div id="map_canvas" style="width:600px; height:480px;"></div>
|
|
||||||
|
<div id="g-exif-map-header">
|
||||||
|
<div id="g-exif-map-header-buttons">
|
||||||
|
<?= $theme->dynamic_top() ?>
|
||||||
|
</div>
|
||||||
|
<h1><?= html::clean($title) ?></h1>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div id="map_canvas" style="width:600px; height:480px;"></div>
|
||||||
|
<?= $theme->dynamic_bottom() ?>
|
Reference in New Issue
Block a user