diff options
Diffstat (limited to 'web-admin/index.cgi')
-rwxr-xr-x | web-admin/index.cgi | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/web-admin/index.cgi b/web-admin/index.cgi index 62fcfb587..2f3ec85e7 100755 --- a/web-admin/index.cgi +++ b/web-admin/index.cgi @@ -69,6 +69,7 @@ sub allowed_pages($) { 'councilslist' => [_('Council contacts'), 1], 'reports' => [_('Search Reports'), 2], 'timeline' => [_('Timeline'), 3], + 'questionnaire' => [_('Survey Results'), 4], 'councilcontacts' => [undef, undef], 'counciledit' => [undef, undef], 'report_edit' => [undef, undef], @@ -863,6 +864,42 @@ sub admin_timeline { } +sub admin_questionnaire { + my $q = shift; + my $cobrand = Page::get_cobrand($q); + print html_head($q, _('Survey Results')); + print $q->h1(_('Survey Results')); + + # columns in questionnaire is id, problem_id, whensent, + # whenanswered, ever_reported, old_state, new_state + + my $survey = select_all("select ever_reported, count(*) from questionnaire where whenanswered is not null group by ever_reported"); + + my %res; + $res{0} = 0; + $res{1} = 0; + foreach my $h (@$survey) { + $res{$h->{ever_reported}} = $h->{count} if (exists $h->{ever_reported}); + } + my $total = $res{0} + $res{1}; + + print $q->start_table({border=>1}); + print $q->Tr({}, + $q->th({}, [_("Reported before"), + _("Not reported before")])); + if ($total) { + print $q->Tr({}, + $q->td([ + sprintf("%d (%d%%)", $res{1}, (100 * $res{1}) / $total), + sprintf("%d (%d%%)", $res{0}, (100 * $res{0}) / $total), + ])); + } else { + print $q->Tr({}, $q->td([ 'n/a', 'n/a' ])); + } + print $q->end_table(); + print html_tail($q); +} + sub not_found { my ($q) = @_; print $q->header(-status=>'404 Not Found',-type=>'text/html'); @@ -917,6 +954,8 @@ sub main { admin_edit_update($q, $id); } elsif ($page eq 'timeline') { admin_timeline($q); + } elsif ($page eq 'questionnaire') { + admin_questionnaire($q); } else { admin_summary($q); } |