X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch.php;h=c4d96af9d41971e577663cdb075ecf9c7cf2a5e4;hb=f981776842674edfa2c654e4248a7b290df98501;hp=74a1a92b5d15787b8eb2fe20d524c01e08c3b43b;hpb=043bbacf7d5ceaeba4db582ac0ea7c75d6f13c80;p=platal.git diff --git a/modules/search.php b/modules/search.php index 74a1a92..c4d96af 100644 --- a/modules/search.php +++ b/modules/search.php @@ -56,21 +56,24 @@ class SearchModule extends PLModule $school = Env::i('school'); } - if (!is_null($school)) { - $sql = 'SELECT name FROM profile_education_enum WHERE id=' . $school; + if ((!is_null($school)) && ($school != '')) { + $sql = 'SELECT degreeid + FROM profile_education_degree + WHERE eduid=' . $school; } else { - $sql = 'DESCRIBE profile_education_enum name'; + $sql = 'SELECT id + FROM profile_education_degree_enum + ORDER BY id'; } $res = XDB::query($sql); - $row = $res->fetchOneRow(); - if (!is_null($school)) { - $types = $row[0]; - } else { - $types = explode('(',$row[1]); - $types = str_replace("'","",substr($types[1],0,-1)); - } - Platal::page()->assign('choix_diplomas', explode(',',$types)); + Platal::page()->assign('choix_diplomas', $res->fetchColumn()); + + $sql = 'SELECT degree + FROM profile_education_degree_enum + ORDER BY id'; + $res = XDB::query($sql); + Platal::page()->assign('name_diplomas', $res->fetchColumn()); } function handler_quick(&$page, $action = null, $subaction = null) @@ -471,6 +474,8 @@ class SearchModule extends PLModule break; case 'school': $db = 'profile_education_enum'; + $field = 'name'; + $id = 'id'; $page->assign('onchange', 'changeSchool(this.value)'); break; case 'section':