X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fxnet%2Fpage.inc.php;h=8acc8eb69b10f06942063449ef3cebf374414127;hb=85909256a0e91d844682eb5a4c0c76553e1042e1;hp=2939ebe012f0fa89bb21f1bf97c1f4758b07daeb;hpb=80f44cfedec2007a6f9bfb7bf516d452281fc225;p=platal.git diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 2939ebe..8acc8eb 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -1,6 +1,6 @@ PlatalPage($tpl, $type); + parent::__construct($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(); + } } // }}} // {{{ function run() - function run() + public function run() { + if (!$this->nomenu) { + $this->useMenu(); + } $this->_run('xnet/skin.tpl'); } // }}} + // {{{ function changeTpl() + + public function changeTpl($tpl, $type = SKINNED) + { + global $globals; + parent::changeTpl($tpl, $type); + $this->assign('is_logged', S::logged()); + if ($globals->asso('id')) { + $this->assign('asso', $globals->asso()); + $this->setType($globals->asso('cat')); + $this->assign('is_admin', may_update()); + $this->assign('is_member', is_member()); + } + } + + // }}} // {{{ function setType - function setType($type) + public function setType($type) { $this->assign('xnet_type', strtolower($type)); } @@ -52,79 +76,107 @@ class XnetPage extends PlatalPage // }}} // {{{ function useMenu - function useMenu() + private function useMenu() { global $globals; $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; + $sub['documentation'] = 'Xnet'; + $sub['signaler un bug'] = array('href' => 'send_bug', 'class' => 'popup_840x600'); + $menu["no_title"] = $sub; - if (logged() && (is_member() || may_update())) { + $perms = S::v('perms'); + $dim = $globals->asso('diminutif'); + 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 ($perms->hasFlag('groupannu')) { $sub['annuaire du groupe'] = "$dim/annuaire"; - if ($globals->xnet->geoloc) - $sub['carte'] = "$dim/geoloc.php"; + $sub['trombinoscope'] = "$dim/trombi"; + $sub['planisphère'] = "$dim/geoloc"; } - if ($globals->asso('mail_domain')) { - $sub['listes de diffusion'] = "$dim/lists"; + if ($perms->hasFlag('groupmember')) { + if ($globals->asso('forum')) { + $sub['forum'] = "$dim/forum"; + } + if ($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 ($perms->hasFlag('groupmember')) { + $sub['télépaiement'] = "$dim/payment"; } - $sub['télépaiement'] = "$dim/paiement"; $menu[$globals->asso('nom')] = $sub; } - if (logged() && may_update()) { + if ($globals->asso() && is_object($perms) && $perms->hasFlag('groupadmin')) { $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"; - $sub['créer une liste'] = "$dim/lists/create"; - $sub['créer un alias'] = "$dim/alias-create.php"; + $sub['créer une liste'] = "$dim/lists/create"; + $sub['créer un alias'] = "$dim/alias/create"; + } + if (S::has_perms()) { + $sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;'); + $sub['clear cache'] = array('href' => 'purge_cache?token=' . S::v('xsrf_token'), 'style' => 'color: gray;'); } - $menu['Administrer Groupe'] = $sub; + $menu['Administrer'] = $sub; + } elseif (S::has_perms()) { + $sub = array(); + $sub['gérer les groupes'] = 'admin'; + $sub['clear cache'] = 'purge_cache?token=' . S::v('xsrf_token'); + $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')); + $links = 'déconnexion'; + $html = '
Mes groupes (' . $links . ') :
'; + 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: + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>