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

   1  <?php
   2  /*
   3    $Id: banner_monthly.php,v 1.3 2002/05/09 18:28:46 dgw_ 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  
  17    $stats = array();
  18    for ($i=1; $i<13; $i++) {
  19      $stats[] = array(strftime('%b', mktime(0,0,0,$i)), '0', '0');
  20    }
  21  
  22    $banner_stats_query = tep_db_query("select month(banners_history_date) as banner_month, sum(banners_shown) as value, sum(banners_clicked) as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $banner_id . "' and year(banners_history_date) = '" . $year . "' group by banner_month");
  23    while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
  24      $stats[($banner_stats['banner_month']-1)] = array(strftime('%b', mktime(0,0,0,$banner_stats['banner_month'])), (($banner_stats['value']) ? $banner_stats['value'] : '0'), (($banner_stats['dvalue']) ? $banner_stats['dvalue'] : '0'));
  25    }
  26  
  27    $graph = new PHPlot(600, 350, 'images/graphs/banner_monthly-' . $banner_id . '.' . $banner_extension);
  28  
  29    $graph->SetFileFormat($banner_extension);
  30    $graph->SetIsInline(1);
  31    $graph->SetPrintImage(0);
  32  
  33    $graph->SetSkipBottomTick(1);
  34    $graph->SetDrawYGrid(1);
  35    $graph->SetPrecisionY(0);
  36    $graph->SetPlotType('lines');
  37  
  38    $graph->SetPlotBorderType('left');
  39    $graph->SetTitleFontSize('4');
  40    $graph->SetTitle(sprintf(TEXT_BANNERS_MONTHLY_STATISTICS, $banner['banners_title'], $year));
  41  
  42    $graph->SetBackgroundColor('white');
  43  
  44    $graph->SetVertTickPosition('plotleft');
  45    $graph->SetDataValues($stats);
  46    $graph->SetDataColors(array('blue','red'),array('blue', 'red'));
  47  
  48    $graph->DrawGraph();
  49  
  50    $graph->PrintImage();
  51  ?>


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