| 1 | package WWW::Garden::Design::Controller::Report; | ||
| 2 | |||
| 3 | use Mojo::Base 'Mojolicious::Controller'; | ||
| 4 | |||
| 5 | use Date::Simple; | ||
| 6 | |||
| 7 | use Moo; | ||
| 8 | |||
| 9 | our $VERSION = '0.97'; | ||
| 10 | |||
| 11 | # ----------------------------------------------- | ||
| 12 | |||
| 13 | sub activity | ||
| 14 | { | ||
| 15 | my($self) = @_; | ||
| 16 | |||
| 17 | $self -> app -> log -> debug('Report.activity()'); | ||
| 18 | |||
| 19 | my($defaults) = $self -> app -> defaults; | ||
| 20 | my($items) = $$defaults{db} -> activity; | ||
| 21 | |||
| 22 | $self -> stash(result_html => $self -> format_activity($items) ); | ||
| 23 | $self -> render; | ||
| 24 | |||
| 25 | } # End of activity. | ||
| 26 | |||
| 27 | # ----------------------------------------------- | ||
| 28 | |||
| 29 | sub crosscheck | ||
| 30 | { | ||
| 31 | my($self) = @_; | ||
| 32 | |||
| 33 | $self -> app -> log -> debug('Report.crosscheck()'); | ||
| 34 | |||
| 35 | my($defaults) = $self -> app -> defaults; | ||
| 36 | my($items) = $$defaults{db} -> crosscheck; | ||
| 37 | |||
| 38 | $self -> stash(result_html => $self -> format_crosscheck($items) ); | ||
| 39 | $self -> render; | ||
| 40 | |||
| 41 | } # End of crosscheck. | ||
| 42 | |||
| 43 | # ----------------------------------------------- | ||
| 44 | |||
| 45 | sub format_activity | ||
| 46 | { | ||
| 47 | my($self, $items) = @_; | ||
| 48 | |||
| 49 | $self -> app -> log -> debug('Report.format_activity(...)'); | ||
| 50 | |||
| 51 | my($html) = ''; | ||
| 52 | |||
| 53 | for my $item (@$items) | ||
| 54 | { | ||
| 55 | $html .= <<EOS; | ||
| 56 | <tr> | ||
| 57 | <td>$$item{timestamp}</td> | ||
| 58 | <td>$$item{name}</td> | ||
| 59 | <td>$$item{context}</td> | ||
| 60 | <td>$$item{note}</td> | ||
| 61 | <td>$$item{outcome}</td> | ||
| 62 | <td>$$item{file_name}</td> | ||
| 63 | </tr> | ||
| 64 | EOS | ||
| 65 | } | ||
| 66 | |||
| 67 | return $html; | ||
| 68 | |||
| 69 | } # End of format_activity. | ||
| 70 | |||
| 71 | # ----------------------------------------------- | ||
| 72 | |||
| 73 | sub format_crosscheck | ||
| 74 | { | ||
| 75 | my($self, $items) = @_; | ||
| 76 | |||
| 77 | $self -> app -> log -> debug('Report.format_crosscheck(...)'); | ||
| 78 | |||
| 79 | my($html) = ''; | ||
| 80 | |||
| 81 | for my $item (@$items) | ||
| 82 | { | ||
| 83 | $html .= <<EOS; | ||
| 84 | <tr> | ||
| 85 | <td>$$item{context}</td> | ||
| 86 | <td>$$item{outcome}</td> | ||
| 87 | <td>$$item{file}</td> | ||
| 88 | </tr> | ||
| 89 | EOS | ||
| 90 | } | ||
| 91 | |||
| 92 | return $html; | ||
| 93 | |||
| 94 | } # End of format_crosscheck. | ||
| 95 | |||
| 96 | # ----------------------------------------------- | ||
| 97 | |||
| 98 | 1; | ||
| 99 | |||
| 100 | =pod | ||
| 101 | |||
| 102 | =head1 NAME | ||
| 103 | |||
| 104 | WWW::Garden::Design::Controller::Report - Manage the 'flowers' database | ||
| 105 | |||
| 106 | =head1 Machine-Readable Change Log | ||
| 107 | |||
| 108 | The file Changes was converted into Changelog.ini by L<Module::Metadata::Changes>. | ||
| 109 | |||
| 110 | =head1 Version Numbers | ||
| 111 | |||
| 112 | Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions. | ||
| 113 | |||
| 114 | =head1 Repository | ||
| 115 | |||
| 116 | L<https://github.com/ronsavage/WWW-Garden-Design> | ||
| 117 | |||
| 118 | =head1 Support | ||
| 119 | |||
| 120 | Email the author, or log a bug on RT: | ||
| 121 | |||
| 122 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=WWW::Garden::Design>. | ||
| 123 | |||
| 124 | =head1 Author | ||
| 125 | |||
| 126 | L<WWW::Garden::Design> was written by Ron Savage I<E<lt>ron@savage.net.auE<gt>> in 2014. | ||
| 127 | |||
| 128 | My homepage: L<https://savage.net.au/>. | ||
| 129 | |||
| 130 | =head1 Copyright | ||
| 131 | |||
| 132 | Australian copyright (c) 2018, Ron Savage. | ||
| 133 | |||
| 134 | All Programs of mine are 'OSI Certified Open Source Software'; | ||
| 135 | you can redistribute them and/or modify them under the terms of | ||
| 136 | The Perl License, a copy of which is available at: | ||
| 137 | http://dev.perl.org/licenses/ | ||
| 138 | |||
| 139 | =cut |