Add optional use of $offset to limit the list

This commit is contained in:
Miles Lott 2001-03-26 20:44:49 +00:00
parent d65679273d
commit 501f75b630
2 changed files with 31 additions and 4 deletions

View File

@ -141,10 +141,33 @@
$this->db->query('DELETE FROM phpgw_accounts WHERE account_id='.$account_id);
}
function get_list($_type='both')
function get_list($_type='both', $start = '',$sort = '', $order = '', $query = '', $offset = '')
{
global $phpgw;
if ($offset)
{
$limitclause = $phpgw->db->limit($start,$offset);
}
elseif ($start && !$offset)
{
$limitclause = $phpgw->db->limit($start);
}
if (! $sort)
{
$sort = "desc";
}
if ($order)
{
$orderclause = "order by $order $sort";
}
else
{
$orderclause = "order by account_lid,account_lastname,account_firstname asc";
}
$ds = $phpgw->common->ldapConnect();
switch($_type)
@ -159,7 +182,7 @@
$whereclause = "";
}
$sql = "select * from phpgw_accounts $whereclause";
$sql = "select * from phpgw_accounts $whereclause $orderclause $limitclause";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record()) {
// get user information from ldap only, if it's a user, not a group

View File

@ -76,11 +76,15 @@
}
function get_list($_type='both',$start = '',$sort = '', $order = '', $query = '')
function get_list($_type='both',$start = '',$sort = '', $order = '', $query = '', $offset = '')
{
global $phpgw, $phpgw_info;
if ($start)
if ($offset)
{
$limitclause = $phpgw->db->limit($start,$offset);
}
elseif ($start && !$offset)
{
$limitclause = $phpgw->db->limit($start);
}