PFAHandler:

- add support for LIMIT/OFFSET to getList()

AliasHandler:
- overload getList() to only return non-mailbox aliases


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1353 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 12 years ago
parent d03e239515
commit b99adf6237

@ -244,6 +244,11 @@ class AliasHandler extends PFAHandler {
return $db_result;
}
public function getList($condition, $limit=-1, $offset=-1) {
# only list aliases that do not belong to mailboxes
return parent::getList( "__is_mailbox IS NULL AND ( $condition )", $limit, $offset);
}
/* delete is already implemented in the "old functions" section
public function delete() {
$this->errormsg[] = '*** Alias domain deletion not implemented yet ***';

@ -214,7 +214,7 @@ class PFAHandler {
* @param array or string - condition (an array will be AND'ed using db_where_clause, a string will be directly used)
* @return array - rows
*/
protected function read_from_db($condition) {
protected function read_from_db($condition, $limit=-1, $offset=-1) {
$select_cols = array();
$yes = escape_string(Lang::read('YES'));
@ -266,6 +266,11 @@ class PFAHandler {
}
$query = "SELECT $cols FROM $table $extrafrom $where ORDER BY " . $this->id_field;
if ($limit > -1 && $offset > -1) {
$query .= " LIMIT $limit OFFSET $offset ";
}
$result = db_query($query);
$db_result = array();
@ -309,8 +314,8 @@ class PFAHandler {
* @return bool - true if at least one item was found
* The data is stored in $this->return (as array of rows, each row is an associative array of column => value)
*/
public function getList($condition) {
$result = $this->read_from_db($condition);
public function getList($condition, $limit=-1, $offset=-1) {
$result = $this->read_from_db($condition, $limit, $offset);
if (count($result) >= 1) {
$this->return = $result;
return true;

Loading…
Cancel
Save