--- lib/A3C/View.pm 2008/04/01 19:44:31 57 +++ lib/A3C/View.pm 2008/04/10 23:16:56 72 @@ -8,13 +8,55 @@ use Data::Dump qw/dump/; +template '/' => page { + + h1 { _('Statistics') } + + my $orgs = A3C::Model::OrganizationCollection->new; + $orgs->unlimit; + + dt { _('Number of schools in system') } + dd { $orgs->count } + + my $people = A3C::Model::PersonCollection->new; + $people->unlimit; + + dt { _('Number of persons in system') } + dd { $people->count } + +=for later + + dt { _('Breakdown by towns') } + dd { + $orgs->redo_search; + # select count(l),l from organizations group by l order by count desc limit 25 + $orgs->group_by( column => 'l' ); + $orgs->order_by( column => 'l', order => 'desc' ); + + warn "## SQL: ", $orgs->build_select_query; + my $count = $orgs->column( column => 'l', function => 'count(l)' ); + warn "## count: $count\n"; +# $orgs->column( column => 'l' ); + warn "## SQL: ", $orgs->build_select_query; + + ul { + for ( 1 .. 1 ) { + my $o = $orgs->next; + warn "## ",dump( $o ); + li { outs ( $o->l, '|', $o->__value('l'), $o->__value( $count ) ) } + } + } + + + } + +=cut -template '/skole' => page { - h1 { _('Schools in system') }; - show 'skole_sve'; }; -private template 'skole_sve' => sub { + +template 'ldap' => page { + h1 { _('LDAP data about Schools in system') }; my $ldap = A3C::LDAP->new; div { $ldap->search( @@ -36,13 +78,18 @@ } }; -template '/search-users' => page { +template 'people' => page { + + h1 { _('Find people') } my $action = new_action( - class => 'SearchUser', - moniker => 'search-users' + class => 'SearchPerson', + moniker => 'search-users', + sticky_on_success => 1, + sticky_on_failure => 1, ); + form { render_action( $action => [ 'uid_contains', 'cn_contains' ] ); form_submit( label => _('Find someone') ); @@ -64,7 +111,9 @@ }; -template '/sync' => page { +template 'sync' => page { + + h1 { _('Sync school from LDAP') } my $action = new_action( class => 'SyncOrganization',