From 6bcd8813ff19f68bff738861ce274aff6ddba8a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 12 Jun 2011 18:50:26 +0200 Subject: [PATCH] Displays search results on maps for all users (not connected, ax, x). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The addresses displayed correspond to the publicity the user is enabled to, ie ax secretaries will only see ax addresses and not loggued users will only see public addresses. Signed-off-by: Stéphane Jacob --- modules/geoloc.php | 12 +++++++++++- modules/search.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/geoloc.php b/modules/geoloc.php index 5e58052..340dfd4 100644 --- a/modules/geoloc.php +++ b/modules/geoloc.php @@ -49,9 +49,19 @@ class GeolocModule extends PLModule $where = ''; } + if (!S::logged() || !S::user()->checkPerms('directory_ax')) { + $where .= " AND pa.pub = 'public'"; + $name_publicity = 'public'; + } else if (!S::user()->checkPerms('directory_private')) { + $where .= " AND pa.pub = 'ax'"; + $name_publicity = 'public'; + } else { + $name_publicity = 'private'; + } + $data = XDB::rawFetchAllAssoc('SELECT pa.latitude, pa.longitude, GROUP_CONCAT(DISTINCT p.hrpid SEPARATOR \',\') AS hrpid, GROUP_CONCAT(pd.promo SEPARATOR \',\') AS promo, - GROUP_CONCAT(DISTINCT pd.private_name, \' (\', pd.promo, \')\' SEPARATOR \', \') AS name, + GROUP_CONCAT(DISTINCT pd.' . $name_publicity . '_name, \' (\', pd.promo, \')\' SEPARATOR \', \') AS name, GROUP_CONCAT(DISTINCT pa.pid SEPARATOR \',\') AS pid FROM profile_addresses AS pa INNER JOIN profiles AS p ON (pa.pid = p.pid) diff --git a/modules/search.php b/modules/search.php index d3c9164..237c739 100644 --- a/modules/search.php +++ b/modules/search.php @@ -121,9 +121,9 @@ class SearchModule extends PLModule require_once 'userset.inc.php'; $view = new QuickSearchSet(); $view->addMod('minifiche', 'Mini-fiches', true, array('with_score' => true, 'starts_with' => $byletter)); + $view->addMod('map', 'Planisphère'); if (S::logged() && !Env::i('nonins')) { $view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true, 'with_score' => true)); - $view->addMod('map', 'Planisphère'); } $view->apply('search', $page, $model); -- 2.1.4