From: x2000bedo Date: Mon, 16 Aug 2004 00:58:35 +0000 (+0000) Subject: Début recherche avancée X-Git-Tag: xorg/old~1754 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c25d7f33de6accf0c6cc4602927816b3f0503109;p=platal.git Début recherche avancée L'interface graphique y est. Il reste à faire fonctionner la requête en elle-même :) --- diff --git a/htdocs/advanced_search.php b/htdocs/advanced_search.php new file mode 100644 index 0000000..47a7fec --- /dev/null +++ b/htdocs/advanced_search.php @@ -0,0 +1,83 @@ +assign('advanced',1); +$page->assign('public_directory',0); +require_once("applis.func.inc.php"); +require_once("geoloc.inc.php"); + +if (array_key_exists('rechercher', $_REQUEST)) { + $page->assign('formulaire',0); + + $nameField = new StringSField('name',array('u.nom','u.epouse'),''); + $firstnameField = new StringSField('firstname',array('u.prenom'),''); + $promo1Field = new PromoSField('promo1','egal1',array('u.promo'),''); + $promo2Field = new PromoSField('promo2','egal2',array('u.promo'),''); + $fields = new SFieldGroup(true,array($nameField,$firstnameField,$promo1Field,$promo2Field)); + + if ($nameField->length()<2 && $firstnameField->length()<2 && + ($public_directory || !$promo1Field->is_a_single_promo())) + { + new ThrowError('Recherche trop générale.'); + } + $offset = new NumericSField('offset'); + + $sql = 'SELECT SQL_CALC_FOUND_ROWS + u.matricule,i.matricule_ax, + u.nom, + u.epouse, + u.prenom, + u.promo, + i.deces!=0 AS decede, + u.username, + u.date, + ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type, + ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type, + c.uid AS contact + FROM auth_user_md5 AS u + INNER JOIN identification AS i ON (i.matricule=u.matricule) + LEFT JOIN contacts AS c ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id) + 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) + WHERE '.$fields->get_where_statement().' + ORDER BY '.implode(',',array_filter(array($fields->get_order_statement(),'promo DESC,nom,prenom'))).' + LIMIT '.$offset->value.','.$globals->search_results_per_page; + + $page->mysql_assign($sql, 'resultats', 'nb_resultats','nb_resultats_total'); + + $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search_results_per_page; + $page->assign('offsets',range(0,$nbpages)); + $page->assign('url_args',$fields->get_url()); + $page->assign('with_soundex',0); + $page->assign('offset',$offset->value); + $page->assign('perpage',$globals->search_results_per_page); + $page->assign('is_admin',has_perms()); +} +else { + $page->assign('formulaire',1); + $sql = 'SELECT id,text FROM nationalites ORDER BY text'; + $page->mysql_assign($sql,'choix_nationalites'); + $sql = 'SELECT id,text FROM binets_def ORDER BY text'; + $page->mysql_assign($sql,'choix_binets'); + $sql = 'SELECT id,text FROM groupesx_def ORDER BY text'; + $page->mysql_assign($sql,'choix_groupesx'); + $sql = 'SELECT id,text FROM sections ORDER BY text'; + $page->mysql_assign($sql,'choix_sections'); + $sql = 'SELECT id,text FROM applis_def ORDER BY text'; + $page->mysql_assign($sql,'choix_schools'); + if (isset($_REQUEST['school'])) { + $sql = 'SELECT type FROM applis_def WHERE id='.$_REQUEST['school']; + $result = $globals->db->query($sql); + list($types) = mysql_fetch_row($result); + $page->assign('choix_diplomas',explode(',',$types)); + } + $sql = 'SELECT id,label FROM emploi_secteur ORDER BY label'; + $page->mysql_assign($sql,'choix_secteurs'); + $sql = 'SELECT id,fonction_fr FROM fonctions_def ORDER BY fonction_fr'; + $page->mysql_assign($sql,'choix_postes'); +} +$page->run(); +?> diff --git a/htdocs/search.php b/htdocs/search.php index c1275dc..c58740e 100644 --- a/htdocs/search.php +++ b/htdocs/search.php @@ -10,6 +10,7 @@ else $page->assign('advanced',0); $page->assign('public_directory',$public_directory); require_once("applis.func.inc.php"); +require_once("geoloc.inc.php"); if (array_key_exists('rechercher', $_REQUEST)) { $page->assign('formulaire',0); diff --git a/templates/search.form.tpl b/templates/search.form.tpl index 69f35dc..3c53162 100644 --- a/templates/search.form.tpl +++ b/templates/search.form.tpl @@ -1,5 +1,16 @@
- Recherche + {if $advanced eq "1"} + Recherche avancée + {else} + Recherche simple + {/if} +
+ {if $advanced eq "1"} + -> Recherche simple + {elseif $public_directory neq "1"} + -> Recherche avancée + {/if} +
{if $error}

@@ -7,37 +18,107 @@

{/if}
-
+ - + - + {if $advanced eq "1"} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -45,7 +126,7 @@ -{/if} - + + + + + + +{/if}
Nom
Prénom
Promotion - +  ET  - +
Géographie
Ville
Pays + +
Région ou département + +
Activité
Entreprise
Poste + +
Secteur + +
CV contient
Divers
{section name=binet loop=$choix_binets} - {/section} @@ -71,7 +152,7 @@
Formation + +
+ +
+

+ +

+

+ N.B. Le caractère joker * peut remplacer une ou plusieurs lettres dans les recherches. +

+{if $advanced eq "1"} + Attention ! La recherche avancée concerne uniquement les inscrits sur le site polytechnique.org. +{/if}