Line | |
---|
1 | package LATMOS::Accounts::Web::Controller; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use base 'Catalyst::Controller'; |
---|
6 | |
---|
7 | =head1 NAME |
---|
8 | |
---|
9 | LATMOS::Accounts::Web::Controller - Base class Controller for LATMOS::Accounts::Web |
---|
10 | |
---|
11 | =head1 DESCRIPTION |
---|
12 | |
---|
13 | [enter your description here] |
---|
14 | |
---|
15 | =head1 METHODS |
---|
16 | |
---|
17 | =cut |
---|
18 | |
---|
19 | =head2 default |
---|
20 | |
---|
21 | =cut |
---|
22 | |
---|
23 | sub begin : Private { |
---|
24 | my ( $self, $c ) = @_; |
---|
25 | |
---|
26 | my $menu = ''; |
---|
27 | my @menus = ( |
---|
28 | [ 'users' => 'Utilisateurs' ], |
---|
29 | [ 'create/user' => 'Créer un Utilisateur' ], |
---|
30 | [ 'groups' => 'Groupes' ], |
---|
31 | [ 'create/group' => 'Créer un Groupe' ], |
---|
32 | [ 'sites' => 'Sites' ], |
---|
33 | ); |
---|
34 | foreach(@menus) { |
---|
35 | $menu .= sprintf( |
---|
36 | q{<a href="%s"><span%s>%s</span></a>}, |
---|
37 | $c->uri_for('/' . $_->[0]), |
---|
38 | ($c->req->path =~ m:^$_->[0]: ? ' id="actif"' : ''), |
---|
39 | $_->[1], |
---|
40 | ); |
---|
41 | |
---|
42 | } |
---|
43 | $c->stash->{mainmenu} = $menu; |
---|
44 | if (!$c->user_exists && $c->req->path ne 'login') { |
---|
45 | $c->forward('/login'); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | =head2 end |
---|
50 | |
---|
51 | Attempt to render a view, if needed. |
---|
52 | |
---|
53 | =cut |
---|
54 | |
---|
55 | sub end : ActionClass('RenderView') { |
---|
56 | my ($self, $c) = @_; |
---|
57 | $c->forward($c->view('TT')); |
---|
58 | $c->model('Accounts')->db->rollback; |
---|
59 | } |
---|
60 | |
---|
61 | =head1 AUTHOR |
---|
62 | |
---|
63 | Thauvin Olivier |
---|
64 | |
---|
65 | =head1 LICENSE |
---|
66 | |
---|
67 | This library is free software, you can redistribute it and/or modify |
---|
68 | it under the same terms as Perl itself. |
---|
69 | |
---|
70 | =cut |
---|
71 | |
---|
72 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.