Changeset 235 for trunk/npemap.org.uk
- Timestamp:
- Oct 29, 2006, 7:10:34 PM (14 years ago)
- Location:
- trunk/npemap.org.uk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/npemap.org.uk/perllib/NPEMap/Postcodes.pm
r230 r235 45 45 my $sth = $dbh->prepare($sql); 46 46 $sth->execute(); 47 return $sth->fetchrow_hashref; 47 return $sth->fetchall_arrayref({}); 48 } 49 50 sub _getLastPostcodes { 51 my $dbh = shift; 52 my $num = shift; 53 my $sql = <<"HERE"; 54 SELECT easting, northing, outward, inward, TO_CHAR(created_at, 'DDth Mon HH24:MI')AS date 55 FROM postcodes 56 WHERE NOT deleted 57 ORDER BY created_at DESC LIMIT ? 58 HERE 59 60 my $sth = $dbh->prepare($sql); 61 $sth->execute($num); 62 return $sth->fetchall_arrayref({}); 48 63 } 49 64 … … 63 78 my $allStats = _getAllStats($dbh); 64 79 my $dateStats = _getDateStats($dbh); 80 my $lastPostcodes = _getLastPostcodes($dbh, 5); 65 81 66 82 my $vars = { 67 83 allstats => $allStats, 68 datestats => $dateStats 84 datestats => $dateStats, 85 lastpostcodes => $lastPostcodes 69 86 }; 70 87 -
trunk/npemap.org.uk/templates/home_stats.tt
r230 r235 3 3 <li>Outward parts collected: [% allstats.us_out %]</li> 4 4 </ul> 5 6 <h3>Recent submissions:</h3> 7 8 <ul> 9 [% FOREACH postcode = lastpostcodes %] 10 <li><a href="tiles/map.html#[% postcode.easting div 1000 %],[% postcode.northing div 1000 %],1">[% postcode.outward %] [% postcode.inward %]</a> ([% postcode.easting %], [% postcode.northing %]) [[% postcode.date %]]</li> 11 [% END %] 12 </ul>
Note: See TracChangeset
for help on using the changeset viewer.