WHERE ni_id={?}', $uid);
XDB::execute('DELETE FROM watch_nonins WHERE ni_id={?}', $uid);
}
+ require_once 'xorg.misc.inc.php';
+ update_NbNotifs();
}
// }}}
}
// }}}
-// {{{ function getNbNotifs
-
-function getNbNotifs()
-{
- if (!S::has('uid')) {
- return 0;
- }
- $uid = S::v('uid', -1);
- $watchlast = S::v('watch_last');
-
- // selectionne les notifs de uid, sans detail sur le watcher, depuis
- // $watchlast, meme ceux sans surveillance, non ordonnés
- $res = select_notifs(false, $uid, $watchlast, false);
- $n = $res->numRows();
- $res->free();
- if ($n == 0) {
- return;
- }
-
- return "<a href='carnet/panel'>$n événement".($n > 1 ? 's' : '')." !</a>";
-}
-
-// }}}
// {{{
global $prf_desc;
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2007 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 *
- ***************************************************************************/
-
-
-function smarty_insert_getNbNotifs($params, &$smarty)
-{
- if(S::logged()) {
- require_once('notifs.inc.php');
- return getNbNotifs();
- }
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
-{**************************************************************************}\r
-{* *}\r
-{* Copyright (C) 2003-2007 Polytechnique.org *}\r
-{* http://opensource.polytechnique.org/ *}\r
-{* *}\r
-{* This program is free software; you can redistribute it and/or modify *}\r
-{* it under the terms of the GNU General Public License as published by *}\r
-{* the Free Software Foundation; either version 2 of the License, or *}\r
-{* (at your option) any later version. *}\r
-{* *}\r
-{* This program is distributed in the hope that it will be useful, *}\r
-{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}\r
-{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}\r
-{* GNU General Public License for more details. *}\r
-{* *}\r
-{* You should have received a copy of the GNU General Public License *}\r
-{* along with this program; if not, write to the Free Software *}\r
-{* Foundation, Inc., *}\r
-{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}\r
-{* *}\r
-{**************************************************************************}\r
- <table>\r
- <tr>\r
- <td class="date-heure">\r
- <script type="text/javascript">\r
- <!--\r
- document.write(getNow());\r
- //-->\r
- </script>\r
- </td>\r
- <td class="inscrits">\r
- {insert name="getNbIns"} polytechniciens sur le web\r
- <form action="search" method="get">\r
- <div>\r
- <input type="text" size="30" name="quick" class="quick_search" value="{$smarty.request.quick|default:"recherche dans l'annuaire"}" onfocus="if (this.value == '{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}') this.value=''" onblur="if (this.value == '') this.value='{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}'"/> \r
- </div>\r
- </form>\r
- {insert name="getNbNotifs"}\r
- </td>\r
- </tr>\r
- </table>\r
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 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 *}
+{* *}
+{**************************************************************************}
+ <table>
+ <tr>
+ <td class="date-heure">
+ <script type="text/javascript">
+ <!--
+ document.write(getNow());
+ //-->
+ </script>
+ </td>
+ <td class="inscrits">
+ {insert name="getNbIns"} polytechniciens sur le web
+ <form action="search" method="get">
+ <div>
+ <input type="text" size="30" name="quick" class="quick_search"
+ value="{$smarty.request.quick|default:"recherche dans l'annuaire"}"
+ onfocus="if (this.value == '{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}') this.value=''"
+ onblur="if (this.value == '') this.value='{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}'"/>
+ </div>
+ </form>
+ {if $smarty.session.auth gt AUTH_PUBLIC && $smarty.session.notifs}
+ <a href="carnet/panel">{$smarty.session.notifs} événement{if $smarty.session.notifs gt 1}s{/if}</a>
+ {/if}
+ </td>
+ </tr>
+ </table>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}