Adds 'last activity' information in the dead-but-still-alive table.
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Thu, 20 Mar 2008 10:22:54 +0000 (11:22 +0100)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Thu, 20 Mar 2008 10:22:54 +0000 (11:22 +0100)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
modules/admin.php
templates/admin/dead_but_active.tpl

index 92a2107..976be74 100644 (file)
@@ -841,11 +841,12 @@ class AdminModule extends PLModule
         $page->assign('xorg_title','Polytechnique.org - Administration - Décédés');
 
         $res = XDB::iterator(
-                "SELECT  u.promo, u.nom, u.prenom, u.deces, u.matricule_ax, a.alias,
-                         DATEDIFF(NOW(), u.deces) AS days
+                "SELECT  u.promo, u.nom, u.prenom, u.deces, u.matricule_ax, a.alias, DATE(MAX(s.start)) AS last
                    FROM  auth_user_md5 AS u
               LEFT JOIN  aliases AS a ON (a.id = u.user_id AND a.type = 'a_vie')
+              LEFT JOIN  logger.sessions AS s ON (s.uid = u.user_id AND suid = 0)
                   WHERE  perms IN ('admin', 'user') AND deces <> 0
+               GROUP BY  u.user_id
                ORDER BY  u.promo, u.nom");
         $page->assign('dead', $res);
     }
index cb3813c..b7ecb11 100644 (file)
 
 <table class="bicol">
   <tr>
-    <th>Promotion</th>
+    <th>Promo</th>
     <th colspan="2">État civil</th>
-    <th>Date de décès</th>
-    <th>depuis</th>
+    <th>Décès</th>
+    <th>Dernière activité</th>
   </tr>
   {iterate from=$dead item=d}
   <tr class="{cycle values="impair,pair"}">
     <td>{$d.prenom} {$d.nom}</td>
     <td style="text-align: center">{$d.deces}</td>
     <td style="text-align: center">
-      {if $d.days gt 730}
-        <strong>{$d.days/365|string_format:"%d"} ans</strong>
-      {elseif $d.days gt 365}
-        1 an
-      {else}
-        {$d.days/30.5|string_format:"%d"} mois
-      {/if}
+      {if $d.last gt $d.deces}<strong>{$d.last}</strong>{elseif $d.last}{$d.last}{else}-{/if}
     </td>
   </tr>
   {/iterate}