};
var map = new google.maps.Map($('#map_canvas').get(0), myOptions);
- $.xget('map/ajax', function(json_data) {
+ $.xget(window.location.href, {ajax: true}, function(json_data) {
var data = jQuery.parseJSON(json_data);
var dots = data.data;
var count = dots.length;
}
}
+class MapView implements PlView
+{
+ private $set;
+
+ public function __construct(PlSet $set, array $params)
+ {
+ $this->set = $set;
+ }
+
+ public function apply(PlPage $page)
+ {
+ Platal::load('geoloc');
+
+ if (Get::b('ajax')) {
+ $pids = $this->set->getIds(new PlLimit());
+ GeolocModule::assign_json_to_map($page, $pids);
+ $page->runJSON();
+ exit;
+ } else {
+ $this->set->getIds(new PlLimit());
+ GeolocModule::prepare_map($page);
+ return 'geoloc/index.tpl';
+ }
+ }
+
+ public function args()
+ {
+ return $this->set->args();
+ }
+}
+
class GadgetView implements PlView
{
public function __construct(PlSet $set, array $params)
$view->addMod('minifiche', 'Mini-fiches', true);
$view->addMod('trombi', 'Trombinoscope', false, array('with_admin' => false, 'with_promo' => true));
- // TODO: Reactivate when the new map is completed.
- // $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'carnet/contacts/search'));
+ $view->addMod('map', 'Planisphère');
$view->apply('carnet/contacts', $page, $action, $subaction);
- //if ($action != 'geoloc' || ($search && !$ssaction) || (!$search && !$subaction)) {
$page->changeTpl('carnet/mescontacts.tpl');
- //}
}
function handler_pdf($page, $arg0 = null, $arg1 = null)
function handlers()
{
return array(
- 'map' => $this->make_hook('map', AUTH_COOKIE),
- 'map/ajax' => $this->make_hook('map_ajax', AUTH_COOKIE)
+ 'map' => $this->make_hook('map', AUTH_COOKIE)
);
}
$page->assign('pl_extra_header', '<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />');
}
- function handler_map($page)
+ static public function assign_json_to_map(PlPage $page, $pids = null)
{
- self::prepare_map($page);
- }
+ if (!is_null($pids)) {
+ $where = XDB::format(' AND pa.pid IN {?}', $pids);
+ } else {
+ $where = '';
+ }
- function handler_map_ajax($page)
- {
$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 CONCAT(pd.private_name, \' (\', pd.promo, \')\') SEPARATOR \',\') AS name
FROM profile_addresses AS pa
INNER JOIN profiles AS p ON (pa.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = pa.pid)
- WHERE pa.type = \'home\' AND pa.latitude IS NOT NULL AND pa.longitude IS NOT NULL
+ WHERE pa.type = \'home\' AND pa.latitude IS NOT NULL AND pa.longitude IS NOT NULL' . $where . '
GROUP BY pa.latitude, pa.longitude');
$page->jsonAssign('data', $data);
+ }
- return PL_JSON;
+ function handler_map($page)
+ {
+ if (Get::b('ajax')) {
+ self::assign_json_to_map($page);
+ return PL_JSON;
+ } else {
+ self::prepare_map($page);
+ }
}
}
if (empty($GLOBALS['IS_XNET_SITE'])) {
$view->addMod('minifiche', 'Mini-fiches', false);
}
- // TODO: Reactivate when the new map is completed.
- // $view->addMod('geoloc', 'Planisphère');
+ $view->addMod('map', 'Planisphère');
$view->apply("lists/annu/$liste", $page, $action, $subaction);
$page->changeTpl('lists/annu.tpl');
$view->addMod('minifiche', 'Mini-fiches', true, array('with_score' => true, 'starts_with' => $byletter));
if (S::logged() && !Env::i('nonins')) {
$view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true, 'with_score' => true));
- // TODO: Reactivate when the new map is completed.
- // $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'search/adv'));
+ $view->addMod('map', 'Planisphère');
}
$view->apply('search', $page, $model);
} else {
$view->addMod('minifiche', 'Mini-fiches', true, array('starts_with' => $byletter));
$view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true));
- // TODO: Reactivate when the new map is completed.
- // $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'search/adv'));
+ $view->addMod('map', 'Planisphère');
if (S::user()->checkPerms(User::PERM_EDIT_DIRECTORY) || S::admin()) {
$view->addMod('addresses', 'Adresses postales', false);
}