X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fxnet%2Fpage.inc.php;h=b164f37c1382077cec60faa4fb06dc00450797fb;hb=98a7e9dc645a582adb7219299a24107e6bd1d2a2;hp=1b793793b007131d91854fe771a55e32fb725fed;hpb=2e94d2b81ecadfd32bea9e45a8f6cf938c877f7f;p=platal.git diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 1b79379..b164f37 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -19,18 +19,23 @@ * 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 - class XnetPage extends PlatalPage { + var $nomenu = false; + // {{{ function XnetPage() 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(); + } } // }}} @@ -38,6 +43,9 @@ class XnetPage extends PlatalPage function run() { + if (!$this->nomenu) { + $this->useMenu(); + } $this->_run('xnet/skin.tpl'); } @@ -59,72 +67,92 @@ class XnetPage extends PlatalPage $menu = array(); $sub = array(); - $sub['accueil'] = ''; $sub['liste des groupes'] = 'plan'; - if (logged()) { - if (has_perms()) { - $sub['admin X.net'] = 'admin'; - } - $sub['déconnexion'] = 'exit'; - } - $menu["Menu Principal"] = $sub; - - if (logged() && (is_member() || may_update())) { + $sub['documentation'] = 'Xnet'; + $sub['Signaler un bug'] = array('link' => 'send_bug', 'onclick' => 'send_bug();return false'); + $menu["no_title"] = $sub; + + if (S::logged() && $globals->asso()) { $sub = array(); $dim = $globals->asso('diminutif'); - $sub['présentation'] = "$dim/"; - if (may_update() || $globals->asso('pub') == 'public') { + $sub['présentation'] = "login/$dim/"; + if (may_update() || (is_member() && $globals->asso('pub') == 'public') + || $globals->asso('cat') == 'Promotions') { $sub['annuaire du groupe'] = "$dim/annuaire"; - if ($globals->xnet->geoloc) - $sub['carte'] = "$dim/geoloc.php"; + $sub['trombinoscope'] = "$dim/trombi"; + $sub['carte'] = "$dim/geoloc"; } - if ($globals->asso('mail_domain')) { - $sub['listes de diffusion'] = "$dim/listes.php"; + if ((is_member() || may_update()) && $globals->asso('mail_domain')) { + $sub['listes de diffusion'] = "$dim/lists"; } - $sub['événement'] = "$dim/evenements.php"; - if (false) { - $sub['carnet'] = "$dim/carnet.php"; + $sub['événement'] = "$dim/events"; + if (may_update() || is_member()) { + $sub['télépaiement'] = "$dim/paiement"; } - $sub['télépaiement'] = "$dim/telepaiement.php"; $menu[$globals->asso('nom')] = $sub; } - if (logged() && may_update()) { + if (S::logged() && may_update()) { $sub = array(); $sub['modifier l\'accueil'] = "$dim/edit"; - if ($globals->wiki->wikidir && $globals->xnet->wiki) - $sub['wiki'] = "$dim/Accueil"; + $sub['gérer les annonces'] = "$dim/admin/announces"; if ($globals->asso('mail_domain')) { - $sub['envoyer un mail'] = "$dim/mail.php"; - $sub['créer une liste'] = "$dim/listes-create.php"; - $sub['créer un alias'] = "$dim/alias-create.php"; + $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 (!logged() && $force) { - $_SESSION['session']->doLogin($this); - } - if (!logged() && Get::has('auth')) { - $_SESSION['session']->doAuthX($this); - } +// {{{ 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 (déconnexion) :
'; + while (list($nom, $mini) = $res->next()) { + $html .= "$nom"; } + return $html; +} - // }}} +// }}} +// {{{ cat_pp + +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: ?>