1
0
mirror of https://github.com/EGroupware/egroupware.git synced 2024-12-18 04:31:06 +01:00
egroupware_official/admin/inc/class.soaccess_history.inc.php

67 lines
1.9 KiB
PHP
Raw Normal View History

<?php
/**************************************************************************\
2004-01-27 00:26:19 +01:00
* eGroupWare - Administration *
* http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
class soaccess_history
{
var $db;
2005-11-13 10:47:05 +01:00
var $table = 'egw_access_log';
function soaccess_history()
{
2005-11-13 10:47:05 +01:00
$this->db = clone($GLOBALS['egw']->db);
$this->db->set_app('phpgwapi');
}
function test_account_id($account_id)
{
if ($account_id)
{
2005-11-13 10:47:05 +01:00
return array('account_id' => $account_id);
}
2005-11-13 10:47:05 +01:00
return false;
}
2005-11-13 10:47:05 +01:00
function &list_history($account_id,$start,$order,$sort)
{
$where = $this->test_account_id($account_id);
2005-11-13 10:47:05 +01:00
$this->db->select($this->table,'loginid,ip,li,lo,account_id,sessionid',$where,__LINE__,__FILE__,(int) $start,'ORDER BY li DESC');
while (($row = $this->db->row(true)))
{
2005-11-13 10:47:05 +01:00
$records[] = $row;
}
return $records;
}
function total($account_id)
{
$where = $this->test_account_id($account_id);
2005-11-13 10:47:05 +01:00
$this->db->select($this->table,'COUNT(*)',$where,__LINE__,__FILE__);
2005-11-13 10:47:05 +01:00
return $this->db->next_record() ? $this->db->f(0) : 0;
}
function return_logged_out($account_id)
{
2005-11-13 10:47:05 +01:00
$where = array('lo != 0');
if ($account_id)
{
2005-11-13 10:47:05 +01:00
$where['account_id'] = $account_id;
}
2005-11-13 10:47:05 +01:00
$this->db->select($this->table,'COUNT(*)',$where,__LINE__,__FILE__);
return $this->db->next_record() ? $this->db->f(0) : 0;
}
2001-09-02 09:30:46 +02:00
}