X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fxnet%2Fpage.inc.php;h=c9ec66158d45ac3558f3cdbf77ac31f6d84e7e8b;hb=14256b085eed2ff3f3ca977894f0a506c849e819;hp=39ac9fc4de45edaf06101545fb0a2260c1997d47;hpb=0337d704b62718d7c77106c0e4c4e26fb02beacf;p=platal.git diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 39ac9fc..c9ec661 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,176 +76,107 @@ class XnetPage extends PlatalPage // }}} // {{{ function useMenu - function useMenu() + private function useMenu() { global $globals; $menu = array(); $sub = array(); - $sub['accueil'] = 'index.php'; - $sub['liste des groupes'] = 'plan.php'; - if (logged()) { - if (has_perms()) { - $sub['admin X.net'] = 'admin.php'; - } - $sub['déconnexion'] = 'deconnexion.php'; - } - $menu["Menu Principal"] = $sub; - - if (logged() && (is_member() || may_update())) { + $sub['liste des groupes'] = 'plan'; + $sub['documentation'] = 'Xnet'; + $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'] = "$dim/asso.php"; - if (may_update() || $globals->asso('pub') == 'public') - $sub['annuaire du groupe'] = "$dim/annuaire.php"; - if ($globals->asso('mail_domain')) { - $sub['listes de diffusion'] = "$dim/listes.php"; + $sub['présentation'] = "login/$dim/"; + if ($perms->hasFlag('groupannu')) { + $sub['annuaire du groupe'] = "$dim/annuaire"; + $sub['trombinoscope'] = "$dim/trombi"; + $sub['planisphère'] = "$dim/geoloc"; + } + 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/telepaiement.php"; $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.php"; + $sub['modifier l\'accueil'] = "$dim/edit"; + $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'] = array('href' => 'admin', 'style' => 'color: gray;'); + $sub['clear cache'] = array('href' => 'purge_cache', 'style' => 'color: gray;'); + } + $menu['Administrer'] = $sub; + } elseif (S::has_perms()) { + $sub = array(); + $sub['gérer les groupes'] = 'admin'; + $sub['clear cache'] = 'purge_cache'; + $menu['Administrer'] = $sub; } $this->assign('menu', $menu); } // }}} - // {{{ function doAuth() - - function doAuth() - { - $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() && Get::has('auth')) { - $_SESSION['session']->doAuthX($this); - } - } - - // }}} } -// }}} -// {{{ class XnetAuth +// {{{ function list_all_my_groups -/** Une classe pour les pages nécessitant l'authentification. - * (equivalent de controlauthentification.inc.php) - */ -class XnetAuth extends XnetPage +function list_all_my_groups($params) { - // {{{ function XnetAuth() - - function XnetAuth($tpl, $type=SKINNED) - { - $this->XnetPage($tpl, $type); + if (!S::logged()) { + return; } - - // }}} - // {{{ function doAuth() - - function doAuth() - { - parent::doAuth(); - $_SESSION['session']->doAuth($this); - } - - // }}} -} - -// }}} -// {{{ class XnetAdmin - -/** Une classe pour les pages réservées aux admins (authentifiés!). - */ -class XnetAdmin extends XnetAuth -{ - // {{{ function XnetAdmin() - - function XnetAdmin($tpl, $type=SKINNED) - { - global $globals; - - $this->XnetAuth($tpl, $type); - check_perms(); - - $this->useMenu(); - if ($globals->asso('cat')) { - $this->assign('asso', $globals->asso()); - $this->setType($globals->asso('cat')); - } + $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 = '