git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-702
New :
+ * Profile :
+ - Address parser. -Car
+
* Search :
- Nickname are used in fast search. -Car
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2005 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+require_once('xorg.inc.php');
+new_nonhtml_page('', AUTH_COOKIE);
+header("Content-type: image/png");
+
+$res = $globals->xdb->iterRow('SELECT lat, lon FROM geoloc_city AS gc LEFT JOIN adresses AS a ON(gc.id = a.cityid) WHERE a.cityid IS NOT NULL GROUP BY gc.id');
+
+$img = imageCreateFromPng("../images/globe.png");
+
+$coul = imagecolorallocate($img, 0, 0, 0);
+
+while ($a = $res->next())
+ imagefilledellipse($img, round(($a[1]/100000 + 180 )/360*600), round((90 - $a[0]/100000)/180*300), 5, 5, $coul);
+
+imagePng($img);
+imagedestroy($img);
+// vim:set et sws=4 sw=4 sts=4:
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2005 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+require_once('xorg.inc.php');
+new_skinned_page('geoloc/index.tpl', AUTH_COOKIE);
+
+$res = $globals->xdb->query('SELECT COUNT(DISTINCT uid) FROM adresses WHERE cityid IS NOT NULL');
+$page->assign('localises', $res->fetchOneCell());
+
+$page->run();
+
+// vim:set et sws=4 sw=4 sts=4:
+?>
$keys = explode('|',fgets($f));
$vals = explode('|',fgets($f));
$infos = array();
- foreach ($keys as $i=>$key) if($vals[$i]) $infos[$key] = $vals[$i];
+ foreach ($keys as $i=>$key) if($vals[$i]) $infos[$key] = ($key == 'sql')?$vals[$i]:utf8_decode($vals[$i]);
global $globals;
if ($infos['sql'])
$globals->xdb->execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']);
if ($adr['city']) $l .= $adr['city'];
}
if ($l) $t .= "\n".trim($l);
+ if ($adr['country'] != '00' && !$adr['countrytxt']) {
+ global $globals;
+ $res = $globals->xdb->query("SELECT pays FROM geoloc_pays WHERE a2 = {?}", $adr['country']);
+ $adr['countrytxt'] = $res->fetchOneCell();
+ }
if ($adr['countrytxt']) $t .= "\n".$adr['countrytxt'];
return trim($t);
}
replace_ifset_adr('pub', $i);
replace_ifset_adr('tel_pub', $i);
replace_ifset_adr('txt', $i);
- if ($GLOBALS['adresses'][$i]['txt'] && !Env::get('nochange'.$i, true)) {
+ if ($GLOBALS['adresses'][$i]['txt'] && Env::get('change'.$i, false)) {
require_once('geoloc.inc.php');
$new = get_address_infos($GLOBALS['adresses'][$i]['txt']);
- $GLOBALS['adresses'][$i]['adr1'] = '';
- $GLOBALS['adresses'][$i]['adr2'] = '';
- $GLOBALS['adresses'][$i]['adr3'] = '';
- $GLOBALS['adresses'][$i]['postcode'] = '';
- $GLOBALS['adresses'][$i]['city'] = '';
- unset($GLOBALS['adresses'][$i]['cityid']);
- $GLOBALS['adresses'][$i]['country'] = '00';
- $GLOBALS['adresses'][$i]['region'] = '';
- $GLOBALS['adresses'][$i] = array_merge($GLOBALS['adresses'][$i], $new);
- $GLOBALS['adresses'][$i]['txt'] = get_address_text($GLOBALS['adresses'][$i]);
+ // if we found a localisation, erase old address
+ if ($new['sql']) {
+ $GLOBALS['adresses'][$i]['adr1'] = '';
+ $GLOBALS['adresses'][$i]['adr2'] = '';
+ $GLOBALS['adresses'][$i]['adr3'] = '';
+ $GLOBALS['adresses'][$i]['postcode'] = '';
+ $GLOBALS['adresses'][$i]['city'] = '';
+ unset($GLOBALS['adresses'][$i]['cityid']);
+ $GLOBALS['adresses'][$i]['country'] = '00';
+ $GLOBALS['adresses'][$i]['countrytxt'] = '';
+ $GLOBALS['adresses'][$i]['region'] = '';
+ $GLOBALS['adresses'][$i] = array_merge($GLOBALS['adresses'][$i], $new);
+ }
}
+ $GLOBALS['adresses'][$i]['txt'] = get_address_text($GLOBALS['adresses'][$i]);
$tab = Env::getMixed('numero_formulaire', Array());
if($tab[$i])
$GLOBALS['adresses'][$i]['numero_formulaire'] = $tab[$i];
<tr>
<td class="colg">
<span class="titre">{$titre}</span>
- {if $adr.nouvelle != 'new' && !$smarty.request.detail[$adrid]}
+ {if !$smarty.request.detail[$adrid]}
<br />
- [<a href="{$url}&detail[{$adrid}]=1">corriger</a>]
- {/if}
- {if $adr.nouvelle != 'new' && !$adr.cityid}
+ [<a href="{$url}&detail[{$adrid}]=1">{if $adr.nouvelle != 'new'}corriger{else}préciser{/if}</a>]
+ {/if}
+ {if $adr.nouvelle != 'new' && !$adr.cityid && !$smarty.request.detail[$adrid]}
<br />
<span class="erreur">non géolocalisée</span>
- {/if}
+ <br />
+ <input type="checkbox" name="change{$adrid}" id="change{$adrid}" />
+ <label for="change{$adrid}">localiser</label>
+ {else}
+ <input type="hidden" name="change{$adrid}" value="0" />
+ {/if}
</td>
<td class="cold">
{if $smarty.request.detail[$adrid] neq 1}
- <input type="hidden" name="nochange{$adrid}" value="1" />
<input type="hidden" name="adr1[{$adrid}]" value="{$adr.adr1}" />
<input type="hidden" name="adr2[{$adrid}]" value="{$adr.adr2}" />
<input type="hidden" name="adr3[{$adrid}]" value="{$adr.adr3}" />
<input type="hidden" name="cityid[{$adrid}]" value="{$adr.cityid}" />
<input type="hidden" name="region[{$adrid}]" value="{$adr.region}" />
<input type="hidden" name="country[{$adrid}]" value="{$adr.country}" />
- <textarea name="txt[{$adrid}]" cols="43" rows="3" onclick="form.nochange{$adrid}.value=0;select()">{$adr.txt}</textarea>
+ <textarea name="txt[{$adrid}]" cols="43" rows="3"
+ {if $adr.nouvelle != 'new' && !$adr.cityid && !$smarty.request.detail[$adrid]}
+ onclick="form.change{$adrid}.checked='checked';select()"
+ {else}
+ onclick="form.change{$adrid}.value=1;select()"
+ {/if}
+ >{$adr.txt}</textarea>
{else}
<input type="hidden" name="cityid[{$adrid}]" value="{$adr.cityid}" />
<input type="text" name="adr1[{$adrid}]" size="43" maxlength="88" value="{$adr.adr1}" />
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2004-2005 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<h1>Géolocalisation</h1>
+
+<p class="descr">Aujourd'hui {$localises} de nos camarades sont localisés grâce à leurs adresses personnelles. La géolocalisation permet de :
+</p>
+<ul>
+<li>standardiser les adresses</li>
+<li>rechercher de manière précise par lieu géographique</li>
+<li>dans un deuxième temps, faire des jolies cartes</li>
+</ul>
+
+<p class="center">
+<img src="globe.php" width="500" alt="Carte du monde des X"/>
+</p>
+
+<p class="descr">Pour savoir comment ça marche tu peux aller faire un tour sur le <a href="http://www.aaege.org/GeolocDev/">site de développement</a> du projet.</p>
+
+<p class="descr">Pour toute question, problème ou suggestion tu peux envoyer un mail à <a href="mailto:contact+geoloc@polytechnique.org">contact+geoloc@polytechnique.org</a></p>
+
+{* vim:set et sw=2 sts=2 sws=2: *}