3 if (!class_exists(
"report_visitor_absolute")) {
 
    7     class Report_visitor_absolute 
extends report_base
 
   15         protected $_sThisTemplate = 
"report_visitor_absolute.tpl";
 
   22         public function drawReport()
 
   26             $oSmarty = $this->getSmarty();
 
   27             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_from'])));
 
   28             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_to'])));
 
   30             if ($oDb->getOne(
"select 1 from oxlogs where oxtime >= $sTimeFrom and oxtime <= $sTimeTo")) {
 
   35             if ($oDb->getOne(
"select 1 from oxorder where oxorderdate >= $sTimeFrom and oxorderdate <= $sTimeTo")) {
 
   40             if ($oDb->getOne(
"select 1 from oxuser where oxcreate >= $sTimeFrom and oxcreate <= $sTimeTo")) {
 
   48         public function visitor_month()
 
   57             $dTimeFrom = mktime(23, 59, 59, date(
"m", $dTimeTo) - 12, date(
"d", $dTimeTo), date(
"Y", $dTimeTo));
 
   59             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", $dTimeTo));
 
   60             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", $dTimeFrom));
 
   62             $sSQL = 
"select oxtime, count(*) as nrof from oxlogs where oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxsessid";
 
   64             for ($i = 1; $i <= 12; $i++) {
 
   65                 $aTemp[date(
"m/Y", mktime(23, 59, 59, date(
"m", $dTimeFrom) + $i, date(
"d", $dTimeFrom), date(
"Y", $dTimeFrom)))] = 0;
 
   68             $rs = $oDb->execute($sSQL);
 
   69             if ($rs != 
false && $rs->recordCount() > 0) {
 
   71                     $aTemp[date(
"m/Y", strtotime($rs->fields[0]))]++;
 
   76             foreach ($aTemp as $key => $value) {
 
   77                 $aDataX[$key] = $value;
 
   84             $sSQL = 
"select oxorderdate from oxorder where oxorderdate >= $sTimeFrom and oxorderdate <= $sTimeTo order by oxorderdate";
 
   86             $rs = $oDb->execute($sSQL);
 
   87             if ($rs != 
false && $rs->recordCount() > 0) {
 
   89                     $aTemp[date(
"m/Y", strtotime($rs->fields[0]))]++;
 
   94             foreach ($aTemp as $key => $value) {
 
   95                 $aDataX2[$key] = $value;
 
   99             $sSQL = 
"select oxcreate from oxuser where oxcreate >= $sTimeFrom and oxcreate <= $sTimeTo order by oxcreate";
 
  101             $rs = $oDb->execute($sSQL);
 
  102             if ($rs != 
false && $rs->recordCount() > 0) {
 
  104                     $aTemp[date(
"m/Y", strtotime($rs->fields[0]))]++;
 
  109             foreach ($aTemp as $key => $value) {
 
  110                 $aDataX3[$key] = $value;
 
  114             header(
"Content-type: image/png");
 
  117             $graph = 
new Graph(800, 600);
 
  119             $graph->setBackgroundImage(
$myConfig->getImageDir(
true) . 
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
 
  122             $graph->setScale(
"textlin");
 
  125             $graph->xaxis->setLabelAlign(
'center', 
'top', 
'right');
 
  128             $graph->yaxis->setLabelAlign(
'right', 
'bottom');
 
  132             $graph->xaxis->setTickLabels($aDataY);
 
  136             $graph->title->set(
"Monat");
 
  139             $graph->title->setFont(FF_FONT1, FS_BOLD);
 
  141             $aDataFinalX = array();
 
  142             foreach ($aDataX as $dData) {
 
  143                 $aDataFinalX[] = $dData;
 
  146             $bplot = 
new BarPlot($aDataFinalX);
 
  147             $bplot->setFillGradient(
"navy", 
"lightsteelblue", GRAD_VER);
 
  148             $bplot->setLegend(
"Besucher");
 
  150             $aDataFinalX2 = array();
 
  151             foreach ($aDataX2 as $dData) {
 
  152                 $aDataFinalX2[] = $dData;
 
  155             $bplot2 = 
new BarPlot($aDataFinalX2);
 
  156             $bplot2->setFillColor(
"orange");
 
  157             $bplot2->setLegend(
"Kaeufer");
 
  159             $aDataFinalX3 = array();
 
  160             foreach ($aDataX3 as $dData) {
 
  161                 $aDataFinalX3[] = $dData;
 
  164             $bplot3 = 
new BarPlot($aDataFinalX3);
 
  165             $bplot3->setFillColor(
"silver");
 
  166             $bplot3->setLegend(
"Neukunden");
 
  169             $gbplot = 
new groupBarPlot(array($bplot, $bplot2, $bplot3));
 
  170             $graph->add($gbplot);
 
  180         public function visitor_week()
 
  188             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_to"))));
 
  189             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_from"))));
 
  191             $sSQL = 
"select oxtime, count(*) as nrof from oxlogs where oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxsessid order by oxtime";
 
  193             $rs = $oDb->execute($sSQL);
 
  194             if ($rs != 
false && $rs->recordCount() > 0) {
 
  197                     $aTemp[
oxRegistry::get(
"oxUtilsDate")->getWeekNumber(
$myConfig->getConfigParam(
'iFirstWeekDay'), strtotime($rs->fields[0]))]++;
 
  203             list($iFrom, $iTo) = $this->getWeekRange();
 
  204             for ($i = $iFrom; $i < $iTo; $i++) {
 
  208                 $aDataY[] = 
"KW " . $i;
 
  211             foreach ($aTemp as $key => $value) {
 
  212                 $aDataX[$key] = $value;
 
  215                 $aDataY[] = 
"KW " . $key;
 
  219             $sSQL = 
"select oxorderdate from oxorder where oxorderdate >= $sTimeFrom and oxorderdate <= $sTimeTo order by oxorderdate";
 
  221             $rs = $oDb->execute($sSQL);
 
  222             if ($rs != 
false && $rs->recordCount() > 0) {
 
  225                     $aTemp[
oxRegistry::get(
"oxUtilsDate")->getWeekNumber(
$myConfig->getConfigParam(
'iFirstWeekDay'), strtotime($rs->fields[0]))]++;
 
  230             foreach ($aTemp as $key => $value) {
 
  231                 $aDataX2[$key] = $value;
 
  235             $sSQL = 
"select oxcreate from oxuser where oxcreate >= $sTimeFrom and oxcreate <= $sTimeTo order by oxcreate";
 
  237             $rs = $oDb->execute($sSQL);
 
  238             if ($rs != 
false && $rs->recordCount() > 0) {
 
  241                     $aTemp[
oxRegistry::get(
"oxUtilsDate")->getWeekNumber(
$myConfig->getConfigParam(
'iFirstWeekDay'), strtotime($rs->fields[0]))]++;
 
  246             foreach ($aTemp as $key => $value) {
 
  247                 $aDataX3[$key] = $value;
 
  250             header(
"Content-type: image/png");
 
  253             $graph = 
new Graph(max(800, count($aDataX) * 80), 600);
 
  255             $graph->setBackgroundImage(
$myConfig->getImageDir(
true) . 
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
 
  258             $graph->setScale(
"textlin");
 
  261             $graph->xaxis->setLabelAlign(
'center', 
'top', 
'right');
 
  264             $graph->yaxis->setLabelAlign(
'right', 
'bottom');
 
  268             $graph->xaxis->setTickLabels($aDataY);
 
  272             $graph->title->set(
"Woche");
 
  275             $graph->title->setFont(FF_FONT1, FS_BOLD);
 
  277             $aDataFinalX = array();
 
  278             foreach ($aDataX as $dData) {
 
  279                 $aDataFinalX[] = $dData;
 
  282             $bplot = 
new BarPlot($aDataFinalX);
 
  283             $bplot->setFillGradient(
"navy", 
"lightsteelblue", GRAD_VER);
 
  284             $bplot->setLegend(
"Besucher");
 
  286             $aDataFinalX2 = array();
 
  287             foreach ($aDataX2 as $dData) {
 
  288                 $aDataFinalX2[] = $dData;
 
  291             $bplot2 = 
new BarPlot($aDataFinalX2);
 
  292             $bplot2->setFillColor(
"orange");
 
  293             $bplot2->setLegend(
"Kaeufer");
 
  295             $aDataFinalX3 = array();
 
  296             foreach ($aDataX3 as $dData) {
 
  297                 $aDataFinalX3[] = $dData;
 
  300             $bplot3 = 
new BarPlot($aDataFinalX3);
 
  301             $bplot3->setFillColor(
"silver");
 
  302             $bplot3->setLegend(
"Neukunden");
 
  305             $gbplot = 
new groupBarPlot(array($bplot, $bplot2, $bplot3));
 
  306             $graph->add($gbplot);