[ 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_syndication.view.php (source)

   1  <?php
   2  /**

   3   * This file implements the UI view for the syndication 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_syndication.view.php,v 1.1 2007/06/25 11:01:08 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_('XML hits summary').'</h2>';
  31  echo '<p>'.sprintf( T_('These are hits from <a %s>XML readers</a>. This includes RSS and Atom readers.'), ' href="?ctrl=stats&amp;tab=useragents&amp;agnt_rss=1&amp;blog='.$blog.'"' ).'</p>';
  32  echo '<p>'.T_('Any user agent accessing the XML feeds will be flagged as an XML reader.').'</p>';
  33  $sql = "
  34      SELECT COUNT(*) AS hits, EXTRACT(YEAR FROM hit_datetime) AS year,
  35                 EXTRACT(MONTH FROM hit_datetime) AS month, EXTRACT(DAY FROM hit_datetime) AS day
  36          FROM T_hitlog INNER JOIN T_useragents ON hit_agnt_ID = agnt_ID
  37       WHERE agnt_type = 'rss'";
  38  if( $blog > 0 )
  39  {
  40      $sql .= ' AND hit_blog_ID = '.$blog;
  41  }
  42  $sql .= ' GROUP BY year, month, day
  43                      ORDER BY year DESC, month DESC, day DESC';
  44  $res_hits = $DB->get_results( $sql, ARRAY_A, 'Get rss summary' );
  45  
  46  
  47  /*

  48   * Chart

  49   */
  50  if( count($res_hits) )
  51  {
  52      $last_date = 0;
  53  
  54      $chart[ 'chart_data' ][ 0 ] = array();
  55      $chart[ 'chart_data' ][ 1 ] = array();
  56  
  57      $count = 0;
  58      foreach( $res_hits as $row_stats )
  59      {
  60          $this_date = mktime( 0, 0, 0, $row_stats['month'], $row_stats['day'], $row_stats['year'] );
  61          if( $last_date != $this_date )
  62          { // We just hit a new day, let's display the previous one:
  63                  $last_date = $this_date;    // that'll be the next one

  64                  $count ++;
  65                  array_unshift( $chart[ 'chart_data' ][ 0 ], date( locale_datefmt(), $last_date ) );
  66                  array_unshift( $chart[ 'chart_data' ][ 1 ], 0 );
  67          }
  68          $chart [ 'chart_data' ][1][0] = $row_stats['hits'];
  69      }
  70  
  71      array_unshift( $chart[ 'chart_data' ][ 0 ], '' );
  72      array_unshift( $chart[ 'chart_data' ][ 1 ], 'XML (RSS/Atom) hits' );    // Translations need to be UTF-8

  73  
  74      $chart[ 'canvas_bg' ] = array (
  75              'width'  => 780,
  76              'height' => 400,
  77              'color'  => 'efede0'
  78          );
  79  
  80      $chart[ 'chart_rect' ] = array (
  81              'x'      => 50,
  82              'y'      => 50,
  83              'width'  => 700,
  84              'height' => 250
  85          );
  86  
  87      $chart[ 'legend_rect' ] = array (
  88              'x'      => 50,
  89              'y'      => 365,
  90              'width'  => 700,
  91              'height' => 8,
  92              'margin' => 6
  93          );
  94  
  95      $chart[ 'draw_text' ] = array (
  96              array (
  97                      'color'    => '9e9286',
  98                      'alpha'    => 75,
  99                      'font'     => "arial",
 100                      'rotation' => 0,
 101                      'bold'     => true,
 102                      'size'     => 42,
 103                      'x'        => 50,
 104                      'y'        => 6,
 105                      'width'    => 700,
 106                      'height'   => 50,
 107                      'text'     => 'XML hits', // Needs UTF-8
 108                      'h_align'  => "right",
 109                      'v_align'  => "bottom" ),
 110              );
 111  
 112      $chart[ 'chart_bg' ] = array (
 113              'positive_color' => "ffffff",
 114              // 'negative_color'  =>  string,

 115              'positive_alpha' => 20,
 116              // 'negative_alpha'  =>  int

 117          );
 118  
 119      $chart [ 'legend_bg' ] = array (
 120              'bg_color'          =>  "ffffff",
 121              'bg_alpha'          =>  20,
 122              // 'border_color'      =>  "000000",

 123              // 'border_alpha'      =>  100,

 124              // 'border_thickness'  =>  1

 125          );
 126  
 127      $chart [ 'legend_label' ] = array(
 128              // 'layout'  =>  "horizontal",

 129              // 'font'    =>  string,

 130              // 'bold'    =>  boolean,

 131              'size'    =>  10,
 132              // 'color'   =>  string,

 133              // 'alpha'   =>  int

 134          );
 135  
 136      $chart[ 'chart_border' ] = array (
 137              'color'=>"000000",
 138              'top_thickness'=>1,
 139              'bottom_thickness'=>1,
 140              'left_thickness'=>1,
 141              'right_thickness'=>1
 142          );
 143  
 144      $chart[ 'chart_type' ] = 'stacked column';
 145  
 146      // $chart[ 'series_color' ] = array ( "4e627c", "c89341" );

 147  
 148      $chart[ 'series_gap' ] = array ( 'set_gap'=>0, 'bar_gap'=>0 );
 149  
 150  
 151      $chart[ 'axis_category' ] = array (
 152              'font'  =>"arial",
 153              'bold'  =>true,
 154              'size'  =>11,
 155              'color' =>'000000',
 156              'alpha' =>75,
 157              'orientation' => 'diagonal_up',
 158              // 'skip'=>2

 159          );
 160  
 161      $chart[ 'axis_value' ] = array (
 162              // 'font'   =>"arial",

 163              // 'bold'   =>true,

 164              'size'   => 11,
 165              'color'  => '000000',
 166              'alpha'  => 75,
 167              'steps'  => 4,
 168              'prefix' => "",
 169              'suffix' => "",
 170              'decimals'=> 0,
 171              'separator'=> "",
 172              'show_min'=> false );
 173  
 174      $chart [ 'chart_value' ] = array (
 175              // 'prefix'         =>  string,

 176              // 'suffix'         =>  " views",

 177              // 'decimals'       =>  int,

 178              // 'separator'      =>  string,

 179              'position'       =>  "cursor",
 180              'hide_zero'      =>  true,
 181              // 'as_percentage'  =>  boolean,

 182              'font'           =>  "arial",
 183              'bold'           =>  true,
 184              'size'           =>  20,
 185              'color'          =>  "ffffff",
 186              'alpha'          =>  75
 187          );
 188  
 189      echo '<div class="center">';
 190      DrawChart( $chart );
 191      echo '</div>';
 192  
 193  }
 194  
 195  /*

 196   * $Log: _stats_syndication.view.php,v $

 197   * Revision 1.1  2007/06/25 11:01:08  fplanque

 198   * MODULES (refactored MVC)

 199   *

 200   * Revision 1.6  2007/04/26 00:11:13  fplanque

 201   * (c) 2007

 202   *

 203   * Revision 1.5  2007/02/10 17:59:03  waltercruz

 204   * Changing double quotes to single quotes and the MySQL date functions to the standart ones

 205   *

 206   * Revision 1.4  2006/11/26 23:39:29  blueyed

 207   * trans: "and" instead of "&amp;" (Which should have been "&" anyway!)

 208   *

 209   * Revision 1.3  2006/11/24 18:27:26  blueyed

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

 211   */
 212  ?>


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