Use the new get_profile/get_user smarty modifiers in plviews to be able to handle...
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 8 May 2011 23:25:05 +0000 (01:25 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 8 May 2011 23:25:05 +0000 (01:25 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
templates/include/plview.groupmember.tpl
templates/include/plview.listmember.tpl
templates/include/plview.minifiche.tpl
templates/include/plview.trombi.tpl

index f22449b..ae538f3 100644 (file)
@@ -33,7 +33,7 @@
   {assign var=lostUsers value=false}
   {foreach from=$set item=user}
     {if $user->lost}{assign var=lostUsers value=true}{/if}
-    {include file="include/plview.groupmember.entry.tpl" user=$user}
+    {include file="include/plview.groupmember.entry.tpl" user=$user|get_user}
   {/foreach}
 </table>
 
index 6d9f75b..ef2976a 100644 (file)
   {/if}
 
   {assign var=current_key value=''}
-  {foreach from=$set item=user}
-  <tr>
-    <td class="titre" style="width: 20%">
-      {if $order eq 'promo'}
-        {assign var=user_key value=$user->promo()}
-      {elseif $order eq 'name'}
-        {assign var=user_key value=$user->lastName()|string_format:'%.1s'|upper}
-      {else}
-        {assign var=user_key value=''}
-      {/if}
-      {if $user_key neq $current_key}
-        {assign var=current_key value=$user_key}
-        {$user_key}
-      {/if}
-    </td>
-    <td>
-      {if $user->hasProfile()}
-        {if $user->lost}{assign var=lostUsers value=true}{/if}
-        {profile user=$user}
-      {else}
-        {$user->displayName()}
-      {/if}
-    </td>
-    {if t($delete)}
-      <td class="center">
-        {if t($user.uid)}
-          <a href="{$platal->ns}member/{$user.uid}">{icon name=user_edit title='Éditer'}</a>&nbsp;
+  {foreach from=$set item=obj}
+    {assign var=user value=$obj|get_user}
+    <tr>
+      <td class="titre" style="width: 20%">
+        {if $order eq 'promo'}
+          {assign var=user_key value=$user->promo()}
+        {elseif $order eq 'name'}
+          {assign var=user_key value=$user->lastName()|string_format:'%.1s'|upper}
+        {else}
+          {assign var=user_key value=''}
+        {/if}
+        {if $user_key neq $current_key}
+          {assign var=current_key value=$user_key}
+          {$user_key}
+        {/if}
+      </td>
+      <td>
+        {if $user->hasProfile()}
+          {if $user->lost}{assign var=lostUsers value=true}{/if}
+          {profile user=$user}
         {else}
-          {icon name=null}&nbsp;
+          {$user->displayName()}
         {/if}
-        <a href='{$platal->pl_self(1)}?{$delete}={$user.email}&amp;token={xsrf_token}'>{icon name=cross title='Retirer'}</a>
       </td>
-    {/if}
-  </tr>
+      {if t($delete)}
+        <td class="center">
+          {if t($user.uid)}
+            <a href="{$platal->ns}member/{$user.uid}">{icon name=user_edit title='Éditer'}</a>&nbsp;
+          {else}
+            {icon name=null}&nbsp;
+          {/if}
+          <a href='{$platal->pl_self(1)}?{$delete}={$user.email}&amp;token={xsrf_token}'>{icon name=cross title='Retirer'}</a>
+        </td>
+      {/if}
+    </tr>
   {/foreach}
 </table>
 
index 4f29aaa..d5b7bf0 100644 (file)
@@ -22,7 +22,7 @@
 
 <div class="contact-list" style="clear: both">
 {foreach from=$set item=res}
-  {include file="include/minifiche.tpl" profile=$res}
+  {include file="include/minifiche.tpl" profile=$res|get_profile}
 {/foreach}
 </div>
 
index 8213c95..1c46ad1 100644 (file)
 <table cellpadding="0" cellspacing="2" style="width: 100%">
   {section name=trombi loop=$set_keys start=0}
   {if $smarty.section.trombi.index % 3 == 1}
-  {assign var=key_prev value=$set_keys[trombi.index_prev]}
-  {assign var=key_cur  value=$set_keys[trombi]}
-  {assign var=key_next value=$set_keys[trombi.index_next]}
-  <tr>
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_prev]->profile() photo=true}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=true}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_next]->profile() photo=true}
-  </tr>
-  <tr>
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_prev]->profile() photo=false}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=false}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_next]->profile() photo=false}
-  </tr>
+    {assign var=key_prev value=$set_keys[trombi.index_prev]}
+    {assign var=key_cur  value=$set_keys[trombi]}
+    {assign var=key_next value=$set_keys[trombi.index_next]}
+    {assign var=profile_prev value=$set[$key_prev]|get_profile}
+    {assign var=profile_cur value=$set[$key_cur]|get_profile}
+    {assign var=profile_next value=$set[$key_next]|get_profile}
+
+    <tr>
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_prev photo=true}
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_cur photo=true}
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_next photo=true}
+    </tr>
+    <tr>
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_prev photo=false}
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_cur photo=false}
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_next photo=false}
+    </tr>
   {elseif ($smarty.section.trombi.index % 3 == 0) && ($smarty.section.trombi.last)}
-  {assign var=key_cur  value=$set_keys[trombi]}
-  <tr>
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=true}
-    <td></td><td></td>
-  </tr>
-  <tr style="margin-top: 0; padding-top: 0">
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=false}
-    <td></td><td></td>
-  </tr>
+    {assign var=key_cur  value=$set_keys[trombi]}
+    {assign var=profile_cur value=$set[$key_cur]|get_profile}
+    <tr>
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_cur photo=true}
+      <td></td><td></td>
+    </tr>
+    <tr style="margin-top: 0; padding-top: 0">
+      {include file="include/plview.trombi.entry.tpl" profile=$profile_cur photo=false}
+      <td></td><td></td>
+    </tr>
   {/if}
   {/section}
 </table>