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) = @_;