8 |
|
|
9 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
10 |
|
|
11 |
|
template '/' => page { |
12 |
|
|
13 |
|
h1 { _('Statistics') } |
14 |
|
|
15 |
|
my $orgs = A3C::Model::OrganizationCollection->new; |
16 |
|
$orgs->unlimit; |
17 |
|
|
18 |
|
dt { _('Number of schools in system') } |
19 |
|
dd { $orgs->count } |
20 |
|
|
21 |
|
my $people = A3C::Model::PersonCollection->new; |
22 |
|
$people->unlimit; |
23 |
|
|
24 |
|
dt { _('Number of persons in system') } |
25 |
|
dd { $people->count } |
26 |
|
|
27 |
|
=for later |
28 |
|
|
29 |
|
dt { _('Breakdown by towns') } |
30 |
|
dd { |
31 |
|
$orgs->redo_search; |
32 |
|
# select count(l),l from organizations group by l order by count desc limit 25 |
33 |
|
$orgs->group_by( column => 'l' ); |
34 |
|
$orgs->order_by( column => 'l', order => 'desc' ); |
35 |
|
|
36 |
|
warn "## SQL: ", $orgs->build_select_query; |
37 |
|
my $count = $orgs->column( column => 'l', function => 'count(l)' ); |
38 |
|
warn "## count: $count\n"; |
39 |
|
# $orgs->column( column => 'l' ); |
40 |
|
warn "## SQL: ", $orgs->build_select_query; |
41 |
|
|
42 |
|
ul { |
43 |
|
for ( 1 .. 1 ) { |
44 |
|
my $o = $orgs->next; |
45 |
|
warn "## ",dump( $o ); |
46 |
|
li { outs ( $o->l, '|', $o->__value('l'), $o->__value( $count ) ) } |
47 |
|
} |
48 |
|
} |
49 |
|
|
50 |
|
|
51 |
|
} |
52 |
|
|
53 |
|
=cut |
54 |
|
|
|
template '/skole' => page { |
|
|
h1 { _('Schools in system') }; |
|
|
show 'skole_sve'; |
|
55 |
}; |
}; |
56 |
|
|
57 |
private template 'skole_sve' => sub { |
|
58 |
|
template 'ldap' => page { |
59 |
|
h1 { _('LDAP data about Schools in system') }; |
60 |
my $ldap = A3C::LDAP->new; |
my $ldap = A3C::LDAP->new; |
61 |
div { |
div { |
62 |
$ldap->search( |
$ldap->search( |
78 |
} |
} |
79 |
}; |
}; |
80 |
|
|
81 |
template '/search-users' => page { |
template 'people' => page { |
82 |
|
|
83 |
|
h1 { _('Find people') } |
84 |
|
|
85 |
my $action = new_action( |
my $action = new_action( |
86 |
class => 'SearchUser', |
class => 'SearchPerson', |
87 |
moniker => 'search-users' |
moniker => 'search-users', |
88 |
|
sticky_on_success => 1, |
89 |
|
sticky_on_failure => 1, |
90 |
); |
); |
91 |
|
|
92 |
|
|
93 |
form { |
form { |
94 |
render_action( $action => [ 'uid_contains', 'cn_contains' ] ); |
render_action( $action => [ 'uid_contains', 'cn_contains' ] ); |
95 |
form_submit( label => _('Find someone') ); |
form_submit( label => _('Find someone') ); |
111 |
|
|
112 |
}; |
}; |
113 |
|
|
114 |
template '/sync' => page { |
template 'sync' => page { |
115 |
|
|
116 |
|
h1 { _('Sync school from LDAP') } |
117 |
|
|
118 |
my $action = new_action( |
my $action = new_action( |
119 |
class => 'SyncOrganization', |
class => 'SyncOrganization', |