[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

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

   1  <?php
   2  /*

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


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