source: trunk/admin/inc/class.soaccess_history.inc.php @ 2

Revision 2, 2.0 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare - Administration                                              *
4        * http://www.egroupware.org                                                *
5        * --------------------------------------------                             *
6        *  This program is free software; you can redistribute it and/or modify it *
7        *  under the terms of the GNU General Public License as published by the   *
8        *  Free Software Foundation; either version 2 of the License, or (at your  *
9        *  option) any later version.                                              *
10        \**************************************************************************/
11
12
13        class soaccess_history
14        {
15                var $db;
16
17                function soaccess_history()
18                {
19                        $this->db       = $GLOBALS['phpgw']->db;
20                }
21
22                function test_account_id($account_id)
23                {
24                        if ($account_id)
25                        {
26                                return " where account_id='$account_id'";
27                        }
28                }
29
30                function list_history($account_id,$start,$order,$sort)
31                {
32                        $where = $this->test_account_id($account_id);
33
34                        $this->db->limit_query("select loginid,ip,li,lo,account_id,sessionid from phpgw_access_log $where order by li desc",$start,__LINE__,__FILE__);
35                        while ($this->db->next_record())
36                        {
37                                $records[] = array(
38                                        'loginid'    => $this->db->f('loginid'),
39                                        'ip'         => $this->db->f('ip'),
40                                        'li'         => $this->db->f('li'),
41                                        'lo'         => $this->db->f('lo'),
42                                        'account_id' => $this->db->f('account_id'),
43                                        'sessionid'  => $this->db->f('sessionid')
44                                );
45                        }
46                        return $records;
47                }
48
49                function total($account_id)
50                {
51                        $where = $this->test_account_id($account_id);
52
53                        $this->db->query("select count(*) from phpgw_access_log $where");
54                        $this->db->next_record();
55
56                        return $this->db->f(0);
57                }
58
59                function return_logged_out($account_id)
60                {
61                        if ($account_id)
62                        {
63                                $where = "and account_id='$account_id'";
64                        }
65
66                        $this->db->query("select count(*) from phpgw_access_log where lo!=0 $where");
67                        $this->db->next_record();
68
69                        return $this->db->f(0);
70                }
71        }
Note: See TracBrowser for help on using the repository browser.