- Timestamp:
- 10/30/15 15:24:33 (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/MANIFEST
r1410 r1438 34 34 lib/LATMOS/Accounts/Web/Controller/Services.pm 35 35 lib/LATMOS/Accounts/Web/Controller/Sites.pm 36 lib/LATMOS/Accounts/Web/Controller/Stat.pm 36 37 lib/LATMOS/Accounts/Web/Controller/Summary/Departments.pm 37 38 lib/LATMOS/Accounts/Web/Controller/Summary/Offices.pm 38 lib/LATMOS/Accounts/Web/Controller/Summary/Rh.pm39 39 lib/LATMOS/Accounts/Web/Controller/Users.pm 40 40 lib/LATMOS/Accounts/Web/Model/Accounts.pm … … 113 113 root/html/sites/menu.tt 114 114 root/html/sites/object_header.tt 115 root/html/stat/index.tt 115 116 root/html/summary/departments/index.tt 116 117 root/html/summary/offices/index.tt -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Json/Stat.pm
r1412 r1438 22 22 =cut 23 23 24 sub employment :Local :Args(0) {25 my ( $self, $c ) = @_;24 sub index :Path :Args(1) { 25 my ( $self, $c, $statname ) = @_; 26 26 27 27 my $base = $c->model('Accounts')->db; 28 28 29 my @results = ();29 my $ostat = $base->get_object('stat', $statname) or return; 30 30 31 foreach my $contrat ($base->search_objects('group', 'sutype=contrattype')) { 32 my $ocontrat = $base->get_object('group', $contrat); 33 my $count = scalar( $base->search_objects('user', "memberOf=$contrat", 'active=1') ); 31 my $res = $ostat->getStat or return; 34 32 35 push(@results, [ ($ocontrat->get_attributes('label') || $contrat), $count ]); 36 } 37 38 $c->stash->{data} = [ sort { $b->[1] <=> $a->[1] } @results ]; 33 $c->stash->{data} = [ map { [ $_, $res->{$_} +0 ] } sort { $res->{$b} <=> $res->{$a} } keys %$res ]; 39 34 } 40 35 41 sub dpmt :Local :Args(0) {42 my ( $self, $c ) = @_;36 sub history :Local :Args(1) { 37 my ( $self, $c, $statname ) = @_; 43 38 44 39 my $base = $c->model('Accounts')->db; 45 40 46 my @results = ();41 my $ostat = $base->get_object('stat', $statname) or return; 47 42 48 foreach my $dpmt ($base->search_objects('group', 'sutype=dpmt')) { 49 my $odpmt = $base->get_object('group', $dpmt); 50 my $count = scalar( $base->search_objects('user', "department=$dpmt", 'active=1') ); 43 my $data = $ostat->getAllStat or return; 51 44 52 push(@results, [ $dpmt, $count ]); 53 } 45 my $graph = { 46 series => [], 47 data => [], 48 }; 54 49 55 $c->stash->{data} = [ sort { $b->[1] <=> $a->[1] } @results ]; 56 } 50 my %lines; 57 51 58 sub manager :Local :Args(0) { 59 my ( $self, $c ) = @_; 60 61 my $base = $c->model('Accounts')->db; 62 63 my @results = (); 64 65 my %active = map { $_ => 1 } $base->search_objects('user', 'active=1', 'givenName=*'); 66 67 my %managed = $base->attributes_summary_by_object('user', 'managerContact'); 68 69 my %managers = (); 70 71 my $total = 0; 72 73 foreach my $user (sort keys %managed) { 74 $active{$user} or next; 75 foreach (@{ $managed{ $user } }) { 76 $active{$_} or next; 77 $managers{$_} ||= 0; 78 $managers{$_} ++; 79 $total++; 52 foreach my $date (sort keys %$data) { 53 foreach my $val (sort keys %{ $data->{$date} }) { 54 push(@{ $lines{$val} }, [ $date, $data->{$date}{$val} + 0 ]); 80 55 } 81 56 } 82 57 83 my $minreport = $c->req->param('min'); 84 my $others = 0; 85 86 foreach my $user (sort { $managers{$b} <=> $managers{$a} } keys %managers) { 87 if ($minreport && $managers{$user} / $total * 100 < $minreport) { 88 $others++; 89 next; 90 } 91 push(@results, [ $user, $managers{$user} ]); 58 foreach (sort keys %lines) { 59 push(@{ $graph->{data} }, $lines{$_}); 60 push(@{ $graph->{series} }, { label => $_ }); 92 61 } 93 62 94 push(@results, [ 'Others', $others ]) if ($others); 95 96 $c->stash->{data} = \@results; 63 $c->stash->{data} = $graph; 97 64 } 98 99 100 65 101 66 -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Stat.pm
r1437 r1438 1 package LATMOS::Accounts::Web::Controller::S ummary::Rh;1 package LATMOS::Accounts::Web::Controller::Stat; 2 2 use Moose; 3 3 use namespace::autoclean; … … 22 22 =cut 23 23 24 sub index :Path :Args( 0) {25 my ( $self, $c ) = @_;24 sub index :Path :Args(1) { 25 my ( $self, $c, $statname ) = @_; 26 26 27 $c->stash->{statname} = $statname; 27 28 } 28 29 -
trunk/LATMOS-Accounts-Web/root/html/includes/sidebar.tt
r1363 r1438 29 29 <li><a href="[% c.uri_for('/summary', 'departments') %]">Liste des départements</a></li> 30 30 31 <li><a href="[% c.uri_for('/summary', 'rh') %]">Statistiques</a></li> 31 [% FOREACH stat = c.model('Accounts').db.list_objects('stat') %] 32 [% ostat = c.model('Accounts').db.get_object('stat', stat) %] 33 <li><a href="[% c.uri_for('/stat', stat) %]">[% ostat.get_attributes('description') || stat | html %]</a></li> 34 [% END %] 35 32 36 </ul> 33 37 </li> -
trunk/LATMOS-Accounts-Web/root/html/includes/wrapper.tt
r1362 r1438 15 15 <script src="[% c.uri_for('/static', 'js', 'jqplot', 'plugins', 'jqplot.json2.js') %]"></script> 16 16 <script src="[% c.uri_for('/static', 'js', 'jqplot', 'plugins', 'jqplot.pieRenderer.js') %]"></script> 17 <script src="[% c.uri_for('/static', 'js', 'jqplot', 'plugins', 'jqplot.dateAxisRenderer.js') %]"></script> 17 18 <link rel="stylesheet" href="[% c.uri_for('/static/js/jqplot/jquery.jqplot.css') %]" type="text/css"> 18 19 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Stat.pm
r1434 r1438 168 168 my ($self, $id) = @_; 169 169 170 ($id) ||= $self->_ attributes('lastStatId');170 ($id) ||= $self->_get_attributes('lastStatId'); 171 171 172 172 if (!$id) {
Note: See TracChangeset
for help on using the changeset viewer.