<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
require_once dirname(__FILE__).'/classes.inc.php';
// {{{ function advancedSearchFromInput
-function getadr_join($table) {
- return 'u.user_id = ' . $table . '.uid' . (Env::v('only_current', false) ? ' AND FIND_IN_SET(\'active\', ' . $table . '.statut)' : '');
+function getAddressJoin($table) {
+ return 'u.user_id = ' . $table . '.pid' . (Env::v('only_current', false) ? ' AND FIND_IN_SET(\'current\', ' . $table . '.flags)' : '');
}
function advancedSearchFromInput()
{
if ($with_soundex = Env::has('with_soundex')) {
- $nameField = new RefWithSoundexSField('name',array('rn.nom1_soundex','rn.nom2_soundex','rn.nom3_soundex'),'recherche_soundex','rn','u.matricule = rn.matricule');
- $firstnameField = new RefWithSoundexSField('firstname',array('rp.prenom1_soundex','rp.prenom2_soundex'),'recherche_soundex','rp','u.matricule = rp.matricule');
+ $nameField = new RefWithSoundexSField('name', array('n.soundex'), 'search_name',
+ 'n', 'u.user_id = n.uid');
} else {
- $nameField = new NameSField('name', array('u.nom','u.nom_usage'), '');
- $firstnameField = new StringSField('firstname', array('u.prenom'), '');
+ $nameField = new NameSField('name', array('n.token'), 'search_name', 'n', 'u.user_id = n.uid');
}
- $nicknameField = new StringSField('nickname', array('q.profile_nick'), '');
$promo1Field = new PromoSField('promo1', 'egal1', array('u.promo'), '');
$promo2Field = new PromoSField('promo2', 'egal2', array('u.promo'), '');
$referentField = null;
}
- if (!Env::i('cityid')) {
- $townField = new RefSField('city', array('ac.city', 'ac.postcode'), 'adresses', 'ac', getadr_join('ac'), false);
- } else {
- $townField = new RefSField('cityid', array('av.cityid', 'av.postcode'), '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('sgcim.map_id'), array('adresses', 'geoloc_city_in_maps'),
- array('amp', 'sgcim'), array(getadr_join('amp'), 'amp.cityid = sgcim.city_id'));
+ $townField = new RefSField('city', array('av.localityId', 'av.postalCode'), 'profile_addresses',
+ 'av', getAddressJoin('av'));
+ $countryField = new RefSField('country', array('ap.countryId'), 'profile_addresses', 'ap', getAddressJoin('ap'));
+ $regionField = new RefSField('region',array('ar.administrativeAreaId'), 'profile_addresses', 'ar', getAddressJoin('ar'));
$entrepriseField = new RefSField('entreprise', array('je.name'), '', '','');
$posteField = new RefSField('poste', array('ep.description'), 'profile_job', 'ep', 'u.user_id = ep.uid', false);
$natField = new RefSField('nationalite', array('u.nationalite', 'u.nationalite2', 'u.nationalite3'), '', '', '');
$binetField = new RefSField('binet', array('b.binet_id'), 'binets_ins', 'b', 'u.user_id=b.user_id');
- $groupexField = new RefSField('groupex', array('g.id'), array('groupex.asso', 'groupex.membres'), array('g', 'gm'),
+ $groupexField = new RefSField('groupex', array('g.id'), array('groups', 'group_members'), array('g', 'gm'),
array("(g.cat = 'GroupesX' OR g.cat = 'Institutions') AND g.pub = 'public'",
'gm.asso_id = g.id AND u.user_id = gm.uid'));
$sectionField = new RefSField('section', array('u.section'), '', '', '');
}
$nwPhoneField = new PhoneSField('phone_number', array('t.search_tel'), 'profile_phones', 't', 't.uid = u.user_id');
return array(
- $nameField, $firstnameField, $nicknameField, $promo1Field,
+ $nameField, $promo1Field,
$promo2Field, $womanField, $subscriberField, $aliveField,
- $townField, $countryField, $regionField, $mapField, $entrepriseField,
+ $townField, $countryField, $regionField, $entrepriseField,
$posteField, $secteurField, $cvField, $natField, $binetField,
$groupexField, $sectionField, $schoolField, $diplomaField,
$freeField, $fonctionField, $nwAddressField, $nwTypeField,