private $query = null;
private $orderby = null;
- private $lastcount = null;
+ private $lastusercount = null;
+ private $lastprofilecount = null;
public function __construct($cond = null, $sort = null)
{
GROUP BY a.uid
' . $this->orderby . '
' . $lim);
- $this->lastcount = (int)XDB::fetchOneCell('SELECT FOUND_ROWS()');
+ $this->lastusercount = (int)XDB::fetchOneCell('SELECT FOUND_ROWS()');
return $fetched;
}
GROUP BY p.pid
' . $this->orderby . '
' . $lim);
- $this->lastcount = (int)XDB::fetchOneCell('SELECT FOUND_ROWS()');
+ $this->lastprofilecount = (int)XDB::fetchOneCell('SELECT FOUND_ROWS()');
return $fetched;
}
public function getTotalCount()
{
- if (is_null($this->lastcount)) {
+ return $this->getTotalUserCount();
+ }
+
+ public function getTotalUserCount()
+ {
+ if (is_null($this->lastusercount)) {
+ $this->requireAccounts();
$this->buildQuery();
- if ($this->with_accounts) {
- $field = 'a.uid';
- } else {
- $field = 'p.pid';
- }
- return (int)XDB::fetchOneCell('SELECT COUNT(DISTINCT ' . $field . ')
+ return (int)XDB::fetchOneCell('SELECT COUNT(DISTINCT a.uid)
+ ' . $this->query);
+ } else {
+ return $this->lastusercount;
+ }
+ }
+
+ public function getTotalProfileCount()
+ {
+ if (is_null($this->lastprofilecount)) {
+ $this->requireProfiles();
+ $this->buildQuery();
+ return (int)XDB::fetchOneCell('SELECT COUNT(DISTINCT p.pid)
' . $this->query);
} else {
- return $this->lastcount;
+ return $this->lastprofilecount;
}
}
{
return $this->getProfiles($limit);
}
+
+ public function filter(array $profiles, $limit = null)
+ {
+ return $this->filterProfiles($profiles, self::defaultLimit($limit));
+ }
+
+ public function getTotalCount()
+ {
+ return $this->getTotalProfileCount();
+ }
}
// }}}