X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fxnet%2Fpage.inc.php;h=8acc8eb69b10f06942063449ef3cebf374414127;hb=8907f26377348b0f6f454abb2cebf363ea9cc8dd;hp=8e19fa2bb4a878e8dede63b0c6d4fed06418e94f;hpb=a7de4ef724d1a3b0bf978a50ce7cc9d23412c7a0;p=platal.git diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 8e19fa2..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'); @@ -41,7 +41,7 @@ class XnetPage extends PlatalPage // }}} // {{{ function run() - function run() + public function run() { if (!$this->nomenu) { $this->useMenu(); @@ -50,9 +50,25 @@ class XnetPage extends PlatalPage } // }}} + // {{{ 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)); } @@ -60,7 +76,7 @@ class XnetPage extends PlatalPage // }}} // {{{ function useMenu - function useMenu() + private function useMenu() { global $globals; @@ -69,31 +85,36 @@ class XnetPage extends PlatalPage $sub = array(); $sub['liste des groupes'] = 'plan'; $sub['documentation'] = 'Xnet'; - $sub['signaler un bug'] = array('href' => 'send_bug', 'class' => 'popup_840x600'); + $sub['signaler un bug'] = array('href' => 'send_bug', 'class' => 'popup_840x600'); $menu["no_title"] = $sub; - + + $perms = S::v('perms'); + $dim = $globals->asso('diminutif'); if (S::logged() && $globals->asso()) { $sub = array(); - $dim = $globals->asso('diminutif'); $sub['présentation'] = "login/$dim/"; - if (may_update() || (is_member() && $globals->asso('pub') == 'public') - || $globals->asso('cat') == 'Promotions') { + if ($perms->hasFlag('groupannu')) { $sub['annuaire du groupe'] = "$dim/annuaire"; $sub['trombinoscope'] = "$dim/trombi"; - $sub['carte'] = "$dim/geoloc"; + $sub['planisphère'] = "$dim/geoloc"; } - if ((is_member() || may_update()) && $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/events"; - if (may_update() || is_member()) { + if ($perms->hasFlag('groupmember')) { $sub['télépaiement'] = "$dim/payment"; } $menu[$globals->asso('nom')] = $sub; } - if (S::logged() && may_update()) { + if ($globals->asso() && is_object($perms) && $perms->hasFlag('groupadmin')) { $sub = array(); $sub['modifier l\'accueil'] = "$dim/edit"; $sub['gérer les annonces'] = "$dim/admin/announces"; @@ -104,13 +125,13 @@ class XnetPage extends PlatalPage } if (S::has_perms()) { $sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;'); - $sub['clear cache'] = array('href' => 'purge_cache', 'style' => 'color: gray;'); + $sub['clear cache'] = array('href' => 'purge_cache?token=' . S::v('xsrf_token'), 'style' => 'color: gray;'); } $menu['Administrer'] = $sub; } elseif (S::has_perms()) { $sub = array(); $sub['gérer les groupes'] = 'admin'; - $sub['clear cache'] = 'purge_cache'; + $sub['clear cache'] = 'purge_cache?token=' . S::v('xsrf_token'); $menu['Administrer'] = $sub; }