L'interface graphique y est.
Il reste à faire fonctionner la requête en elle-même :)
--- /dev/null
+<?php
+require("auto.prepend.inc.php");
+require("search.classes.inc.php");
+new_skinned_page('search.tpl', AUTH_COOKIE);
+$page->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();
+?>
$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);
<div class="rubrique">
- Recherche
+ {if $advanced eq "1"}
+ Recherche avancée
+ {else}
+ Recherche simple
+ {/if}
+ <div class="floatright">
+ {if $advanced eq "1"}
+ <a href="search.php">-> Recherche simple</a>
+ {elseif $public_directory neq "1"}
+ <a href="advanced_search.php">-> Recherche avancée</a>
+ {/if}
+ </div>
</div>
{if $error}
<p class="error">
</p>
{/if}
<div class="center">
- <form action="{$smarty.server.PHP_SELF}" method="post">
+ <form action="{$smarty.server.PHP_SELF}" method="post" name="recherche">
<input type="hidden" name="public_directory" value="{$public_directory}">
<table class="tinybicol" cellpadding="3" summary="Recherche">
<tr>
<td>Nom</td>
- <td><input type="text" name="name" size="50" maxlength="50" /></td>
+ <td><input type="text" name="name" size="50" maxlength="50" value="{$smarty.request.name}" /></td>
</tr>
<tr>
<td>Prénom</td>
- <td><input type="text" name="firstname" size="50" maxlength="50" /></td>
+ <td><input type="text" name="firstname" size="50" maxlength="50" value="{$smarty.request.firstname}" /></td>
</tr>
<tr>
<td>Promotion</td>
<td>
<select name="egal1">
- <option value="=" selected> = </option>
- <option value=">" > > </option>
- <option value="<" > < </option>
+ <option value="=" {if $smarty.request.egal1 eq "="}selected{/if}> = </option>
+ <option value=">" {if $smarty.request.egal1 eq ">"}selected{/if}> > </option>
+ <option value="<" {if $smarty.request.egal1 eq "<"}selected{/if}> < </option>
</select>
- <input type="text" name="promo1" size="4" maxlength="4" />
+ <input type="text" name="promo1" size="4" maxlength="4" value="{$smarty.request.promo1}" />
ET
<select name="egal2">
- <option value="=" selected> = </option>
- <option value=">" > > </option>
- <option value="<" > < </option>
+ <option value="=" {if $smarty.request.egal2 eq "="}selected{/if}> = </option>
+ <option value=">" {if $smarty.request.egal2 eq ">"}selected{/if}> > </option>
+ <option value="<" {if $smarty.request.egal2 eq "<"}selected{/if}> < </option>
</select>
- <input type="text" name="promo2" size="4" maxlength="4" />
+ <input type="text" name="promo2" size="4" maxlength="4" value="{$smarty.request.promo2}" />
</td>
</tr>
{if $advanced eq "1"}
<tr>
+ <th colspan="2">Géographie</th>
+ </tr>
+ <tr>
+ <td>Ville</td>
+ <td><input type="text" name="ville" size="50" value="{$smarty.request.ville}" /></td>
+ </tr>
+ <tr>
+ <td>Pays</td>
+ <td>
+ <select name="pays" onChange="javascript:document.recherche.submit();">
+ {if isset($smarty.request.pays)}
+ {assign var="pays" value=$smarty.request.pays}
+ {else}
+ {assign var="pays" value=""}
+ {/if}
+ {geoloc_pays pays=$pays}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Région ou département</td>
+ <td>
+ <select name="region">
+ {if isset($smarty.request.region)}
+ {assign var="region" value=$smarty.request.region}
+ {else}
+ {assign var="region" value=""}
+ {/if}
+ {geoloc_region pays=$smarty.request.pays region=$region}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th colspan="2">Activité</th>
+ </tr>
+ <tr>
+ <td>Entreprise</td>
+ <td><input type="text" name="entreprise" size="50" value="{$smarty.request.entreprise}" /></td>
+ </tr>
+ <tr>
+ <td>Poste</td>
+ <td>
+ <select name="poste">
+ <option value=""></option>
+ {section name=poste loop=$choix_postes}
+ <option value="{$choix_postes[poste].id}" {if $smarty.request.poste eq $choix_postes[poste].id}selected{/if}>
+ {$choix_postes[poste].fonction_fr}
+ </option>
+ {/section}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Secteur</td>
+ <td>
+ <select name="secteur">
+ <option value=""></option>
+ {section name=secteur loop=$choix_secteurs}
+ <option value="{$choix_secteurs[secteur].id}" {if $smarty.request.secteur eq $choix_secteurs[secteur].id}selected{/if}>
+ {$choix_secteurs[secteur].label}
+ </option>
+ {/section}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>CV contient</td>
+ <td><input type="text" name="cv" size="50" value="{$smarty.request.cv}" /></td>
+ </tr>
+ <tr>
<th colspan="2">Divers</th>
</tr>
<tr>
<td>
<select name="nationalite">
{section name=nationalite loop=$choix_nationalites}
- <option value="{$choix_nationalites[nationalite].id}">
+ <option value="{$choix_nationalites[nationalite].id}" {if $smarty.request.nationalite eq $choix_nationalites[nationalite].id}selected{/if}>
{$choix_nationalites[nationalite].text}
</option>
{/section}
<select name="binet">
<option value="0"></option>
{section name=binet loop=$choix_binets}
- <option value="{$choix_binets[binet].id}">
+ <option value="{$choix_binets[binet].id}" {if $smarty.request.binet eq $choix_binets[binet].id}selected{/if}>
{$choix_binets[binet].text}
</option>
{/section}
<select name="groupex">
<option value="0"></option>
{section name=groupex loop=$choix_groupesx}
- <option value="{$choix_groupesx[groupex].id}">
+ <option value="{$choix_groupesx[groupex].id}" {if $smarty.request.groupex eq $choix_groupesx[groupex].id}selected{/if}>
{$choix_groupesx[groupex].text}
</option>
{/section}
<td>
<select name="section">
{section name=section loop=$choix_sections}
- <option value="{$choix_sections[section].id}">
+ <option value="{$choix_sections[section].id}" {if $smarty.request.section eq $choix_sections[section].id}selected{/if}>
{$choix_sections[section].text}
</option>
{/section}
</select>
</td>
</tr>
-{/if}
<tr>
- <td colspan="2" class="center"><input type="submit" name="rechercher" value="Ok" /></td>
+ <td>Formation</td>
+ <td>
+ <select name="school" onChange="javascript:document.recherche.submit();">
+ <option value=""></option>
+ {section name=school loop=$choix_schools}
+ <option value="{$choix_schools[school].id}" {if $smarty.request.school eq $choix_schools[school].id}selected{/if}>
+ {$choix_schools[school].text}
+ </option>
+ {/section}
+ </select>
+ </td>
</tr>
+ <tr>
+ <td></td>
+ <td>
+ <select name="diploma">
+ <option value=""></option>
+ {section name=diploma loop=$choix_diplomas}
+ <option value="{$choix_diplomas[diploma]}" {if $smarty.request.diploma eq $choix_diplomas[diploma]}selected{/if}>
+ {$choix_diplomas[diploma]}
+ </option>
+ {/section}
+ </select>
+ </td>
+ </tr>
+{/if}
</table>
+ <p class="center">
+ <input type="submit" name="rechercher" value="Chercher" />
+ </p>
</form>
</div>
+<p class="normal">
+ <strong>N.B.</strong> Le caractère joker * peut remplacer une ou plusieurs lettres dans les recherches.
+</p>
+{if $advanced eq "1"}
+ <strong>Attention !</strong> La recherche avancée concerne uniquement les inscrits sur le site polytechnique.org.
+{/if}