$mapid);
$fields = new SFieldGroup(true, $SFields);
$where = $fields->get_where_statement();
+ $joins = $fields->get_select_statement();
if ($where) {
$where .= ' AND ';
}
gc.name,
COUNT(u.user_id) AS pop,
SUM(u.promo % 2) AS yellow',
- "{$fields->get_select_statement()}
+ "$joins
LEFT JOIN geoloc_city AS gc ON(gcim.city_id = gc.id)",
$where . ($direct ? "gcim.infos = 'smallest'" : '1'),
'gc.id, gc.alias',
'am.cityid = gcim.city_id',
'map.map_id = gcim.map_id'));
$fields = new SFieldGroup(true, $SFields);
+ $where = $fields->get_where_statement();
+ $joins = $fields->get_select_statement();
$countryres = $set->get('map.map_id AS id,
COUNT(u.user_id) AS nbPop,
SUM(u.promo % 2) AS yellow,
COUNT(DISTINCT gcim.city_id) AS nbCities,
SUM(IF(u.user_id IS NULL,0,am.glng)) AS lonPop,
SUM(IF(u.user_id IS NULL, 0,am.glat)) AS latPop',
- $fields->get_select_statement(),
- $fields->get_where_statement(),
+ $joins,
+ $where,
'map.map_id',
'NULL');
if ($maxpop < $c['nbPop']) $maxpop = $c['nbPop'];
$c['xPop'] = geoloc_to_x($c['lonPop'], $c['latPop']);
$c['yPop'] = geoloc_to_y($c['lonPop'], $c['latPop']);
- $countries[$c['id']] = array_merge($countries[$c['id']], $c);
+ @$countries[$c['id']] = array_merge($countries[$c['id']], $c);
$nbcities += $c['nbCities'];
}
if ($nocity && $nbcities < $minentities){
foreach($countries as $i => $c) {
$countries[$i]['nbPop'] = 0;
- if ($c['nbCities'] > 0) {
+ if (@$c['nbCities'] > 0) {
geoloc_getData_subcities($c['id'], $sin, $cities, false);
}
}
class SearchSet extends UserSet
{
+ public $advanced = false;
private $score = null;
private $order = null;
private $quick = false;
new ThrowError('Recherche trop générale.');
}
$this->score = $qSearch->get_score_statement();
- parent::__construct("{$fields->get_select_statement()}
- {$globals->search->result_where_statement}",
+ parent::__construct("{$fields->get_select_statement()}",
$fields->get_where_statement() .
(S::logged() && Env::has('nonins') ? ' AND u.perms="pending" AND u.deces=0' : ''));
private function getAdvanced()
{
global $globals;
+ $this->advanced = true;
$fields = new SFieldGroup(true, advancedSearchFromInput());
if ($fields->too_large()) {
new ThrowError('Recherche trop générale.');
}
- parent::__construct($fields->get_select_statement() . ' ' . $globals->search->result_where_statement,
+ parent::__construct($fields->get_select_statement(),
$fields->get_where_statement());
$this->order = implode(',',array_filter(array($fields->get_order_statement(),
'promo DESC, NomSortKey, prenom')));
public function joins()
{
- return ($this->set instanceof SearchSet ? "" :
- "LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id)
+ return "LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id)
LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id)
LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id)
LEFT JOIN geoloc_pays AS n ON (u.nationalite = n.a2)
AND FIND_IN_SET('active', adr.statut))
LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2)
LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region)
- LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = 'active')
- ") . (S::logged() ?
- "LEFT JOIN contacts AS c On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")"
- : "");
+ LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = 'active')" .
+ (S::logged() ?
+ "LEFT JOIN contacts AS c On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")"
+ : "");
}
public function templateName()
$view->addMod('minifiche', 'Minifiches', true);
$view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true));
$view->addMod('geoloc', 'Planishpère');
- $view->apply('search', $page, $action, $subaction);
+ $view->apply('search/adv', $page, $action, $subaction);
if ($subaction) {
return;
$cityIdField = new RefSField('cityid',array('av.cityid'),'adresses','av',getadr_join('av'));
$countryField = new RefSField('country',array('ap.country'),'adresses','ap',getadr_join('ap'));
$regionField = new RefSField('region',array('ar.region'),'adresses','ar',getadr_join('ar'));
- $mapField = new MapSField('mapid', array('gcim.map_id'), array('adresses','geoloc_city_in_maps'), array('am','gcim'), array(getadr_join('am'), 'am.cityid = gcim.city_id'));
$entrepriseField = new RefSField('entreprise',array('ee.entreprise'),'entreprises','ee','u.user_id=ee.uid',false);
$posteField = new RefSField('poste',array('ep.poste'),'entreprises','ep','u.user_id=ep.uid', false);
$townField, $countryField, $regionField, $entrepriseField,
$posteField, $secteurField, $cvField, $natField, $binetField,
$groupexField, $sectionField, $schoolField, $diplomaField,
- $freeField, $fonctionField, $cityIdField, $mapField);
+ $freeField, $fonctionField, $cityIdField);
}
// }}}
<script type="text/javascript">// <!--
var baseurl = "{#globals.baseurl#}/search/";
{literal}
-
- // use same form to send to search or map
- function launch_form(url) {
- var f = document.getElementById('recherche');
- f.action = url;
- f.submit();
- }
-
// display an autocomplete row : blabla (nb of found matches)
function format_autocomplete(row) {
if (row[1] == 1) {
<tr>
<td colspan="2" style="padding-top: 1.5em">
<div style="float: right">
- <input type="button" value="Chercher" onclick="launch_form('search/adv')"/>
+ <input type="button" value="Chercher" />
</div>
{if $smarty.session.auth ge AUTH_COOKIE}
<input type='checkbox' name='order' value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} id="order"/>
</tr>
</table>
</form>
-<p class="center">
- <input type="button" value="Voir les résultats sur une carte" onclick="launch_form('geoloc/')"/>
-</p>
<p>
<strong>N.B.</strong> Le caractère joker * peut remplacer une ou plusieurs lettres dans les recherches.
</p>
<ul class="noprint">
{if $with_soundex && ($smarty.request.firstname || $smarty.request.name)}
<li>Étendre ta recherche par <strong>
- <a href="{$with_soundex}">proximité sonore</a>
+ <a href="search/adv{$plset_search}with_soundex=1">proximité sonore</a>
</strong>
</li>
{/if}
- <li><strong><a href="{$url_search_form}">Modifier</a>
+ <li><strong><a href="search/adv{$plset_search|regex_replace:"/rechercher=[^&]*/":""}">Modifier</a>
</strong> ta recherche
</li>