X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fxnet%2Fpage.inc.php;h=525890339702adb206958de9280664be5692a017;hb=ea6398d17ff92793b0a76d6fffc88147bb40a203;hp=cf3df33e2da0e9937224e28d1d96487f8b115f50;hpb=b0b937fdb5cb3d4758d054ce9eb02d184f430ccc;p=platal.git diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index cf3df33..5258903 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -19,10 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once('platal/page.inc.php'); -require_once('xnet/smarty.plugins.inc.php'); - -// {{{ class XnetPage +require_once dirname(__FILE__).'/../../classes/Page.php'; class XnetPage extends PlatalPage { @@ -31,6 +28,14 @@ class XnetPage extends PlatalPage function XnetPage($tpl, $type=SKINNED) { $this->PlatalPage($tpl, $type); + + $this->register_function('list_all_my_groups', 'list_all_my_groups'); + $this->register_modifier('cat_pp', 'cat_pp'); + $this->assign('it_is_xnet', true); + + if (!S::logged() && Get::has('auth')) { + XnetSession::doAuthX(); + } } // }}} @@ -58,15 +63,16 @@ class XnetPage extends PlatalPage $menu = array(); - $sub = array(); - $sub['accueil'] = ''; - $sub['liste des groupes'] = 'plan'; if (S::logged()) { - if (S::has_perms()) { - $sub['admin X.net'] = 'admin'; - } + $sub = array(); $sub['déconnexion'] = 'exit'; + $menu['no_title'] = $sub; } + + $sub = array(); + $sub['accueil'] = ''; + $sub['liste des groupes'] = 'plan'; + $sub['documentation'] = 'Xnet'; $menu["Menu Principal"] = $sub; if (S::logged() && (is_member() || may_update())) { @@ -75,16 +81,13 @@ class XnetPage extends PlatalPage $sub['présentation'] = "$dim/"; if (may_update() || $globals->asso('pub') == 'public') { $sub['annuaire du groupe'] = "$dim/annuaire"; - if ($globals->xnet->geoloc) - $sub['carte'] = "$dim/geoloc.php"; + $sub['carte'] = "$dim/geoloc"; } if ($globals->asso('mail_domain')) { $sub['listes de diffusion'] = "$dim/lists"; + $sub['envoyer un mail'] = "$dim/mail"; } $sub['événement'] = "$dim/events"; - if (false) { - $sub['carnet'] = "$dim/carnet.php"; - } $sub['télépaiement'] = "$dim/paiement"; $menu[$globals->asso('nom')] = $sub; @@ -94,40 +97,60 @@ class XnetPage extends PlatalPage $sub = array(); $sub['modifier l\'accueil'] = "$dim/edit"; if ($globals->asso('mail_domain')) { - $sub['envoyer un mail'] = "$dim/mail"; $sub['créer une liste'] = "$dim/lists/create"; $sub['créer un alias'] = "$dim/alias/create"; } - $menu['Administrer Groupe'] = $sub; + if (S::has_perms()) { + $sub['gérer les groupes'] = 'admin'; + } + $menu['Administrer'] = $sub; + } elseif (S::has_perms()) { + $sub = array(); + $sub['gérer les groupes'] = 'admin'; + $menu['Administrer'] = $sub; } $this->assign('menu', $menu); } // }}} - // {{{ function doAuth() +} - function doAuth($force = false) - { - $this->register_function('list_all_my_groups', 'list_all_my_groups'); - $this->register_modifier('cat_pp', 'cat_pp'); - $this->assign('it_is_xnet', true); - if (!S::logged() && $force) { - XnetSession::doAuth(); - } - if (!S::logged() && Get::has('auth')) { - XnetSession::doAuthX(); - } +// {{{ function list_all_my_groups + +function list_all_my_groups($params) +{ + if (!S::logged()) { + return; } + $res = XDB::iterRow( + "SELECT a.nom, a.diminutif + FROM groupex.asso AS a + INNER JOIN groupex.membres AS m ON m.asso_id = a.id + WHERE m.uid={?}", S::v('uid')); + $html = '
Mes groupes :
'; + while (list($nom, $mini) = $res->next()) { + $html .= "• $nom"; + } + return $html; +} - // }}} +// }}} +// {{{ cat_pp - function doLogin() - { - redirect(S::v('loginX')); - } +function cat_pp($cat) +{ + $trans = array( + 'groupesx' => 'Groupes X' , + 'binets' => 'Binets' , + 'institutions' => 'Institutions' , + 'promotions' => 'Promotions' + ); + + return $trans[strtolower($cat)]; } // }}} + // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?>