summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-27 11:47:54 -0800
committerEvan Prodromou <evan@status.net>2009-12-27 11:47:54 -0800
commit4b7835caa570a27f372935fdda799dd065ae8ea4 (patch)
tree4fa097142c02838859cb5b5404879dac88ed4ae9
parent5d6b6bfd3494a7829c8fdccfdf85278811db83c8 (diff)
pagination works for flagged profiles
-rw-r--r--plugins/UserFlag/adminprofileflag.php25
1 files changed, 16 insertions, 9 deletions
diff --git a/plugins/UserFlag/adminprofileflag.php b/plugins/UserFlag/adminprofileflag.php
index 5d6acf086..b0888a31d 100644
--- a/plugins/UserFlag/adminprofileflag.php
+++ b/plugins/UserFlag/adminprofileflag.php
@@ -43,7 +43,8 @@ if (!defined('STATUSNET')) {
class AdminprofileflagAction extends Action
{
- var $page = null;
+ var $page = null;
+ var $profiles = null;
/**
* Take arguments for running
@@ -90,14 +91,14 @@ class AdminprofileflagAction extends Action
return false;
}
- $page = $this->int('page');
+ $this->page = $this->trimmed('page');
- if (empty($page)) {
+ if (empty($this->page)) {
$this->page = 1;
- } else {
- $this->page = $page;
}
+ $this->profiles = $this->getProfiles();
+
return true;
}
@@ -128,11 +129,12 @@ class AdminprofileflagAction extends Action
function showContent()
{
- $profile = $this->getProfiles();
+ $pl = new FlaggedProfileList($this->profiles, $this);
- $pl = new FlaggedProfileList($profile, $this);
+ $cnt = $pl->show();
- $pl->show();
+ $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
+ $this->page, 'adminprofileflag');
}
function getProfiles()
@@ -146,7 +148,12 @@ class AdminprofileflagAction extends Action
$ufp->whereAdd('cleared is NULL');
$ufp->groupBy('profile_id');
- $ufp->orderBy('flag_count DESC');
+ $ufp->orderBy('flag_count DESC, profile_id DESC');
+
+ $offset = ($this->page-1) * PROFILES_PER_PAGE;
+ $limit = PROFILES_PER_PAGE + 1;
+
+ $ufp->limit($offset, $limit);
$profiles = array();