[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/admin/includes/graphs/ -> banner_daily.php (source)

   1  <?php
   2  /*
   3    $Id: banner_daily.php,v 1.2 2002/05/09 14:09:38 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2002 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    include(DIR_WS_CLASSES . 'phplot.php');
  14  
  15    $year = (($HTTP_GET_VARS['year']) ? $HTTP_GET_VARS['year'] : date('Y'));
  16    $month = (($HTTP_GET_VARS['month']) ? $HTTP_GET_VARS['month'] : date('n'));
  17  
  18    $days = (date('t', mktime(0,0,0,$month))+1);
  19    $stats = array();
  20    for ($i=1; $i<$days; $i++) {
  21      $stats[] = array($i, '0', '0');
  22    }
  23  
  24    $banner_stats_query = tep_db_query("select dayofmonth(banners_history_date) as banner_day, banners_shown as value, banners_clicked as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $banner_id . "' and month(banners_history_date) = '" . $month . "' and year(banners_history_date) = '" . $year . "'");
  25    while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
  26      $stats[($banner_stats['banner_day']-1)] = array($banner_stats['banner_day'], (($banner_stats['value']) ? $banner_stats['value'] : '0'), (($banner_stats['dvalue']) ? $banner_stats['dvalue'] : '0'));
  27    }
  28  
  29    $graph = new PHPlot(600, 350, 'images/graphs/banner_daily-' . $banner_id . '.' . $banner_extension);
  30  
  31    $graph->SetFileFormat($banner_extension);
  32    $graph->SetIsInline(1);
  33    $graph->SetPrintImage(0);
  34  
  35    $graph->SetSkipBottomTick(1);
  36    $graph->SetDrawYGrid(1);
  37    $graph->SetPrecisionY(0);
  38    $graph->SetPlotType('lines');
  39  
  40    $graph->SetPlotBorderType('left');
  41    $graph->SetTitleFontSize('4');
  42    $graph->SetTitle(sprintf(TEXT_BANNERS_DAILY_STATISTICS, $banner['banners_title'], strftime('%B', mktime(0,0,0,$month)), $year));
  43  
  44    $graph->SetBackgroundColor('white');
  45  
  46    $graph->SetVertTickPosition('plotleft');
  47    $graph->SetDataValues($stats);
  48    $graph->SetDataColors(array('blue','red'),array('blue', 'red'));
  49  
  50    $graph->DrawGraph();
  51  
  52    $graph->PrintImage();
  53  ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics