From: Guillaume Bandet Date: Tue, 10 Jun 2008 10:12:52 +0000 (+0200) Subject: Adds a networking address field in advanced search form X-Git-Tag: xorg/1.0.0~332^2~569 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=14256b085eed2ff3f3ca977894f0a506c849e819;p=platal.git Adds a networking address field in advanced search form --- diff --git a/modules/search.php b/modules/search.php index 1a98912..55e5d20 100644 --- a/modules/search.php +++ b/modules/search.php @@ -168,6 +168,11 @@ class SearchModule extends PLModule $page->assign('advanced',1); $page->addJsLink('jquery.autocomplete.js'); + $res = XDB::iterator("SELECT nw.network_type AS type, nw.name + FROM profile_networking_enum AS nw + ORDER BY name ;"); + $page->assign('network_list', $res->fetchAllAssoc()); + if (!Env::has('rechercher') && $action != 'geoloc') { $this->form_prepare(); } else { diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index 91c924d..5ef9fd6 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -44,7 +44,9 @@ if (S::logged()) q.profile_mobile AS mobile, q.profile_freetext AS freetext, adr.city, gp.pays AS countrytxt, gr.name AS region, - e.entreprise,'; + e.entreprise, + nw.address AS networking_address, + nwe.name AS networking_name,'; else $globals->search->result_fields .=" IF(q.profile_web_pub='public', q.profile_web, '') AS web, @@ -53,20 +55,24 @@ else IF(adr.pub='public', adr.city, '') AS city, IF(adr.pub='public', gp.pays, '') AS countrytxt, IF(adr.pub='public', gr.name, '') AS region, - IF(e.pub='public', e.entreprise, '') AS entreprise,"; + IF(e.pub='public', e.entreprise, '') AS entreprise, + IF(nw.pub='public', nw.address, '') AS networking_address, + IF(nw.pub='public', nwe.name, '') AS networking_name,"; @$globals->search->result_where_statement = ' - LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0) - LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid) - LEFT JOIN applis_ins AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1) - LEFT JOIN applis_def AS ad1 ON (ad1.id = ai1.aid) - 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) - LEFT JOIN adresses AS adr ON (u.user_id = adr.uid 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\')'; + LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0) + LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid) + LEFT JOIN applis_ins AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1) + LEFT JOIN applis_def AS ad1 ON (ad1.id = ai1.aid) + 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) + LEFT JOIN adresses AS adr ON (u.user_id = adr.uid 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\') + LEFT JOIN profile_networking AS nw ON (nw.uid = u.user_id) + LEFT JOIN profile_networking_enum AS nwe ON (nwe.network_type = nw.network_type)'; // }}} // {{{ class ThrowError diff --git a/modules/search/search.inc.php b/modules/search/search.inc.php index 0d23a78..52575b5 100644 --- a/modules/search/search.inc.php +++ b/modules/search/search.inc.php @@ -73,13 +73,20 @@ function advancedSearchFromInput() $freeField = new RefSField('free',array('q.profile_freetext'),'','','',false); + $nwAddressField = new RefSField('networking_address', array('nw.address'), 'profile_networking', 'nw', 'nw.uid=u.user_id', false); + if (Env::v('networking_address') == '') { + $nwTypeField = new RefSField('networking_type', array('nwe.name'), array('profile_networking', 'profile_networking_enum'), array('nw', 'nwe'), array('nw.uid = u.user_id', 'nwe.network_type = nw.network_type'), true); + } else { + $nwTypeField = new RefSField('networking_type', array('nwe.name'), 'profile_networking_enum', 'nwe', 'nwe.network_type = nw.network_type', true); + } return array( $nameField, $firstnameField, $nicknameField, $promo1Field, - $promo2Field, $womanField, $subscriberField, $aliveField, $referentField, + $promo2Field, $womanField, $subscriberField, $aliveField, $townField, $countryField, $regionField, $mapField, $entrepriseField, $posteField, $secteurField, $cvField, $natField, $binetField, $groupexField, $sectionField, $schoolField, $diplomaField, - $freeField, $fonctionField); + $freeField, $fonctionField, $nwAddressField, $nwTypeField, + $referentField); } // }}} diff --git a/templates/search/adv.form.tpl b/templates/search/adv.form.tpl index 6f36626..c1ef43a 100644 --- a/templates/search/adv.form.tpl +++ b/templates/search/adv.form.tpl @@ -404,6 +404,34 @@ checked="checked"{/if}/>Chercher uniquement les adresses où les camarades sont Commentaire contient + + Messageries, networking et sites webs + + + + Adresse + + + + + + + + Type + + + + + {if $smarty.session.auth ge AUTH_COOKIE}