3 if (!class_exists(
"report_visitor_absolute")) {
9 class Report_visitor_absolute
extends report_base
17 protected $_sThisTemplate =
"report_visitor_absolute.tpl";
24 public function drawReport()
28 $oSmarty = $this->getSmarty();
29 $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_from'])));
30 $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_to'])));
32 if ($oDb->getOne(
"select 1 from oxlogs where oxtime >= $sTimeFrom and oxtime <= $sTimeTo")) {
37 if ($oDb->getOne(
"select 1 from oxorder where oxorderdate >= $sTimeFrom and oxorderdate <= $sTimeTo")) {
42 if ($oDb->getOne(
"select 1 from oxuser where oxcreate >= $sTimeFrom and oxcreate <= $sTimeTo")) {
50 public function visitor_month()
59 $dTimeFrom = mktime(23, 59, 59, date(
"m", $dTimeTo) - 12, date(
"d", $dTimeTo), date(
"Y", $dTimeTo));
61 $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", $dTimeTo));
62 $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", $dTimeFrom));
64 $sSQL =
"select oxtime, count(*) as nrof from oxlogs where oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxsessid";
66 for ($i = 1; $i <= 12; $i++) {
67 $aTemp[date(
"m/Y", mktime(23, 59, 59, date(
"m", $dTimeFrom) + $i, date(
"d", $dTimeFrom), date(
"Y", $dTimeFrom)))] = 0;
70 $rs = $oDb->execute($sSQL);
71 if ($rs !=
false && $rs->recordCount() > 0) {
73 $aTemp[date(
"m/Y", strtotime($rs->fields[0]))]++;
78 foreach ($aTemp as $key => $value) {
79 $aDataX[$key] = $value;
86 $sSQL =
"select oxorderdate from oxorder where oxorderdate >= $sTimeFrom and oxorderdate <= $sTimeTo order by oxorderdate";
88 $rs = $oDb->execute($sSQL);
89 if ($rs !=
false && $rs->recordCount() > 0) {
91 $aTemp[date(
"m/Y", strtotime($rs->fields[0]))]++;
96 foreach ($aTemp as $key => $value) {
97 $aDataX2[$key] = $value;
101 $sSQL =
"select oxcreate from oxuser where oxcreate >= $sTimeFrom and oxcreate <= $sTimeTo order by oxcreate";
103 $rs = $oDb->execute($sSQL);
104 if ($rs !=
false && $rs->recordCount() > 0) {
106 $aTemp[date(
"m/Y", strtotime($rs->fields[0]))]++;
111 foreach ($aTemp as $key => $value) {
112 $aDataX3[$key] = $value;
116 header(
"Content-type: image/png");
119 $graph =
new Graph(800, 600);
121 $graph->setBackgroundImage(
$myConfig->getImageDir(
true) .
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
124 $graph->setScale(
"textlin");
127 $graph->xaxis->setLabelAlign(
'center',
'top',
'right');
130 $graph->yaxis->setLabelAlign(
'right',
'bottom');
134 $graph->xaxis->setTickLabels($aDataY);
138 $graph->title->set(
"Monat");
141 $graph->title->setFont(FF_FONT1, FS_BOLD);
143 $aDataFinalX = array();
144 foreach ($aDataX as $dData) {
145 $aDataFinalX[] = $dData;
148 $bplot =
new BarPlot($aDataFinalX);
149 $bplot->setFillGradient(
"navy",
"lightsteelblue", GRAD_VER);
150 $bplot->setLegend(
"Besucher");
152 $aDataFinalX2 = array();
153 foreach ($aDataX2 as $dData) {
154 $aDataFinalX2[] = $dData;
157 $bplot2 =
new BarPlot($aDataFinalX2);
158 $bplot2->setFillColor(
"orange");
159 $bplot2->setLegend(
"Kaeufer");
161 $aDataFinalX3 = array();
162 foreach ($aDataX3 as $dData) {
163 $aDataFinalX3[] = $dData;
166 $bplot3 =
new BarPlot($aDataFinalX3);
167 $bplot3->setFillColor(
"silver");
168 $bplot3->setLegend(
"Neukunden");
171 $gbplot =
new groupBarPlot(array($bplot, $bplot2, $bplot3));
172 $graph->add($gbplot);
182 public function visitor_week()
190 $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_to"))));
191 $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_from"))));
193 $sSQL =
"select oxtime, count(*) as nrof from oxlogs where oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxsessid order by oxtime";
195 $rs = $oDb->execute($sSQL);
196 if ($rs !=
false && $rs->recordCount() > 0) {
199 $aTemp[
oxRegistry::get(
"oxUtilsDate")->getWeekNumber(
$myConfig->getConfigParam(
'iFirstWeekDay'), strtotime($rs->fields[0]))]++;
205 list($iFrom, $iTo) = $this->getWeekRange();
206 for ($i = $iFrom; $i < $iTo; $i++) {
210 $aDataY[] =
"KW " . $i;
213 foreach ($aTemp as $key => $value) {
214 $aDataX[$key] = $value;
217 $aDataY[] =
"KW " . $key;
221 $sSQL =
"select oxorderdate from oxorder where oxorderdate >= $sTimeFrom and oxorderdate <= $sTimeTo order by oxorderdate";
223 $rs = $oDb->execute($sSQL);
224 if ($rs !=
false && $rs->recordCount() > 0) {
227 $aTemp[
oxRegistry::get(
"oxUtilsDate")->getWeekNumber(
$myConfig->getConfigParam(
'iFirstWeekDay'), strtotime($rs->fields[0]))]++;
232 foreach ($aTemp as $key => $value) {
233 $aDataX2[$key] = $value;
237 $sSQL =
"select oxcreate from oxuser where oxcreate >= $sTimeFrom and oxcreate <= $sTimeTo order by oxcreate";
239 $rs = $oDb->execute($sSQL);
240 if ($rs !=
false && $rs->recordCount() > 0) {
243 $aTemp[
oxRegistry::get(
"oxUtilsDate")->getWeekNumber(
$myConfig->getConfigParam(
'iFirstWeekDay'), strtotime($rs->fields[0]))]++;
248 foreach ($aTemp as $key => $value) {
249 $aDataX3[$key] = $value;
252 header(
"Content-type: image/png");
255 $graph =
new Graph(max(800, count($aDataX) * 80), 600);
257 $graph->setBackgroundImage(
$myConfig->getImageDir(
true) .
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
260 $graph->setScale(
"textlin");
263 $graph->xaxis->setLabelAlign(
'center',
'top',
'right');
266 $graph->yaxis->setLabelAlign(
'right',
'bottom');
270 $graph->xaxis->setTickLabels($aDataY);
274 $graph->title->set(
"Woche");
277 $graph->title->setFont(FF_FONT1, FS_BOLD);
279 $aDataFinalX = array();
280 foreach ($aDataX as $dData) {
281 $aDataFinalX[] = $dData;
284 $bplot =
new BarPlot($aDataFinalX);
285 $bplot->setFillGradient(
"navy",
"lightsteelblue", GRAD_VER);
286 $bplot->setLegend(
"Besucher");
288 $aDataFinalX2 = array();
289 foreach ($aDataX2 as $dData) {
290 $aDataFinalX2[] = $dData;
293 $bplot2 =
new BarPlot($aDataFinalX2);
294 $bplot2->setFillColor(
"orange");
295 $bplot2->setLegend(
"Kaeufer");
297 $aDataFinalX3 = array();
298 foreach ($aDataX3 as $dData) {
299 $aDataFinalX3[] = $dData;
302 $bplot3 =
new BarPlot($aDataFinalX3);
303 $bplot3->setFillColor(
"silver");
304 $bplot3->setLegend(
"Neukunden");
307 $gbplot =
new groupBarPlot(array($bplot, $bplot2, $bplot3));
308 $graph->add($gbplot);