# ================================================================== # Plugins::NewestReviews - Auto Generated Program Module # # Plugins::NewestReviews # Author : Jordan Rapp # Version : 1.0 # Updated : Wed Sep 11 20:07:11 2008 # # ================================================================== # package Plugins::NewestReviews; # ================================================================== use strict; use GT::Base; use GT::Plugins qw/STOP CONTINUE/; use Links qw/:objects/; # Inherit from base class for debug and error methods @Plugins::NewestReviews::ISA = qw(GT::Base); # Your code begins here. # PLUGIN HOOKS # =================================================================== sub generate_newest_reviews { my $mh = shift || 5; require Links::Plugins; #my $cfg = Links::Plugins::get_plugin_user_cfg('MostPopular'); my $db = $DB->table('Reviews'); my $linksdb = $DB->table('Links'); use Data::Dumper; my $sth = $db->do("SELECT Review_Subject, Review_LinkID FROM glinks_Reviews WHERE Review_Validated = 'Yes' ORDER BY Review_Date DESC LIMIT 5"); my @loop; while (my $row = $sth->fetchrow_hashref()) { my $link = $linksdb->get($row->{Review_LinkID}); $link = Links::SiteHTML::tags('link',$link); push @loop, { %$link, %$row }; } return { NewestReviewsLinks => \@loop }; } # Always end with a 1. 1;