Skip to content

Commit

Permalink
Added paging.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmuth committed Feb 12, 2012
1 parent 87ba93b commit 1a7aad4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions recent/main.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ function fivestarstats_recent() {

$retval = fivestarstats_recent_get_html($votes);
//fivestarstats_debug($retval); // Debugging

/**
TODO:
- Add paging
*/

return($retval);

Expand All @@ -38,7 +33,7 @@ function fivestarstats_recent_votes() {

$retval = array();

$num = 5;
$num = 20;
$query = "SELECT "
. "votes.timestamp, "
. "votes.vote_source, "
Expand All @@ -57,10 +52,9 @@ function fivestarstats_recent_votes() {
. "(content_type='node' OR content_type='comment') "
. "AND value_type='percent' "
. "ORDER BY vote_id DESC "
. "LIMIT $num "
;

$cursor = db_query($query);
$cursor = pager_query($query, $num);
while ($row = db_fetch_array($cursor)) {
$retval[] = $row;
}
Expand Down Expand Up @@ -131,7 +125,12 @@ function fivestarstats_recent_get_html($data) {

}


$pager = theme("pager");

$retval .= $pager;
$retval .= theme("table", $header, $rows);
$retval .= $pager;

return($retval);

Expand Down

0 comments on commit 1a7aad4

Please sign in to comment.