[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/graphs/ -> banner_monthly.php (source)

   1  <?php
   2  /*

   3  $Id: banner_monthly.php 3 2006-05-27 04:59:07Z user $

   4    osCMax Power E-Commerce

   5    http://oscdox.com

   6    Copyright 2006 osCMax2005 osCMax, 2002 osCommerce

   7    Released under the GNU General Public License

   8  */
   9    include(DIR_WS_CLASSES . 'phplot.php');
  10    $year = (($HTTP_GET_VARS['year']) ? $HTTP_GET_VARS['year'] : date('Y'));
  11    $stats = array();
  12    for ($i=1; $i<13; $i++) {
  13      $stats[] = array(strftime('%b', mktime(0,0,0,$i)), '0', '0');
  14    }
  15    $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");
  16    while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
  17      $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'));
  18    }
  19    $graph = new PHPlot(600, 350, 'images/graphs/banner_monthly-' . $banner_id . '.' . $banner_extension);
  20    $graph->SetFileFormat($banner_extension);
  21    $graph->SetIsInline(1);
  22    $graph->SetPrintImage(0);
  23    $graph->SetSkipBottomTick(1);
  24    $graph->SetDrawYGrid(1);
  25    $graph->SetPrecisionY(0);
  26    $graph->SetPlotType('lines');
  27    $graph->SetPlotBorderType('left');
  28    $graph->SetTitleFontSize('4');
  29    $graph->SetTitle(sprintf(TEXT_BANNERS_MONTHLY_STATISTICS, $banner['banners_title'], $year));
  30    $graph->SetBackgroundColor('white');
  31    $graph->SetVertTickPosition('plotleft');
  32    $graph->SetDataValues($stats);
  33    $graph->SetDataColors(array('blue','red'),array('blue', 'red'));
  34    $graph->DrawGraph();
  35    $graph->PrintImage();
  36  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7