[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/admin/inc/ -> class.uiaccess_history.inc.php (source)

   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      /* $Id: class.uiaccess_history.inc.php 20295 2006-02-15 12:31:25Z  $ */
  13  
  14      class uiaccess_history
  15      {
  16          var $template;
  17          var $public_functions = array(
  18              'list_history' => True
  19          );
  20  
  21  		function uiaccess_history()
  22          {
  23              if ($GLOBALS['egw']->acl->check('access_log_access',1,'admin'))
  24              {
  25                  $GLOBALS['egw']->redirect_link('/index.php');
  26              }
  27              
  28              $this->bo         =& CreateObject('admin.boaccess_history');
  29              $this->nextmatchs =& CreateObject('phpgwapi.nextmatchs');
  30              $this->template   = $GLOBALS['egw']->template;
  31              $this->template->set_file(
  32                  Array(
  33                      'accesslog' => 'accesslog.tpl'
  34                  )
  35              );
  36              $this->template->set_block('accesslog','list');
  37              $this->template->set_block('accesslog','row');
  38              $this->template->set_block('accesslog','row_empty');
  39          }
  40  
  41  		function list_history()
  42          {
  43              $account_id = get_var('account_id',array('GET','POST'));
  44              $start = get_var('start',array('POST'),0);
  45              $sort = get_var('sort',array('POST'),0);
  46              $order = get_var('order',array('POST'),0);
  47              
  48              $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('View access log');
  49              if(!@is_object($GLOBALS['egw']->js))
  50              {
  51                  $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
  52              }
  53              $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin');
  54              $GLOBALS['egw']->common->egw_header();
  55              echo parse_navbar();
  56  
  57              $total_records = $this->bo->total($account_id);
  58  
  59              $var = Array(
  60                  'th_bg'       => $GLOBALS['egw_info']['theme']['th_bg'],
  61                  'nextmatchs_left'  => $this->nextmatchs->left('/index.php',$start,$total_records,'&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id),
  62                  'nextmatchs_right' => $this->nextmatchs->right('/index.php',$start,$total_records,'&menuaction=admin.uiaccess_history.list_history&account_id=' . $account_id),
  63                  'showing'          => $this->nextmatchs->show_hits($total_records,$start),
  64                  'lang_loginid'     => lang('LoginID'),
  65                  'lang_ip'     => lang('IP'),
  66                  'lang_login'  => lang('Login'),
  67                  'lang_logout' => lang('Logout'),
  68                  'lang_total'  => lang('Total')
  69              );
  70  
  71              if ($account_id)
  72              {
  73                  $var['link_return_to_view_account'] = '<a href="' . $GLOBALS['egw']->link('/index.php',
  74                      Array(
  75                          'menuaction' => 'admin.uiaccounts.view',
  76                          'account_id' => $account_id
  77                      )
  78                  ) . '">' . lang('Return to view account') . '</a>';
  79                  $var['lang_last_x_logins'] = lang('Last %1 logins for %2',$total_records,$GLOBALS['egw']->common->grab_owner_name($account_id));
  80              }
  81              else
  82              {
  83                  $var['lang_last_x_logins'] = lang('Last %1 logins',$total_records);
  84              }
  85  
  86              $this->template->set_var($var);
  87  
  88              $records = $this->bo->list_history($account_id,$start,$order,$sort);
  89              while (is_array($records) && list(,$record) = each($records))
  90              {
  91                  $this->nextmatchs->template_alternate_row_color($this->template);
  92  
  93                  $var = array(
  94                      'row_loginid' => $record['loginid'],
  95                      'row_ip'      => $record['ip'],
  96                      'row_li'      => $record['li'],
  97                      'row_lo'      => $record['account_id'] ? $record['lo'] : '<b>'.lang($record['sessionid']).'</b>',
  98                      'row_total'   => ($record['lo']?$record['total']:'&nbsp;')
  99                  );
 100                  $this->template->set_var($var);
 101                  $this->template->fp('rows_access','row',True);
 102              }
 103  
 104              if (! $total_records && $account_id)
 105              {
 106                  $this->nextmatchs->template_alternate_row_color($this->template);
 107                  $this->template->set_var('row_message',lang('No login history exists for this user'));
 108                  $this->template->fp('rows_access','row_empty',True);
 109              }
 110  
 111              $loggedout = $this->bo->return_logged_out($account_id);
 112  
 113              if ($total_records)
 114              {
 115                  $percent = round((10000 * ($loggedout / $total_records)) / 100);
 116              }
 117              else
 118              {
 119                  $percent = '0';
 120              }
 121  
 122              $var = Array(
 123                  'bg_color'     => $GLOBALS['egw_info']['themes']['bg_color'],
 124                  'footer_total' => lang('Total records') . ': ' . $total_records
 125              );
 126              if ($account_id)
 127              {
 128                  $var['lang_percent'] = lang('Percent this user has logged out') . ': ' . $percent . '%';
 129              }
 130              else
 131              {
 132                  $var['lang_percent'] = lang('Percent of users that logged out') . ': ' . $percent . '%';
 133              }
 134  
 135              // create the menu on the left, if needed
 136              $menuClass =& CreateObject('admin.uimenuclass');
 137              $var['rows'] = $menuClass->createHTMLCode('view_account');
 138  
 139              $this->template->set_var($var);
 140              $this->template->pfp('out','list');
 141          }
 142      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7