+sub listModeratorBoards : Private {
+ my ( $self, $c, $fbid ) = @_;
+ my $dbh = $c->model;
+
+ my $categories = $dbh->prepare(q{SELECT fcid,category FROM forum_categories ORDER BY fcid});
+ my $boards = $dbh->prepare(q{SELECT fb.fbid,fb.board, bool_or(fa.post) AS post
+ FROM forum_boards fb NATURAL JOIN forum_access fa
+ WHERE fb.fcid = $1
+ AND gid IN (SELECT groups($2))
+ AND moderate
+ GROUP BY fb.fbid,fb.board
+ ORDER BY fb.fbid
+ });
+ $categories->execute;
+ my @categories;
+ while (my $category = $categories->fetchrow_hashref){
+ $boards->execute($category->{fcid},$c->stash->{UID});
+
+ my @boards;
+ while (my $b = $boards->fetchrow_hashref){
+ next if ($b->{fbid} == $fbid);
+ push @boards,$b;
+ }
+ $category->{boards} = \@boards;
+ push @categories,$category if @boards;
+ }
+ $c->stash(categories => \@categories);
+}
+