[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/sessions/views/ -> _stats_sessions.view.php (source)

   1  <?php
   2  /**

   3   * This file implements the UI view for the Session stats.

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.net/}

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   9   *

  10   * {@internal License choice

  11   * - If you have received this file as part of a package, please find the license.txt file in

  12   *   the same folder or the closest folder above for complete license terms.

  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  14   *   then you must choose one of the following licenses before using the file:

  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  17   * }}

  18   *

  19   * {@internal Open Source relicensing agreement:

  20   * }}

  21   *

  22   * @package admin

  23   *

  24   * @version $Id: _stats_sessions.view.php,v 1.1 2007/06/25 11:01:07 fplanque Exp $

  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  global $blog, $admin_url, $rsc_url;
  29  
  30  echo '<h2>'.T_('Last sessions').'</h2>';
  31  
  32  // Create result set:

  33  $sql = 'SELECT user_login, COUNT( sess_ID ) AS nb_sessions, MAX( sess_lastseen ) AS sess_lastseen
  34                      FROM T_sessions LEFT JOIN T_users ON sess_user_ID = user_ID
  35                   GROUP BY user_login';
  36  
  37  $count_sql = 'SELECT COUNT( DISTINCT(user_login) )
  38                                  FROM T_sessions LEFT JOIN T_users ON sess_user_ID = user_ID';
  39  
  40  $Results = & new Results( $sql, 'usess_', '-D', 20, $count_sql );
  41  
  42  $Results->title = T_('Last sessions');
  43  
  44  function stat_session_login( $login )
  45  {
  46      if( empty($login) )
  47      {
  48          return T_('Anonymous');
  49      }
  50      else
  51      {
  52          return '<strong>'.$login.'</strong>';
  53      }
  54  }
  55  $Results->cols[] = array(
  56                          'th' => T_('User login'),
  57                          'order' => 'user_login',
  58                          'td' => '%stat_session_login( #user_login# )%',
  59                      );
  60  
  61  $Results->cols[] = array(
  62                          'th' => T_('Last seen'),
  63                          'order' => 'sess_lastseen',
  64                          'default_dir' => 'D',
  65                          'td' => '%mysql2localedatetime( #sess_lastseen# )%',
  66                       );
  67  
  68  $Results->cols[] = array(
  69                          'th' => T_('Session count'),
  70                          'order' => 'nb_sessions',
  71                          'td_class' => 'right',
  72                          'total_class' => 'right',
  73                          'td' => '$nb_sessions$',
  74                      );
  75  
  76  // Display results:

  77  $Results->display();
  78  
  79  /*

  80   * $Log: _stats_sessions.view.php,v $

  81   * Revision 1.1  2007/06/25 11:01:07  fplanque

  82   * MODULES (refactored MVC)

  83   *

  84   * Revision 1.3  2007/04/26 00:11:13  fplanque

  85   * (c) 2007

  86   *

  87   * Revision 1.2  2006/11/24 18:27:26  blueyed

  88   * Fixed link to b2evo CVS browsing interface in file docblocks

  89   */
  90  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics