From 55b774e2d3b604fc0d4ddc89e6d0e6e0699b4bcf Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Tue, 31 Aug 2004 19:09:19 +0000 Subject: [PATCH] poly, only 1 tab left --- include/profil/assign_poly.inc.php | 36 ++++++++++++ include/profil/get_poly.inc.php | 61 ++++++++++++++++++++ include/profil/profil_poly.inc.php | 115 ------------------------------------- templates/profil/poly.tpl | 34 ++++++++++- 4 files changed, 128 insertions(+), 118 deletions(-) create mode 100644 include/profil/assign_poly.inc.php create mode 100644 include/profil/get_poly.inc.php delete mode 100644 include/profil/profil_poly.inc.php diff --git a/include/profil/assign_poly.inc.php b/include/profil/assign_poly.inc.php new file mode 100644 index 0000000..c2cfb16 --- /dev/null +++ b/include/profil/assign_poly.inc.php @@ -0,0 +1,36 @@ +mysql_assign("SELECT text,id + FROM binets_ins, binets_def + WHERE binets_def.id=binets_ins.binet_id AND + user_id='{$_SESSION['uid']}'", 'binets'); + +$page->mysql_assign("SELECT text,id + FROM groupesx_ins, groupesx_def + WHERE groupesx_def.id=groupesx_ins.gid AND + guid='{$_SESSION['uid']}'", 'groupesx'); +$page->assign('section', $section); + +?> diff --git a/include/profil/get_poly.inc.php b/include/profil/get_poly.inc.php new file mode 100644 index 0000000..b93d8a8 --- /dev/null +++ b/include/profil/get_poly.inc.php @@ -0,0 +1,61 @@ +db->query($sql); +list($nom, $prenom, $promo, $epouse, $flags, $section) = mysql_fetch_row($result); + +replace_ifset($section,'section'); + +/************* gestion des binets ************/ +if (isset($_REQUEST['binet_op'])) { + // retrait binet + if($_REQUEST['binet_op']=="retirer" && !empty($_REQUEST['binet_id'])) { + $globals->db->query("delete from binets_ins where user_id='{$_SESSION['uid']}' and binet_id='{$_REQUEST['binet_id']}'"); + } + // ajout binet + if ($_REQUEST['binet_op']=="ajouter" && !empty($_REQUEST['binet_id'])) { + $globals->db->query("insert into binets_ins (user_id,binet_id) VALUES('{$_SESSION['uid']}','{$_REQUEST['binet_id']}')"); + } +} +/************* gestion des groupes X ************/ +if (isset($_REQUEST['groupex_op'])) { + // retrait groupe X + if ($_REQUEST['groupex_op']=="retirer" && !empty($_REQUEST['groupex_id'])) { + $globals->db->query("delete from groupesx_ins where guid='{$_SESSION['uid']}' and gid='{$_REQUEST['groupex_id']}'"); + } + // ajout groupe X + if ($_REQUEST['groupex_op']=="ajouter" && !empty($_REQUEST['groupex_id'])) { + $globals->db->query("insert into groupesx_ins (guid,gid) VALUES('{$_SESSION['uid']}','{$_REQUEST['groupex_id']}')"); + } +} + +?> diff --git a/include/profil/profil_poly.inc.php b/include/profil/profil_poly.inc.php deleted file mode 100644 index b6e680e..0000000 --- a/include/profil/profil_poly.inc.php +++ /dev/null @@ -1,115 +0,0 @@ -db->query("select * from binets_ins, binets_def " - ."where binets_def.id=binets_ins.binet_id and user_id='{$params['uid']}'"); - while ($myrow2=mysql_fetch_array($result)) { ?> - - - - - retirer - - - - - -   - - -register_function('print_binets','_print_binet_smarty'); - -function _print_groupex_smarty($params){ - if(!isset($params['uid'])) return; - $result = $globals->db->query("select * from groupesx_ins, groupesx_def where groupesx_def.id=groupesx_ins.gid and guid='{$params['uid']}'"); - while ($myrow2=mysql_fetch_array($result)) { - ?> - - - - - - - retirer - - - - - - register_function('print_groupex','_print_groupex_smarty'); - - -$sql = "SELECT u.nom, u.prenom". - ", u.promo, epouse, i.flags, section". - " FROM auth_user_md5 AS u". - " LEFT JOIN identification AS i ON(u.matricule = i.matricule) ". - " WHERE user_id=".$_SESSION['uid']; - -$result = $globals->db->query($sql); -list($nom, $prenom, - $promo, $epouse, $flags, $section) = mysql_fetch_row($result); - -//TODO : ne plus afficher directement les erreurs mysql... -//if(mysql_errno($conn) !=0) echo mysql_errno($conn).": ".mysql_error($conn); - -replace_ifset($section,"section"); -$page->assign_by_ref('section', $section); - -/************* gestion des binets ************/ -if (isset($_REQUEST['binet_op']) && !$no_update_bd) { - // retrait binet - if($_REQUEST['binet_op']=="retirer" && !empty($_REQUEST['binet_id'])) { - $globals->db->query("delete from binets_ins where user_id='{$_SESSION['uid']}' and binet_id='{$_REQUEST['binet_id']}'"); - } - // ajout binet - if ($_REQUEST['binet_op']=="ajouter" && !empty($_REQUEST['binet_id'])) { - $globals->db->query("insert into binets_ins (user_id,binet_id) VALUES('{$_SESSION['uid']}','{$_REQUEST['binet_id']}')"); - } -} -/************* gestion des groupes X ************/ -if (isset($_REQUEST['groupex_op']) && !$no_update_bd) { - // retrait groupe X - if ($_REQUEST['groupex_op']=="retirer" && !empty($_REQUEST['groupex_id'])) { - $globals->db->query("delete from groupesx_ins where guid='{$_SESSION['uid']}' and gid='{$_REQUEST['groupex_id']}'"); - } - // ajout groupe X - if ($_REQUEST['groupex_op']=="ajouter" && !empty($_REQUEST['groupex_id'])) { - $globals->db->query("insert into groupesx_ins (guid,gid) VALUES('{$_SESSION['uid']}','{$_REQUEST['groupex_id']}')"); - } -} - - -?> diff --git a/templates/profil/poly.tpl b/templates/profil/poly.tpl index 44a2e6a..25ef360 100644 --- a/templates/profil/poly.tpl +++ b/templates/profil/poly.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: poly.tpl,v 1.4 2004-08-31 11:25:42 x2000habouzit Exp $ + $Id: poly.tpl,v 1.5 2004-08-31 19:09:20 x2000habouzit Exp $ ***************************************************************************} @@ -122,8 +122,22 @@ (ex-)Binet(s) + {foreach from=$binets item=b} + + {$b.text} + + + + retirer + + + + + +   + + {/foreach} - {print_binets uid=$smarty.session.uid} @@ -139,7 +153,21 @@ Groupe(s) X - {print_groupex uid=$smarty.session.uid} + {foreach from=$groupesx item=g} + + {$g.text} + + + + retirer + + + + + +   + + {/foreach}