0337d704 |
1 | <?php |
2 | /*************************************************************************** |
5ddeb07c |
3 | * Copyright (C) 2003-2007 Polytechnique.org * |
0337d704 |
4 | * http://opensource.polytechnique.org/ * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License, or * |
9 | * (at your option) any later version. * |
10 | * * |
11 | * This program is distributed in the hope that it will be useful, * |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
14 | * GNU General Public License for more details. * |
15 | * * |
16 | * You should have received a copy of the GNU General Public License * |
17 | * along with this program; if not, write to the Free Software * |
18 | * Foundation, Inc., * |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
20 | ***************************************************************************/ |
21 | |
abc68084 |
22 | require_once dirname(__FILE__).'/classes.inc.php'; |
0337d704 |
23 | |
56670b6a |
24 | // {{{ function advancedSearchFromInput |
2b105fb6 |
25 | function getadr_join($table) { |
5e2307dc |
26 | return 'u.user_id='.$table.'.uid'.(Env::v('only_current',false)?' AND FIND_IN_SET(\'active\','.$table.'.statut)':''); |
2b105fb6 |
27 | } |
56670b6a |
28 | function advancedSearchFromInput() |
29 | { |
30 | if ($with_soundex = Env::has('with_soundex')) { |
31 | $nameField = new RefWithSoundexSField('name',array('rn.nom1_soundex','rn.nom2_soundex','rn.nom3_soundex'),'recherche_soundex','rn','u.matricule = rn.matricule'); |
32 | $firstnameField = new RefWithSoundexSField('firstname',array('rp.prenom1_soundex','rp.prenom2_soundex'),'recherche_soundex','rp','u.matricule = rp.matricule'); |
33 | } else { |
34 | $nameField = new NameSField('name',array('u.nom','u.nom_usage'),''); |
35 | $firstnameField = new StringSField('firstname',array('u.prenom'),''); |
36 | } |
37 | $nicknameField = new StringSField('nickname',array('q.profile_nick'),''); |
38 | |
39 | $promo1Field = new PromoSField('promo1','egal1',array('u.promo'),''); |
40 | $promo2Field = new PromoSField('promo2','egal2',array('u.promo'),''); |
010268b2 |
41 | $womanField = new RefSField('woman',array('FIND_IN_SET(\'femme\',u.flags)+1'),'','',''); |
56670b6a |
42 | $subscriberField = new RefSField('subscriber',array('!(u.perms IN (\'admin\',\'user\'))+1'),'','',''); |
43 | $aliveField = new RefSField('alive',array('(u.deces!=0)+1'),'','',''); |
44 | |
56670b6a |
45 | $townField = new RefSField('city',array('ac.city'),'adresses','ac',getadr_join('ac'),false); |
46 | $cityIdField = new RefSField('cityid',array('av.cityid'),'adresses','av',getadr_join('av')); |
47 | $countryField = new RefSField('country',array('ap.country'),'adresses','ap',getadr_join('ap')); |
48 | $regionField = new RefSField('region',array('ar.region'),'adresses','ar',getadr_join('ar')); |
56670b6a |
49 | |
50 | $entrepriseField = new RefSField('entreprise',array('ee.entreprise'),'entreprises','ee','u.user_id=ee.uid',false); |
51 | $posteField = new RefSField('poste',array('ep.poste'),'entreprises','ep','u.user_id=ep.uid', false); |
52 | $fonctionField = new RefSField('fonction',array('en.fonction'),'entreprises','en','u.user_id=en.uid'); |
53 | $secteurField = new RefSField('secteur',array('fm.secteur'),'entreprises','fm','u.user_id=fm.uid'); |
54 | $cvField = new RefSField('cv',array('u.cv'),'','','',false); |
55 | |
56 | $natField = new RefSField('nationalite',array('u.nationalite'),'','',''); |
57 | $binetField = new RefSField('binet',array('b.binet_id'),'binets_ins','b','u.user_id=b.user_id'); |
58 | $groupexField = new RefSField('groupex',array('g.gid'),'groupesx_ins','g','u.user_id=g.guid'); |
59 | $sectionField = new RefSField('section',array('u.section'),'','',''); |
60 | $schoolField = new RefSField('school',array('as.aid'),'applis_ins','`as`','u.user_id=as.uid'); |
61 | $diplomaField = new RefSField('diploma',array('ad.type'),'applis_ins','ad','u.user_id=ad.uid'); |
62 | |
63 | $freeField = new RefSField('free',array('q.profile_freetext'),'','','',false); |
64 | |
65 | return array( |
66 | $nameField, $firstnameField, $nicknameField, $promo1Field, |
67 | $promo2Field, $womanField, $subscriberField, $aliveField, |
68 | $townField, $countryField, $regionField, $entrepriseField, |
69 | $posteField, $secteurField, $cvField, $natField, $binetField, |
70 | $groupexField, $sectionField, $schoolField, $diplomaField, |
86b5c8f0 |
71 | $freeField, $fonctionField, $cityIdField); |
56670b6a |
72 | } |
73 | |
74 | // }}} |
75 | |
a7de4ef7 |
76 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
0337d704 |
77 | ?> |