ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/includes/graphs/banner_infobox.php
Go to the documentation of this file.
00001 <?php
00009 if (!defined('IS_ADMIN_FLAG')) {
00010   die('Illegal Access');
00011 }
00012   include(DIR_WS_CLASSES . 'phplot.php');
00013 
00014   $stats = array();
00015   $banner_stats = $db->Execute("select dayofmonth(banners_history_date) as name, banners_shown as value, banners_clicked as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . (int)$banner_id . "' and to_days(now()) - to_days(banners_history_date) < " . zen_db_input($days) . " order by banners_history_date");
00016   while (!$banner_stats->EOF) {
00017     $stats[] = array($banner_stats->fields['name'], $banner_stats->fields['value'], $banner_stats->fields['dvalue']);
00018     $banner_stats->MoveNext();
00019   }
00020 
00021   if (sizeof($stats) < 1) $stats = array(array(date('j'), 0, 0));
00022 
00023   $graph = new PHPlot(200, 220, 'images/graphs/banner_infobox-' . $banner_id . '.' . $banner_extension);
00024 
00025   $graph->SetFileFormat($banner_extension);
00026   $graph->SetIsInline(1);
00027   $graph->SetPrintImage(0);
00028 
00029   $graph->draw_vert_ticks = 0;
00030   $graph->SetSkipBottomTick(1);
00031   $graph->SetDrawXDataLabels(0);
00032   $graph->SetDrawYGrid(0);
00033   $graph->SetPlotType('bars');
00034   $graph->SetDrawDataLabels(1);
00035   $graph->SetLabelScalePosition(1);
00036   $graph->SetMarginsPixels(15,15,15,30);
00037 
00038   $graph->SetTitleFontSize('4');
00039   $graph->SetTitle(TEXT_BANNERS_LAST_3_DAYS);
00040 
00041   $graph->SetDataValues($stats);
00042   $graph->SetDataColors(array('blue','red'),array('blue', 'red'));
00043 
00044   $graph->DrawGraph();
00045 
00046   $graph->PrintImage();
 All Data Structures Namespaces Files Functions Variables Enumerations