git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-339
* Profile :
- #65 : Add professionnal cellphone. -Car
- #170 : Remove region display for french departments. -Car
+ - #204 : Add nicknames (searchable too). -MC
* Search :
- #249, #251, #253 : Some tweaks to be more accurate. -MC
$nameField = new NameSField('name',array('u.nom','u.epouse'),'');
$firstnameField = new StringSField('firstname',array('u.prenom'),'');
}
+ $nicknameField = new StringSField('nickname',array('q.profile_nick'),'');
$promo1Field = new PromoSField('promo1','egal1',array('u.promo'),'');
$promo2Field = new PromoSField('promo2','egal2',array('u.promo'),'');
$freeField = new RefSField('free',array('u.libre'),'','','',false);
$offset = new NumericSField('offset');
- $fields = new SFieldGroup(true, array( $nameField, $firstnameField, $promo1Field,
+ $fields = new SFieldGroup(true, array( $nameField, $firstnameField, $nicknameField, $promo1Field,
$promo2Field, $womanField, $subscriberField, $aliveField, $townField, $countryField,
$regionField, $entrepriseField, $posteField, $secteurField, $cvField, $natField,
$binetField, $groupexField, $sectionField, $schoolField, $diplomaField, $freeField)
'.$globals->search->result_fields.'
c.uid AS contact,
w.ni_id AS watch
- FROM auth_user_md5 AS u
+ FROM auth_user_md5 AS u
+ INNER JOIN auth_user_quick AS q USING(user_id)
'.$fields->get_select_statement().'
'.(Env::has('only_referent') ? ' INNER JOIN mentor AS m ON (m.uid = u.user_id)' : '').'
LEFT JOIN aliases AS a ON (u.user_id = a.id AND a.type="a_vie")
$page->assign('appli_type2',$appli_type2);
$page->assign('nouvellephoto', $nouvellephoto);
+$page->assign('surnom', $surnom);
?>
***************************************************************************/
// on ramène les données du profil connecté (uid paramètre de session)
-$sql = "SELECT u.nom, u.prenom".
- ", u.promo, u.epouse, FIND_IN_SET('femme',u.flags), nationalite".
- ", mobile".
- ", web".
- ", libre".
- ", a1.aid, a1.type".
- ", a2.aid, a2.type".
- " FROM auth_user_md5 AS u".
- " LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)".
- " LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)".
- " WHERE user_id = {?}";
+$sql = "SELECT u.nom, u.prenom, u.promo, u.epouse, FIND_IN_SET('femme',u.flags), u.nationalite, u.mobile, u.web, u.libre,
+ q.profile_nick,
+ a1.aid, a1.type, a2.aid, a2.type
+ FROM auth_user_md5 AS u
+ INNER JOIN auth_user_quick AS q USING(user_id)
+ LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)
+ LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
+ WHERE u.user_id = {?}";
$result = $globals->xdb->query($sql, Session::getInt('uid', -1));
-list($nom, $prenom,
- $promo, $epouse, $femme, $nationalite,
- $mobile, $web, $libre,
- $appli_id1,$appli_type1,
- $appli_id2,$appli_type2) = $result->fetchOneRow();
+list($nom, $prenom, $promo, $epouse, $femme,
+ $nationalite, $mobile, $web, $libre, $surnom,
+ $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
replace_ifset($nationalite,'nationalite');
replace_ifset($mobile,'mobile');
replace_ifset($appli_id2,"appli_id2");
replace_ifset($appli_type1,"appli_type1");
replace_ifset($appli_type2,"appli_type2");
+replace_ifset($surnom,"surnom");
if(Env::has('modifier') || Env::has('suivant')) {
$mobile_public = Env::has('mobile_public');
$sql = "UPDATE auth_user_md5
SET nationalite= {?}, web= {?}, mobile= {?}, libre= {?} WHERE user_id= {?}";
-
-
$globals->xdb->execute($sql, $nationalite, $web, $mobile, $libre, Session::getInt('uid', -1));
+$globals->xdb->execute("UPDATE auth_user_quick SET profile_nick={?} WHERE user_id = {?}", $surnom, Session::getInt('uid', -1));
?>
function &get_user_details($login, $from_uid = '')
{
global $globals;
- $reqsql = "SELECT u.prenom, u.nom, u.epouse,
+ $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.epouse, u.date, u.cv, u.mobile, u.web, u.libre,
+ u.perms IN ('admin','user') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces,
+ q.profile_nick AS nickname,
IF(gp.nat='',gp.pays,gp.nat) AS nationalite, gp.a2 AS iso3166,
- u.user_id, a.alias AS forlife, a2.alias AS bestalias,
- u.matricule, u.perms IN ('admin','user') AS inscrit,
- FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces,
- u.date, u.cv, sections.text AS section, u.mobile, u.web,
- u.libre, u.promo, c.uid IS NOT NULL AS is_contact, p.x, p.y,
-
+ a.alias AS forlife, a2.alias AS bestalias,
+ c.uid IS NOT NULL AS is_contact,
+ s.text AS section, p.x, p.y,
m.expertise != '' AS is_referent
- FROM auth_user_md5 AS u
- INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie')
- INNER JOIN aliases AS a2 ON (u.user_id=a2.id AND FIND_IN_SET('bestalias',a2.flags))
- LEFT JOIN contacts AS c ON (c.uid = {?} and c.contact = u.user_id)
- LEFT JOIN geoloc_pays AS gp ON (gp.a2 = u.nationalite)
- INNER JOIN sections ON (sections.id = u.section)
- LEFT JOIN photo AS p ON (p.uid = u.user_id)
- LEFT JOIN mentor AS m ON (m.uid = u.user_id)
+ FROM auth_user_md5 AS u
+ INNER JOIN auth_user_quick AS q USING(user_id)
+ INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie')
+ INNER JOIN aliases AS a2 ON (u.user_id=a2.id AND FIND_IN_SET('bestalias',a2.flags))
+ LEFT JOIN contacts AS c ON (c.uid = {?} and c.contact = u.user_id)
+ LEFT JOIN geoloc_pays AS gp ON (gp.a2 = u.nationalite)
+ INNER JOIN sections AS s ON (s.id = u.section)
+ LEFT JOIN photo AS p ON (p.uid = u.user_id)
+ LEFT JOIN mentor AS m ON (m.uid = u.user_id)
WHERE a.alias = {?}";
$res = $globals->xdb->query($reqsql, $from_uid, $login);
$user = $res->fetchOneAssoc();
<td id="fiche_identite">
<div class="civilite">
{if $x.sexe}•{/if}
- {$x.prenom} {if $x.epouse eq ""}{$x.nom}{else}{$x.epouse} ({$x.nom}){/if}
+ {$x.prenom} {if $x.epouse eq ""}{$x.nom}{else}{$x.epouse} ({$x.nom}){/if}
+ {if $x.nickname} (aka {$x.nickname}){/if}
<a href="vcard.php/{$x.forlife}.vcf?x={$x.forlife}">
<img src="images/vcard.png" alt="Afficher la carte de visite" title="Afficher la carte de visite"/>
</a>
<td colspan="2" class="pflags">
<table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
<tr>
+ <td class="rouge">
+ <input type="checkbox" disabled="disabled" checked="checked" />
+ </td>
+ <td class="texte">
+ privé
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td class="colg">
+ <span class="titre">Surnom</span>
+ </td>
+ <td class="cold">
+ <input type="text" size="35" maxlength="64" name="surnom" value="{$surnom}" />
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="pflags">
+ <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
+ <tr>
<td class="vert">
<input type="checkbox" name="mobile_public" {if $mobile_public}checked="checked"{/if} />
</td>
</td>
</tr>
<tr>
+ <td>Surnom</td>
+ <td>
+ <input type="text" name="nickname" size="32" value="{$smarty.request.nickname}" />
+ </td>
+ </tr>
+ <tr>
<td>Promotion</td>
<td>
<select name="egal1">
alter table auth_user_quick add column profile_from_ax INT(1) not null default 0;
alter table auth_user_quick add column core_mail_fmt enum('html', 'texte') not null default 'html';
+alter table auth_user_quick add column profile_nick varchar(64) not null;
+alter table auth_user_quick add index(profile_nick);
+