From: x2000habouzit Date: Sat, 6 Nov 2004 17:22:11 +0000 (+0000) Subject: modifs concerning notifs + watches X-Git-Tag: xorg/old~1043 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=7b5ecb452b195d4f8141f7401f0ba6a6e9e8b092;p=platal.git modifs concerning notifs + watches --- diff --git a/htdocs/advanced_search.php b/htdocs/advanced_search.php index baca075..beb77cc 100644 --- a/htdocs/advanced_search.php +++ b/htdocs/advanced_search.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: advanced_search.php,v 1.26 2004-11-05 14:34:03 x2000habouzit Exp $ + $Id: advanced_search.php,v 1.27 2004-11-06 17:22:11 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -112,11 +112,13 @@ else { u.promo, a.alias AS forlife, '.$globals->search_result_fields.' - c.uid AS contact + c.uid AS contact, + w.ni_id AS contact FROM auth_user_md5 AS u '.$fields->get_select_statement().' LEFT JOIN aliases AS a ON (u.user_id = a.id AND a.type="a_vie") LEFT JOIN contacts AS c ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id) + LEFT JOIN watch_nonins AS w ON (w.ni_id=u.user_id AND w.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).') '.$globals->search_result_where_statement.' '.(($where!='')?('WHERE '.$where):'').' ORDER BY '.(logged() && !empty($_REQUEST['mod_date_sort']) ? 'date DESC,' :'') diff --git a/htdocs/carnet/notifs.php b/htdocs/carnet/notifs.php index 22f1556..0bb3ca1 100644 --- a/htdocs/carnet/notifs.php +++ b/htdocs/carnet/notifs.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: notifs.php,v 1.5 2004-11-06 16:08:27 x2000habouzit Exp $ + $Id: notifs.php,v 1.6 2004-11-06 17:22:12 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -54,6 +54,10 @@ if(isset($_REQUEST['promo'])) { } } +if(isset($_REQUEST['del_nonins'])) $watch->_nonins->del($_REQUEST['del_nonins']); +if(isset($_REQUEST['add_nonins'])) $watch->_nonins->add($_REQUEST['add_nonins']); +if(isset($_REQUEST['subs'])) $watch->_subs->update('sub'); + $page->assign_by_ref('watch', $watch); $page->assign_by_ref('err', $err); diff --git a/htdocs/search.php b/htdocs/search.php index 39b7324..6f8de05 100644 --- a/htdocs/search.php +++ b/htdocs/search.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: search.php,v 1.46 2004-11-05 14:34:03 x2000habouzit Exp $ + $Id: search.php,v 1.47 2004-11-06 17:22:11 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -55,12 +55,12 @@ if (array_key_exists('quick', $_REQUEST)) { a.alias AS forlife, '.$globals->search_result_fields.' c.uid AS contact, - w.arg AS watch + w.ni_id AS watch FROM auth_user_md5 AS r LEFT JOIN auth_user_md5 AS u ON (u.matricule=r.matricule) LEFT JOIN aliases AS a ON (u.user_id = a.id AND a.type="a_vie") LEFT JOIN contacts AS c ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id) - LEFT JOIN watch AS w ON (w.arg=u.user_id AND w.user_id='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND w.type="non-inscrit") + LEFT JOIN watch_nonins AS w ON (w.ni_id=u.user_id AND w.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).') '.$globals->search_result_where_statement.' WHERE '.$fields->get_where_statement().' ORDER BY '.(logged() && !empty($_REQUEST['mod_date_sort']) ? 'date DESC,' :'') @@ -68,6 +68,7 @@ if (array_key_exists('quick', $_REQUEST)) { LIMIT '.$offset->value.','.$globals->search_results_per_page; $page->mysql_assign($sql, 'resultats', 'nb_resultats','nb_resultats_total'); + echo mysql_error(); $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search_results_per_page; $page->assign('offsets',range(0,$nbpages)); diff --git a/include/notifs.inc.php b/include/notifs.inc.php index f70188e..781eadf 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.6 2004-11-06 16:08:27 x2000habouzit Exp $ + $Id: notifs.inc.php,v 1.7 2004-11-06 17:22:12 x2000habouzit Exp $ ***************************************************************************/ require_once('diogenes.flagset.inc.php'); @@ -27,7 +27,7 @@ class Watch { var $_uid; var $_promos; var $_nonins; - var $_cats; + var $_cats = Array(); var $_subs; var $watch_contacts; var $watch_last; @@ -37,32 +37,36 @@ class Watch { $this->_uid = $uid; $this->_promos = new PromoNotifs($uid); $this->_nonins = new NoninsNotifs($uid); - $this->_cats = new WatchCat(); $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); mysql_free_result($res); + + $res = $globals->db->query("SELECT * FROM watch_cat"); + while($tmp = mysql_fetch_assoc($res)) $this->_cats[$tmp['id']] = $tmp; + mysql_free_result($res); } + function cats() { + return $this->_cats; + } + + function subs($i) { + return $this->_subs->_data[$i]; + } + function promos() { return $this->_promos->toRanges(); } -} - -class WatchCat { - var $_data = Array(); - function WatchCat() { - global $globals; - $res = $globals->db->query("SELECT * FROM watch_cat"); - while($tmp = mysql_fetch_assoc($res)) $this->_data[$tmp['id']] = $tmp; - mysql_free_result($res); + function nonins() { + return $this->_nonins->_data; } } class WatchSub { var $_uid; - var $_data; + var $_data = Array(); function WatchSub($uid) { $this->_uid = $uid; @@ -71,6 +75,19 @@ class WatchSub { while(list($c) = mysql_fetch_row($res)) $this->_data[$c] = $c; mysql_free_result($res); } + + function update($ind) { + global $globals; + $this->_data = Array(); + $globals->db->query("DELETE FROM watch_sub WHERE uid='{$this->_uid}'"); + foreach($_REQUEST[$ind] as $key=>$val) { + $globals->db->query("INSERT INTO watch_sub + SELECT '{$this->_uid}',id + FROM watch_cat + WHERE id='$key'"); + if(mysql_affected_rows()) $this->_data[$key] = $key; + } + } } class PromoNotifs { @@ -171,7 +188,7 @@ class NoninsNotifs { function add($p) { global $globals; $globals->db->query("INSERT INTO watch_nonins (uid,ni_id) VALUES('{$this->_uid}','$p')"); - $res = $globals->db->query("SELECT prenom,IF(u.epouse='',u.nom,u.epouse),promo,user_id + $res = $globals->db->query("SELECT prenom,IF(epouse='',nom,epouse) AS nom,promo,user_id FROM auth_user_md5 WHERE user_id='$p'"); $this->_data["$p"] = mysql_fetch_assoc($res); diff --git a/templates/carnet/notifs.tpl b/templates/carnet/notifs.tpl index e043c73..d94b813 100644 --- a/templates/carnet/notifs.tpl +++ b/templates/carnet/notifs.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: notifs.tpl,v 1.10 2004-11-06 16:08:28 x2000habouzit Exp $ + $Id: notifs.tpl,v 1.11 2004-11-06 17:22:12 x2000habouzit Exp $ ***************************************************************************} {dynamic} @@ -35,13 +35,22 @@ S'il n'y a rien
+ Événements à surveiller + {foreach from=$watch->cats() item=s key=i} + subs($i)}checked="checked"{/if} /> {$s.short}
+ {/foreach} +
+
+ +
+
+ +
+
Contacts watch_contacts}checked="checked"{/if} /> Surveiller mes contacts
@@ -97,14 +106,14 @@ et cliquer sur les icones Ajouter
- {if $notifs->nonins|@count eq 0} + {if $watch->nonins()|@count eq 0}

Tu ne surveilles actuellement aucun non-inscrit.

- {elseif $notifs->nonins|@count} -

Tu surveilles {if $notifs->nonins|@count eq 1}le non-inscrit{else}les non-inscrits{/if} :

+ {elseif $watch->nonins()|@count} +

Tu surveilles {if $watch->nonins()|@count eq 1}le non-inscrit{else}les non-inscrits{/if} :

    - {foreach from=$notifs->nonins item=p} + {foreach from=$watch->nonins() item=p}
  • - {$p.prenom} {$p.nom} ({$p.promo}) retirer + {$p.prenom} {$p.nom} ({$p.promo}) retirer
  • {/foreach}
diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index d7d5197..baa294c 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: minifiche.tpl,v 1.11 2004-11-05 14:34:05 x2000habouzit Exp $ + $Id: minifiche.tpl,v 1.12 2004-11-06 17:22:13 x2000habouzit Exp $ ***************************************************************************} @@ -36,23 +36,23 @@ {/if} {/min_auth} - {if $inscrit || $c.dcd}
- {strip} {if $c.iso3166} {$c.nat}  {/if} - (X {$c.promo} - {if $c.app0text}, + (X {$c.promo}{if $c.app0text}, {applis_fmt type=$c.app0type text=$c.app0text url=$c.app0url} - {/if} - {if $c.app1text}, + {/if}{if $c.app1text}, {applis_fmt type=$c.app1type text=$c.app1text url=$c.app1url} {/if}) - {if $c.dcd} décédé le {$c.deces}{/if} - {/strip} + {if $c.dcd}décédé le {$c.deces}{/if} + {min_auth level="cookie"} + {if !$c.dcd && !$inscrit} + clique ici si tu connais son adresse email ! + + {/if} + {/min_auth}
- {/if} {min_auth level="cookie"} {include file="include/minifiche_pvt.tpl"} {/min_auth} diff --git a/templates/include/minifiche_pvt.tpl b/templates/include/minifiche_pvt.tpl index 54c13cc..d23e6e8 100644 --- a/templates/include/minifiche_pvt.tpl +++ b/templates/include/minifiche_pvt.tpl @@ -17,17 +17,12 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: minifiche_pvt.tpl,v 1.12 2004-11-05 14:34:05 x2000habouzit Exp $ + $Id: minifiche_pvt.tpl,v 1.13 2004-11-06 17:22:13 x2000habouzit Exp $ ***************************************************************************} {if !$inscrit} {if !$c.dcd} -
{if $show_action eq ajouter} {*