From 684f02ebc57c3fe3d989668dcf05e1fc8b6a734d Mon Sep 17 00:00:00 2001 From: abijah Date: Fri, 29 May 2009 03:36:28 +0000 Subject: [PATCH] More tweaks to get the map working. At the moment, the clickable area is off because it's not scaled like the actual image is. I'll have to work on that next. git-svn-id: file:///svn-source/pmgr/branches/initial_20090526@34 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/controllers/maps_controller.php | 7 ++-- site/views/maps/view.ctp | 54 +++++++++++++++++++--------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/site/controllers/maps_controller.php b/site/controllers/maps_controller.php index 088c8cf..bab9533 100644 --- a/site/controllers/maps_controller.php +++ b/site/controllers/maps_controller.php @@ -42,7 +42,7 @@ class MapsController extends AppController { * - Produces a PNG site map image */ - function map($id = null, $requested_width = 600) { + function map($id = null, $requested_width = 800) { if (!$id) { $this->Session->setFlash(__('Invalid Item.', true)); $this->redirect(array('action'=>'index')); @@ -235,14 +235,14 @@ class MapsController extends AppController { *****/ // Scale things according to desired display width - $screen_adjustment_factor = $requested_width / $info['extents']['right'];; + $screen_adjustment_factor = $requested_width / $info['extents']['right']; // Define image size $info['width'] = $info['extents']['right'] * $screen_adjustment_factor; $info['depth'] = $info['extents']['bottom'] * $screen_adjustment_factor; // Go through each unit, adjusting map locations - foreach ($info['units'] AS $unit) { + foreach ($info['units'] AS &$unit) { $unit['left'] *= $screen_adjustment_factor; $unit['right'] *= $screen_adjustment_factor; $unit['top'] *= $screen_adjustment_factor; @@ -255,7 +255,6 @@ class MapsController extends AppController { - } ?> \ No newline at end of file diff --git a/site/views/maps/view.ctp b/site/views/maps/view.ctp index 7eeeb50..a6d5ef6 100644 --- a/site/views/maps/view.ctp +++ b/site/views/maps/view.ctp @@ -1,24 +1,46 @@ -
-image(array('controller' => 'maps', - 'action' => 'map', - $info['map_id']), - array('alt' => 'Site Map', - 'class' => 'imagemap', - 'usemap' => '#mapimg')); -?> +
+ url(array('controller' => 'units', + 'action' => 'view', + $unit['id'])) . + '" alt="' . + $unit['name'] . + '">' . "\n"); + } + }// for indentation purposes + ?> + + + image(array('controller' => 'maps', + 'action' => 'map', + $info['map_id']), + array('alt' => 'Site Map', + 'class' => 'map', + 'usemap' => '#mapzones')); + ?> +
-
+
image(array('controller' => 'maps', - 'action' => 'legend', - $map['Map']['id']), - array('alt' => 'Site Map Legend')); - */ + echo $html->image(array('controller' => 'maps', + 'action' => 'legend', + $info['map_id']), + array('alt' => 'Site Map Legend', + 'class' => 'map')); ?>