init
[garradin.git] / www / admin / membres / cotisations / voir.php
1 <?php
2 namespace Garradin;
3
4 require_once __DIR__ . '/../../_inc.php';
5
6 if ($user['droits']['membres'] < Membres::DROIT_ECRITURE)
7 {
8 throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
9 }
10
11 if (empty($_GET['id']) || !is_numeric($_GET['id']))
12 {
13 throw new UserException("Argument du numéro de cotisation manquant.");
14 }
15
16 $id = (int) $_GET['id'];
17
18 $cotisations = new Cotisations;
19 $m_cotisations = new Cotisations_Membres;
20
21 $co = $cotisations->get($id);
22
23 if (!$co)
24 {
25 throw new UserException("Cette cotisation n'existe pas.");
26 }
27
28 $page = (int) utils::get('p') ?: 1;
29
30 $tpl->assign('page', $page);
31 $tpl->assign('bypage', Cotisations_Membres::ITEMS_PER_PAGE);
32 $tpl->assign('total', $m_cotisations->countMembersForCotisation($co['id']));
33 $tpl->assign('pagination_url', utils::getSelfUrl(true) . '?id=' . $co['id'] . '&amp;p=[ID]');
34
35 $tpl->assign('cotisation', $co);
36 $tpl->assign('order', utils::get('o') ?: 'date');
37 $tpl->assign('desc', !isset($_GET['a']));
38 $tpl->assign('liste', $m_cotisations->listMembersForCotisation(
39 $co['id'], $page, utils::get('o'), isset($_GET['a']) ? false : true));
40
41 $tpl->display('admin/membres/cotisations/voir.tpl');
42
43 ?>