From: x2000habouzit Date: Sat, 6 Nov 2004 18:18:44 +0000 (+0000) Subject: not done, but I want to save my work X-Git-Tag: xorg/old~1041 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8930da6cf8ec82c0ee1fc951d41139bb4b3e2305;p=platal.git not done, but I want to save my work --- diff --git a/htdocs/carnet/panel.php b/htdocs/carnet/panel.php new file mode 100644 index 0000000..e12f61b --- /dev/null +++ b/htdocs/carnet/panel.php @@ -0,0 +1,34 @@ +assign_by_ref('notifs', $notifs); + +$page->run(); + +?> diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 2b76c7f..8b2615b 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: notifs.inc.php,v 1.8 2004-11-06 17:37:22 x2000habouzit Exp $ + $Id: notifs.inc.php,v 1.9 2004-11-06 18:18:44 x2000habouzit Exp $ ***************************************************************************/ define("WATCH_FICHE", 1); @@ -26,6 +26,7 @@ define("WATCH_INSCR", 2); define("WATCH_DEATH", 3); function register_watch_op($uid,$cid,$date='',$info='') { + global $globals; $date = empty($date) ? 'NOW()' : "'$date'"; $globals->db->query("REPLACE INTO watch_ops (uid,cid,known,date,info) VALUES('$uid','$cid',NOW(),$date,'$info')"); if($cid == WATCH_FICHE) { @@ -33,6 +34,60 @@ function register_watch_op($uid,$cid,$date='',$info='') { } } +class Notifs { + var $_uid; + var $_cats = Array(); + var $_data = Array(); + + function Notifs($uid) { + global $globals; + $this->_uid = $uid; + + $res = $globals->db->query("SELECT * FROM watch_cat"); + while($tmp = mysql_fetch_assoc($res)) $this->_cats[$tmp['id']] = $tmp; + mysql_free_result($res); + + $res = $globals->db->query("SELECT u.promo, u.prenom, IF(u.epouse='',u.nom,u.epouse) AS nom, a.alias AS forlife, wo.* + FROM auth_user_quick AS q + INNER JOIN contacts AS c ON(q.user_id = c.uid) + INNER JOIN watch_ops AS wo ON(wo.uid=c.contact) + INNER JOIN watch_sub AS ws ON(wo.cid=ws.cid AND ws.uid=c.uid) + INNER JOIN auth_user_md5 AS u ON(u.user_id = wo.uid) + LEFT JOIN aliases AS a ON(u.user_id = a.id AND a.type='a_vie') + WHERE q.user_id = '$uid' AND q.watch_contacts=1 + ORDER BY wo.cid,promo,nom"); + while($tmp = mysql_fetch_assoc($res)) { + $this->_data[$tmp['cid']][$tmp['promo']][$tmp['uid']] = $tmp; + } + + $res = $globals->db->query("SELECT u.promo, u.prenom, IF(u.epouse='',u.nom,u.epouse) AS nom, a.alias AS forlife, wo.* + FROM watch_promo AS w + INNER JOIN auth_user_md5 AS u USING(promo) + INNER JOIN watch_ops AS wo ON(wo.uid=u.user_id) + INNER JOIN watch_sub AS ws ON(wo.cid=ws.cid) + INNER JOIN watch_cat AS wc ON(wc.id=wo.cid AND wc.frequent=0) + LEFT JOIN aliases AS a ON(u.user_id = a.id AND a.type='a_vie') + WHERE w.uid = '$uid' + ORDER BY wo.cid,promo,nom"); + while($tmp = mysql_fetch_assoc($res)) { + $this->_data[$tmp['cid']][$tmp['promo']][$tmp['uid']] = $tmp; + } + + $res = $globals->db->query("SELECT u.promo, u.prenom, IF(u.epouse='',u.nom,u.epouse) AS nom, a.alias AS forlife, wo.* + FROM watch_nonins AS w + INNER JOIN auth_user_md5 AS u ON(w.ni_id=u.user_id) + INNER JOIN watch_ops AS wo ON(wo.uid=u.user_id) + INNER JOIN watch_sub AS ws ON(wo.cid=ws.cid) + INNER JOIN watch_cat AS wc ON(wc.id=wo.cid) + LEFT JOIN aliases AS a ON(u.user_id = a.id AND a.type='a_vie') + WHERE w.uid = '$uid' + ORDER BY wo.cid,promo,nom"); + while($tmp = mysql_fetch_assoc($res)) { + $this->_data[$tmp['cid']][$tmp['promo']][$tmp['uid']] = $tmp; + } + } +} + class Watch { var $_uid; var $_promos; @@ -40,7 +95,6 @@ class Watch { var $_cats = Array(); var $_subs; var $watch_contacts; - var $watch_last; function Watch($uid) { global $globals; @@ -48,8 +102,8 @@ class Watch { $this->_promos = new PromoNotifs($uid); $this->_nonins = new NoninsNotifs($uid); $this->_subs = new WatchSub($uid); - $res = $globals->db->query("SELECT watch_contacts,watch_last FROM auth_user_quick WHERE user_id='$uid'"); - list($this->watch_contacts, $this->watch_last) = mysql_fetch_row($res); + $res = $globals->db->query("SELECT watch_contacts FROM auth_user_quick WHERE user_id='$uid'"); + list($this->watch_contacts) = mysql_fetch_row($res); mysql_free_result($res); $res = $globals->db->query("SELECT * FROM watch_cat"); diff --git a/include/xorg.session.inc.php b/include/xorg.session.inc.php index 91a3704..c8ad395 100644 --- a/include/xorg.session.inc.php +++ b/include/xorg.session.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.session.inc.php,v 1.36 2004-11-06 13:53:52 x2000habouzit Exp $ + $Id: xorg.session.inc.php,v 1.37 2004-11-06 18:18:44 x2000habouzit Exp $ ***************************************************************************/ require("diogenes.core.session.inc.php"); @@ -220,8 +220,9 @@ function try_cookie() { function start_connexion ($uid, $identified) { global $globals; $result=$globals->db->query(" - SELECT prenom, nom, perms, promo, matricule, UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, - a.alias, UNIX_TIMESTAMP(q.lastnewslogin), a2.alias, password, FIND_IN_SET('femme', flags) + SELECT prenom, nom, perms, promo, matricule, UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, a.alias, + UNIX_TIMESTAMP(q.lastnewslogin), q.watch_last, + a2.alias, password, FIND_IN_SET('femme', flags) FROM auth_user_md5 AS u INNER JOIN auth_user_quick AS q USING(user_id) INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type='a_vie') @@ -230,8 +231,9 @@ function start_connexion ($uid, $identified) { WHERE u.user_id=$uid ORDER BY s.start DESC, a2.type != 'epouse', length(a2.alias) LIMIT 1"); - list($prenom, $nom, $perms, $promo, $matricule, $lastlogin, $host, - $forlife, $lastnewslogin, $bestalias, $password, $femme) = mysql_fetch_row($result); + list($prenom, $nom, $perms, $promo, $matricule, $lastlogin, $host, $forlife, + $lastnewslogin, $watch_last, + $bestalias, $password, $femme) = mysql_fetch_row($result); mysql_free_result($result); // on garde le logger si il existe (pour ne pas casser les sessions lors d'une @@ -257,6 +259,7 @@ function start_connexion ($uid, $identified) { // le login est stocké pour un an $_SESSION['lastlogin'] = $lastlogin; $_SESSION['lastnewslogin'] = $lastnewslogin; + $_SESSION['watch_last'] = $watch_last; $_SESSION['host'] = $host; $_SESSION['auth'] = ($identified ? AUTH_MDP : AUTH_COOKIE); $_SESSION['uid'] = $uid; diff --git a/templates/carnet/index.tpl b/templates/carnet/index.tpl index 000b84a..5ec4d50 100644 --- a/templates/carnet/index.tpl +++ b/templates/carnet/index.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: index.tpl,v 1.2 2004-11-04 15:48:45 x2000habouzit Exp $ + $Id: index.tpl,v 1.3 2004-11-06 18:18:44 x2000habouzit Exp $ ***************************************************************************}

Carnet polytechnicien

@@ -29,7 +29,7 @@ - +
Page de tes contacts
@@ -37,7 +37,7 @@ Tu peux ici lister tes contacts, en ajouter et en retirer. - +
Le trombi de tes contacts
@@ -46,10 +46,28 @@ + + +
+ + + + + - +
+ Notifications +
+ + +
+ Affichage de tous les évenements de camarades/promos +
+
Être notifié des inscriptions, décès, changement de fiche, ... diff --git a/templates/carnet/panel.tpl b/templates/carnet/panel.tpl new file mode 100644 index 0000000..dee8b4c --- /dev/null +++ b/templates/carnet/panel.tpl @@ -0,0 +1,79 @@ +{*************************************************************************** + * Copyright (C) 2003-2004 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 * + *************************************************************************** + $Id: panel.tpl,v 1.1 2004-11-06 18:18:44 x2000habouzit Exp $ + ***************************************************************************} + +

Carnet polytechnicien

+ + + + + + + + + +
+ Tes contacts +
+ +
+ Tu peux ici lister tes contacts, en ajouter et en retirer. +
+
+ +
+ La même chose que la page de tes contacts... en images ! +
+
+ +
+ + + + + + + + + +
+ Notifications +
+ +
+ Affichage de tous les évenements de camarades/promos +
+
+ +
+ Être notifié des inscriptions, décès, changement de fiche, ... +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *}