Adds a listing page for dead user with not yet disabled accounts.
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Thu, 20 Mar 2008 00:03:03 +0000 (01:03 +0100)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Thu, 20 Mar 2008 00:03:03 +0000 (01:03 +0100)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
modules/admin.php
templates/admin/dead_but_active.tpl [new file with mode: 0644]
templates/admin/index.tpl

index af011ea..92a2107 100644 (file)
@@ -27,6 +27,7 @@ class AdminModule extends PLModule
             'phpinfo'                      => $this->make_hook('phpinfo', AUTH_MDP, 'admin'),
             'admin'                        => $this->make_hook('default', AUTH_MDP, 'admin'),
             'admin/ax-xorg'                => $this->make_hook('ax_xorg', AUTH_MDP, 'admin'),
+            'admin/dead-but-active'        => $this->make_hook('dead_but_active', AUTH_MDP, 'admin'),
             'admin/deaths'                 => $this->make_hook('deaths', AUTH_MDP, 'admin'),
             'admin/downtime'               => $this->make_hook('downtime', AUTH_MDP, 'admin'),
             'admin/homonyms'               => $this->make_hook('homonyms', AUTH_MDP, 'admin'),
@@ -835,6 +836,20 @@ class AdminModule extends PLModule
         $page->assign('decedes', $res);
     }
 
+    function handler_dead_but_active(&$page) {
+        $page->changeTpl('admin/dead_but_active.tpl');
+        $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
+                   FROM  auth_user_md5 AS u
+              LEFT JOIN  aliases AS a ON (a.id = u.user_id AND a.type = 'a_vie')
+                  WHERE  perms IN ('admin', 'user') AND deces <> 0
+               ORDER BY  u.promo, u.nom");
+        $page->assign('dead', $res);
+    }
+
     function handler_synchro_ax(&$page, $user = null, $action = null) {
         $page->changeTpl('admin/synchro_ax.tpl');
         $page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX');
diff --git a/templates/admin/dead_but_active.tpl b/templates/admin/dead_but_active.tpl
new file mode 100644 (file)
index 0000000..cb3813c
--- /dev/null
@@ -0,0 +1,61 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.org/                                  *}
+{*                                                                        *}
+{*  This program is free software; you can redistribute it and/or modify  *}
+{*  it under the terms of the GNU General Public License as published by  *}
+{*  the Free Software Foundation; either version 2 of the License, or     *}
+{*  (at your option) any later version.                                   *}
+{*                                                                        *}
+{*  This program is distributed in the hope that it will be useful,       *}
+{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
+{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
+{*  GNU General Public License for more details.                          *}
+{*                                                                        *}
+{*  You should have received a copy of the GNU General Public License     *}
+{*  along with this program; if not, write to the Free Software           *}
+{*  Foundation, Inc.,                                                     *}
+{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<h1>Décédés encore actifs</h1>
+
+<p>
+  Liste des polytechniciens décédés, mais dont le compte est encore actif
+  (veufs/veuves, ...).
+</p>
+
+<table class="bicol">
+  <tr>
+    <th>Promotion</th>
+    <th colspan="2">État civil</th>
+    <th>Date de décès</th>
+    <th>depuis</th>
+  </tr>
+  {iterate from=$dead item=d}
+  <tr class="{cycle values="impair,pair"}">
+    <td style="text-align: center">{$d.promo}</td>
+    <td>
+      <a href="profile/{$d.alias}" class="popup2">{icon name=user_suit title='Afficher la fiche'}</a>
+      <a href="http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&amp;anc_id={$d.matricule_ax}">{*
+        *}{icon name=user_gray title="fiche AX"}</a>
+      <a href="admin/user/{$d.alias}">{icon name=wrench title='Administrer user'}</a>
+    </td>
+    <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}
+    </td>
+  </tr>
+  {/iterate}
+</table>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index fe4dd82..13f0d5d 100644 (file)
@@ -69,6 +69,8 @@
       &nbsp;&nbsp;|&nbsp;&nbsp;      
       <a href="admin/deaths">Décès</a>
       &nbsp;&nbsp;|&nbsp;&nbsp;
+      <a href="admin/dead-but-active">Décédés actifs</a>
+      &nbsp;&nbsp;|&nbsp;&nbsp;
       <a href="admin/synchro_ax">Synchro AX</a>
     </td>
   </tr>