2001-07-13 09:02:34 +02:00
|
|
|
<?php
|
2001-07-13 09:05:19 +02:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - Administration *
|
|
|
|
* http://www.phpgroupware.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$ */
|
2001-07-13 09:02:34 +02:00
|
|
|
|
|
|
|
class uiaccess_history
|
|
|
|
{
|
|
|
|
var $template;
|
|
|
|
var $public_functions = array(
|
2001-12-21 04:41:06 +01:00
|
|
|
'list_history' => True
|
|
|
|
);
|
2001-07-13 09:02:34 +02:00
|
|
|
|
|
|
|
function uiaccess_history()
|
|
|
|
{
|
|
|
|
$this->bo = createobject('admin.boaccess_history');
|
|
|
|
$this->nextmatchs = createobject('phpgwapi.nextmatchs');
|
2001-09-02 01:40:28 +02:00
|
|
|
$this->template = $GLOBALS['phpgw']->template;
|
|
|
|
$this->template->set_file(
|
|
|
|
Array(
|
|
|
|
'accesslog' => 'accesslog.tpl'
|
|
|
|
)
|
|
|
|
);
|
2001-07-13 09:02:34 +02:00
|
|
|
$this->template->set_block('accesslog','list');
|
|
|
|
$this->template->set_block('accesslog','row');
|
|
|
|
$this->template->set_block('accesslog','row_empty');
|
|
|
|
}
|
|
|
|
|
|
|
|
function list_history()
|
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
$account_id = ($GLOBALS['HTTP_GET_VARS']['account_id']?$GLOBALS['HTTP_GET_VARS']['account_id']:$GLOBALS['HTTP_POST_VARS']['account_id']);
|
|
|
|
$start = ($GLOBALS['HTTP_POST_VARS']['start']?$GLOBALS['HTTP_POST_VARS']['start']:0);
|
|
|
|
$sort = ($GLOBALS['HTTP_POST_VARS']['sort']?$GLOBALS['HTTP_POST_VARS']['sort']:0);
|
|
|
|
$order = ($GLOBALS['HTTP_POST_VARS']['order']?$GLOBALS['HTTP_POST_VARS']['order']:0);
|
|
|
|
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
2001-07-13 09:02:34 +02:00
|
|
|
echo parse_navbar();
|
|
|
|
|
|
|
|
$total_records = $this->bo->total($account_id);
|
|
|
|
|
2001-09-02 01:40:28 +02:00
|
|
|
$var = Array(
|
2001-12-21 04:41:06 +01:00
|
|
|
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
|
|
|
'nextmatchs_left' => $this->nextmatchs->left('/index.php',$start,$total_records,'&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id),
|
|
|
|
'nextmatchs_right' => $this->nextmatchs->right('/index.php',$start,$total_records,'&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id),
|
|
|
|
'showing' => $this->nextmatchs->show_hits($total_records,$start),
|
|
|
|
'lang_loginid' => lang('LoginID'),
|
|
|
|
'lang_ip' => lang('IP'),
|
|
|
|
'lang_login' => lang('Login'),
|
|
|
|
'lang_logout' => lang('Logout'),
|
|
|
|
'lang_total' => lang('Total')
|
2001-09-02 01:40:28 +02:00
|
|
|
);
|
2001-07-13 09:02:34 +02:00
|
|
|
|
|
|
|
if ($account_id)
|
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
$var['link_return_to_view_account'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php',
|
2001-12-21 04:41:06 +01:00
|
|
|
Array(
|
|
|
|
'menuaction' => 'admin.uiaccounts.view',
|
|
|
|
'account_id' => $account_id
|
|
|
|
)
|
|
|
|
) . '">' . lang('Return to view account') . '</a>';
|
2001-09-02 01:40:28 +02:00
|
|
|
$var['lang_last_x_logins'] = lang('Last %1 logins for %2',$total_records,$this->bo->grab_fullname($account_id));
|
2001-07-13 09:02:34 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
$var['lang_last_x_logins'] = lang('Last x logins',$total_records);
|
2001-07-13 09:02:34 +02:00
|
|
|
}
|
|
|
|
|
2001-09-02 01:40:28 +02:00
|
|
|
$this->template->set_var($var);
|
2001-07-13 09:02:34 +02:00
|
|
|
|
|
|
|
$records = $this->bo->list_history($account_id,$start,$order,$sort);
|
|
|
|
while (is_array($records) && list(,$record) = each($records))
|
2001-12-21 04:41:06 +01:00
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
$this->nextmatchs->template_alternate_row_color($this->template);
|
|
|
|
|
2001-10-02 08:55:54 +02:00
|
|
|
$var = array(
|
|
|
|
'row_loginid' => $record['loginid'],
|
|
|
|
'row_ip' => $record['ip'],
|
|
|
|
'row_li' => $record['li'],
|
|
|
|
'row_lo' => $record['lo'],
|
|
|
|
'row_total' => ($record['lo']?$record['total']:' ')
|
2001-09-02 01:40:28 +02:00
|
|
|
);
|
|
|
|
$this->template->set_var($var);
|
2001-08-28 23:50:10 +02:00
|
|
|
$this->template->fp('rows_access','row',True);
|
2001-07-13 09:02:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $total_records && $account_id)
|
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
$this->nextmatchs->template_alternate_row_color($this->template);
|
2001-07-13 09:02:34 +02:00
|
|
|
$this->template->set_var('row_message',lang('No login history exists for this user'));
|
2001-08-28 23:50:10 +02:00
|
|
|
$this->template->fp('rows_access','row_empty',True);
|
2001-07-13 09:02:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$loggedout = $this->bo->return_logged_out($account_id);
|
|
|
|
|
|
|
|
if ($total_records)
|
|
|
|
{
|
|
|
|
$percent = round((10000 * ($loggedout / $total_records)) / 100);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$percent = '0';
|
|
|
|
}
|
|
|
|
|
2001-09-02 01:40:28 +02:00
|
|
|
$var = Array(
|
2001-12-21 04:41:06 +01:00
|
|
|
'bg_color' => $GLOBALS['phpgw_info']['themes']['bg_color'],
|
|
|
|
'footer_total' => lang('Total records') . ': ' . $total_records
|
2001-09-02 01:40:28 +02:00
|
|
|
);
|
2001-07-13 09:02:34 +02:00
|
|
|
if ($account_id)
|
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
$var['lang_percent'] = lang('Percent this user has logged out') . ': ' . $percent . '%';
|
2001-07-13 09:02:34 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-09-02 01:40:28 +02:00
|
|
|
$var['lang_percent'] = lang('Percent of users that logged out') . ': ' . $percent . '%';
|
2001-07-13 09:02:34 +02:00
|
|
|
}
|
2001-12-21 04:41:06 +01:00
|
|
|
|
2001-08-28 23:50:10 +02:00
|
|
|
// create the menu on the left, if needed
|
|
|
|
$menuClass = CreateObject('admin.uimenuclass');
|
2001-09-02 01:40:28 +02:00
|
|
|
$var['rows'] = $menuClass->createHTMLCode('view_account');
|
2001-12-21 04:41:06 +01:00
|
|
|
|
2001-09-02 01:40:28 +02:00
|
|
|
$this->template->set_var($var);
|
2001-07-13 09:02:34 +02:00
|
|
|
$this->template->pfp('out','list');
|
|
|
|
}
|
|
|
|
}
|