use strict;
use warnings;
+use feature ':5.10';
use parent 'Catalyst::Controller';
use NDWeb::Include;
}
+sub channels : Local {
+ my ( $self, $c, $order ) = @_;
+ my $dbh = $c->model;
+
+ if ($order ~~ /(alliance|channel)/){
+ $order = "lower($1) ASC";
+ }elsif ($order ~~ /(coords)/){
+ $order = "x,y,z";
+ }else{
+ $order = 'lower(channel)';
+ }
+
+ my $query = $dbh->prepare(q{
+SELECT id,coords(x,y,z),nick,channel,alliance FROM current_planet_stats
+WHERE channel <> '' and channel IS NOT NULL
+ORDER BY } . $order
+ );
+ $query->execute;
+ $c->stash(planets => $query->fetchall_arrayref({}) );
+}
+
sub postplanetcomment : Local {
my ($self, $c, $p) = @_;
<p>Intel menu</p>
<ul class="linkbar">
<li><a href="/intel">Intel</a></li>
+ <li><a href="/intel/channels">Channels</a></li>
<li><form action="/intel/find" method="post"><p>
<input class="coordsinput" type="text" name="coords" value="[% checkcoords %]">
<input class="coordsinput" type="submit" value="Check">
--- /dev/null
+[% META title = 'Channels' %]
+<table>
+ <tr>
+ <th><a href="[% c.uri_for('channels','coords') %]">Coords</a></th>
+ <th>Nick</th>
+ <th><a href="[% c.uri_for('channels','channel') %]">Channel</a></th>
+ <th><a href="[% c.uri_for('channels','alliance') %]">Alliance</a></th>
+ </tr>
+[% FOR p IN planets %]
+ <tr align="left" class="[% loop.count % 2 == 0 ? 'even' : 'odd' %]">
+ <td><a href="[% c.uri_for('/stats/planet',p.id) %]">[% p.coords %]</a></td>
+ <td><a href="[% c.uri_for('planet',p.id) %]">[% p.nick %]</a></td>
+ <td>[% p.channel %]</td>
+ <td>[% p.alliance %]</td>
+ </tr>
+[% END %]
+</table>