X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch.php;h=53bc84e0900dc09e7ee2b7b93fa81440e953f5c2;hb=5b2c99878fc75a6acffb2239e284f2cb1782142c;hp=3df06925bdaa6d8670753b6cd5cf6b9e212be67f;hpb=76cbe885cee40ea53bf1c52b70b44d792024f341;p=platal.git diff --git a/modules/search.php b/modules/search.php index 3df0692..53bc84e 100644 --- a/modules/search.php +++ b/modules/search.php @@ -164,10 +164,12 @@ class SearchModule extends PLModule $this->form_prepare(); } else { $textFields = array( - 'country' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'pays', 'exact' => false), + 'country' => array('field' => 'iso_3166_1_a2', 'table' => 'geoloc_countries', 'text' => 'countryFR', + 'exact' => false), 'fonction' => array('field' => 'id', 'table' => 'fonctions_def', 'text' => 'fonction_fr', 'exact' => true), 'secteur' => array('field' => 'id', 'table' => 'profile_job_sector_enum', 'text' => 'name', 'exact' => false), - 'nationalite' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'nat', 'exact' => 'false'), + 'nationalite' => array('field' => 'iso_3166_1_a2', 'table' => 'geoloc_countries', + 'text' => 'nationalityFR', 'exact' => 'false'), 'binet' => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false), 'networking_type' => array('field' => 'network_type', 'table' => 'profile_networking_enum', 'text' => 'name', 'exact' => false), @@ -176,7 +178,7 @@ class SearchModule extends PLModule 'exact' => false), 'section' => array('field' => 'id', 'table' => 'sections', 'text' => 'text', 'exact' => false), 'school' => array('field' => 'id', 'table' => 'profile_education_enum', 'text' => 'name', 'exact' => false), - 'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false) + 'city' => array('table' => 'geoloc_localities', 'text' => 'name', 'exact' => false) ); if (!Env::has('page')) { S::logger()->log('search', 'adv=' . var_export($_GET, true)); @@ -270,18 +272,17 @@ class SearchModule extends PLModule $realid = 'profile_networking_enum.network_type'; break; case 'city': - $db = 'geoloc_city INNER JOIN - adresses ON(geoloc_city.id = adresses.cityid)'; - $unique='uid'; - $field='geoloc_city.name'; + $db = 'geoloc_localities INNER JOIN + profile_addresses ON (geoloc_localities.id = profile_addresses.localityId)'; + $unique = 'uid'; + $field ='geoloc_localities.name'; break; case 'countryTxt': - $db = 'geoloc_pays INNER JOIN - adresses ON(geoloc_pays.a2 = adresses.country)'; - $unique = 'uid'; - $field = 'geoloc_pays.pays'; - $field2 = 'geoloc_pays.country'; - $realid = 'geoloc_pays.a2'; + $db = 'geoloc_countries INNER JOIN + profile_addresses ON (geoloc_countries.iso_3166_1_a2 = profile_addresses.countryId)'; + $unique = 'pid'; + $field = 'geoloc_countries.countryFR'; + $realid = 'geoloc_countries.iso_3166_1_a2'; break; case 'entreprise': $db = 'profile_job_enum INNER JOIN @@ -310,10 +311,10 @@ class SearchModule extends PLModule $unique = 'm.uid'; break; case 'nationaliteTxt': - $db = 'geoloc_pays AS acgp - INNER JOIN profiles AS acp ON (acgp.a2 IN (acp.nationality1, acp.nationality2, acp.nationality3))'; - $field = 'IF(acgp.nat = \'\', acgp.pays, acgp.nat)'; - $realid = 'acgp.a2'; + $db = 'geoloc_countries INNER JOIN + profile ON (geoloc_countries.a2 IN (profile.nationality1, profile.nationality2, profile.nationality3))'; + $field = 'geoloc_countries.nationalityFR'; + $realid = 'geoloc_countries.iso_3166_1_a2'; break; case 'description': $db = 'profile_job'; @@ -422,9 +423,9 @@ class SearchModule extends PLModule $id = 'network_type'; break; case 'country': - $db = 'geoloc_pays'; - $field = 'pays'; - $id = 'a2'; + $db = 'geoloc_countries'; + $field = 'countryFR'; + $id = 'iso_3166_1_a2'; $page->assign('onchange', 'changeCountry(this.value)'); break; case 'fonction': @@ -442,17 +443,17 @@ class SearchModule extends PLModule $field = 'nom'; break; case 'nationalite': - $db = 'geoloc_pays AS acgp INNER JOIN + $db = 'geoloc_countries INNER JOIN profiles AS acp ON (acgp.a2 IN (acp.nationality1, acp.nationality2, acp.nationality3))'; - $field = 'IF(acgp.nat=\'\', acgp.pays, acgp.nat)'; - $id = 'acgp.a2'; + $field = 'nationalityFR'; + $id = 'iso_3166_1_a2'; break; case 'region': - $db = 'geoloc_region'; + $db = 'geoloc_administrativeareas'; $field = 'name'; - $id = 'region'; + $id = 'id'; if (isset($_REQUEST['country'])) { - $where .= ' WHERE a2 = "'.$_REQUEST['country'].'"'; + $where .= ' WHERE country = "' . $_REQUEST['country'] . '"'; } break; case 'school':