From: Stéphane Jacob Date: Sun, 11 Jul 2010 10:56:13 +0000 (+0200) Subject: Properly uses names (Closes #1192). X-Git-Tag: xorg/1.0.1~356 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=09e54905d120cbd7cc885d0b1f6c0c464eaf1f82;p=platal.git Properly uses names (Closes #1192). Signed-off-by: Stéphane Jacob --- diff --git a/classes/profile.php b/classes/profile.php index fe929c1..0b22460 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -850,8 +850,9 @@ class Profile IF( {?}, pn_n.name, NULL) AS nickname, IF(pn_uf.name IS NULL, pn_f.name, pn_uf.name) AS firstname_ordinary, IF(pn_ul.name IS NULL, pn_l.name, pn_ul.name) AS lastname_ordinary, - pd.yourself, pd.promo, pd.short_name, pd.directory_name AS full_name, - pd.directory_name, IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile, + pd.yourself, pd.promo, pd.short_name, pd.public_name AS full_name, + pd.directory_name, pd.public_name, pd.private_name, + IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile, (ph.pub IN {?} AND ph.attach IS NOT NULL) AS has_photo, ph.x AS photo_width, ph.y AS photo_height, p.last_change < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_old, diff --git a/classes/user.php b/classes/user.php index b2a75f0..db0f675 100644 --- a/classes/user.php +++ b/classes/user.php @@ -287,6 +287,22 @@ class User extends PlUser return $this->profile()->lastName(); } + public function fullName($with_promo = false) + { + if (!$this->hasProfile()) { + return $this->full_name; + } + return $this->profile()->fullName($with_promo); + } + + public function directoryName() + { + if (!$this->hasProfile()) { + return $this->full_name; + } + return $this->profile()->directory_name; + } + /** Return the main profile attached with this account if any. */ public function profile() diff --git a/plugins/function.profile.php b/plugins/function.profile.php index dfc4bf3..a355f8f 100644 --- a/plugins/function.profile.php +++ b/plugins/function.profile.php @@ -31,7 +31,7 @@ function smarty_function_profile($params, &$smarty) $user = User::getWithUID($user); } - $name = pl_entities($user->fullName()); + $name = pl_entities($user->directoryName()); if ($with_sex && $user->isFemale()) { $name = '•' . $name; } diff --git a/templates/admin/validation.tpl b/templates/admin/validation.tpl index 6f4f833..8c0cb21 100644 --- a/templates/admin/validation.tpl +++ b/templates/admin/validation.tpl @@ -46,8 +46,11 @@ function toggleField(name, id, obj) { Demandeur : - - {$valid->user->fullName()} ({$valid->user->promo()}) + {if $valid->user->hasProfile()} + {assign var="profile" value=$valid->user->profile()} + + {/if} + {$valid->user->fullName("promo")} diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index f593af7..21fc745 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -55,7 +55,7 @@
{if $profile->isFemale()}•{/if} {if !$dead && $registered}{/if} - {$profile->full_name} + {$profile->directory_name} {if !$dead && $registered}{/if}
diff --git a/templates/include/plview.trombi.entry.tpl b/templates/include/plview.trombi.entry.tpl index ea6dbcc..24e157d 100644 --- a/templates/include/plview.trombi.entry.tpl +++ b/templates/include/plview.trombi.entry.tpl @@ -33,9 +33,7 @@ {else} - name_tooltip}class="hinted" - title="{$profile->directory_name}"{/if}>{$profile->directory_name} - {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if} + {$profile->private_name} {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if} {/if} diff --git a/templates/include/trombi.tpl b/templates/include/trombi.tpl index e389a9d..f3ec1e7 100644 --- a/templates/include/trombi.tpl +++ b/templates/include/trombi.tpl @@ -37,7 +37,7 @@ {/if}
- {$p.name_display}{if $trombi_show_promo} ({$p.promo_display}){/if} + {$p.name_display}{if $trombi_show_promo} ({$p.promo_display}){/if} {if $loop eq "3"} diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index e1e8210..79abc50 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -86,10 +86,7 @@ function chgMainWinLoc(strPage)
{if $profile->isFemale()}•{/if} - name_tooltip neq ""}class="hinted" title="{$profile->name_tooltip}"{/if}>{$profile->shortName()} - {if $logged} - {if $profile->nickname} (alias {$profile->nickname}){/if} - {/if} + {if $logged}{$profile->private_name}{else}{$profile->public_name}{/if} {if $logged}  {if !$profile->isDead()}{*